usb: gadget: net2272: use common is_selfpowered
authorPeter Chen <peter.chen@freescale.com>
Wed, 28 Jan 2015 08:32:37 +0000 (16:32 +0800)
committerFelipe Balbi <balbi@ti.com>
Thu, 29 Jan 2015 16:35:27 +0000 (10:35 -0600)
Delete private selfpowered variable, and use common one.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/gadget/udc/net2272.c
drivers/usb/gadget/udc/net2272.h

index d20de1fab08e3d1484dbeb62e224c6e0a2759d37..195baf3e1fcd4722c80e47f0789de17cf2ad0a88 100644 (file)
@@ -1132,13 +1132,10 @@ net2272_wakeup(struct usb_gadget *_gadget)
 static int
 net2272_set_selfpowered(struct usb_gadget *_gadget, int value)
 {
-       struct net2272 *dev;
-
        if (!_gadget)
                return -ENODEV;
-       dev = container_of(_gadget, struct net2272, gadget);
 
-       dev->is_selfpowered = value;
+       _gadget->is_selfpowered = (value != 0);
 
        return 0;
 }
@@ -1844,7 +1841,7 @@ net2272_handle_stat0_irqs(struct net2272 *dev, u8 stat)
                        case USB_RECIP_DEVICE:
                                if (u.r.wLength > 2)
                                        goto do_stall;
-                               if (dev->is_selfpowered)
+                               if (dev->gadget.is_selfpowered)
                                        status = (1 << USB_DEVICE_SELF_POWERED);
 
                                /* don't bother with a request object! */
index e59505789359dbec837b9d9eb73fe867277311b5..127ab03fcde3ba40bf539d231ac92baaeff7f265 100644 (file)
@@ -458,7 +458,6 @@ struct net2272 {
        struct usb_gadget_driver *driver;
        unsigned protocol_stall:1,
                 softconnect:1,
-                is_selfpowered:1,
                 wakeup:1,
                 dma_eot_polarity:1,
                 dma_dack_polarity:1,