Re: [PATCH 5/7] s3c-hsudc: use udc_start and udc_stop functions

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

 



On Mon, Dec 19, 2011 at 02:26:20PM +0100, Heiko Stübner wrote:
> udc_start and udc_stop reduce code duplication in comparison to
> start and stop generalising calls done by all drivers
> (i.e. bind and unbind) and moving these calls to common code.
> 
> Signed-off-by: Heiko Stuebner <heiko@xxxxxxxxx>
> ---
>  drivers/usb/gadget/s3c-hsudc.c |   44 ++++++++++++---------------------------
>  1 files changed, 14 insertions(+), 30 deletions(-)
> 
> diff --git a/drivers/usb/gadget/s3c-hsudc.c b/drivers/usb/gadget/s3c-hsudc.c
> index 42bcd97..daaccec 100644
> --- a/drivers/usb/gadget/s3c-hsudc.c
> +++ b/drivers/usb/gadget/s3c-hsudc.c
> @@ -282,8 +282,7 @@ static void s3c_hsudc_nuke_ep(struct s3c_hsudc_ep *hsep, int status)
>   * All the endpoints are stopped and any pending transfer requests if any on
>   * the endpoint are terminated.
>   */
> -static void s3c_hsudc_stop_activity(struct s3c_hsudc *hsudc,
> -			  struct usb_gadget_driver *driver)
> +static void s3c_hsudc_stop_activity(struct s3c_hsudc *hsudc)
>  {
>  	struct s3c_hsudc_ep *hsep;
>  	int epnum;
> @@ -295,10 +294,6 @@ static void s3c_hsudc_stop_activity(struct s3c_hsudc *hsudc,
>  		hsep->stopped = 1;
>  		s3c_hsudc_nuke_ep(hsep, -ESHUTDOWN);
>  	}
> -
> -	spin_unlock(&hsudc->lock);
> -	driver->disconnect(&hsudc->gadget);
> -	spin_lock(&hsudc->lock);
>  }
>  
>  /**
> @@ -1135,16 +1130,15 @@ static irqreturn_t s3c_hsudc_irq(int irq, void *_dev)
>  	return IRQ_HANDLED;
>  }
>  
> -static int s3c_hsudc_start(struct usb_gadget_driver *driver,
> -		int (*bind)(struct usb_gadget *))
> +static int s3c_hsudc_start(struct usb_gadget *g,
> +		struct usb_gadget_driver *driver)
>  {
>  	struct s3c_hsudc *hsudc = the_controller;

while at that, you can drop this "the_controller" global. You could use
a container_of() to reach your s3c_hsudc pointer.

-- 
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