Patchwork [U-Boot,v4,2/3] usb:gadget:composite: Support for composite at gadget.h

login
register
mail settings
Submitter Łukasz Majewski
Date April 18, 2012, 3:26 p.m.
Message ID <1334762811-23068-3-git-send-email-l.majewski@samsung.com>
Download mbox | patch
Permalink /patch/153533/
State Changes Requested
Delegated to: Marek Vasut
Headers show

Comments

Łukasz Majewski - April 18, 2012, 3:26 p.m.
Add device data pointer to the USB gadget's device struct.
Wrapper for extracting usb_gadget from Linux's usb device

Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Marek Vasut <marex@denx.de>

---
 include/linux/usb/gadget.h |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
Marek Vasut - April 29, 2012, 11:23 p.m.
Dear Lukasz Majewski,

> Add device data pointer to the USB gadget's device struct.
> Wrapper for extracting usb_gadget from Linux's usb device
> 
> Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> Cc: Marek Vasut <marex@denx.de>

Acked-by: Marek Vasut <marex@denx.de>
> 
> ---
>  include/linux/usb/gadget.h |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)
> 
> diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
> index 275cb5f..eba865e 100644
> --- a/include/linux/usb/gadget.h
> +++ b/include/linux/usb/gadget.h
> @@ -411,6 +411,7 @@ struct usb_gadget_ops {
> 
>  struct device {
>  	void		*driver_data;	/* data private to the driver */
> +	void            *device_data;   /* data private to the device */

Can't device_data be wrapped into driver_data? I guess not ...

>  };
> 
>  /**
> @@ -481,6 +482,11 @@ static inline void *get_gadget_data(struct usb_gadget
> *gadget) return gadget->dev.driver_data;
>  }
> 
> +static inline struct usb_gadget *dev_to_usb_gadget(struct device *dev)
> +{
> +	return container_of(dev, struct usb_gadget, dev);
> +}
> +
>  /* iterates the non-control endpoints; 'tmp' is a struct usb_ep pointer */
>  #define gadget_for_each_ep(tmp, gadget) \
>  	list_for_each_entry(tmp, &(gadget)->ep_list, ep_list)

Best regards,
Marek Vasut

Patch

diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index 275cb5f..eba865e 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -411,6 +411,7 @@  struct usb_gadget_ops {
 
 struct device {
 	void		*driver_data;	/* data private to the driver */
+	void            *device_data;   /* data private to the device */
 };
 
 /**
@@ -481,6 +482,11 @@  static inline void *get_gadget_data(struct usb_gadget *gadget)
 	return gadget->dev.driver_data;
 }
 
+static inline struct usb_gadget *dev_to_usb_gadget(struct device *dev)
+{
+	return container_of(dev, struct usb_gadget, dev);
+}
+
 /* iterates the non-control endpoints; 'tmp' is a struct usb_ep pointer */
 #define gadget_for_each_ep(tmp, gadget) \
 	list_for_each_entry(tmp, &(gadget)->ep_list, ep_list)