diff mbox

[U-Boot,3/4] usb:gadget: Wrapper for extracting usb_gadget from linux's device

Message ID 1334214931-19480-4-git-send-email-l.majewski@samsung.com
State Changes Requested
Delegated to: Marek Vasut
Headers show

Commit Message

Ɓukasz Majewski April 12, 2012, 7:15 a.m. UTC
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 |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

Comments

Marek Vasut April 14, 2012, 9:47 a.m. UTC | #1
Dear Lukasz Majewski,

> 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 |    5 +++++
>  1 files changed, 5 insertions(+), 0 deletions(-)
> 
> diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
> index 275cb5f..b0a0e1f 100644
> --- a/include/linux/usb/gadget.h
> +++ b/include/linux/usb/gadget.h
> @@ -481,6 +481,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)

Maybe you should put all these patches together and show us only the product -- 
the stripped down version of this composite driver.

Best regards,
Marek Vasut
diff mbox

Patch

diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index 275cb5f..b0a0e1f 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -481,6 +481,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)