diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2007-11-20 16:28:55 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-02-01 17:34:52 -0500 |
commit | 5933101718ea3d283983a923c5524c88138e5564 (patch) | |
tree | 318146f6302e8195a41514c2edabee1f108407b2 /drivers/usb/gadget/dummy_hcd.c | |
parent | 90da096ee46b682011b7d549e52b81cf9742e60b (diff) |
USB: dummy_hcd: don't register drivers on the platform bus
This patch (as1017) makes dummy_hcd behave more like the other USB
peripheral controller drivers by no longer registering its
gadget driver on the platform bus. Doing that has always been a
mistake, since a usb_gadget_driver isn't a platform_driver. Instead
the gadget driver is left unregistered in sysfs.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
CC: David Brownell <david-b@pacbell.net>
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.c | 33 |
1 files changed, 8 insertions, 25 deletions
diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c index 9db2482bdfa2..1a8a5f33443e 100644 --- a/drivers/usb/gadget/dummy_hcd.c +++ b/drivers/usb/gadget/dummy_hcd.c | |||
@@ -772,18 +772,17 @@ usb_gadget_register_driver (struct usb_gadget_driver *driver) | |||
772 | list_del_init (&dum->ep [0].ep.ep_list); | 772 | list_del_init (&dum->ep [0].ep.ep_list); |
773 | INIT_LIST_HEAD(&dum->fifo_req.queue); | 773 | INIT_LIST_HEAD(&dum->fifo_req.queue); |
774 | 774 | ||
775 | driver->driver.bus = NULL; | ||
775 | dum->driver = driver; | 776 | dum->driver = driver; |
776 | dum->gadget.dev.driver = &driver->driver; | 777 | dum->gadget.dev.driver = &driver->driver; |
777 | dev_dbg (udc_dev(dum), "binding gadget driver '%s'\n", | 778 | dev_dbg (udc_dev(dum), "binding gadget driver '%s'\n", |
778 | driver->driver.name); | 779 | driver->driver.name); |
779 | if ((retval = driver->bind (&dum->gadget)) != 0) | 780 | retval = driver->bind(&dum->gadget); |
780 | goto err_bind_gadget; | 781 | if (retval) { |
781 | 782 | dum->driver = NULL; | |
782 | driver->driver.bus = dum->gadget.dev.parent->bus; | 783 | dum->gadget.dev.driver = NULL; |
783 | if ((retval = driver_register (&driver->driver)) != 0) | 784 | return retval; |
784 | goto err_register; | 785 | } |
785 | if ((retval = device_bind_driver (&dum->gadget.dev)) != 0) | ||
786 | goto err_bind_driver; | ||
787 | 786 | ||
788 | /* khubd will enumerate this in a while */ | 787 | /* khubd will enumerate this in a while */ |
789 | spin_lock_irq (&dum->lock); | 788 | spin_lock_irq (&dum->lock); |
@@ -793,20 +792,6 @@ usb_gadget_register_driver (struct usb_gadget_driver *driver) | |||
793 | 792 | ||
794 | usb_hcd_poll_rh_status (dummy_to_hcd (dum)); | 793 | usb_hcd_poll_rh_status (dummy_to_hcd (dum)); |
795 | return 0; | 794 | return 0; |
796 | |||
797 | err_bind_driver: | ||
798 | driver_unregister (&driver->driver); | ||
799 | err_register: | ||
800 | if (driver->unbind) | ||
801 | driver->unbind (&dum->gadget); | ||
802 | spin_lock_irq (&dum->lock); | ||
803 | dum->pullup = 0; | ||
804 | set_link_state (dum); | ||
805 | spin_unlock_irq (&dum->lock); | ||
806 | err_bind_gadget: | ||
807 | dum->driver = NULL; | ||
808 | dum->gadget.dev.driver = NULL; | ||
809 | return retval; | ||
810 | } | 795 | } |
811 | EXPORT_SYMBOL (usb_gadget_register_driver); | 796 | EXPORT_SYMBOL (usb_gadget_register_driver); |
812 | 797 | ||
@@ -830,11 +815,9 @@ usb_gadget_unregister_driver (struct usb_gadget_driver *driver) | |||
830 | spin_unlock_irqrestore (&dum->lock, flags); | 815 | spin_unlock_irqrestore (&dum->lock, flags); |
831 | 816 | ||
832 | driver->unbind (&dum->gadget); | 817 | driver->unbind (&dum->gadget); |
818 | dum->gadget.dev.driver = NULL; | ||
833 | dum->driver = NULL; | 819 | dum->driver = NULL; |
834 | 820 | ||
835 | device_release_driver (&dum->gadget.dev); | ||
836 | driver_unregister (&driver->driver); | ||
837 | |||
838 | spin_lock_irqsave (&dum->lock, flags); | 821 | spin_lock_irqsave (&dum->lock, flags); |
839 | dum->pullup = 0; | 822 | dum->pullup = 0; |
840 | set_link_state (dum); | 823 | set_link_state (dum); |