提交 ef979a26 编写于 作者: P Peter Chen 提交者: Felipe Balbi

usb: gadget: add reset API at usb_gadget_driver

Adding reset API for UDC bus reset handler is useful for below
two issues.

Current disconnect API at usb_gadget_driver is also invoked at
udc's bus reset handler, but the document says it is invoked when
the host is disconnected.

Besides, we may expect the gadget_driver to do different things
for host sends bus reset and host disconnects gadget, eg, we may not
want to flush dirty page for mass storage at bus reset, and want to
do it at disconnection.
Acked-by: NAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: NPeter Chen <peter.chen@freescale.com>
Signed-off-by: NFelipe Balbi <balbi@ti.com>
上级 85b06f5e
...@@ -817,6 +817,8 @@ static inline int usb_gadget_disconnect(struct usb_gadget *gadget) ...@@ -817,6 +817,8 @@ static inline int usb_gadget_disconnect(struct usb_gadget *gadget)
* Called in a context that permits sleeping. * Called in a context that permits sleeping.
* @suspend: Invoked on USB suspend. May be called in_interrupt. * @suspend: Invoked on USB suspend. May be called in_interrupt.
* @resume: Invoked on USB resume. May be called in_interrupt. * @resume: Invoked on USB resume. May be called in_interrupt.
* @reset: Invoked on USB bus reset. It is mandatory for all gadget drivers
* and should be called in_interrupt.
* @driver: Driver model state for this driver. * @driver: Driver model state for this driver.
* *
* Devices are disabled till a gadget driver successfully bind()s, which * Devices are disabled till a gadget driver successfully bind()s, which
...@@ -874,6 +876,7 @@ struct usb_gadget_driver { ...@@ -874,6 +876,7 @@ struct usb_gadget_driver {
void (*disconnect)(struct usb_gadget *); void (*disconnect)(struct usb_gadget *);
void (*suspend)(struct usb_gadget *); void (*suspend)(struct usb_gadget *);
void (*resume)(struct usb_gadget *); void (*resume)(struct usb_gadget *);
void (*reset)(struct usb_gadget *);
/* FIXME support safe rmmod */ /* FIXME support safe rmmod */
struct device_driver driver; struct device_driver driver;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册