diff options
author | Oliver Neukum <oliver@neukum.org> | 2008-03-14 03:53:24 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-03-25 01:26:15 -0400 |
commit | 4f4f9c53c241a0205434c76d05eba2c5f160e9d0 (patch) | |
tree | bdb487c15fb22e4d07101ff77c3fa9b0453a0ab6 /drivers/usb | |
parent | cc36bdd47ae51b66780b317c1fa519221f894405 (diff) |
USB: sierra: dma fixes
while I was adding autosuspend to that driver I noticed a few issues.
You were having DMAed buffers as a part of a structure.
This will fail on platforms that are not DMA-coherent (arm, sparc, ppc, ...)
Please test this patch to fix it.
Signed-off-by: Kevin Lloyd <klloyd@sierrawireless.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/serial/sierra.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index e3d44ae8d448..dda4d05fe237 100644 --- a/drivers/usb/serial/sierra.c +++ b/drivers/usb/serial/sierra.c | |||
@@ -14,7 +14,7 @@ | |||
14 | Whom based his on the Keyspan driver by Hugh Blemings <hugh@blemings.org> | 14 | Whom based his on the Keyspan driver by Hugh Blemings <hugh@blemings.org> |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #define DRIVER_VERSION "v.1.2.7" | 17 | #define DRIVER_VERSION "v.1.2.8" |
18 | #define DRIVER_AUTHOR "Kevin Lloyd <linux@sierrawireless.com>" | 18 | #define DRIVER_AUTHOR "Kevin Lloyd <linux@sierrawireless.com>" |
19 | #define DRIVER_DESC "USB Driver for Sierra Wireless USB modems" | 19 | #define DRIVER_DESC "USB Driver for Sierra Wireless USB modems" |
20 | 20 | ||
@@ -196,9 +196,9 @@ struct sierra_port_private { | |||
196 | spinlock_t lock; /* lock the structure */ | 196 | spinlock_t lock; /* lock the structure */ |
197 | int outstanding_urbs; /* number of out urbs in flight */ | 197 | int outstanding_urbs; /* number of out urbs in flight */ |
198 | 198 | ||
199 | /* Input endpoints and buffer for this port */ | 199 | /* Input endpoints and buffers for this port */ |
200 | struct urb *in_urbs[N_IN_URB]; | 200 | struct urb *in_urbs[N_IN_URB]; |
201 | char in_buffer[N_IN_URB][IN_BUFLEN]; | 201 | char *in_buffer[N_IN_URB]; |
202 | 202 | ||
203 | /* Settings for the port */ | 203 | /* Settings for the port */ |
204 | int rts_state; /* Handshaking pins (outputs) */ | 204 | int rts_state; /* Handshaking pins (outputs) */ |
@@ -638,6 +638,15 @@ static int sierra_startup(struct usb_serial *serial) | |||
638 | return -ENOMEM; | 638 | return -ENOMEM; |
639 | } | 639 | } |
640 | spin_lock_init(&portdata->lock); | 640 | spin_lock_init(&portdata->lock); |
641 | for (j = 0; j < N_IN_URB; j++) { | ||
642 | portdata->in_buffer[j] = kmalloc(IN_BUFLEN, GFP_KERNEL); | ||
643 | if (!portdata->in_buffer[j]) { | ||
644 | for (--j; j >= 0; j--) | ||
645 | kfree(portdata->in_buffer[j]); | ||
646 | kfree(portdata); | ||
647 | return -ENOMEM; | ||
648 | } | ||
649 | } | ||
641 | 650 | ||
642 | usb_set_serial_port_data(port, portdata); | 651 | usb_set_serial_port_data(port, portdata); |
643 | 652 | ||
@@ -681,7 +690,7 @@ static void sierra_shutdown(struct usb_serial *serial) | |||
681 | for (j = 0; j < N_IN_URB; j++) { | 690 | for (j = 0; j < N_IN_URB; j++) { |
682 | usb_kill_urb(portdata->in_urbs[j]); | 691 | usb_kill_urb(portdata->in_urbs[j]); |
683 | usb_free_urb(portdata->in_urbs[j]); | 692 | usb_free_urb(portdata->in_urbs[j]); |
684 | portdata->in_urbs[j] = NULL; | 693 | kfree(portdata->in_buffer[j]); |
685 | } | 694 | } |
686 | kfree(portdata); | 695 | kfree(portdata); |
687 | usb_set_serial_port_data(port, NULL); | 696 | usb_set_serial_port_data(port, NULL); |