]> git.karo-electronics.de Git - linux-beck.git/commitdiff
usb: gadget: langwell: don't use the_controller when it's not needed
authorFelipe Balbi <balbi@ti.com>
Sat, 8 Oct 2011 10:08:01 +0000 (13:08 +0300)
committerFelipe Balbi <balbi@ti.com>
Thu, 13 Oct 2011 17:39:54 +0000 (20:39 +0300)
in most cases, we can fetch our structure by
calling dev_get_drvdata().

Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/gadget/langwell_udc.c

index cb728d3079aff0f73b90c1ec582b701c59c0eb03..444bd11d3f4b150acb8b02f6307d100f91650bd4 100644 (file)
@@ -1551,7 +1551,7 @@ static void stop_activity(struct langwell_udc *dev,
 static ssize_t show_function(struct device *_dev,
                struct device_attribute *attr, char *buf)
 {
-       struct langwell_udc     *dev = the_controller;
+       struct langwell_udc     *dev = dev_get_drvdata(_dev);
 
        if (!dev->driver || !dev->driver->function
                        || strlen(dev->driver->function) > PAGE_SIZE)
@@ -1580,7 +1580,7 @@ static inline enum usb_device_speed lpm_device_speed(u32 reg)
 static ssize_t show_langwell_udc(struct device *_dev,
                struct device_attribute *attr, char *buf)
 {
-       struct langwell_udc     *dev = the_controller;
+       struct langwell_udc     *dev = dev_get_drvdata(_dev);
        struct langwell_request *req;
        struct langwell_ep      *ep = NULL;
        char                    *next;
@@ -1812,7 +1812,7 @@ static DEVICE_ATTR(langwell_udc, S_IRUGO, show_langwell_udc, NULL);
 static ssize_t store_remote_wakeup(struct device *_dev,
                struct device_attribute *attr, const char *buf, size_t count)
 {
-       struct langwell_udc     *dev = the_controller;
+       struct langwell_udc     *dev = dev_get_drvdata(_dev);
        unsigned long           flags;
        ssize_t                 rc = count;
 
@@ -2973,7 +2973,7 @@ static irqreturn_t langwell_irq(int irq, void *_dev)
 /* release device structure */
 static void gadget_release(struct device *_dev)
 {
-       struct langwell_udc     *dev = the_controller;
+       struct langwell_udc     *dev = dev_get_drvdata(_dev);
 
        dev_dbg(&dev->pdev->dev, "---> %s()\n", __func__);
 
@@ -3031,7 +3031,7 @@ static void sram_deinit(struct langwell_udc *dev)
 /* tear down the binding between this driver and the pci device */
 static void langwell_udc_remove(struct pci_dev *pdev)
 {
-       struct langwell_udc     *dev = the_controller;
+       struct langwell_udc     *dev = pci_get_drvdata(pdev);
 
        DECLARE_COMPLETION(done);
 
@@ -3378,7 +3378,7 @@ error:
 /* device controller suspend */
 static int langwell_udc_suspend(struct pci_dev *pdev, pm_message_t state)
 {
-       struct langwell_udc     *dev = the_controller;
+       struct langwell_udc     *dev = pci_get_drvdata(pdev);
 
        dev_dbg(&dev->pdev->dev, "---> %s()\n", __func__);
 
@@ -3426,7 +3426,7 @@ static int langwell_udc_suspend(struct pci_dev *pdev, pm_message_t state)
 /* device controller resume */
 static int langwell_udc_resume(struct pci_dev *pdev)
 {
-       struct langwell_udc     *dev = the_controller;
+       struct langwell_udc     *dev = pci_get_drvdata(pdev);
        size_t                  size;
 
        dev_dbg(&dev->pdev->dev, "---> %s()\n", __func__);
@@ -3508,7 +3508,7 @@ static int langwell_udc_resume(struct pci_dev *pdev)
 /* pci driver shutdown */
 static void langwell_udc_shutdown(struct pci_dev *pdev)
 {
-       struct langwell_udc     *dev = the_controller;
+       struct langwell_udc     *dev = pci_get_drvdata(pdev);
        u32                     usbmode;
 
        dev_dbg(&dev->pdev->dev, "---> %s()\n", __func__);