usb: gadget: configfs: add suspend/resume
authorAndrzej Pietrasiewicz <andrzej.p@samsung.com>
Wed, 8 Oct 2014 10:03:36 +0000 (12:03 +0200)
committerFelipe Balbi <balbi@ti.com>
Mon, 3 Nov 2014 16:00:59 +0000 (10:00 -0600)
USB gadgets composed with configfs lack suspend and resume
methods. This patch uses composite_suspend()/composite_resume()
the same way e.g. composite_setup() or composite_disconnect()
are used in a configfs-based gadget.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/gadget/composite.c
drivers/usb/gadget/configfs.c
include/linux/usb/composite.h

index e071d580346ec340deb59e815fcdd740a5dd1bf9..617835348569d63de1d41e5701bc8fc4bb742abd 100644 (file)
@@ -2064,8 +2064,7 @@ fail:
 
 /*-------------------------------------------------------------------------*/
 
-static void
-composite_suspend(struct usb_gadget *gadget)
+void composite_suspend(struct usb_gadget *gadget)
 {
        struct usb_composite_dev        *cdev = get_gadget_data(gadget);
        struct usb_function             *f;
@@ -2088,8 +2087,7 @@ composite_suspend(struct usb_gadget *gadget)
        usb_gadget_vbus_draw(gadget, 2);
 }
 
-static void
-composite_resume(struct usb_gadget *gadget)
+void composite_resume(struct usb_gadget *gadget)
 {
        struct usb_composite_dev        *cdev = get_gadget_data(gadget);
        struct usb_function             *f;
index 34034333f7f61ee50ea262c1d4440374c42bfacd..d25f9f3dfea0c607c8868b4f9b8a2edb78689226 100644 (file)
@@ -1453,6 +1453,9 @@ static const struct usb_gadget_driver configfs_driver_template = {
        .reset          = composite_disconnect,
        .disconnect     = composite_disconnect,
 
+       .suspend        = composite_suspend,
+       .resume         = composite_resume,
+
        .max_speed      = USB_SPEED_SUPER,
        .driver = {
                .owner          = THIS_MODULE,
index ed3811c09ec1e88c7db0f97a01524b2dc9cec4c0..3d87defcc5270f1659a610a3d126c0156c0c6ce2 100644 (file)
@@ -506,6 +506,8 @@ extern int usb_string_ids_n(struct usb_composite_dev *c, unsigned n);
 extern void composite_disconnect(struct usb_gadget *gadget);
 extern int composite_setup(struct usb_gadget *gadget,
                const struct usb_ctrlrequest *ctrl);
+extern void composite_suspend(struct usb_gadget *gadget);
+extern void composite_resume(struct usb_gadget *gadget);
 
 /*
  * Some systems will need runtime overrides for the  product identifiers