Re: [RFC/PATCH 1/3] usb: gadget: introduce start() and stop()

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

 



On Fri, 13 May 2011, Felipe Balbi wrote:

> these two methods will be used to tell
> controller driver to prepare for starting/stopping
> operation with a gadget driver. They will
> be implemented and used by the new usb udc
> class which will come in later patches.
> 
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
> Signed-off-by: Felipe Balbi <balbi@xxxxxx>
> ---
>  include/linux/usb/gadget.h |    5 +++++
>  1 files changed, 5 insertions(+), 0 deletions(-)
> 
> diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
> index e538172..34d47f5 100644
> --- a/include/linux/usb/gadget.h
> +++ b/include/linux/usb/gadget.h
> @@ -417,6 +417,8 @@ static inline void usb_ep_fifo_flush(struct usb_ep *ep)
>  /*-------------------------------------------------------------------------*/
>  
>  struct usb_gadget;
> +struct usb_gadget_driver;
> +typedef int (*usb_gad_bind_t)(struct usb_gadget *gadget);

Ugh!  Please don't do this.  Write out the full function type at the 
place where it is used, just like all the other function pointer 
declarations do.

>  /* the rest of the api to the controller hardware: device operations,
>   * which don't involve endpoints (or i/o).
> @@ -430,6 +432,8 @@ struct usb_gadget_ops {
>  	int	(*pullup) (struct usb_gadget *, int is_on);
>  	int	(*ioctl)(struct usb_gadget *,
>  				unsigned code, unsigned long param);
> +	int	(*start)(struct usb_gadget *, struct usb_gadget_driver *);
> +	int	(*stop)(struct usb_gadget *, struct usb_gadget_driver *);
>  };
>  
>  /**
> @@ -769,6 +773,7 @@ static inline int usb_gadget_disconnect(struct usb_gadget *gadget)
>  struct usb_gadget_driver {
>  	char			*function;
>  	enum usb_device_speed	speed;
> +	usb_gad_bind_t		bind;
>  	void			(*unbind)(struct usb_gadget *);
>  	int			(*setup)(struct usb_gadget *,
>  					const struct usb_ctrlrequest *);

After all, why should bind be different from unbind or setup?

Also, there should be kerneldoc for the new bind method in the comments 
preceding the definition of struct usb_gadget_driver.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

  Powered by Linux