diff options
Diffstat (limited to 'drivers/usb/gadget/dummy_hcd.c')
-rw-r--r-- | drivers/usb/gadget/dummy_hcd.c | 76 |
1 files changed, 39 insertions, 37 deletions
diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c index 904519085334..1e407745c115 100644 --- a/drivers/usb/gadget/dummy_hcd.c +++ b/drivers/usb/gadget/dummy_hcd.c | |||
@@ -896,7 +896,7 @@ dummy_gadget_release (struct device *dev) | |||
896 | #endif | 896 | #endif |
897 | } | 897 | } |
898 | 898 | ||
899 | static int dummy_udc_probe (struct device *dev) | 899 | static int dummy_udc_probe (struct platform_device *dev) |
900 | { | 900 | { |
901 | struct dummy *dum = the_controller; | 901 | struct dummy *dum = the_controller; |
902 | int rc; | 902 | int rc; |
@@ -909,7 +909,7 @@ static int dummy_udc_probe (struct device *dev) | |||
909 | dum->gadget.is_otg = (dummy_to_hcd(dum)->self.otg_port != 0); | 909 | dum->gadget.is_otg = (dummy_to_hcd(dum)->self.otg_port != 0); |
910 | 910 | ||
911 | strcpy (dum->gadget.dev.bus_id, "gadget"); | 911 | strcpy (dum->gadget.dev.bus_id, "gadget"); |
912 | dum->gadget.dev.parent = dev; | 912 | dum->gadget.dev.parent = &dev->dev; |
913 | dum->gadget.dev.release = dummy_gadget_release; | 913 | dum->gadget.dev.release = dummy_gadget_release; |
914 | rc = device_register (&dum->gadget.dev); | 914 | rc = device_register (&dum->gadget.dev); |
915 | if (rc < 0) | 915 | if (rc < 0) |
@@ -919,26 +919,26 @@ static int dummy_udc_probe (struct device *dev) | |||
919 | usb_bus_get (&dummy_to_hcd (dum)->self); | 919 | usb_bus_get (&dummy_to_hcd (dum)->self); |
920 | #endif | 920 | #endif |
921 | 921 | ||
922 | dev_set_drvdata (dev, dum); | 922 | platform_set_drvdata (dev, dum); |
923 | device_create_file (&dum->gadget.dev, &dev_attr_function); | 923 | device_create_file (&dum->gadget.dev, &dev_attr_function); |
924 | return rc; | 924 | return rc; |
925 | } | 925 | } |
926 | 926 | ||
927 | static int dummy_udc_remove (struct device *dev) | 927 | static int dummy_udc_remove (struct platform_device *dev) |
928 | { | 928 | { |
929 | struct dummy *dum = dev_get_drvdata (dev); | 929 | struct dummy *dum = platform_get_drvdata (dev); |
930 | 930 | ||
931 | dev_set_drvdata (dev, NULL); | 931 | platform_set_drvdata (dev, NULL); |
932 | device_remove_file (&dum->gadget.dev, &dev_attr_function); | 932 | device_remove_file (&dum->gadget.dev, &dev_attr_function); |
933 | device_unregister (&dum->gadget.dev); | 933 | device_unregister (&dum->gadget.dev); |
934 | return 0; | 934 | return 0; |
935 | } | 935 | } |
936 | 936 | ||
937 | static int dummy_udc_suspend (struct device *dev, pm_message_t state) | 937 | static int dummy_udc_suspend (struct platform_device *dev, pm_message_t state) |
938 | { | 938 | { |
939 | struct dummy *dum = dev_get_drvdata(dev); | 939 | struct dummy *dum = platform_get_drvdata(dev); |
940 | 940 | ||
941 | dev_dbg (dev, "%s\n", __FUNCTION__); | 941 | dev_dbg (&dev->dev, "%s\n", __FUNCTION__); |
942 | spin_lock_irq (&dum->lock); | 942 | spin_lock_irq (&dum->lock); |
943 | dum->udc_suspended = 1; | 943 | dum->udc_suspended = 1; |
944 | set_link_state (dum); | 944 | set_link_state (dum); |
@@ -949,29 +949,30 @@ static int dummy_udc_suspend (struct device *dev, pm_message_t state) | |||
949 | return 0; | 949 | return 0; |
950 | } | 950 | } |
951 | 951 | ||
952 | static int dummy_udc_resume (struct device *dev) | 952 | static int dummy_udc_resume (struct platform_device *dev) |
953 | { | 953 | { |
954 | struct dummy *dum = dev_get_drvdata(dev); | 954 | struct dummy *dum = platform_get_drvdata(dev); |
955 | 955 | ||
956 | dev_dbg (dev, "%s\n", __FUNCTION__); | 956 | dev_dbg (&dev->dev, "%s\n", __FUNCTION__); |
957 | spin_lock_irq (&dum->lock); | 957 | spin_lock_irq (&dum->lock); |
958 | dum->udc_suspended = 0; | 958 | dum->udc_suspended = 0; |
959 | set_link_state (dum); | 959 | set_link_state (dum); |
960 | spin_unlock_irq (&dum->lock); | 960 | spin_unlock_irq (&dum->lock); |
961 | 961 | ||
962 | dev->power.power_state = PMSG_ON; | 962 | dev->dev.power.power_state = PMSG_ON; |
963 | usb_hcd_poll_rh_status (dummy_to_hcd (dum)); | 963 | usb_hcd_poll_rh_status (dummy_to_hcd (dum)); |
964 | return 0; | 964 | return 0; |
965 | } | 965 | } |
966 | 966 | ||
967 | static struct device_driver dummy_udc_driver = { | 967 | static struct platform_driver dummy_udc_driver = { |
968 | .name = (char *) gadget_name, | ||
969 | .owner = THIS_MODULE, | ||
970 | .bus = &platform_bus_type, | ||
971 | .probe = dummy_udc_probe, | 968 | .probe = dummy_udc_probe, |
972 | .remove = dummy_udc_remove, | 969 | .remove = dummy_udc_remove, |
973 | .suspend = dummy_udc_suspend, | 970 | .suspend = dummy_udc_suspend, |
974 | .resume = dummy_udc_resume, | 971 | .resume = dummy_udc_resume, |
972 | .driver = { | ||
973 | .name = (char *) gadget_name, | ||
974 | .owner = THIS_MODULE, | ||
975 | }, | ||
975 | }; | 976 | }; |
976 | 977 | ||
977 | /*-------------------------------------------------------------------------*/ | 978 | /*-------------------------------------------------------------------------*/ |
@@ -1898,14 +1899,14 @@ static const struct hc_driver dummy_hcd = { | |||
1898 | .bus_resume = dummy_bus_resume, | 1899 | .bus_resume = dummy_bus_resume, |
1899 | }; | 1900 | }; |
1900 | 1901 | ||
1901 | static int dummy_hcd_probe (struct device *dev) | 1902 | static int dummy_hcd_probe (struct platform_device *dev) |
1902 | { | 1903 | { |
1903 | struct usb_hcd *hcd; | 1904 | struct usb_hcd *hcd; |
1904 | int retval; | 1905 | int retval; |
1905 | 1906 | ||
1906 | dev_info (dev, "%s, driver " DRIVER_VERSION "\n", driver_desc); | 1907 | dev_info (dev, "%s, driver " DRIVER_VERSION "\n", driver_desc); |
1907 | 1908 | ||
1908 | hcd = usb_create_hcd (&dummy_hcd, dev, dev->bus_id); | 1909 | hcd = usb_create_hcd (&dummy_hcd, &dev->dev, dev->dev.bus_id); |
1909 | if (!hcd) | 1910 | if (!hcd) |
1910 | return -ENOMEM; | 1911 | return -ENOMEM; |
1911 | the_controller = hcd_to_dummy (hcd); | 1912 | the_controller = hcd_to_dummy (hcd); |
@@ -1918,48 +1919,49 @@ static int dummy_hcd_probe (struct device *dev) | |||
1918 | return retval; | 1919 | return retval; |
1919 | } | 1920 | } |
1920 | 1921 | ||
1921 | static int dummy_hcd_remove (struct device *dev) | 1922 | static int dummy_hcd_remove (struct platform_device *dev) |
1922 | { | 1923 | { |
1923 | struct usb_hcd *hcd; | 1924 | struct usb_hcd *hcd; |
1924 | 1925 | ||
1925 | hcd = dev_get_drvdata (dev); | 1926 | hcd = platform_get_drvdata (dev); |
1926 | usb_remove_hcd (hcd); | 1927 | usb_remove_hcd (hcd); |
1927 | usb_put_hcd (hcd); | 1928 | usb_put_hcd (hcd); |
1928 | the_controller = NULL; | 1929 | the_controller = NULL; |
1929 | return 0; | 1930 | return 0; |
1930 | } | 1931 | } |
1931 | 1932 | ||
1932 | static int dummy_hcd_suspend (struct device *dev, pm_message_t state) | 1933 | static int dummy_hcd_suspend (struct platform_device *dev, pm_message_t state) |
1933 | { | 1934 | { |
1934 | struct usb_hcd *hcd; | 1935 | struct usb_hcd *hcd; |
1935 | 1936 | ||
1936 | dev_dbg (dev, "%s\n", __FUNCTION__); | 1937 | dev_dbg (&dev->dev, "%s\n", __FUNCTION__); |
1937 | hcd = dev_get_drvdata (dev); | 1938 | hcd = platform_get_drvdata (dev); |
1938 | 1939 | ||
1939 | hcd->state = HC_STATE_SUSPENDED; | 1940 | hcd->state = HC_STATE_SUSPENDED; |
1940 | return 0; | 1941 | return 0; |
1941 | } | 1942 | } |
1942 | 1943 | ||
1943 | static int dummy_hcd_resume (struct device *dev) | 1944 | static int dummy_hcd_resume (struct platform_device *dev) |
1944 | { | 1945 | { |
1945 | struct usb_hcd *hcd; | 1946 | struct usb_hcd *hcd; |
1946 | 1947 | ||
1947 | dev_dbg (dev, "%s\n", __FUNCTION__); | 1948 | dev_dbg (&dev->dev, "%s\n", __FUNCTION__); |
1948 | hcd = dev_get_drvdata (dev); | 1949 | hcd = platform_get_drvdata (dev); |
1949 | hcd->state = HC_STATE_RUNNING; | 1950 | hcd->state = HC_STATE_RUNNING; |
1950 | 1951 | ||
1951 | usb_hcd_poll_rh_status (hcd); | 1952 | usb_hcd_poll_rh_status (hcd); |
1952 | return 0; | 1953 | return 0; |
1953 | } | 1954 | } |
1954 | 1955 | ||
1955 | static struct device_driver dummy_hcd_driver = { | 1956 | static struct platform_driver dummy_hcd_driver = { |
1956 | .name = (char *) driver_name, | ||
1957 | .owner = THIS_MODULE, | ||
1958 | .bus = &platform_bus_type, | ||
1959 | .probe = dummy_hcd_probe, | 1957 | .probe = dummy_hcd_probe, |
1960 | .remove = dummy_hcd_remove, | 1958 | .remove = dummy_hcd_remove, |
1961 | .suspend = dummy_hcd_suspend, | 1959 | .suspend = dummy_hcd_suspend, |
1962 | .resume = dummy_hcd_resume, | 1960 | .resume = dummy_hcd_resume, |
1961 | .driver = { | ||
1962 | .name = (char *) driver_name, | ||
1963 | .owner = THIS_MODULE, | ||
1964 | }, | ||
1963 | }; | 1965 | }; |
1964 | 1966 | ||
1965 | /*-------------------------------------------------------------------------*/ | 1967 | /*-------------------------------------------------------------------------*/ |
@@ -1995,11 +1997,11 @@ static int __init init (void) | |||
1995 | if (usb_disabled ()) | 1997 | if (usb_disabled ()) |
1996 | return -ENODEV; | 1998 | return -ENODEV; |
1997 | 1999 | ||
1998 | retval = driver_register (&dummy_hcd_driver); | 2000 | retval = platform_driver_register (&dummy_hcd_driver); |
1999 | if (retval < 0) | 2001 | if (retval < 0) |
2000 | return retval; | 2002 | return retval; |
2001 | 2003 | ||
2002 | retval = driver_register (&dummy_udc_driver); | 2004 | retval = platform_driver_register (&dummy_udc_driver); |
2003 | if (retval < 0) | 2005 | if (retval < 0) |
2004 | goto err_register_udc_driver; | 2006 | goto err_register_udc_driver; |
2005 | 2007 | ||
@@ -2015,9 +2017,9 @@ static int __init init (void) | |||
2015 | err_register_udc: | 2017 | err_register_udc: |
2016 | platform_device_unregister (&the_hcd_pdev); | 2018 | platform_device_unregister (&the_hcd_pdev); |
2017 | err_register_hcd: | 2019 | err_register_hcd: |
2018 | driver_unregister (&dummy_udc_driver); | 2020 | platform_driver_unregister (&dummy_udc_driver); |
2019 | err_register_udc_driver: | 2021 | err_register_udc_driver: |
2020 | driver_unregister (&dummy_hcd_driver); | 2022 | platform_driver_unregister (&dummy_hcd_driver); |
2021 | return retval; | 2023 | return retval; |
2022 | } | 2024 | } |
2023 | module_init (init); | 2025 | module_init (init); |
@@ -2026,7 +2028,7 @@ static void __exit cleanup (void) | |||
2026 | { | 2028 | { |
2027 | platform_device_unregister (&the_udc_pdev); | 2029 | platform_device_unregister (&the_udc_pdev); |
2028 | platform_device_unregister (&the_hcd_pdev); | 2030 | platform_device_unregister (&the_hcd_pdev); |
2029 | driver_unregister (&dummy_udc_driver); | 2031 | platform_driver_unregister (&dummy_udc_driver); |
2030 | driver_unregister (&dummy_hcd_driver); | 2032 | platform_driver_unregister (&dummy_hcd_driver); |
2031 | } | 2033 | } |
2032 | module_exit (cleanup); | 2034 | module_exit (cleanup); |