diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index 275cb5fe15..eba865ea09 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)