From 9d8bab58b758cd5a96d368a8cc64111c9ab50407 Mon Sep 17 00:00:00 2001 From: David Brownell Date: Sun, 1 Jul 2007 11:04:54 -0700 Subject: 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 Signed-off-by: Greg Kroah-Hartman --- drivers/usb/gadget/file_storage.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) (limited to 'drivers/usb/gadget/file_storage.c') 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) } /* Free the data buffers */ - for (i = 0; i < NUM_BUFFERS; ++i) { - struct fsg_buffhd *bh = &fsg->buffhds[i]; - - if (bh->buf) - usb_ep_free_buffer(fsg->bulk_in, bh->buf, bh->dma, - mod_data.buflen); - } + for (i = 0; i < NUM_BUFFERS; ++i) + kfree(fsg->buffhds[i].buf); /* Free the request and buffer for endpoint 0 */ if (req) { - if (req->buf) - usb_ep_free_buffer(fsg->ep0, req->buf, - req->dma, EP0_BUFSIZE); + kfree(req->buf); usb_ep_free_request(fsg->ep0, req); } @@ -3972,8 +3965,7 @@ static int __init fsg_bind(struct usb_gadget *gadget) fsg->ep0req = req = usb_ep_alloc_request(fsg->ep0, GFP_KERNEL); if (!req) goto out; - req->buf = usb_ep_alloc_buffer(fsg->ep0, EP0_BUFSIZE, - &req->dma, GFP_KERNEL); + req->buf = kmalloc(EP0_BUFSIZE, GFP_KERNEL); if (!req->buf) goto out; req->complete = ep0_complete; @@ -3985,8 +3977,7 @@ static int __init fsg_bind(struct usb_gadget *gadget) /* Allocate for the bulk-in endpoint. We assume that * the buffer will also work with the bulk-out (and * interrupt-in) endpoint. */ - bh->buf = usb_ep_alloc_buffer(fsg->bulk_in, mod_data.buflen, - &bh->dma, GFP_KERNEL); + bh->buf = kmalloc(mod_data.buflen, GFP_KERNEL); if (!bh->buf) goto out; bh->next = bh + 1; -- cgit v1.2.2