diff options
author | David Brownell <david-b@pacbell.net> | 2007-07-01 14:04:54 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-07-12 19:34:42 -0400 |
commit | 9d8bab58b758cd5a96d368a8cc64111c9ab50407 (patch) | |
tree | 710695adf1e50f2e4680c130d548ccd3e6251630 /drivers/usb | |
parent | ad8c623f4f48085edd51c7f4cdfd10295547bf45 (diff) |
usb gadget stack: remove usb_ep_*_buffer(), part 1
Remove usb_ep_{alloc,free}_buffer() calls, for small dma-coherent buffers.
This patch just removes the interface and its users; later patches will
remove controller driver support.
- This interface is invariably not implemented correctly in the
controller drivers (e.g. using dma pools, a mechanism which
post-dates the interface by several years).
- At this point no gadget driver really *needs* to use it. In
current kernels, any driver that needs such a mechanism could
allocate a dma pool themselves.
Removing this interface is thus a simplification and improvement.
Note that the gmidi.c driver had a bug in this area; fixed.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/gadget/file_storage.c | 19 | ||||
-rw-r--r-- | drivers/usb/gadget/gmidi.c | 8 | ||||
-rw-r--r-- | drivers/usb/gadget/inode.c | 4 | ||||
-rw-r--r-- | drivers/usb/gadget/zero.c | 9 |
4 files changed, 11 insertions, 29 deletions
diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c index 7e650d015585..8712ef987179 100644 --- a/drivers/usb/gadget/file_storage.c +++ b/drivers/usb/gadget/file_storage.c | |||
@@ -3733,19 +3733,12 @@ static void /* __init_or_exit */ fsg_unbind(struct usb_gadget *gadget) | |||
3733 | } | 3733 | } |
3734 | 3734 | ||
3735 | /* Free the data buffers */ | 3735 | /* Free the data buffers */ |
3736 | for (i = 0; i < NUM_BUFFERS; ++i) { | 3736 | for (i = 0; i < NUM_BUFFERS; ++i) |
3737 | struct fsg_buffhd *bh = &fsg->buffhds[i]; | 3737 | kfree(fsg->buffhds[i].buf); |
3738 | |||
3739 | if (bh->buf) | ||
3740 | usb_ep_free_buffer(fsg->bulk_in, bh->buf, bh->dma, | ||
3741 | mod_data.buflen); | ||
3742 | } | ||
3743 | 3738 | ||
3744 | /* Free the request and buffer for endpoint 0 */ | 3739 | /* Free the request and buffer for endpoint 0 */ |
3745 | if (req) { | 3740 | if (req) { |
3746 | if (req->buf) | 3741 | kfree(req->buf); |
3747 | usb_ep_free_buffer(fsg->ep0, req->buf, | ||
3748 | req->dma, EP0_BUFSIZE); | ||
3749 | usb_ep_free_request(fsg->ep0, req); | 3742 | usb_ep_free_request(fsg->ep0, req); |
3750 | } | 3743 | } |
3751 | 3744 | ||
@@ -3972,8 +3965,7 @@ static int __init fsg_bind(struct usb_gadget *gadget) | |||
3972 | fsg->ep0req = req = usb_ep_alloc_request(fsg->ep0, GFP_KERNEL); | 3965 | fsg->ep0req = req = usb_ep_alloc_request(fsg->ep0, GFP_KERNEL); |
3973 | if (!req) | 3966 | if (!req) |
3974 | goto out; | 3967 | goto out; |
3975 | req->buf = usb_ep_alloc_buffer(fsg->ep0, EP0_BUFSIZE, | 3968 | req->buf = kmalloc(EP0_BUFSIZE, GFP_KERNEL); |
3976 | &req->dma, GFP_KERNEL); | ||
3977 | if (!req->buf) | 3969 | if (!req->buf) |
3978 | goto out; | 3970 | goto out; |
3979 | req->complete = ep0_complete; | 3971 | req->complete = ep0_complete; |
@@ -3985,8 +3977,7 @@ static int __init fsg_bind(struct usb_gadget *gadget) | |||
3985 | /* Allocate for the bulk-in endpoint. We assume that | 3977 | /* Allocate for the bulk-in endpoint. We assume that |
3986 | * the buffer will also work with the bulk-out (and | 3978 | * the buffer will also work with the bulk-out (and |
3987 | * interrupt-in) endpoint. */ | 3979 | * interrupt-in) endpoint. */ |
3988 | bh->buf = usb_ep_alloc_buffer(fsg->bulk_in, mod_data.buflen, | 3980 | bh->buf = kmalloc(mod_data.buflen, GFP_KERNEL); |
3989 | &bh->dma, GFP_KERNEL); | ||
3990 | if (!bh->buf) | 3981 | if (!bh->buf) |
3991 | goto out; | 3982 | goto out; |
3992 | bh->next = bh + 1; | 3983 | bh->next = bh + 1; |
diff --git a/drivers/usb/gadget/gmidi.c b/drivers/usb/gadget/gmidi.c index d08a8d0e6427..1c5aa49d7432 100644 --- a/drivers/usb/gadget/gmidi.c +++ b/drivers/usb/gadget/gmidi.c | |||
@@ -1248,17 +1248,11 @@ autoconf_fail: | |||
1248 | tasklet_init(&dev->tasklet, gmidi_in_tasklet, (unsigned long)dev); | 1248 | tasklet_init(&dev->tasklet, gmidi_in_tasklet, (unsigned long)dev); |
1249 | 1249 | ||
1250 | /* preallocate control response and buffer */ | 1250 | /* preallocate control response and buffer */ |
1251 | dev->req = usb_ep_alloc_request(gadget->ep0, GFP_KERNEL); | 1251 | dev->req = alloc_ep_req(gadget->ep0, USB_BUFSIZ); |
1252 | if (!dev->req) { | 1252 | if (!dev->req) { |
1253 | err = -ENOMEM; | 1253 | err = -ENOMEM; |
1254 | goto fail; | 1254 | goto fail; |
1255 | } | 1255 | } |
1256 | dev->req->buf = usb_ep_alloc_buffer(gadget->ep0, USB_BUFSIZ, | ||
1257 | &dev->req->dma, GFP_KERNEL); | ||
1258 | if (!dev->req->buf) { | ||
1259 | err = -ENOMEM; | ||
1260 | goto fail; | ||
1261 | } | ||
1262 | 1256 | ||
1263 | dev->req->complete = gmidi_setup_complete; | 1257 | dev->req->complete = gmidi_setup_complete; |
1264 | 1258 | ||
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c index f723e083c9d0..e60745ffaf8e 100644 --- a/drivers/usb/gadget/inode.c +++ b/drivers/usb/gadget/inode.c | |||
@@ -923,7 +923,7 @@ static void clean_req (struct usb_ep *ep, struct usb_request *req) | |||
923 | struct dev_data *dev = ep->driver_data; | 923 | struct dev_data *dev = ep->driver_data; |
924 | 924 | ||
925 | if (req->buf != dev->rbuf) { | 925 | if (req->buf != dev->rbuf) { |
926 | usb_ep_free_buffer (ep, req->buf, req->dma, req->length); | 926 | kfree(req->buf); |
927 | req->buf = dev->rbuf; | 927 | req->buf = dev->rbuf; |
928 | req->dma = DMA_ADDR_INVALID; | 928 | req->dma = DMA_ADDR_INVALID; |
929 | } | 929 | } |
@@ -963,7 +963,7 @@ static int setup_req (struct usb_ep *ep, struct usb_request *req, u16 len) | |||
963 | return -EBUSY; | 963 | return -EBUSY; |
964 | } | 964 | } |
965 | if (len > sizeof (dev->rbuf)) | 965 | if (len > sizeof (dev->rbuf)) |
966 | req->buf = usb_ep_alloc_buffer (ep, len, &req->dma, GFP_ATOMIC); | 966 | req->buf = kmalloc(len, GFP_ATOMIC); |
967 | if (req->buf == 0) { | 967 | if (req->buf == 0) { |
968 | req->buf = dev->rbuf; | 968 | req->buf = dev->rbuf; |
969 | return -ENOMEM; | 969 | return -ENOMEM; |
diff --git a/drivers/usb/gadget/zero.c b/drivers/usb/gadget/zero.c index 7078374d0b79..a2e6e3fc8c8d 100644 --- a/drivers/usb/gadget/zero.c +++ b/drivers/usb/gadget/zero.c | |||
@@ -481,8 +481,7 @@ alloc_ep_req (struct usb_ep *ep, unsigned length) | |||
481 | req = usb_ep_alloc_request (ep, GFP_ATOMIC); | 481 | req = usb_ep_alloc_request (ep, GFP_ATOMIC); |
482 | if (req) { | 482 | if (req) { |
483 | req->length = length; | 483 | req->length = length; |
484 | req->buf = usb_ep_alloc_buffer (ep, length, | 484 | req->buf = kmalloc(length, GFP_ATOMIC); |
485 | &req->dma, GFP_ATOMIC); | ||
486 | if (!req->buf) { | 485 | if (!req->buf) { |
487 | usb_ep_free_request (ep, req); | 486 | usb_ep_free_request (ep, req); |
488 | req = NULL; | 487 | req = NULL; |
@@ -493,8 +492,7 @@ alloc_ep_req (struct usb_ep *ep, unsigned length) | |||
493 | 492 | ||
494 | static void free_ep_req (struct usb_ep *ep, struct usb_request *req) | 493 | static void free_ep_req (struct usb_ep *ep, struct usb_request *req) |
495 | { | 494 | { |
496 | if (req->buf) | 495 | kfree(req->buf); |
497 | usb_ep_free_buffer (ep, req->buf, req->dma, req->length); | ||
498 | usb_ep_free_request (ep, req); | 496 | usb_ep_free_request (ep, req); |
499 | } | 497 | } |
500 | 498 | ||
@@ -1199,8 +1197,7 @@ autoconf_fail: | |||
1199 | dev->req = usb_ep_alloc_request (gadget->ep0, GFP_KERNEL); | 1197 | dev->req = usb_ep_alloc_request (gadget->ep0, GFP_KERNEL); |
1200 | if (!dev->req) | 1198 | if (!dev->req) |
1201 | goto enomem; | 1199 | goto enomem; |
1202 | dev->req->buf = usb_ep_alloc_buffer (gadget->ep0, USB_BUFSIZ, | 1200 | dev->req->buf = kmalloc(USB_BUFSIZ, GFP_KERNEL); |
1203 | &dev->req->dma, GFP_KERNEL); | ||
1204 | if (!dev->req->buf) | 1201 | if (!dev->req->buf) |
1205 | goto enomem; | 1202 | goto enomem; |
1206 | 1203 | ||