aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>2011-06-16 14:36:55 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2011-07-01 17:31:06 -0400
commit2542787430fc46b4e07e0da4c6ec80ed230032e5 (patch)
treebc989828f8b5f69d5fc8aa4506fc50d8c3daa773 /drivers/usb/gadget
parente9c23a255a33cf423336b7cba39b2b6dcc83a6bc (diff)
usb: gadget: dummy_hcd: use dummy_pullup() instead of open coding
The removed code does the same thing as dummy_pullup(). The only difference is that in dummy_udc_stop() the first dummy_pullup() did not call usb_hcd_poll_rh_status(). 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')
-rw-r--r--drivers/usb/gadget/dummy_hcd.c34
1 files changed, 7 insertions, 27 deletions
diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c
index d040dc406b12..cecc25ad4586 100644
--- a/drivers/usb/gadget/dummy_hcd.c
+++ b/drivers/usb/gadget/dummy_hcd.c
@@ -944,31 +944,21 @@ static int dummy_udc_start(struct usb_gadget_driver *driver,
944 return retval; 944 return retval;
945 } 945 }
946 946
947 /* khubd will enumerate this in a while */ 947 if (dum->gadget.speed == USB_SPEED_SUPER)
948 spin_lock_irq (&dum->lock);
949 dum->pullup = 1;
950 if (dum->gadget.speed == USB_SPEED_SUPER) {
951 dum->gadget.is_otg = 948 dum->gadget.is_otg =
952 (dummy_hcd_to_hcd(dum->ss_hcd)->self.otg_port != 0); 949 (dummy_hcd_to_hcd(dum->ss_hcd)->self.otg_port != 0);
953 set_link_state(dum->ss_hcd); 950 else
954 } else {
955 dum->gadget.is_otg = 951 dum->gadget.is_otg =
956 (dummy_hcd_to_hcd(dum->hs_hcd)->self.otg_port != 0); 952 (dummy_hcd_to_hcd(dum->hs_hcd)->self.otg_port != 0);
957 set_link_state(dum->hs_hcd);
958 }
959 953
960 spin_unlock_irq (&dum->lock); 954 /* khubd will enumerate this in a while */
961 955 dummy_pullup(&dum->gadget, 1);
962 usb_hcd_poll_rh_status((dum->gadget.speed == USB_SPEED_SUPER ?
963 dummy_hcd_to_hcd(dum->ss_hcd) :
964 dummy_hcd_to_hcd(dum->hs_hcd)));
965 return 0; 956 return 0;
966} 957}
967 958
968static int dummy_udc_stop(struct usb_gadget_driver *driver) 959static int dummy_udc_stop(struct usb_gadget_driver *driver)
969{ 960{
970 struct dummy *dum = &the_controller; 961 struct dummy *dum = &the_controller;
971 unsigned long flags;
972 962
973 if (!dum) 963 if (!dum)
974 return -ENODEV; 964 return -ENODEV;
@@ -978,23 +968,13 @@ static int dummy_udc_stop(struct usb_gadget_driver *driver)
978 dev_dbg (udc_dev(dum), "unregister gadget driver '%s'\n", 968 dev_dbg (udc_dev(dum), "unregister gadget driver '%s'\n",
979 driver->driver.name); 969 driver->driver.name);
980 970
981 spin_lock_irqsave (&dum->lock, flags); 971 dummy_pullup(&dum->gadget, 0);
982 dum->pullup = 0;
983 set_link_state((dum->gadget.speed == USB_SPEED_SUPER ?
984 dum->ss_hcd : dum->hs_hcd));
985 spin_unlock_irqrestore (&dum->lock, flags);
986 972
987 driver->unbind (&dum->gadget); 973 driver->unbind (&dum->gadget);
988 dum->gadget.dev.driver = NULL; 974 dum->gadget.dev.driver = NULL;
989 dum->driver = NULL; 975 dum->driver = NULL;
990 spin_lock_irqsave (&dum->lock, flags); 976
991 dum->pullup = 0; 977 dummy_pullup(&dum->gadget, 0);
992 set_link_state((dum->gadget.speed == USB_SPEED_SUPER ?
993 dum->ss_hcd : dum->hs_hcd));
994 spin_unlock_irqrestore (&dum->lock, flags);
995 usb_hcd_poll_rh_status((dum->gadget.speed == USB_SPEED_SUPER ?
996 dummy_hcd_to_hcd(dum->ss_hcd) :
997 dummy_hcd_to_hcd(dum->hs_hcd)));
998 return 0; 978 return 0;
999} 979}
1000 980