diff options
author | Felipe Balbi <balbi@ti.com> | 2011-10-10 10:11:20 -0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2011-10-13 13:39:58 -0400 |
commit | af1d7056a5c1e5eaaf807ddd1423101db84668d0 (patch) | |
tree | 3cf45f55f1b37033eca75b5bae691591ce1427f4 /drivers/usb/renesas_usbhs/mod_gadget.c | |
parent | 4cf5e00b055ba5e4f3852e477a2a4346730ea283 (diff) |
usb: gadget: renesas: convert to new style
using udc_start()/udc_stop() as we should.
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/renesas_usbhs/mod_gadget.c')
-rw-r--r-- | drivers/usb/renesas_usbhs/mod_gadget.c | 61 |
1 files changed, 9 insertions, 52 deletions
diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c b/drivers/usb/renesas_usbhs/mod_gadget.c index cb2d451d511e..c5c9ee5abb7a 100644 --- a/drivers/usb/renesas_usbhs/mod_gadget.c +++ b/drivers/usb/renesas_usbhs/mod_gadget.c | |||
@@ -730,10 +730,6 @@ static int usbhsg_try_stop(struct usbhs_priv *priv, u32 status) | |||
730 | 730 | ||
731 | usbhsg_pipe_disable(dcp); | 731 | usbhsg_pipe_disable(dcp); |
732 | 732 | ||
733 | if (gpriv->driver && | ||
734 | gpriv->driver->disconnect) | ||
735 | gpriv->driver->disconnect(&gpriv->gadget); | ||
736 | |||
737 | dev_dbg(dev, "stop gadget\n"); | 733 | dev_dbg(dev, "stop gadget\n"); |
738 | 734 | ||
739 | return 0; | 735 | return 0; |
@@ -744,31 +740,19 @@ static int usbhsg_try_stop(struct usbhs_priv *priv, u32 status) | |||
744 | * linux usb function | 740 | * linux usb function |
745 | * | 741 | * |
746 | */ | 742 | */ |
747 | static int usbhsg_gadget_start(struct usb_gadget_driver *driver, | 743 | static int usbhsg_gadget_start(struct usb_gadget *gadget, |
748 | int (*bind)(struct usb_gadget *)) | 744 | struct usb_gadget_driver *driver) |
749 | { | 745 | { |
750 | struct usbhsg_gpriv *gpriv; | 746 | struct usbhsg_gpriv *gpriv = usbhsg_gadget_to_gpriv(gadget); |
751 | struct usbhs_priv *priv; | 747 | struct usbhs_priv *priv; |
752 | struct device *dev; | 748 | struct device *dev; |
753 | int ret; | 749 | int ret; |
754 | 750 | ||
755 | if (!bind || | 751 | if (!driver || |
756 | !driver || | ||
757 | !driver->setup || | 752 | !driver->setup || |
758 | driver->speed != USB_SPEED_HIGH) | 753 | driver->speed != USB_SPEED_HIGH) |
759 | return -EINVAL; | 754 | return -EINVAL; |
760 | 755 | ||
761 | /* | ||
762 | * find unused controller | ||
763 | */ | ||
764 | usbhsg_for_each_controller(gpriv) { | ||
765 | if (!gpriv->driver) | ||
766 | goto find_unused_controller; | ||
767 | } | ||
768 | return -ENODEV; | ||
769 | |||
770 | find_unused_controller: | ||
771 | |||
772 | dev = usbhsg_gpriv_to_dev(gpriv); | 756 | dev = usbhsg_gpriv_to_dev(gpriv); |
773 | priv = usbhsg_gpriv_to_priv(gpriv); | 757 | priv = usbhsg_gpriv_to_priv(gpriv); |
774 | 758 | ||
@@ -782,19 +766,8 @@ find_unused_controller: | |||
782 | goto add_fail; | 766 | goto add_fail; |
783 | } | 767 | } |
784 | 768 | ||
785 | ret = bind(&gpriv->gadget); | ||
786 | if (ret) { | ||
787 | dev_err(dev, "bind to driver %s error %d\n", | ||
788 | driver->driver.name, ret); | ||
789 | goto bind_fail; | ||
790 | } | ||
791 | |||
792 | dev_dbg(dev, "bind %s\n", driver->driver.name); | ||
793 | |||
794 | return usbhsg_try_start(priv, USBHSG_STATUS_REGISTERD); | 769 | return usbhsg_try_start(priv, USBHSG_STATUS_REGISTERD); |
795 | 770 | ||
796 | bind_fail: | ||
797 | device_del(&gpriv->gadget.dev); | ||
798 | add_fail: | 771 | add_fail: |
799 | gpriv->driver = NULL; | 772 | gpriv->driver = NULL; |
800 | gpriv->gadget.dev.driver = NULL; | 773 | gpriv->gadget.dev.driver = NULL; |
@@ -802,9 +775,10 @@ add_fail: | |||
802 | return ret; | 775 | return ret; |
803 | } | 776 | } |
804 | 777 | ||
805 | static int usbhsg_gadget_stop(struct usb_gadget_driver *driver) | 778 | static int usbhsg_gadget_stop(struct usb_gadget *gadget, |
779 | struct usb_gadget_driver *driver) | ||
806 | { | 780 | { |
807 | struct usbhsg_gpriv *gpriv; | 781 | struct usbhsg_gpriv *gpriv = usbhsg_gadget_to_gpriv(gadget); |
808 | struct usbhs_priv *priv; | 782 | struct usbhs_priv *priv; |
809 | struct device *dev; | 783 | struct device *dev; |
810 | 784 | ||
@@ -812,17 +786,6 @@ static int usbhsg_gadget_stop(struct usb_gadget_driver *driver) | |||
812 | !driver->unbind) | 786 | !driver->unbind) |
813 | return -EINVAL; | 787 | return -EINVAL; |
814 | 788 | ||
815 | /* | ||
816 | * find controller | ||
817 | */ | ||
818 | usbhsg_for_each_controller(gpriv) { | ||
819 | if (gpriv->driver == driver) | ||
820 | goto find_matching_controller; | ||
821 | } | ||
822 | return -ENODEV; | ||
823 | |||
824 | find_matching_controller: | ||
825 | |||
826 | dev = usbhsg_gpriv_to_dev(gpriv); | 789 | dev = usbhsg_gpriv_to_dev(gpriv); |
827 | priv = usbhsg_gpriv_to_priv(gpriv); | 790 | priv = usbhsg_gpriv_to_priv(gpriv); |
828 | 791 | ||
@@ -830,12 +793,6 @@ find_matching_controller: | |||
830 | device_del(&gpriv->gadget.dev); | 793 | device_del(&gpriv->gadget.dev); |
831 | gpriv->driver = NULL; | 794 | gpriv->driver = NULL; |
832 | 795 | ||
833 | if (driver->disconnect) | ||
834 | driver->disconnect(&gpriv->gadget); | ||
835 | |||
836 | driver->unbind(&gpriv->gadget); | ||
837 | dev_dbg(dev, "unbind %s\n", driver->driver.name); | ||
838 | |||
839 | return 0; | 796 | return 0; |
840 | } | 797 | } |
841 | 798 | ||
@@ -852,8 +809,8 @@ static int usbhsg_get_frame(struct usb_gadget *gadget) | |||
852 | 809 | ||
853 | static struct usb_gadget_ops usbhsg_gadget_ops = { | 810 | static struct usb_gadget_ops usbhsg_gadget_ops = { |
854 | .get_frame = usbhsg_get_frame, | 811 | .get_frame = usbhsg_get_frame, |
855 | .start = usbhsg_gadget_start, | 812 | .udc_start = usbhsg_gadget_start, |
856 | .stop = usbhsg_gadget_stop, | 813 | .udc_stop = usbhsg_gadget_stop, |
857 | }; | 814 | }; |
858 | 815 | ||
859 | static int usbhsg_start(struct usbhs_priv *priv) | 816 | static int usbhsg_start(struct usbhs_priv *priv) |