diff options
Diffstat (limited to 'drivers/usb/gadget/dummy_hcd.c')
-rw-r--r-- | drivers/usb/gadget/dummy_hcd.c | 54 |
1 files changed, 14 insertions, 40 deletions
diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c index 583db7c38cf1..02106bebd5c1 100644 --- a/drivers/usb/gadget/dummy_hcd.c +++ b/drivers/usb/gadget/dummy_hcd.c | |||
@@ -470,7 +470,7 @@ static int dummy_disable (struct usb_ep *_ep) | |||
470 | } | 470 | } |
471 | 471 | ||
472 | static struct usb_request * | 472 | static struct usb_request * |
473 | dummy_alloc_request (struct usb_ep *_ep, unsigned mem_flags) | 473 | dummy_alloc_request (struct usb_ep *_ep, gfp_t mem_flags) |
474 | { | 474 | { |
475 | struct dummy_ep *ep; | 475 | struct dummy_ep *ep; |
476 | struct dummy_request *req; | 476 | struct dummy_request *req; |
@@ -507,7 +507,7 @@ dummy_alloc_buffer ( | |||
507 | struct usb_ep *_ep, | 507 | struct usb_ep *_ep, |
508 | unsigned bytes, | 508 | unsigned bytes, |
509 | dma_addr_t *dma, | 509 | dma_addr_t *dma, |
510 | unsigned mem_flags | 510 | gfp_t mem_flags |
511 | ) { | 511 | ) { |
512 | char *retval; | 512 | char *retval; |
513 | struct dummy_ep *ep; | 513 | struct dummy_ep *ep; |
@@ -541,7 +541,7 @@ fifo_complete (struct usb_ep *ep, struct usb_request *req) | |||
541 | 541 | ||
542 | static int | 542 | static int |
543 | dummy_queue (struct usb_ep *_ep, struct usb_request *_req, | 543 | dummy_queue (struct usb_ep *_ep, struct usb_request *_req, |
544 | unsigned mem_flags) | 544 | gfp_t mem_flags) |
545 | { | 545 | { |
546 | struct dummy_ep *ep; | 546 | struct dummy_ep *ep; |
547 | struct dummy_request *req; | 547 | struct dummy_request *req; |
@@ -935,14 +935,10 @@ static int dummy_udc_remove (struct device *dev) | |||
935 | return 0; | 935 | return 0; |
936 | } | 936 | } |
937 | 937 | ||
938 | static int dummy_udc_suspend (struct device *dev, pm_message_t state, | 938 | static int dummy_udc_suspend (struct device *dev, pm_message_t state) |
939 | u32 level) | ||
940 | { | 939 | { |
941 | struct dummy *dum = dev_get_drvdata(dev); | 940 | struct dummy *dum = dev_get_drvdata(dev); |
942 | 941 | ||
943 | if (level != SUSPEND_DISABLE) | ||
944 | return 0; | ||
945 | |||
946 | dev_dbg (dev, "%s\n", __FUNCTION__); | 942 | dev_dbg (dev, "%s\n", __FUNCTION__); |
947 | spin_lock_irq (&dum->lock); | 943 | spin_lock_irq (&dum->lock); |
948 | dum->udc_suspended = 1; | 944 | dum->udc_suspended = 1; |
@@ -954,13 +950,10 @@ static int dummy_udc_suspend (struct device *dev, pm_message_t state, | |||
954 | return 0; | 950 | return 0; |
955 | } | 951 | } |
956 | 952 | ||
957 | static int dummy_udc_resume (struct device *dev, u32 level) | 953 | static int dummy_udc_resume (struct device *dev) |
958 | { | 954 | { |
959 | struct dummy *dum = dev_get_drvdata(dev); | 955 | struct dummy *dum = dev_get_drvdata(dev); |
960 | 956 | ||
961 | if (level != RESUME_ENABLE) | ||
962 | return 0; | ||
963 | |||
964 | dev_dbg (dev, "%s\n", __FUNCTION__); | 957 | dev_dbg (dev, "%s\n", __FUNCTION__); |
965 | spin_lock_irq (&dum->lock); | 958 | spin_lock_irq (&dum->lock); |
966 | dum->udc_suspended = 0; | 959 | dum->udc_suspended = 0; |
@@ -974,6 +967,7 @@ static int dummy_udc_resume (struct device *dev, u32 level) | |||
974 | 967 | ||
975 | static struct device_driver dummy_udc_driver = { | 968 | static struct device_driver dummy_udc_driver = { |
976 | .name = (char *) gadget_name, | 969 | .name = (char *) gadget_name, |
970 | .owner = THIS_MODULE, | ||
977 | .bus = &platform_bus_type, | 971 | .bus = &platform_bus_type, |
978 | .probe = dummy_udc_probe, | 972 | .probe = dummy_udc_probe, |
979 | .remove = dummy_udc_remove, | 973 | .remove = dummy_udc_remove, |
@@ -999,7 +993,7 @@ static int dummy_urb_enqueue ( | |||
999 | struct usb_hcd *hcd, | 993 | struct usb_hcd *hcd, |
1000 | struct usb_host_endpoint *ep, | 994 | struct usb_host_endpoint *ep, |
1001 | struct urb *urb, | 995 | struct urb *urb, |
1002 | unsigned mem_flags | 996 | gfp_t mem_flags |
1003 | ) { | 997 | ) { |
1004 | struct dummy *dum; | 998 | struct dummy *dum; |
1005 | struct urbp *urbp; | 999 | struct urbp *urbp; |
@@ -1758,7 +1752,7 @@ static int dummy_hub_control ( | |||
1758 | return retval; | 1752 | return retval; |
1759 | } | 1753 | } |
1760 | 1754 | ||
1761 | static int dummy_hub_suspend (struct usb_hcd *hcd) | 1755 | static int dummy_bus_suspend (struct usb_hcd *hcd) |
1762 | { | 1756 | { |
1763 | struct dummy *dum = hcd_to_dummy (hcd); | 1757 | struct dummy *dum = hcd_to_dummy (hcd); |
1764 | 1758 | ||
@@ -1769,7 +1763,7 @@ static int dummy_hub_suspend (struct usb_hcd *hcd) | |||
1769 | return 0; | 1763 | return 0; |
1770 | } | 1764 | } |
1771 | 1765 | ||
1772 | static int dummy_hub_resume (struct usb_hcd *hcd) | 1766 | static int dummy_bus_resume (struct usb_hcd *hcd) |
1773 | { | 1767 | { |
1774 | struct dummy *dum = hcd_to_dummy (hcd); | 1768 | struct dummy *dum = hcd_to_dummy (hcd); |
1775 | 1769 | ||
@@ -1901,8 +1895,8 @@ static const struct hc_driver dummy_hcd = { | |||
1901 | 1895 | ||
1902 | .hub_status_data = dummy_hub_status, | 1896 | .hub_status_data = dummy_hub_status, |
1903 | .hub_control = dummy_hub_control, | 1897 | .hub_control = dummy_hub_control, |
1904 | .hub_suspend = dummy_hub_suspend, | 1898 | .bus_suspend = dummy_bus_suspend, |
1905 | .hub_resume = dummy_hub_resume, | 1899 | .bus_resume = dummy_bus_resume, |
1906 | }; | 1900 | }; |
1907 | 1901 | ||
1908 | static int dummy_hcd_probe (struct device *dev) | 1902 | static int dummy_hcd_probe (struct device *dev) |
@@ -1936,52 +1930,32 @@ static int dummy_hcd_remove (struct device *dev) | |||
1936 | return 0; | 1930 | return 0; |
1937 | } | 1931 | } |
1938 | 1932 | ||
1939 | static int dummy_hcd_suspend (struct device *dev, pm_message_t state, | 1933 | static int dummy_hcd_suspend (struct device *dev, pm_message_t state) |
1940 | u32 level) | ||
1941 | { | 1934 | { |
1942 | struct usb_hcd *hcd; | 1935 | struct usb_hcd *hcd; |
1943 | 1936 | ||
1944 | if (level != SUSPEND_DISABLE) | ||
1945 | return 0; | ||
1946 | |||
1947 | dev_dbg (dev, "%s\n", __FUNCTION__); | 1937 | dev_dbg (dev, "%s\n", __FUNCTION__); |
1948 | hcd = dev_get_drvdata (dev); | 1938 | hcd = dev_get_drvdata (dev); |
1949 | 1939 | ||
1950 | #ifndef CONFIG_USB_SUSPEND | ||
1951 | /* Otherwise this would never happen */ | ||
1952 | usb_lock_device (hcd->self.root_hub); | ||
1953 | dummy_hub_suspend (hcd); | ||
1954 | usb_unlock_device (hcd->self.root_hub); | ||
1955 | #endif | ||
1956 | |||
1957 | hcd->state = HC_STATE_SUSPENDED; | 1940 | hcd->state = HC_STATE_SUSPENDED; |
1958 | return 0; | 1941 | return 0; |
1959 | } | 1942 | } |
1960 | 1943 | ||
1961 | static int dummy_hcd_resume (struct device *dev, u32 level) | 1944 | static int dummy_hcd_resume (struct device *dev) |
1962 | { | 1945 | { |
1963 | struct usb_hcd *hcd; | 1946 | struct usb_hcd *hcd; |
1964 | 1947 | ||
1965 | if (level != RESUME_ENABLE) | ||
1966 | return 0; | ||
1967 | |||
1968 | dev_dbg (dev, "%s\n", __FUNCTION__); | 1948 | dev_dbg (dev, "%s\n", __FUNCTION__); |
1969 | hcd = dev_get_drvdata (dev); | 1949 | hcd = dev_get_drvdata (dev); |
1970 | hcd->state = HC_STATE_RUNNING; | 1950 | hcd->state = HC_STATE_RUNNING; |
1971 | 1951 | ||
1972 | #ifndef CONFIG_USB_SUSPEND | ||
1973 | /* Otherwise this would never happen */ | ||
1974 | usb_lock_device (hcd->self.root_hub); | ||
1975 | dummy_hub_resume (hcd); | ||
1976 | usb_unlock_device (hcd->self.root_hub); | ||
1977 | #endif | ||
1978 | |||
1979 | usb_hcd_poll_rh_status (hcd); | 1952 | usb_hcd_poll_rh_status (hcd); |
1980 | return 0; | 1953 | return 0; |
1981 | } | 1954 | } |
1982 | 1955 | ||
1983 | static struct device_driver dummy_hcd_driver = { | 1956 | static struct device_driver dummy_hcd_driver = { |
1984 | .name = (char *) driver_name, | 1957 | .name = (char *) driver_name, |
1958 | .owner = THIS_MODULE, | ||
1985 | .bus = &platform_bus_type, | 1959 | .bus = &platform_bus_type, |
1986 | .probe = dummy_hcd_probe, | 1960 | .probe = dummy_hcd_probe, |
1987 | .remove = dummy_hcd_remove, | 1961 | .remove = dummy_hcd_remove, |