Skip to content

Commit

Permalink
usb: gadget: langwell: don't use the_controller when it's not needed
Browse files Browse the repository at this point in the history
in most cases, we can fetch our structure by
calling dev_get_drvdata().

Signed-off-by: Felipe Balbi <balbi@ti.com>
  • Loading branch information
Felipe Balbi committed Oct 13, 2011
1 parent 1a8060d commit 5bc639f
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions drivers/usb/gadget/langwell_udc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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__);

Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -3378,7 +3378,7 @@ static int langwell_udc_probe(struct pci_dev *pdev,
/* 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__);

Expand Down Expand Up @@ -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__);
Expand Down Expand Up @@ -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__);
Expand Down

0 comments on commit 5bc639f

Please sign in to comment.