summaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/dummy_hcd.c
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>2011-06-17 10:11:41 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2011-07-01 14:31:08 -0700
commitd8a14a85c72faf1bdcbbc12255361aaa9cb79ff5 (patch)
tree0243234c420daf30548c67f4787675cb59d62f99 /drivers/usb/gadget/dummy_hcd.c
parent719e52cbc7b826fae9501f3b86b8cbc25a4c5268 (diff)
usb: gadget: dummy_hcd: use less checks for USB_SPEED_SUPER
Taking the correct struct once avoids doing the speed dance. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/gadget/dummy_hcd.c')
-rw-r--r--drivers/usb/gadget/dummy_hcd.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c
index 1fc80bb8ca3..865faf0932a 100644
--- a/drivers/usb/gadget/dummy_hcd.c
+++ b/drivers/usb/gadget/dummy_hcd.c
@@ -809,18 +809,18 @@ static int dummy_set_selfpowered (struct usb_gadget *_gadget, int value)
static int dummy_pullup (struct usb_gadget *_gadget, int value)
{
+ struct dummy_hcd *dum_hcd;
struct dummy *dum;
unsigned long flags;
- dum = gadget_to_dummy_hcd(_gadget)->dum;
+ dum_hcd = gadget_to_dummy_hcd(_gadget);
+ dum = dum_hcd->dum;
+
spin_lock_irqsave (&dum->lock, flags);
dum->pullup = (value != 0);
- set_link_state((dum->gadget.speed == USB_SPEED_SUPER ?
- dum->ss_hcd : dum->hs_hcd));
+ set_link_state(dum_hcd);
spin_unlock_irqrestore (&dum->lock, flags);
- usb_hcd_poll_rh_status((dum->gadget.speed == USB_SPEED_SUPER ?
- dummy_hcd_to_hcd(dum->ss_hcd) :
- dummy_hcd_to_hcd(dum->hs_hcd)));
+ usb_hcd_poll_rh_status(dummy_hcd_to_hcd(dum_hcd));
return 0;
}
@@ -1043,34 +1043,32 @@ static int dummy_udc_remove (struct platform_device *pdev)
static int dummy_udc_suspend (struct platform_device *pdev, pm_message_t state)
{
struct dummy *dum = platform_get_drvdata(pdev);
+ struct dummy_hcd *dum_hcd;
dev_dbg (&pdev->dev, "%s\n", __func__);
+ dum_hcd = gadget_to_dummy_hcd(&dum->gadget);
spin_lock_irq (&dum->lock);
dum->udc_suspended = 1;
- set_link_state((dum->gadget.speed == USB_SPEED_SUPER ?
- dum->ss_hcd : dum->hs_hcd));
+ set_link_state(dum_hcd);
spin_unlock_irq (&dum->lock);
- usb_hcd_poll_rh_status((dum->gadget.speed == USB_SPEED_SUPER ?
- dummy_hcd_to_hcd(dum->ss_hcd) :
- dummy_hcd_to_hcd(dum->hs_hcd)));
+ usb_hcd_poll_rh_status(dummy_hcd_to_hcd(dum_hcd));
return 0;
}
static int dummy_udc_resume (struct platform_device *pdev)
{
struct dummy *dum = platform_get_drvdata(pdev);
+ struct dummy_hcd *dum_hcd;
dev_dbg (&pdev->dev, "%s\n", __func__);
+ dum_hcd = gadget_to_dummy_hcd(&dum->gadget);
spin_lock_irq (&dum->lock);
dum->udc_suspended = 0;
- set_link_state((dum->gadget.speed == USB_SPEED_SUPER ?
- dum->ss_hcd : dum->hs_hcd));
+ set_link_state(dum_hcd);
spin_unlock_irq (&dum->lock);
- usb_hcd_poll_rh_status((dum->gadget.speed == USB_SPEED_SUPER ?
- dummy_hcd_to_hcd(dum->ss_hcd) :
- dummy_hcd_to_hcd(dum->hs_hcd)));
+ usb_hcd_poll_rh_status(dummy_hcd_to_hcd(dum_hcd));
return 0;
}