diff options
Diffstat (limited to 'drivers/usb/gadget')
-rw-r--r-- | drivers/usb/gadget/dummy_hcd.c | 54 | ||||
-rw-r--r-- | drivers/usb/gadget/ether.c | 23 | ||||
-rw-r--r-- | drivers/usb/gadget/file_storage.c | 52 | ||||
-rw-r--r-- | drivers/usb/gadget/goku_udc.c | 7 | ||||
-rw-r--r-- | drivers/usb/gadget/lh7a40x_udc.c | 13 | ||||
-rw-r--r-- | drivers/usb/gadget/net2280.c | 7 | ||||
-rw-r--r-- | drivers/usb/gadget/omap_udc.c | 28 | ||||
-rw-r--r-- | drivers/usb/gadget/pxa2xx_udc.c | 26 | ||||
-rw-r--r-- | drivers/usb/gadget/pxa2xx_udc.h | 8 | ||||
-rw-r--r-- | drivers/usb/gadget/serial.c | 16 | ||||
-rw-r--r-- | drivers/usb/gadget/zero.c | 9 |
11 files changed, 108 insertions, 135 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, |
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c index 49459e33e952..8f402f85e1ca 100644 --- a/drivers/usb/gadget/ether.c +++ b/drivers/usb/gadget/ether.c | |||
@@ -945,11 +945,11 @@ config_buf (enum usb_device_speed speed, | |||
945 | 945 | ||
946 | /*-------------------------------------------------------------------------*/ | 946 | /*-------------------------------------------------------------------------*/ |
947 | 947 | ||
948 | static void eth_start (struct eth_dev *dev, unsigned gfp_flags); | 948 | static void eth_start (struct eth_dev *dev, gfp_t gfp_flags); |
949 | static int alloc_requests (struct eth_dev *dev, unsigned n, unsigned gfp_flags); | 949 | static int alloc_requests (struct eth_dev *dev, unsigned n, gfp_t gfp_flags); |
950 | 950 | ||
951 | static int | 951 | static int |
952 | set_ether_config (struct eth_dev *dev, unsigned gfp_flags) | 952 | set_ether_config (struct eth_dev *dev, gfp_t gfp_flags) |
953 | { | 953 | { |
954 | int result = 0; | 954 | int result = 0; |
955 | struct usb_gadget *gadget = dev->gadget; | 955 | struct usb_gadget *gadget = dev->gadget; |
@@ -1081,7 +1081,7 @@ static void eth_reset_config (struct eth_dev *dev) | |||
1081 | * that returns config descriptors, and altsetting code. | 1081 | * that returns config descriptors, and altsetting code. |
1082 | */ | 1082 | */ |
1083 | static int | 1083 | static int |
1084 | eth_set_config (struct eth_dev *dev, unsigned number, unsigned gfp_flags) | 1084 | eth_set_config (struct eth_dev *dev, unsigned number, gfp_t gfp_flags) |
1085 | { | 1085 | { |
1086 | int result = 0; | 1086 | int result = 0; |
1087 | struct usb_gadget *gadget = dev->gadget; | 1087 | struct usb_gadget *gadget = dev->gadget; |
@@ -1598,7 +1598,7 @@ static void defer_kevent (struct eth_dev *dev, int flag) | |||
1598 | static void rx_complete (struct usb_ep *ep, struct usb_request *req); | 1598 | static void rx_complete (struct usb_ep *ep, struct usb_request *req); |
1599 | 1599 | ||
1600 | static int | 1600 | static int |
1601 | rx_submit (struct eth_dev *dev, struct usb_request *req, unsigned gfp_flags) | 1601 | rx_submit (struct eth_dev *dev, struct usb_request *req, gfp_t gfp_flags) |
1602 | { | 1602 | { |
1603 | struct sk_buff *skb; | 1603 | struct sk_buff *skb; |
1604 | int retval = -ENOMEM; | 1604 | int retval = -ENOMEM; |
@@ -1724,7 +1724,7 @@ clean: | |||
1724 | } | 1724 | } |
1725 | 1725 | ||
1726 | static int prealloc (struct list_head *list, struct usb_ep *ep, | 1726 | static int prealloc (struct list_head *list, struct usb_ep *ep, |
1727 | unsigned n, unsigned gfp_flags) | 1727 | unsigned n, gfp_t gfp_flags) |
1728 | { | 1728 | { |
1729 | unsigned i; | 1729 | unsigned i; |
1730 | struct usb_request *req; | 1730 | struct usb_request *req; |
@@ -1763,7 +1763,7 @@ extra: | |||
1763 | return 0; | 1763 | return 0; |
1764 | } | 1764 | } |
1765 | 1765 | ||
1766 | static int alloc_requests (struct eth_dev *dev, unsigned n, unsigned gfp_flags) | 1766 | static int alloc_requests (struct eth_dev *dev, unsigned n, gfp_t gfp_flags) |
1767 | { | 1767 | { |
1768 | int status; | 1768 | int status; |
1769 | 1769 | ||
@@ -1779,7 +1779,7 @@ fail: | |||
1779 | return status; | 1779 | return status; |
1780 | } | 1780 | } |
1781 | 1781 | ||
1782 | static void rx_fill (struct eth_dev *dev, unsigned gfp_flags) | 1782 | static void rx_fill (struct eth_dev *dev, gfp_t gfp_flags) |
1783 | { | 1783 | { |
1784 | struct usb_request *req; | 1784 | struct usb_request *req; |
1785 | unsigned long flags; | 1785 | unsigned long flags; |
@@ -1962,7 +1962,7 @@ drop: | |||
1962 | * normally just one notification will be queued. | 1962 | * normally just one notification will be queued. |
1963 | */ | 1963 | */ |
1964 | 1964 | ||
1965 | static struct usb_request *eth_req_alloc (struct usb_ep *, unsigned, unsigned); | 1965 | static struct usb_request *eth_req_alloc (struct usb_ep *, unsigned, gfp_t); |
1966 | static void eth_req_free (struct usb_ep *ep, struct usb_request *req); | 1966 | static void eth_req_free (struct usb_ep *ep, struct usb_request *req); |
1967 | 1967 | ||
1968 | static void | 1968 | static void |
@@ -2024,7 +2024,7 @@ static int rndis_control_ack (struct net_device *net) | |||
2024 | 2024 | ||
2025 | #endif /* RNDIS */ | 2025 | #endif /* RNDIS */ |
2026 | 2026 | ||
2027 | static void eth_start (struct eth_dev *dev, unsigned gfp_flags) | 2027 | static void eth_start (struct eth_dev *dev, gfp_t gfp_flags) |
2028 | { | 2028 | { |
2029 | DEBUG (dev, "%s\n", __FUNCTION__); | 2029 | DEBUG (dev, "%s\n", __FUNCTION__); |
2030 | 2030 | ||
@@ -2092,7 +2092,7 @@ static int eth_stop (struct net_device *net) | |||
2092 | /*-------------------------------------------------------------------------*/ | 2092 | /*-------------------------------------------------------------------------*/ |
2093 | 2093 | ||
2094 | static struct usb_request * | 2094 | static struct usb_request * |
2095 | eth_req_alloc (struct usb_ep *ep, unsigned size, unsigned gfp_flags) | 2095 | eth_req_alloc (struct usb_ep *ep, unsigned size, gfp_t gfp_flags) |
2096 | { | 2096 | { |
2097 | struct usb_request *req; | 2097 | struct usb_request *req; |
2098 | 2098 | ||
@@ -2533,6 +2533,7 @@ static struct usb_gadget_driver eth_driver = { | |||
2533 | 2533 | ||
2534 | .driver = { | 2534 | .driver = { |
2535 | .name = (char *) shortname, | 2535 | .name = (char *) shortname, |
2536 | .owner = THIS_MODULE, | ||
2536 | // .shutdown = ... | 2537 | // .shutdown = ... |
2537 | // .suspend = ... | 2538 | // .suspend = ... |
2538 | // .resume = ... | 2539 | // .resume = ... |
diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c index a41d9d4baee3..ea09aaa3cab6 100644 --- a/drivers/usb/gadget/file_storage.c +++ b/drivers/usb/gadget/file_storage.c | |||
@@ -224,6 +224,7 @@ | |||
224 | #include <linux/fs.h> | 224 | #include <linux/fs.h> |
225 | #include <linux/init.h> | 225 | #include <linux/init.h> |
226 | #include <linux/kernel.h> | 226 | #include <linux/kernel.h> |
227 | #include <linux/kthread.h> | ||
227 | #include <linux/limits.h> | 228 | #include <linux/limits.h> |
228 | #include <linux/list.h> | 229 | #include <linux/list.h> |
229 | #include <linux/module.h> | 230 | #include <linux/module.h> |
@@ -669,7 +670,6 @@ struct fsg_dev { | |||
669 | wait_queue_head_t thread_wqh; | 670 | wait_queue_head_t thread_wqh; |
670 | int thread_wakeup_needed; | 671 | int thread_wakeup_needed; |
671 | struct completion thread_notifier; | 672 | struct completion thread_notifier; |
672 | int thread_pid; | ||
673 | struct task_struct *thread_task; | 673 | struct task_struct *thread_task; |
674 | sigset_t thread_signal_mask; | 674 | sigset_t thread_signal_mask; |
675 | 675 | ||
@@ -1084,7 +1084,6 @@ static void wakeup_thread(struct fsg_dev *fsg) | |||
1084 | static void raise_exception(struct fsg_dev *fsg, enum fsg_state new_state) | 1084 | static void raise_exception(struct fsg_dev *fsg, enum fsg_state new_state) |
1085 | { | 1085 | { |
1086 | unsigned long flags; | 1086 | unsigned long flags; |
1087 | struct task_struct *thread_task; | ||
1088 | 1087 | ||
1089 | /* Do nothing if a higher-priority exception is already in progress. | 1088 | /* Do nothing if a higher-priority exception is already in progress. |
1090 | * If a lower-or-equal priority exception is in progress, preempt it | 1089 | * If a lower-or-equal priority exception is in progress, preempt it |
@@ -1093,9 +1092,9 @@ static void raise_exception(struct fsg_dev *fsg, enum fsg_state new_state) | |||
1093 | if (fsg->state <= new_state) { | 1092 | if (fsg->state <= new_state) { |
1094 | fsg->exception_req_tag = fsg->ep0_req_tag; | 1093 | fsg->exception_req_tag = fsg->ep0_req_tag; |
1095 | fsg->state = new_state; | 1094 | fsg->state = new_state; |
1096 | thread_task = fsg->thread_task; | 1095 | if (fsg->thread_task) |
1097 | if (thread_task) | 1096 | send_sig_info(SIGUSR1, SEND_SIG_FORCED, |
1098 | send_sig_info(SIGUSR1, SEND_SIG_FORCED, thread_task); | 1097 | fsg->thread_task); |
1099 | } | 1098 | } |
1100 | spin_unlock_irqrestore(&fsg->lock, flags); | 1099 | spin_unlock_irqrestore(&fsg->lock, flags); |
1101 | } | 1100 | } |
@@ -3383,11 +3382,6 @@ static int fsg_main_thread(void *fsg_) | |||
3383 | { | 3382 | { |
3384 | struct fsg_dev *fsg = (struct fsg_dev *) fsg_; | 3383 | struct fsg_dev *fsg = (struct fsg_dev *) fsg_; |
3385 | 3384 | ||
3386 | fsg->thread_task = current; | ||
3387 | |||
3388 | /* Release all our userspace resources */ | ||
3389 | daemonize("file-storage-gadget"); | ||
3390 | |||
3391 | /* Allow the thread to be killed by a signal, but set the signal mask | 3385 | /* Allow the thread to be killed by a signal, but set the signal mask |
3392 | * to block everything but INT, TERM, KILL, and USR1. */ | 3386 | * to block everything but INT, TERM, KILL, and USR1. */ |
3393 | siginitsetinv(&fsg->thread_signal_mask, sigmask(SIGINT) | | 3387 | siginitsetinv(&fsg->thread_signal_mask, sigmask(SIGINT) | |
@@ -3400,9 +3394,6 @@ static int fsg_main_thread(void *fsg_) | |||
3400 | * that expects a __user pointer and it will work okay. */ | 3394 | * that expects a __user pointer and it will work okay. */ |
3401 | set_fs(get_ds()); | 3395 | set_fs(get_ds()); |
3402 | 3396 | ||
3403 | /* Wait for the gadget registration to finish up */ | ||
3404 | wait_for_completion(&fsg->thread_notifier); | ||
3405 | |||
3406 | /* The main loop */ | 3397 | /* The main loop */ |
3407 | while (fsg->state != FSG_STATE_TERMINATED) { | 3398 | while (fsg->state != FSG_STATE_TERMINATED) { |
3408 | if (exception_in_progress(fsg) || signal_pending(current)) { | 3399 | if (exception_in_progress(fsg) || signal_pending(current)) { |
@@ -3440,8 +3431,9 @@ static int fsg_main_thread(void *fsg_) | |||
3440 | spin_unlock_irq(&fsg->lock); | 3431 | spin_unlock_irq(&fsg->lock); |
3441 | } | 3432 | } |
3442 | 3433 | ||
3434 | spin_lock_irq(&fsg->lock); | ||
3443 | fsg->thread_task = NULL; | 3435 | fsg->thread_task = NULL; |
3444 | flush_signals(current); | 3436 | spin_unlock_irq(&fsg->lock); |
3445 | 3437 | ||
3446 | /* In case we are exiting because of a signal, unregister the | 3438 | /* In case we are exiting because of a signal, unregister the |
3447 | * gadget driver and close the backing file. */ | 3439 | * gadget driver and close the backing file. */ |
@@ -3831,12 +3823,11 @@ static int __init fsg_bind(struct usb_gadget *gadget) | |||
3831 | 3823 | ||
3832 | /* Create the LUNs, open their backing files, and register the | 3824 | /* Create the LUNs, open their backing files, and register the |
3833 | * LUN devices in sysfs. */ | 3825 | * LUN devices in sysfs. */ |
3834 | fsg->luns = kmalloc(i * sizeof(struct lun), GFP_KERNEL); | 3826 | fsg->luns = kzalloc(i * sizeof(struct lun), GFP_KERNEL); |
3835 | if (!fsg->luns) { | 3827 | if (!fsg->luns) { |
3836 | rc = -ENOMEM; | 3828 | rc = -ENOMEM; |
3837 | goto out; | 3829 | goto out; |
3838 | } | 3830 | } |
3839 | memset(fsg->luns, 0, i * sizeof(struct lun)); | ||
3840 | fsg->nluns = i; | 3831 | fsg->nluns = i; |
3841 | 3832 | ||
3842 | for (i = 0; i < fsg->nluns; ++i) { | 3833 | for (i = 0; i < fsg->nluns; ++i) { |
@@ -3959,10 +3950,12 @@ static int __init fsg_bind(struct usb_gadget *gadget) | |||
3959 | sprintf(&serial[i], "%02X", c); | 3950 | sprintf(&serial[i], "%02X", c); |
3960 | } | 3951 | } |
3961 | 3952 | ||
3962 | if ((rc = kernel_thread(fsg_main_thread, fsg, (CLONE_VM | CLONE_FS | | 3953 | fsg->thread_task = kthread_create(fsg_main_thread, fsg, |
3963 | CLONE_FILES))) < 0) | 3954 | "file-storage-gadget"); |
3955 | if (IS_ERR(fsg->thread_task)) { | ||
3956 | rc = PTR_ERR(fsg->thread_task); | ||
3964 | goto out; | 3957 | goto out; |
3965 | fsg->thread_pid = rc; | 3958 | } |
3966 | 3959 | ||
3967 | INFO(fsg, DRIVER_DESC ", version: " DRIVER_VERSION "\n"); | 3960 | INFO(fsg, DRIVER_DESC ", version: " DRIVER_VERSION "\n"); |
3968 | INFO(fsg, "Number of LUNs=%d\n", fsg->nluns); | 3961 | INFO(fsg, "Number of LUNs=%d\n", fsg->nluns); |
@@ -3994,7 +3987,12 @@ static int __init fsg_bind(struct usb_gadget *gadget) | |||
3994 | DBG(fsg, "removable=%d, stall=%d, buflen=%u\n", | 3987 | DBG(fsg, "removable=%d, stall=%d, buflen=%u\n", |
3995 | mod_data.removable, mod_data.can_stall, | 3988 | mod_data.removable, mod_data.can_stall, |
3996 | mod_data.buflen); | 3989 | mod_data.buflen); |
3997 | DBG(fsg, "I/O thread pid: %d\n", fsg->thread_pid); | 3990 | DBG(fsg, "I/O thread pid: %d\n", fsg->thread_task->pid); |
3991 | |||
3992 | set_bit(REGISTERED, &fsg->atomic_bitflags); | ||
3993 | |||
3994 | /* Tell the thread to start working */ | ||
3995 | wake_up_process(fsg->thread_task); | ||
3998 | return 0; | 3996 | return 0; |
3999 | 3997 | ||
4000 | autoconf_fail: | 3998 | autoconf_fail: |
@@ -4046,6 +4044,7 @@ static struct usb_gadget_driver fsg_driver = { | |||
4046 | 4044 | ||
4047 | .driver = { | 4045 | .driver = { |
4048 | .name = (char *) shortname, | 4046 | .name = (char *) shortname, |
4047 | .owner = THIS_MODULE, | ||
4049 | // .release = ... | 4048 | // .release = ... |
4050 | // .suspend = ... | 4049 | // .suspend = ... |
4051 | // .resume = ... | 4050 | // .resume = ... |
@@ -4057,10 +4056,9 @@ static int __init fsg_alloc(void) | |||
4057 | { | 4056 | { |
4058 | struct fsg_dev *fsg; | 4057 | struct fsg_dev *fsg; |
4059 | 4058 | ||
4060 | fsg = kmalloc(sizeof *fsg, GFP_KERNEL); | 4059 | fsg = kzalloc(sizeof *fsg, GFP_KERNEL); |
4061 | if (!fsg) | 4060 | if (!fsg) |
4062 | return -ENOMEM; | 4061 | return -ENOMEM; |
4063 | memset(fsg, 0, sizeof *fsg); | ||
4064 | spin_lock_init(&fsg->lock); | 4062 | spin_lock_init(&fsg->lock); |
4065 | init_rwsem(&fsg->filesem); | 4063 | init_rwsem(&fsg->filesem); |
4066 | init_waitqueue_head(&fsg->thread_wqh); | 4064 | init_waitqueue_head(&fsg->thread_wqh); |
@@ -4086,15 +4084,9 @@ static int __init fsg_init(void) | |||
4086 | if ((rc = fsg_alloc()) != 0) | 4084 | if ((rc = fsg_alloc()) != 0) |
4087 | return rc; | 4085 | return rc; |
4088 | fsg = the_fsg; | 4086 | fsg = the_fsg; |
4089 | if ((rc = usb_gadget_register_driver(&fsg_driver)) != 0) { | 4087 | if ((rc = usb_gadget_register_driver(&fsg_driver)) != 0) |
4090 | fsg_free(fsg); | 4088 | fsg_free(fsg); |
4091 | return rc; | 4089 | return rc; |
4092 | } | ||
4093 | set_bit(REGISTERED, &fsg->atomic_bitflags); | ||
4094 | |||
4095 | /* Tell the thread to start working */ | ||
4096 | complete(&fsg->thread_notifier); | ||
4097 | return 0; | ||
4098 | } | 4090 | } |
4099 | module_init(fsg_init); | 4091 | module_init(fsg_init); |
4100 | 4092 | ||
diff --git a/drivers/usb/gadget/goku_udc.c b/drivers/usb/gadget/goku_udc.c index eaab26f4ed37..654469778ab5 100644 --- a/drivers/usb/gadget/goku_udc.c +++ b/drivers/usb/gadget/goku_udc.c | |||
@@ -269,7 +269,7 @@ static int goku_ep_disable(struct usb_ep *_ep) | |||
269 | /*-------------------------------------------------------------------------*/ | 269 | /*-------------------------------------------------------------------------*/ |
270 | 270 | ||
271 | static struct usb_request * | 271 | static struct usb_request * |
272 | goku_alloc_request(struct usb_ep *_ep, unsigned gfp_flags) | 272 | goku_alloc_request(struct usb_ep *_ep, gfp_t gfp_flags) |
273 | { | 273 | { |
274 | struct goku_request *req; | 274 | struct goku_request *req; |
275 | 275 | ||
@@ -327,7 +327,7 @@ goku_free_request(struct usb_ep *_ep, struct usb_request *_req) | |||
327 | */ | 327 | */ |
328 | static void * | 328 | static void * |
329 | goku_alloc_buffer(struct usb_ep *_ep, unsigned bytes, | 329 | goku_alloc_buffer(struct usb_ep *_ep, unsigned bytes, |
330 | dma_addr_t *dma, unsigned gfp_flags) | 330 | dma_addr_t *dma, gfp_t gfp_flags) |
331 | { | 331 | { |
332 | void *retval; | 332 | void *retval; |
333 | struct goku_ep *ep; | 333 | struct goku_ep *ep; |
@@ -789,7 +789,7 @@ finished: | |||
789 | /*-------------------------------------------------------------------------*/ | 789 | /*-------------------------------------------------------------------------*/ |
790 | 790 | ||
791 | static int | 791 | static int |
792 | goku_queue(struct usb_ep *_ep, struct usb_request *_req, unsigned gfp_flags) | 792 | goku_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags) |
793 | { | 793 | { |
794 | struct goku_request *req; | 794 | struct goku_request *req; |
795 | struct goku_ep *ep; | 795 | struct goku_ep *ep; |
@@ -1970,6 +1970,7 @@ MODULE_DEVICE_TABLE (pci, pci_ids); | |||
1970 | static struct pci_driver goku_pci_driver = { | 1970 | static struct pci_driver goku_pci_driver = { |
1971 | .name = (char *) driver_name, | 1971 | .name = (char *) driver_name, |
1972 | .id_table = pci_ids, | 1972 | .id_table = pci_ids, |
1973 | .owner = THIS_MODULE, | ||
1973 | 1974 | ||
1974 | .probe = goku_probe, | 1975 | .probe = goku_probe, |
1975 | .remove = goku_remove, | 1976 | .remove = goku_remove, |
diff --git a/drivers/usb/gadget/lh7a40x_udc.c b/drivers/usb/gadget/lh7a40x_udc.c index 4842577789c9..9b3673904daf 100644 --- a/drivers/usb/gadget/lh7a40x_udc.c +++ b/drivers/usb/gadget/lh7a40x_udc.c | |||
@@ -71,13 +71,13 @@ static char *state_names[] = { | |||
71 | static int lh7a40x_ep_enable(struct usb_ep *ep, | 71 | static int lh7a40x_ep_enable(struct usb_ep *ep, |
72 | const struct usb_endpoint_descriptor *); | 72 | const struct usb_endpoint_descriptor *); |
73 | static int lh7a40x_ep_disable(struct usb_ep *ep); | 73 | static int lh7a40x_ep_disable(struct usb_ep *ep); |
74 | static struct usb_request *lh7a40x_alloc_request(struct usb_ep *ep, int); | 74 | static struct usb_request *lh7a40x_alloc_request(struct usb_ep *ep, gfp_t); |
75 | static void lh7a40x_free_request(struct usb_ep *ep, struct usb_request *); | 75 | static void lh7a40x_free_request(struct usb_ep *ep, struct usb_request *); |
76 | static void *lh7a40x_alloc_buffer(struct usb_ep *ep, unsigned, dma_addr_t *, | 76 | static void *lh7a40x_alloc_buffer(struct usb_ep *ep, unsigned, dma_addr_t *, |
77 | int); | 77 | gfp_t); |
78 | static void lh7a40x_free_buffer(struct usb_ep *ep, void *, dma_addr_t, | 78 | static void lh7a40x_free_buffer(struct usb_ep *ep, void *, dma_addr_t, |
79 | unsigned); | 79 | unsigned); |
80 | static int lh7a40x_queue(struct usb_ep *ep, struct usb_request *, int); | 80 | static int lh7a40x_queue(struct usb_ep *ep, struct usb_request *, gfp_t); |
81 | static int lh7a40x_dequeue(struct usb_ep *ep, struct usb_request *); | 81 | static int lh7a40x_dequeue(struct usb_ep *ep, struct usb_request *); |
82 | static int lh7a40x_set_halt(struct usb_ep *ep, int); | 82 | static int lh7a40x_set_halt(struct usb_ep *ep, int); |
83 | static int lh7a40x_fifo_status(struct usb_ep *ep); | 83 | static int lh7a40x_fifo_status(struct usb_ep *ep); |
@@ -1106,7 +1106,7 @@ static int lh7a40x_ep_disable(struct usb_ep *_ep) | |||
1106 | } | 1106 | } |
1107 | 1107 | ||
1108 | static struct usb_request *lh7a40x_alloc_request(struct usb_ep *ep, | 1108 | static struct usb_request *lh7a40x_alloc_request(struct usb_ep *ep, |
1109 | unsigned gfp_flags) | 1109 | gfp_t gfp_flags) |
1110 | { | 1110 | { |
1111 | struct lh7a40x_request *req; | 1111 | struct lh7a40x_request *req; |
1112 | 1112 | ||
@@ -1134,7 +1134,7 @@ static void lh7a40x_free_request(struct usb_ep *ep, struct usb_request *_req) | |||
1134 | } | 1134 | } |
1135 | 1135 | ||
1136 | static void *lh7a40x_alloc_buffer(struct usb_ep *ep, unsigned bytes, | 1136 | static void *lh7a40x_alloc_buffer(struct usb_ep *ep, unsigned bytes, |
1137 | dma_addr_t * dma, unsigned gfp_flags) | 1137 | dma_addr_t * dma, gfp_t gfp_flags) |
1138 | { | 1138 | { |
1139 | char *retval; | 1139 | char *retval; |
1140 | 1140 | ||
@@ -1158,7 +1158,7 @@ static void lh7a40x_free_buffer(struct usb_ep *ep, void *buf, dma_addr_t dma, | |||
1158 | * NOTE: Sets INDEX register | 1158 | * NOTE: Sets INDEX register |
1159 | */ | 1159 | */ |
1160 | static int lh7a40x_queue(struct usb_ep *_ep, struct usb_request *_req, | 1160 | static int lh7a40x_queue(struct usb_ep *_ep, struct usb_request *_req, |
1161 | unsigned gfp_flags) | 1161 | gfp_t gfp_flags) |
1162 | { | 1162 | { |
1163 | struct lh7a40x_request *req; | 1163 | struct lh7a40x_request *req; |
1164 | struct lh7a40x_ep *ep; | 1164 | struct lh7a40x_ep *ep; |
@@ -2140,6 +2140,7 @@ static int lh7a40x_udc_remove(struct device *_dev) | |||
2140 | 2140 | ||
2141 | static struct device_driver udc_driver = { | 2141 | static struct device_driver udc_driver = { |
2142 | .name = (char *)driver_name, | 2142 | .name = (char *)driver_name, |
2143 | .owner = THIS_MODULE, | ||
2143 | .bus = &platform_bus_type, | 2144 | .bus = &platform_bus_type, |
2144 | .probe = lh7a40x_udc_probe, | 2145 | .probe = lh7a40x_udc_probe, |
2145 | .remove = lh7a40x_udc_remove | 2146 | .remove = lh7a40x_udc_remove |
diff --git a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c index 477fab2e74d1..0dc6bb00bf72 100644 --- a/drivers/usb/gadget/net2280.c +++ b/drivers/usb/gadget/net2280.c | |||
@@ -376,7 +376,7 @@ static int net2280_disable (struct usb_ep *_ep) | |||
376 | /*-------------------------------------------------------------------------*/ | 376 | /*-------------------------------------------------------------------------*/ |
377 | 377 | ||
378 | static struct usb_request * | 378 | static struct usb_request * |
379 | net2280_alloc_request (struct usb_ep *_ep, unsigned gfp_flags) | 379 | net2280_alloc_request (struct usb_ep *_ep, gfp_t gfp_flags) |
380 | { | 380 | { |
381 | struct net2280_ep *ep; | 381 | struct net2280_ep *ep; |
382 | struct net2280_request *req; | 382 | struct net2280_request *req; |
@@ -463,7 +463,7 @@ net2280_alloc_buffer ( | |||
463 | struct usb_ep *_ep, | 463 | struct usb_ep *_ep, |
464 | unsigned bytes, | 464 | unsigned bytes, |
465 | dma_addr_t *dma, | 465 | dma_addr_t *dma, |
466 | unsigned gfp_flags | 466 | gfp_t gfp_flags |
467 | ) | 467 | ) |
468 | { | 468 | { |
469 | void *retval; | 469 | void *retval; |
@@ -897,7 +897,7 @@ done (struct net2280_ep *ep, struct net2280_request *req, int status) | |||
897 | /*-------------------------------------------------------------------------*/ | 897 | /*-------------------------------------------------------------------------*/ |
898 | 898 | ||
899 | static int | 899 | static int |
900 | net2280_queue (struct usb_ep *_ep, struct usb_request *_req, unsigned gfp_flags) | 900 | net2280_queue (struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags) |
901 | { | 901 | { |
902 | struct net2280_request *req; | 902 | struct net2280_request *req; |
903 | struct net2280_ep *ep; | 903 | struct net2280_ep *ep; |
@@ -2948,6 +2948,7 @@ MODULE_DEVICE_TABLE (pci, pci_ids); | |||
2948 | static struct pci_driver net2280_pci_driver = { | 2948 | static struct pci_driver net2280_pci_driver = { |
2949 | .name = (char *) driver_name, | 2949 | .name = (char *) driver_name, |
2950 | .id_table = pci_ids, | 2950 | .id_table = pci_ids, |
2951 | .owner = THIS_MODULE, | ||
2951 | 2952 | ||
2952 | .probe = net2280_probe, | 2953 | .probe = net2280_probe, |
2953 | .remove = net2280_remove, | 2954 | .remove = net2280_remove, |
diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c index ff5533e69560..41c96b0afbb3 100644 --- a/drivers/usb/gadget/omap_udc.c +++ b/drivers/usb/gadget/omap_udc.c | |||
@@ -269,7 +269,7 @@ static int omap_ep_disable(struct usb_ep *_ep) | |||
269 | /*-------------------------------------------------------------------------*/ | 269 | /*-------------------------------------------------------------------------*/ |
270 | 270 | ||
271 | static struct usb_request * | 271 | static struct usb_request * |
272 | omap_alloc_request(struct usb_ep *ep, unsigned gfp_flags) | 272 | omap_alloc_request(struct usb_ep *ep, gfp_t gfp_flags) |
273 | { | 273 | { |
274 | struct omap_req *req; | 274 | struct omap_req *req; |
275 | 275 | ||
@@ -298,7 +298,7 @@ omap_alloc_buffer( | |||
298 | struct usb_ep *_ep, | 298 | struct usb_ep *_ep, |
299 | unsigned bytes, | 299 | unsigned bytes, |
300 | dma_addr_t *dma, | 300 | dma_addr_t *dma, |
301 | unsigned gfp_flags | 301 | gfp_t gfp_flags |
302 | ) | 302 | ) |
303 | { | 303 | { |
304 | void *retval; | 304 | void *retval; |
@@ -691,7 +691,7 @@ static void next_out_dma(struct omap_ep *ep, struct omap_req *req) | |||
691 | } | 691 | } |
692 | 692 | ||
693 | static void | 693 | static void |
694 | finish_out_dma(struct omap_ep *ep, struct omap_req *req, int status) | 694 | finish_out_dma(struct omap_ep *ep, struct omap_req *req, int status, int one) |
695 | { | 695 | { |
696 | u16 count; | 696 | u16 count; |
697 | 697 | ||
@@ -699,6 +699,8 @@ finish_out_dma(struct omap_ep *ep, struct omap_req *req, int status) | |||
699 | ep->dma_counter = (u16) (req->req.dma + req->req.actual); | 699 | ep->dma_counter = (u16) (req->req.dma + req->req.actual); |
700 | count = dma_dest_len(ep, req->req.dma + req->req.actual); | 700 | count = dma_dest_len(ep, req->req.dma + req->req.actual); |
701 | count += req->req.actual; | 701 | count += req->req.actual; |
702 | if (one) | ||
703 | count--; | ||
702 | if (count <= req->req.length) | 704 | if (count <= req->req.length) |
703 | req->req.actual = count; | 705 | req->req.actual = count; |
704 | 706 | ||
@@ -747,7 +749,7 @@ static void dma_irq(struct omap_udc *udc, u16 irq_src) | |||
747 | if (!list_empty(&ep->queue)) { | 749 | if (!list_empty(&ep->queue)) { |
748 | req = container_of(ep->queue.next, | 750 | req = container_of(ep->queue.next, |
749 | struct omap_req, queue); | 751 | struct omap_req, queue); |
750 | finish_out_dma(ep, req, 0); | 752 | finish_out_dma(ep, req, 0, dman_stat & UDC_DMA_RX_SB); |
751 | } | 753 | } |
752 | UDC_IRQ_SRC_REG = UDC_RXN_EOT; | 754 | UDC_IRQ_SRC_REG = UDC_RXN_EOT; |
753 | 755 | ||
@@ -925,7 +927,7 @@ static void dma_channel_release(struct omap_ep *ep) | |||
925 | while (UDC_RXDMA_CFG_REG & mask) | 927 | while (UDC_RXDMA_CFG_REG & mask) |
926 | udelay(10); | 928 | udelay(10); |
927 | if (req) | 929 | if (req) |
928 | finish_out_dma(ep, req, -ECONNRESET); | 930 | finish_out_dma(ep, req, -ECONNRESET, 0); |
929 | } | 931 | } |
930 | omap_free_dma(ep->lch); | 932 | omap_free_dma(ep->lch); |
931 | ep->dma_channel = 0; | 933 | ep->dma_channel = 0; |
@@ -937,7 +939,7 @@ static void dma_channel_release(struct omap_ep *ep) | |||
937 | /*-------------------------------------------------------------------------*/ | 939 | /*-------------------------------------------------------------------------*/ |
938 | 940 | ||
939 | static int | 941 | static int |
940 | omap_ep_queue(struct usb_ep *_ep, struct usb_request *_req, unsigned gfp_flags) | 942 | omap_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags) |
941 | { | 943 | { |
942 | struct omap_ep *ep = container_of(_ep, struct omap_ep, ep); | 944 | struct omap_ep *ep = container_of(_ep, struct omap_ep, ep); |
943 | struct omap_req *req = container_of(_req, struct omap_req, req); | 945 | struct omap_req *req = container_of(_req, struct omap_req, req); |
@@ -1786,8 +1788,12 @@ static void devstate_irq(struct omap_udc *udc, u16 irq_src) | |||
1786 | udc->driver->suspend(&udc->gadget); | 1788 | udc->driver->suspend(&udc->gadget); |
1787 | spin_lock(&udc->lock); | 1789 | spin_lock(&udc->lock); |
1788 | } | 1790 | } |
1791 | if (udc->transceiver) | ||
1792 | otg_set_suspend(udc->transceiver, 1); | ||
1789 | } else { | 1793 | } else { |
1790 | VDBG("resume\n"); | 1794 | VDBG("resume\n"); |
1795 | if (udc->transceiver) | ||
1796 | otg_set_suspend(udc->transceiver, 0); | ||
1791 | if (udc->gadget.speed == USB_SPEED_FULL | 1797 | if (udc->gadget.speed == USB_SPEED_FULL |
1792 | && udc->driver->resume) { | 1798 | && udc->driver->resume) { |
1793 | spin_unlock(&udc->lock); | 1799 | spin_unlock(&udc->lock); |
@@ -2909,12 +2915,10 @@ static int __exit omap_udc_remove(struct device *dev) | |||
2909 | * may involve talking to an external transceiver (e.g. isp1301). | 2915 | * may involve talking to an external transceiver (e.g. isp1301). |
2910 | */ | 2916 | */ |
2911 | 2917 | ||
2912 | static int omap_udc_suspend(struct device *dev, pm_message_t message, u32 level) | 2918 | static int omap_udc_suspend(struct device *dev, pm_message_t message) |
2913 | { | 2919 | { |
2914 | u32 devstat; | 2920 | u32 devstat; |
2915 | 2921 | ||
2916 | if (level != SUSPEND_POWER_DOWN) | ||
2917 | return 0; | ||
2918 | devstat = UDC_DEVSTAT_REG; | 2922 | devstat = UDC_DEVSTAT_REG; |
2919 | 2923 | ||
2920 | /* we're requesting 48 MHz clock if the pullup is enabled | 2924 | /* we're requesting 48 MHz clock if the pullup is enabled |
@@ -2931,11 +2935,8 @@ static int omap_udc_suspend(struct device *dev, pm_message_t message, u32 level) | |||
2931 | return 0; | 2935 | return 0; |
2932 | } | 2936 | } |
2933 | 2937 | ||
2934 | static int omap_udc_resume(struct device *dev, u32 level) | 2938 | static int omap_udc_resume(struct device *dev) |
2935 | { | 2939 | { |
2936 | if (level != RESUME_POWER_ON) | ||
2937 | return 0; | ||
2938 | |||
2939 | DBG("resume + wakeup/SRP\n"); | 2940 | DBG("resume + wakeup/SRP\n"); |
2940 | omap_pullup(&udc->gadget, 1); | 2941 | omap_pullup(&udc->gadget, 1); |
2941 | 2942 | ||
@@ -2948,6 +2949,7 @@ static int omap_udc_resume(struct device *dev, u32 level) | |||
2948 | 2949 | ||
2949 | static struct device_driver udc_driver = { | 2950 | static struct device_driver udc_driver = { |
2950 | .name = (char *) driver_name, | 2951 | .name = (char *) driver_name, |
2952 | .owner = THIS_MODULE, | ||
2951 | .bus = &platform_bus_type, | 2953 | .bus = &platform_bus_type, |
2952 | .probe = omap_udc_probe, | 2954 | .probe = omap_udc_probe, |
2953 | .remove = __exit_p(omap_udc_remove), | 2955 | .remove = __exit_p(omap_udc_remove), |
diff --git a/drivers/usb/gadget/pxa2xx_udc.c b/drivers/usb/gadget/pxa2xx_udc.c index 73f8c9404156..f83a9262f953 100644 --- a/drivers/usb/gadget/pxa2xx_udc.c +++ b/drivers/usb/gadget/pxa2xx_udc.c | |||
@@ -332,7 +332,7 @@ static int pxa2xx_ep_disable (struct usb_ep *_ep) | |||
332 | * pxa2xx_ep_alloc_request - allocate a request data structure | 332 | * pxa2xx_ep_alloc_request - allocate a request data structure |
333 | */ | 333 | */ |
334 | static struct usb_request * | 334 | static struct usb_request * |
335 | pxa2xx_ep_alloc_request (struct usb_ep *_ep, unsigned gfp_flags) | 335 | pxa2xx_ep_alloc_request (struct usb_ep *_ep, gfp_t gfp_flags) |
336 | { | 336 | { |
337 | struct pxa2xx_request *req; | 337 | struct pxa2xx_request *req; |
338 | 338 | ||
@@ -367,7 +367,7 @@ pxa2xx_ep_free_request (struct usb_ep *_ep, struct usb_request *_req) | |||
367 | */ | 367 | */ |
368 | static void * | 368 | static void * |
369 | pxa2xx_ep_alloc_buffer(struct usb_ep *_ep, unsigned bytes, | 369 | pxa2xx_ep_alloc_buffer(struct usb_ep *_ep, unsigned bytes, |
370 | dma_addr_t *dma, unsigned gfp_flags) | 370 | dma_addr_t *dma, gfp_t gfp_flags) |
371 | { | 371 | { |
372 | char *retval; | 372 | char *retval; |
373 | 373 | ||
@@ -422,7 +422,7 @@ static inline void ep0_idle (struct pxa2xx_udc *dev) | |||
422 | } | 422 | } |
423 | 423 | ||
424 | static int | 424 | static int |
425 | write_packet(volatile unsigned long *uddr, struct pxa2xx_request *req, unsigned max) | 425 | write_packet(volatile u32 *uddr, struct pxa2xx_request *req, unsigned max) |
426 | { | 426 | { |
427 | u8 *buf; | 427 | u8 *buf; |
428 | unsigned length, count; | 428 | unsigned length, count; |
@@ -874,7 +874,7 @@ done: | |||
874 | /*-------------------------------------------------------------------------*/ | 874 | /*-------------------------------------------------------------------------*/ |
875 | 875 | ||
876 | static int | 876 | static int |
877 | pxa2xx_ep_queue(struct usb_ep *_ep, struct usb_request *_req, unsigned gfp_flags) | 877 | pxa2xx_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags) |
878 | { | 878 | { |
879 | struct pxa2xx_request *req; | 879 | struct pxa2xx_request *req; |
880 | struct pxa2xx_ep *ep; | 880 | struct pxa2xx_ep *ep; |
@@ -2602,24 +2602,23 @@ static int __exit pxa2xx_udc_remove(struct device *_dev) | |||
2602 | * VBUS IRQs should probably be ignored so that the PXA device just acts | 2602 | * VBUS IRQs should probably be ignored so that the PXA device just acts |
2603 | * "dead" to USB hosts until system resume. | 2603 | * "dead" to USB hosts until system resume. |
2604 | */ | 2604 | */ |
2605 | static int pxa2xx_udc_suspend(struct device *dev, pm_message_t state, u32 level) | 2605 | static int pxa2xx_udc_suspend(struct device *dev, pm_message_t state) |
2606 | { | 2606 | { |
2607 | struct pxa2xx_udc *udc = dev_get_drvdata(dev); | 2607 | struct pxa2xx_udc *udc = dev_get_drvdata(dev); |
2608 | 2608 | ||
2609 | if (level == SUSPEND_POWER_DOWN) { | 2609 | if (!udc->mach->udc_command) |
2610 | if (!udc->mach->udc_command) | 2610 | WARN("USB host won't detect disconnect!\n"); |
2611 | WARN("USB host won't detect disconnect!\n"); | 2611 | pullup(udc, 0); |
2612 | pullup(udc, 0); | 2612 | |
2613 | } | ||
2614 | return 0; | 2613 | return 0; |
2615 | } | 2614 | } |
2616 | 2615 | ||
2617 | static int pxa2xx_udc_resume(struct device *dev, u32 level) | 2616 | static int pxa2xx_udc_resume(struct device *dev) |
2618 | { | 2617 | { |
2619 | struct pxa2xx_udc *udc = dev_get_drvdata(dev); | 2618 | struct pxa2xx_udc *udc = dev_get_drvdata(dev); |
2620 | 2619 | ||
2621 | if (level == RESUME_POWER_ON) | 2620 | pullup(udc, 1); |
2622 | pullup(udc, 1); | 2621 | |
2623 | return 0; | 2622 | return 0; |
2624 | } | 2623 | } |
2625 | 2624 | ||
@@ -2632,6 +2631,7 @@ static int pxa2xx_udc_resume(struct device *dev, u32 level) | |||
2632 | 2631 | ||
2633 | static struct device_driver udc_driver = { | 2632 | static struct device_driver udc_driver = { |
2634 | .name = "pxa2xx-udc", | 2633 | .name = "pxa2xx-udc", |
2634 | .owner = THIS_MODULE, | ||
2635 | .bus = &platform_bus_type, | 2635 | .bus = &platform_bus_type, |
2636 | .probe = pxa2xx_udc_probe, | 2636 | .probe = pxa2xx_udc_probe, |
2637 | .shutdown = pxa2xx_udc_shutdown, | 2637 | .shutdown = pxa2xx_udc_shutdown, |
diff --git a/drivers/usb/gadget/pxa2xx_udc.h b/drivers/usb/gadget/pxa2xx_udc.h index a58f3e6e71f1..19a883f7d1b8 100644 --- a/drivers/usb/gadget/pxa2xx_udc.h +++ b/drivers/usb/gadget/pxa2xx_udc.h | |||
@@ -69,11 +69,11 @@ struct pxa2xx_ep { | |||
69 | * UDDR = UDC Endpoint Data Register (the fifo) | 69 | * UDDR = UDC Endpoint Data Register (the fifo) |
70 | * DRCM = DMA Request Channel Map | 70 | * DRCM = DMA Request Channel Map |
71 | */ | 71 | */ |
72 | volatile unsigned long *reg_udccs; | 72 | volatile u32 *reg_udccs; |
73 | volatile unsigned long *reg_ubcr; | 73 | volatile u32 *reg_ubcr; |
74 | volatile unsigned long *reg_uddr; | 74 | volatile u32 *reg_uddr; |
75 | #ifdef USE_DMA | 75 | #ifdef USE_DMA |
76 | volatile unsigned long *reg_drcmr; | 76 | volatile u32 *reg_drcmr; |
77 | #define drcmr(n) .reg_drcmr = & DRCMR ## n , | 77 | #define drcmr(n) .reg_drcmr = & DRCMR ## n , |
78 | #else | 78 | #else |
79 | #define drcmr(n) | 79 | #define drcmr(n) |
diff --git a/drivers/usb/gadget/serial.c b/drivers/usb/gadget/serial.c index c925d9222f53..b35ac6d334f8 100644 --- a/drivers/usb/gadget/serial.c +++ b/drivers/usb/gadget/serial.c | |||
@@ -300,18 +300,18 @@ static int gs_build_config_buf(u8 *buf, enum usb_device_speed speed, | |||
300 | u8 type, unsigned int index, int is_otg); | 300 | u8 type, unsigned int index, int is_otg); |
301 | 301 | ||
302 | static struct usb_request *gs_alloc_req(struct usb_ep *ep, unsigned int len, | 302 | static struct usb_request *gs_alloc_req(struct usb_ep *ep, unsigned int len, |
303 | unsigned kmalloc_flags); | 303 | gfp_t kmalloc_flags); |
304 | static void gs_free_req(struct usb_ep *ep, struct usb_request *req); | 304 | static void gs_free_req(struct usb_ep *ep, struct usb_request *req); |
305 | 305 | ||
306 | static struct gs_req_entry *gs_alloc_req_entry(struct usb_ep *ep, unsigned len, | 306 | static struct gs_req_entry *gs_alloc_req_entry(struct usb_ep *ep, unsigned len, |
307 | unsigned kmalloc_flags); | 307 | gfp_t kmalloc_flags); |
308 | static void gs_free_req_entry(struct usb_ep *ep, struct gs_req_entry *req); | 308 | static void gs_free_req_entry(struct usb_ep *ep, struct gs_req_entry *req); |
309 | 309 | ||
310 | static int gs_alloc_ports(struct gs_dev *dev, unsigned kmalloc_flags); | 310 | static int gs_alloc_ports(struct gs_dev *dev, gfp_t kmalloc_flags); |
311 | static void gs_free_ports(struct gs_dev *dev); | 311 | static void gs_free_ports(struct gs_dev *dev); |
312 | 312 | ||
313 | /* circular buffer */ | 313 | /* circular buffer */ |
314 | static struct gs_buf *gs_buf_alloc(unsigned int size, unsigned kmalloc_flags); | 314 | static struct gs_buf *gs_buf_alloc(unsigned int size, gfp_t kmalloc_flags); |
315 | static void gs_buf_free(struct gs_buf *gb); | 315 | static void gs_buf_free(struct gs_buf *gb); |
316 | static void gs_buf_clear(struct gs_buf *gb); | 316 | static void gs_buf_clear(struct gs_buf *gb); |
317 | static unsigned int gs_buf_data_avail(struct gs_buf *gb); | 317 | static unsigned int gs_buf_data_avail(struct gs_buf *gb); |
@@ -2091,7 +2091,7 @@ static int gs_build_config_buf(u8 *buf, enum usb_device_speed speed, | |||
2091 | * usb_request or NULL if there is an error. | 2091 | * usb_request or NULL if there is an error. |
2092 | */ | 2092 | */ |
2093 | static struct usb_request * | 2093 | static struct usb_request * |
2094 | gs_alloc_req(struct usb_ep *ep, unsigned int len, unsigned kmalloc_flags) | 2094 | gs_alloc_req(struct usb_ep *ep, unsigned int len, gfp_t kmalloc_flags) |
2095 | { | 2095 | { |
2096 | struct usb_request *req; | 2096 | struct usb_request *req; |
2097 | 2097 | ||
@@ -2132,7 +2132,7 @@ static void gs_free_req(struct usb_ep *ep, struct usb_request *req) | |||
2132 | * endpoint, buffer len, and kmalloc flags. | 2132 | * endpoint, buffer len, and kmalloc flags. |
2133 | */ | 2133 | */ |
2134 | static struct gs_req_entry * | 2134 | static struct gs_req_entry * |
2135 | gs_alloc_req_entry(struct usb_ep *ep, unsigned len, unsigned kmalloc_flags) | 2135 | gs_alloc_req_entry(struct usb_ep *ep, unsigned len, gfp_t kmalloc_flags) |
2136 | { | 2136 | { |
2137 | struct gs_req_entry *req; | 2137 | struct gs_req_entry *req; |
2138 | 2138 | ||
@@ -2173,7 +2173,7 @@ static void gs_free_req_entry(struct usb_ep *ep, struct gs_req_entry *req) | |||
2173 | * | 2173 | * |
2174 | * The device lock is normally held when calling this function. | 2174 | * The device lock is normally held when calling this function. |
2175 | */ | 2175 | */ |
2176 | static int gs_alloc_ports(struct gs_dev *dev, unsigned kmalloc_flags) | 2176 | static int gs_alloc_ports(struct gs_dev *dev, gfp_t kmalloc_flags) |
2177 | { | 2177 | { |
2178 | int i; | 2178 | int i; |
2179 | struct gs_port *port; | 2179 | struct gs_port *port; |
@@ -2255,7 +2255,7 @@ static void gs_free_ports(struct gs_dev *dev) | |||
2255 | * | 2255 | * |
2256 | * Allocate a circular buffer and all associated memory. | 2256 | * Allocate a circular buffer and all associated memory. |
2257 | */ | 2257 | */ |
2258 | static struct gs_buf *gs_buf_alloc(unsigned int size, unsigned kmalloc_flags) | 2258 | static struct gs_buf *gs_buf_alloc(unsigned int size, gfp_t kmalloc_flags) |
2259 | { | 2259 | { |
2260 | struct gs_buf *gb; | 2260 | struct gs_buf *gb; |
2261 | 2261 | ||
diff --git a/drivers/usb/gadget/zero.c b/drivers/usb/gadget/zero.c index 6890e773b2a2..6c58636e914b 100644 --- a/drivers/usb/gadget/zero.c +++ b/drivers/usb/gadget/zero.c | |||
@@ -612,7 +612,7 @@ static void source_sink_complete (struct usb_ep *ep, struct usb_request *req) | |||
612 | } | 612 | } |
613 | 613 | ||
614 | static struct usb_request * | 614 | static struct usb_request * |
615 | source_sink_start_ep (struct usb_ep *ep, unsigned gfp_flags) | 615 | source_sink_start_ep (struct usb_ep *ep, gfp_t gfp_flags) |
616 | { | 616 | { |
617 | struct usb_request *req; | 617 | struct usb_request *req; |
618 | int status; | 618 | int status; |
@@ -640,7 +640,7 @@ source_sink_start_ep (struct usb_ep *ep, unsigned gfp_flags) | |||
640 | } | 640 | } |
641 | 641 | ||
642 | static int | 642 | static int |
643 | set_source_sink_config (struct zero_dev *dev, unsigned gfp_flags) | 643 | set_source_sink_config (struct zero_dev *dev, gfp_t gfp_flags) |
644 | { | 644 | { |
645 | int result = 0; | 645 | int result = 0; |
646 | struct usb_ep *ep; | 646 | struct usb_ep *ep; |
@@ -744,7 +744,7 @@ static void loopback_complete (struct usb_ep *ep, struct usb_request *req) | |||
744 | } | 744 | } |
745 | 745 | ||
746 | static int | 746 | static int |
747 | set_loopback_config (struct zero_dev *dev, unsigned gfp_flags) | 747 | set_loopback_config (struct zero_dev *dev, gfp_t gfp_flags) |
748 | { | 748 | { |
749 | int result = 0; | 749 | int result = 0; |
750 | struct usb_ep *ep; | 750 | struct usb_ep *ep; |
@@ -845,7 +845,7 @@ static void zero_reset_config (struct zero_dev *dev) | |||
845 | * by limiting configuration choices (like the pxa2xx). | 845 | * by limiting configuration choices (like the pxa2xx). |
846 | */ | 846 | */ |
847 | static int | 847 | static int |
848 | zero_set_config (struct zero_dev *dev, unsigned number, unsigned gfp_flags) | 848 | zero_set_config (struct zero_dev *dev, unsigned number, gfp_t gfp_flags) |
849 | { | 849 | { |
850 | int result = 0; | 850 | int result = 0; |
851 | struct usb_gadget *gadget = dev->gadget; | 851 | struct usb_gadget *gadget = dev->gadget; |
@@ -1302,6 +1302,7 @@ static struct usb_gadget_driver zero_driver = { | |||
1302 | 1302 | ||
1303 | .driver = { | 1303 | .driver = { |
1304 | .name = (char *) shortname, | 1304 | .name = (char *) shortname, |
1305 | .owner = THIS_MODULE, | ||
1305 | // .shutdown = ... | 1306 | // .shutdown = ... |
1306 | // .suspend = ... | 1307 | // .suspend = ... |
1307 | // .resume = ... | 1308 | // .resume = ... |