aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/misc
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2010-03-05 15:10:17 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2010-05-20 16:21:31 -0400
commit0ede76fcec5415ef82a423a95120286895822e2d (patch)
tree61aa2a0b499a0101033c59b8884328bdb31e5956 /drivers/input/misc
parent749da5f82fe33ff68dd4aa1a5e35cd9aa6246dab (diff)
USB: remove uses of URB_NO_SETUP_DMA_MAP
This patch (as1350) removes all usages of coherent buffers for USB control-request setup-packet buffers. There's no good reason to reserve coherent memory for these things; control requests are hardly ever used in large quantity (the major exception is firmware transfers, and they aren't time-critical). Furthermore, only seven drivers used it. We might as well always use streaming DMA mappings for setup-packet buffers, and remove some extra complexity from usbcore. The DMA-mapping portion of hcd.c is currently in flux. A separate patch will be submitted to remove support for URB_NO_SETUP_DMA_MAP after everything else settles down. The removal should go smoothly, as by then nobody will be using it. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/input/misc')
-rw-r--r--drivers/input/misc/cm109.c12
-rw-r--r--drivers/input/misc/powermate.c9
-rw-r--r--drivers/input/misc/yealink.c11
3 files changed, 8 insertions, 24 deletions
diff --git a/drivers/input/misc/cm109.c b/drivers/input/misc/cm109.c
index 86457feccfc4..8d2d291ee508 100644
--- a/drivers/input/misc/cm109.c
+++ b/drivers/input/misc/cm109.c
@@ -102,7 +102,6 @@ struct cm109_dev {
102 struct cm109_ctl_packet *ctl_data; 102 struct cm109_ctl_packet *ctl_data;
103 dma_addr_t ctl_dma; 103 dma_addr_t ctl_dma;
104 struct usb_ctrlrequest *ctl_req; 104 struct usb_ctrlrequest *ctl_req;
105 dma_addr_t ctl_req_dma;
106 struct urb *urb_ctl; 105 struct urb *urb_ctl;
107 /* 106 /*
108 * The 3 bitfields below are protected by ctl_submit_lock. 107 * The 3 bitfields below are protected by ctl_submit_lock.
@@ -629,9 +628,7 @@ static const struct usb_device_id cm109_usb_table[] = {
629 628
630static void cm109_usb_cleanup(struct cm109_dev *dev) 629static void cm109_usb_cleanup(struct cm109_dev *dev)
631{ 630{
632 if (dev->ctl_req) 631 kfree(dev->ctl_req);
633 usb_buffer_free(dev->udev, sizeof(*(dev->ctl_req)),
634 dev->ctl_req, dev->ctl_req_dma);
635 if (dev->ctl_data) 632 if (dev->ctl_data)
636 usb_buffer_free(dev->udev, USB_PKT_LEN, 633 usb_buffer_free(dev->udev, USB_PKT_LEN,
637 dev->ctl_data, dev->ctl_dma); 634 dev->ctl_data, dev->ctl_dma);
@@ -696,8 +693,7 @@ static int cm109_usb_probe(struct usb_interface *intf,
696 if (!dev->ctl_data) 693 if (!dev->ctl_data)
697 goto err_out; 694 goto err_out;
698 695
699 dev->ctl_req = usb_buffer_alloc(udev, sizeof(*(dev->ctl_req)), 696 dev->ctl_req = kmalloc(sizeof(*(dev->ctl_req)), GFP_KERNEL);
700 GFP_KERNEL, &dev->ctl_req_dma);
701 if (!dev->ctl_req) 697 if (!dev->ctl_req)
702 goto err_out; 698 goto err_out;
703 699
@@ -735,10 +731,8 @@ static int cm109_usb_probe(struct usb_interface *intf,
735 usb_fill_control_urb(dev->urb_ctl, udev, usb_sndctrlpipe(udev, 0), 731 usb_fill_control_urb(dev->urb_ctl, udev, usb_sndctrlpipe(udev, 0),
736 (void *)dev->ctl_req, dev->ctl_data, USB_PKT_LEN, 732 (void *)dev->ctl_req, dev->ctl_data, USB_PKT_LEN,
737 cm109_urb_ctl_callback, dev); 733 cm109_urb_ctl_callback, dev);
738 dev->urb_ctl->setup_dma = dev->ctl_req_dma;
739 dev->urb_ctl->transfer_dma = dev->ctl_dma; 734 dev->urb_ctl->transfer_dma = dev->ctl_dma;
740 dev->urb_ctl->transfer_flags |= URB_NO_SETUP_DMA_MAP | 735 dev->urb_ctl->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
741 URB_NO_TRANSFER_DMA_MAP;
742 dev->urb_ctl->dev = udev; 736 dev->urb_ctl->dev = udev;
743 737
744 /* find out the physical bus location */ 738 /* find out the physical bus location */
diff --git a/drivers/input/misc/powermate.c b/drivers/input/misc/powermate.c
index 668913d12044..7ba4b5f53fc2 100644
--- a/drivers/input/misc/powermate.c
+++ b/drivers/input/misc/powermate.c
@@ -64,7 +64,6 @@ struct powermate_device {
64 dma_addr_t data_dma; 64 dma_addr_t data_dma;
65 struct urb *irq, *config; 65 struct urb *irq, *config;
66 struct usb_ctrlrequest *configcr; 66 struct usb_ctrlrequest *configcr;
67 dma_addr_t configcr_dma;
68 struct usb_device *udev; 67 struct usb_device *udev;
69 struct input_dev *input; 68 struct input_dev *input;
70 spinlock_t lock; 69 spinlock_t lock;
@@ -182,8 +181,6 @@ static void powermate_sync_state(struct powermate_device *pm)
182 usb_fill_control_urb(pm->config, pm->udev, usb_sndctrlpipe(pm->udev, 0), 181 usb_fill_control_urb(pm->config, pm->udev, usb_sndctrlpipe(pm->udev, 0),
183 (void *) pm->configcr, NULL, 0, 182 (void *) pm->configcr, NULL, 0,
184 powermate_config_complete, pm); 183 powermate_config_complete, pm);
185 pm->config->setup_dma = pm->configcr_dma;
186 pm->config->transfer_flags |= URB_NO_SETUP_DMA_MAP;
187 184
188 if (usb_submit_urb(pm->config, GFP_ATOMIC)) 185 if (usb_submit_urb(pm->config, GFP_ATOMIC))
189 printk(KERN_ERR "powermate: usb_submit_urb(config) failed"); 186 printk(KERN_ERR "powermate: usb_submit_urb(config) failed");
@@ -281,8 +278,7 @@ static int powermate_alloc_buffers(struct usb_device *udev, struct powermate_dev
281 if (!pm->data) 278 if (!pm->data)
282 return -1; 279 return -1;
283 280
284 pm->configcr = usb_buffer_alloc(udev, sizeof(*(pm->configcr)), 281 pm->configcr = kmalloc(sizeof(*(pm->configcr)), GFP_KERNEL);
285 GFP_ATOMIC, &pm->configcr_dma);
286 if (!pm->configcr) 282 if (!pm->configcr)
287 return -1; 283 return -1;
288 284
@@ -293,8 +289,7 @@ static void powermate_free_buffers(struct usb_device *udev, struct powermate_dev
293{ 289{
294 usb_buffer_free(udev, POWERMATE_PAYLOAD_SIZE_MAX, 290 usb_buffer_free(udev, POWERMATE_PAYLOAD_SIZE_MAX,
295 pm->data, pm->data_dma); 291 pm->data, pm->data_dma);
296 usb_buffer_free(udev, sizeof(*(pm->configcr)), 292 kfree(pm->configcr);
297 pm->configcr, pm->configcr_dma);
298} 293}
299 294
300/* Called whenever a USB device matching one in our supported devices table is connected */ 295/* Called whenever a USB device matching one in our supported devices table is connected */
diff --git a/drivers/input/misc/yealink.c b/drivers/input/misc/yealink.c
index 93a22ac0f88c..2828328e9dd0 100644
--- a/drivers/input/misc/yealink.c
+++ b/drivers/input/misc/yealink.c
@@ -111,7 +111,6 @@ struct yealink_dev {
111 struct yld_ctl_packet *ctl_data; 111 struct yld_ctl_packet *ctl_data;
112 dma_addr_t ctl_dma; 112 dma_addr_t ctl_dma;
113 struct usb_ctrlrequest *ctl_req; 113 struct usb_ctrlrequest *ctl_req;
114 dma_addr_t ctl_req_dma;
115 struct urb *urb_ctl; 114 struct urb *urb_ctl;
116 115
117 char phys[64]; /* physical device path */ 116 char phys[64]; /* physical device path */
@@ -836,8 +835,7 @@ static int usb_cleanup(struct yealink_dev *yld, int err)
836 usb_free_urb(yld->urb_irq); 835 usb_free_urb(yld->urb_irq);
837 usb_free_urb(yld->urb_ctl); 836 usb_free_urb(yld->urb_ctl);
838 837
839 usb_buffer_free(yld->udev, sizeof(*(yld->ctl_req)), 838 kfree(yld->ctl_req);
840 yld->ctl_req, yld->ctl_req_dma);
841 usb_buffer_free(yld->udev, USB_PKT_LEN, 839 usb_buffer_free(yld->udev, USB_PKT_LEN,
842 yld->ctl_data, yld->ctl_dma); 840 yld->ctl_data, yld->ctl_dma);
843 usb_buffer_free(yld->udev, USB_PKT_LEN, 841 usb_buffer_free(yld->udev, USB_PKT_LEN,
@@ -896,8 +894,7 @@ static int usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
896 if (!yld->ctl_data) 894 if (!yld->ctl_data)
897 return usb_cleanup(yld, -ENOMEM); 895 return usb_cleanup(yld, -ENOMEM);
898 896
899 yld->ctl_req = usb_buffer_alloc(udev, sizeof(*(yld->ctl_req)), 897 yld->ctl_req = kmalloc(sizeof(*(yld->ctl_req)), GFP_KERNEL);
900 GFP_ATOMIC, &yld->ctl_req_dma);
901 if (yld->ctl_req == NULL) 898 if (yld->ctl_req == NULL)
902 return usb_cleanup(yld, -ENOMEM); 899 return usb_cleanup(yld, -ENOMEM);
903 900
@@ -936,10 +933,8 @@ static int usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
936 usb_fill_control_urb(yld->urb_ctl, udev, usb_sndctrlpipe(udev, 0), 933 usb_fill_control_urb(yld->urb_ctl, udev, usb_sndctrlpipe(udev, 0),
937 (void *)yld->ctl_req, yld->ctl_data, USB_PKT_LEN, 934 (void *)yld->ctl_req, yld->ctl_data, USB_PKT_LEN,
938 urb_ctl_callback, yld); 935 urb_ctl_callback, yld);
939 yld->urb_ctl->setup_dma = yld->ctl_req_dma;
940 yld->urb_ctl->transfer_dma = yld->ctl_dma; 936 yld->urb_ctl->transfer_dma = yld->ctl_dma;
941 yld->urb_ctl->transfer_flags |= URB_NO_SETUP_DMA_MAP | 937 yld->urb_ctl->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
942 URB_NO_TRANSFER_DMA_MAP;
943 yld->urb_ctl->dev = udev; 938 yld->urb_ctl->dev = udev;
944 939
945 /* find out the physical bus location */ 940 /* find out the physical bus location */