Re: [PATCH] staging: dwc2: fix wrong setting of DMA masks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Fri, Mar 22, 2013 at 05:27:26PM -0700, Paul Zimmerman wrote:
> We were setting the DMA masks in dwc2_driver_probe(), but that is
> before the driver parameters have been set to their default values.
> That meant the DMA masks could be set wrong. Fix it by moving the
> DMA mask setting into dwc2_hcd_init(), after the driver parameters
> have been set.
> 
> This required a bit of refactoring of the dwc2_hcd_init() code as
> well. While there, also remove the unneeded struct device *dev
> parameter to dwc2_hcd_init() and dwc2_hcd_remove(), and pass in the
> value through the hsotg->dev member.

looks like this can be easily split into a proper series:

patch 1: remove struct device *dev parameter from both functions
patch 2: refactor dwc2_hcd_init()
patch 3: fix setting of DMA masks.

This will make your patches a lot easier to review and isolates the only
change which can cause a regression into its own patch. Should anything
turn out to be wrong in your DMA masks change, it can be easily reverted
without removing the other two cleanups.

> diff --git a/drivers/staging/dwc2/hcd.c b/drivers/staging/dwc2/hcd.c
> index 01dbdd8..1a78924 100644
> --- a/drivers/staging/dwc2/hcd.c
> +++ b/drivers/staging/dwc2/hcd.c
> @@ -2682,7 +2682,7 @@ static void dwc2_set_uninitialized(int *p, int size)
>   * USB bus with the core and calls the hc_driver->start() function. It returns
>   * a negative error on failure.
>   */
> -int dwc2_hcd_init(struct device *dev, struct dwc2_hsotg *hsotg, int irq,
> +int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq,
>  		  struct dwc2_core_params *params)
>  {
>  	struct usb_hcd *hcd;
> @@ -2691,7 +2691,7 @@ int dwc2_hcd_init(struct device *dev, struct dwc2_hsotg *hsotg, int irq,
>  	int i, num_channels;
>  	int retval = -ENOMEM;
>  
> -	dev_dbg(dev, "DWC OTG HCD INIT\n");
> +	dev_dbg(hsotg->dev, "DWC OTG HCD INIT\n");

I would even have a patch before removing the parameter which just
converts dev_* messages to use hsotg->dev, then remove the parameter,
but that's just me. I really, really enjoy 'atomic' changes.

-- 
balbi

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux