On Fri, Nov 22, 2013 at 04:43:44PM -0800, Paul Zimmerman wrote:
> This is a series of cleanups to the DWC2 driver, in response to Dan
> Carpenter's review on 11/15/2013. I believe I have addressed all of
> Dan's suggestions, except for removing the validation checks from
> the dwc2_set_param_* functions. We depend on the validation checks
> for setting a default value for each of the parameters, so the
> checks cannot simply be removed.
No, I didn't mean they should be removed, just that some of them could
be written in a simpler way. Not a big deal either way.
regards,
dan carpenter
diff --git a/drivers/staging/dwc2/core.c b/drivers/staging/dwc2/core.c
index 6d001b52f652..b7a7d28bc391 100644
--- a/drivers/staging/dwc2/core.c
+++ b/drivers/staging/dwc2/core.c
@@ -2157,26 +2157,18 @@ int dwc2_set_param_max_transfer_size(struct dwc2_hsotg
*hsotg, int val)
return retval;
}
-int dwc2_set_param_max_packet_count(struct dwc2_hsotg *hsotg, int val)
+void dwc2_set_param_max_packet_count(struct dwc2_hsotg *hsotg, int val)
{
- int valid = 1;
- int retval = 0;
-
- if (val < 15 || val > hsotg->hw_params.max_packet_count)
- valid = 0;
-
- if (!valid) {
+ if (DWC2_OUT_OF_BOUNDS(val, 15, hsotg->hw_params.max_packet_count)) {
if (val >= 0)
dev_err(hsotg->dev,
"%d invalid for max_packet_count. Check HW
configuration.\n",
val);
val = hsotg->hw_params.max_packet_count;
dev_dbg(hsotg->dev, "Setting max_packet_count to %d\n", val);
- retval = -EINVAL;
}
hsotg->core_params->max_packet_count = val;
- return retval;
}
int dwc2_set_param_host_channels(struct dwc2_hsotg *hsotg, int val)
_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel