aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/dummy_hcd.c
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>2011-06-17 04:11:41 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2011-07-01 17:31:08 -0400
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 1fc80bb8ca39..865faf0932af 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)
809 809
810static int dummy_pullup (struct usb_gadget *_gadget, int value) 810static int dummy_pullup (struct usb_gadget *_gadget, int value)
811{ 811{
812 struct dummy_hcd *dum_hcd;
812 struct dummy *dum; 813 struct dummy *dum;
813 unsigned long flags; 814 unsigned long flags;
814 815
815 dum = gadget_to_dummy_hcd(_gadget)->dum; 816 dum_hcd = gadget_to_dummy_hcd(_gadget);
817 dum = dum_hcd->dum;
818
816 spin_lock_irqsave (&dum->lock, flags); 819 spin_lock_irqsave (&dum->lock, flags);
817 dum->pullup = (value != 0); 820 dum->pullup = (value != 0);
818 set_link_state((dum->gadget.speed == USB_SPEED_SUPER ? 821 set_link_state(dum_hcd);
819 dum->ss_hcd : dum->hs_hcd));
820 spin_unlock_irqrestore (&dum->lock, flags); 822 spin_unlock_irqrestore (&dum->lock, flags);
821 usb_hcd_poll_rh_status((dum->gadget.speed == USB_SPEED_SUPER ? 823 usb_hcd_poll_rh_status(dummy_hcd_to_hcd(dum_hcd));
822 dummy_hcd_to_hcd(dum->ss_hcd) :
823 dummy_hcd_to_hcd(dum->hs_hcd)));
824 return 0; 824 return 0;
825} 825}
826 826
@@ -1043,34 +1043,32 @@ static int dummy_udc_remove (struct platform_device *pdev)
1043static int dummy_udc_suspend (struct platform_device *pdev, pm_message_t state) 1043static int dummy_udc_suspend (struct platform_device *pdev, pm_message_t state)
1044{ 1044{
1045 struct dummy *dum = platform_get_drvdata(pdev); 1045 struct dummy *dum = platform_get_drvdata(pdev);
1046 struct dummy_hcd *dum_hcd;
1046 1047
1047 dev_dbg (&pdev->dev, "%s\n", __func__); 1048 dev_dbg (&pdev->dev, "%s\n", __func__);
1049 dum_hcd = gadget_to_dummy_hcd(&dum->gadget);
1048 spin_lock_irq (&dum->lock); 1050 spin_lock_irq (&dum->lock);
1049 dum->udc_suspended = 1; 1051 dum->udc_suspended = 1;
1050 set_link_state((dum->gadget.speed == USB_SPEED_SUPER ? 1052 set_link_state(dum_hcd);
1051 dum->ss_hcd : dum->hs_hcd));
1052 spin_unlock_irq (&dum->lock); 1053 spin_unlock_irq (&dum->lock);
1053 1054
1054 usb_hcd_poll_rh_status((dum->gadget.speed == USB_SPEED_SUPER ? 1055 usb_hcd_poll_rh_status(dummy_hcd_to_hcd(dum_hcd));
1055 dummy_hcd_to_hcd(dum->ss_hcd) :
1056 dummy_hcd_to_hcd(dum->hs_hcd)));
1057 return 0; 1056 return 0;
1058} 1057}
1059 1058
1060static int dummy_udc_resume (struct platform_device *pdev) 1059static int dummy_udc_resume (struct platform_device *pdev)
1061{ 1060{
1062 struct dummy *dum = platform_get_drvdata(pdev); 1061 struct dummy *dum = platform_get_drvdata(pdev);
1062 struct dummy_hcd *dum_hcd;
1063 1063
1064 dev_dbg (&pdev->dev, "%s\n", __func__); 1064 dev_dbg (&pdev->dev, "%s\n", __func__);
1065 dum_hcd = gadget_to_dummy_hcd(&dum->gadget);
1065 spin_lock_irq (&dum->lock); 1066 spin_lock_irq (&dum->lock);
1066 dum->udc_suspended = 0; 1067 dum->udc_suspended = 0;
1067 set_link_state((dum->gadget.speed == USB_SPEED_SUPER ? 1068 set_link_state(dum_hcd);
1068 dum->ss_hcd : dum->hs_hcd));
1069 spin_unlock_irq (&dum->lock); 1069 spin_unlock_irq (&dum->lock);
1070 1070
1071 usb_hcd_poll_rh_status((dum->gadget.speed == USB_SPEED_SUPER ? 1071 usb_hcd_poll_rh_status(dummy_hcd_to_hcd(dum_hcd));
1072 dummy_hcd_to_hcd(dum->ss_hcd) :
1073 dummy_hcd_to_hcd(dum->hs_hcd)));
1074 return 0; 1072 return 0;
1075} 1073}
1076 1074