usb: gadget: android: Only call ctrlrequest callback on enabled functions
Mike Lockwood [Tue, 2 Aug 2011 15:13:48 +0000 (11:13 -0400)]
Signed-off-by: Mike Lockwood <lockwood@android.com>

drivers/usb/gadget/android.c

index c82b43b..b13633b 100644 (file)
@@ -1040,7 +1040,6 @@ android_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *c)
        struct android_dev              *dev = _android_dev;
        struct usb_composite_dev        *cdev = get_gadget_data(gadget);
        struct usb_request              *req = cdev->req;
-       struct android_usb_function     **functions = dev->functions;
        struct android_usb_function     *f;
        int value = -EOPNOTSUPP;
        unsigned long flags;
@@ -1050,7 +1049,7 @@ android_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *c)
        req->length = 0;
        gadget->ep0->driver_data = cdev;
 
-       while ((f = *functions++)) {
+       list_for_each_entry(f, &dev->enabled_functions, enabled_list) {
                if (f->ctrlrequest) {
                        value = f->ctrlrequest(f, cdev, c);
                        if (value >= 0)