diff options
-rw-r--r-- | drivers/usb/misc/sisusbvga/sisusb.c | 53 | ||||
-rw-r--r-- | drivers/usb/misc/sisusbvga/sisusb.h | 2 |
2 files changed, 13 insertions, 42 deletions
diff --git a/drivers/usb/misc/sisusbvga/sisusb.c b/drivers/usb/misc/sisusbvga/sisusb.c index b4ec716de7da..0025847743f3 100644 --- a/drivers/usb/misc/sisusbvga/sisusb.c +++ b/drivers/usb/misc/sisusbvga/sisusb.c | |||
@@ -79,14 +79,12 @@ sisusb_free_buffers(struct sisusb_usb_data *sisusb) | |||
79 | 79 | ||
80 | for (i = 0; i < NUMOBUFS; i++) { | 80 | for (i = 0; i < NUMOBUFS; i++) { |
81 | if (sisusb->obuf[i]) { | 81 | if (sisusb->obuf[i]) { |
82 | usb_buffer_free(sisusb->sisusb_dev, sisusb->obufsize, | 82 | kfree(sisusb->obuf[i]); |
83 | sisusb->obuf[i], sisusb->transfer_dma_out[i]); | ||
84 | sisusb->obuf[i] = NULL; | 83 | sisusb->obuf[i] = NULL; |
85 | } | 84 | } |
86 | } | 85 | } |
87 | if (sisusb->ibuf) { | 86 | if (sisusb->ibuf) { |
88 | usb_buffer_free(sisusb->sisusb_dev, sisusb->ibufsize, | 87 | kfree(sisusb->ibuf); |
89 | sisusb->ibuf, sisusb->transfer_dma_in); | ||
90 | sisusb->ibuf = NULL; | 88 | sisusb->ibuf = NULL; |
91 | } | 89 | } |
92 | } | 90 | } |
@@ -230,8 +228,7 @@ sisusb_bulk_completeout(struct urb *urb) | |||
230 | 228 | ||
231 | static int | 229 | static int |
232 | sisusb_bulkout_msg(struct sisusb_usb_data *sisusb, int index, unsigned int pipe, void *data, | 230 | sisusb_bulkout_msg(struct sisusb_usb_data *sisusb, int index, unsigned int pipe, void *data, |
233 | int len, int *actual_length, int timeout, unsigned int tflags, | 231 | int len, int *actual_length, int timeout, unsigned int tflags) |
234 | dma_addr_t transfer_dma) | ||
235 | { | 232 | { |
236 | struct urb *urb = sisusb->sisurbout[index]; | 233 | struct urb *urb = sisusb->sisurbout[index]; |
237 | int retval, byteswritten = 0; | 234 | int retval, byteswritten = 0; |
@@ -245,9 +242,6 @@ sisusb_bulkout_msg(struct sisusb_usb_data *sisusb, int index, unsigned int pipe, | |||
245 | urb->transfer_flags |= tflags; | 242 | urb->transfer_flags |= tflags; |
246 | urb->actual_length = 0; | 243 | urb->actual_length = 0; |
247 | 244 | ||
248 | if ((urb->transfer_dma = transfer_dma)) | ||
249 | urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; | ||
250 | |||
251 | /* Set up context */ | 245 | /* Set up context */ |
252 | sisusb->urbout_context[index].actual_length = (timeout) ? | 246 | sisusb->urbout_context[index].actual_length = (timeout) ? |
253 | NULL : actual_length; | 247 | NULL : actual_length; |
@@ -297,8 +291,8 @@ sisusb_bulk_completein(struct urb *urb) | |||
297 | } | 291 | } |
298 | 292 | ||
299 | static int | 293 | static int |
300 | sisusb_bulkin_msg(struct sisusb_usb_data *sisusb, unsigned int pipe, void *data, int len, | 294 | sisusb_bulkin_msg(struct sisusb_usb_data *sisusb, unsigned int pipe, void *data, |
301 | int *actual_length, int timeout, unsigned int tflags, dma_addr_t transfer_dma) | 295 | int len, int *actual_length, int timeout, unsigned int tflags) |
302 | { | 296 | { |
303 | struct urb *urb = sisusb->sisurbin; | 297 | struct urb *urb = sisusb->sisurbin; |
304 | int retval, readbytes = 0; | 298 | int retval, readbytes = 0; |
@@ -311,9 +305,6 @@ sisusb_bulkin_msg(struct sisusb_usb_data *sisusb, unsigned int pipe, void *data, | |||
311 | urb->transfer_flags |= tflags; | 305 | urb->transfer_flags |= tflags; |
312 | urb->actual_length = 0; | 306 | urb->actual_length = 0; |
313 | 307 | ||
314 | if ((urb->transfer_dma = transfer_dma)) | ||
315 | urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; | ||
316 | |||
317 | sisusb->completein = 0; | 308 | sisusb->completein = 0; |
318 | retval = usb_submit_urb(urb, GFP_ATOMIC); | 309 | retval = usb_submit_urb(urb, GFP_ATOMIC); |
319 | if (retval == 0) { | 310 | if (retval == 0) { |
@@ -422,8 +413,7 @@ static int sisusb_send_bulk_msg(struct sisusb_usb_data *sisusb, int ep, int len, | |||
422 | thispass, | 413 | thispass, |
423 | &transferred_len, | 414 | &transferred_len, |
424 | async ? 0 : 5 * HZ, | 415 | async ? 0 : 5 * HZ, |
425 | tflags, | 416 | tflags); |
426 | sisusb->transfer_dma_out[index]); | ||
427 | 417 | ||
428 | if (result == -ETIMEDOUT) { | 418 | if (result == -ETIMEDOUT) { |
429 | 419 | ||
@@ -432,29 +422,16 @@ static int sisusb_send_bulk_msg(struct sisusb_usb_data *sisusb, int ep, int len, | |||
432 | return -ETIME; | 422 | return -ETIME; |
433 | 423 | ||
434 | continue; | 424 | continue; |
425 | } | ||
435 | 426 | ||
436 | } else if ((result == 0) && !async && transferred_len) { | 427 | if ((result == 0) && !async && transferred_len) { |
437 | 428 | ||
438 | thispass -= transferred_len; | 429 | thispass -= transferred_len; |
439 | if (thispass) { | 430 | buffer += transferred_len; |
440 | if (sisusb->transfer_dma_out) { | ||
441 | /* If DMA, copy remaining | ||
442 | * to beginning of buffer | ||
443 | */ | ||
444 | memcpy(buffer, | ||
445 | buffer + transferred_len, | ||
446 | thispass); | ||
447 | } else { | ||
448 | /* If not DMA, simply increase | ||
449 | * the pointer | ||
450 | */ | ||
451 | buffer += transferred_len; | ||
452 | } | ||
453 | } | ||
454 | 431 | ||
455 | } else | 432 | } else |
456 | break; | 433 | break; |
457 | }; | 434 | } |
458 | 435 | ||
459 | if (result) | 436 | if (result) |
460 | return result; | 437 | return result; |
@@ -530,8 +507,7 @@ static int sisusb_recv_bulk_msg(struct sisusb_usb_data *sisusb, int ep, int len, | |||
530 | thispass, | 507 | thispass, |
531 | &transferred_len, | 508 | &transferred_len, |
532 | 5 * HZ, | 509 | 5 * HZ, |
533 | tflags, | 510 | tflags); |
534 | sisusb->transfer_dma_in); | ||
535 | 511 | ||
536 | if (transferred_len) | 512 | if (transferred_len) |
537 | thispass = transferred_len; | 513 | thispass = transferred_len; |
@@ -3132,8 +3108,7 @@ static int sisusb_probe(struct usb_interface *intf, | |||
3132 | 3108 | ||
3133 | /* Allocate buffers */ | 3109 | /* Allocate buffers */ |
3134 | sisusb->ibufsize = SISUSB_IBUF_SIZE; | 3110 | sisusb->ibufsize = SISUSB_IBUF_SIZE; |
3135 | if (!(sisusb->ibuf = usb_buffer_alloc(dev, SISUSB_IBUF_SIZE, | 3111 | if (!(sisusb->ibuf = kmalloc(SISUSB_IBUF_SIZE, GFP_KERNEL))) { |
3136 | GFP_KERNEL, &sisusb->transfer_dma_in))) { | ||
3137 | dev_err(&sisusb->sisusb_dev->dev, "Failed to allocate memory for input buffer"); | 3112 | dev_err(&sisusb->sisusb_dev->dev, "Failed to allocate memory for input buffer"); |
3138 | retval = -ENOMEM; | 3113 | retval = -ENOMEM; |
3139 | goto error_2; | 3114 | goto error_2; |
@@ -3142,9 +3117,7 @@ static int sisusb_probe(struct usb_interface *intf, | |||
3142 | sisusb->numobufs = 0; | 3117 | sisusb->numobufs = 0; |
3143 | sisusb->obufsize = SISUSB_OBUF_SIZE; | 3118 | sisusb->obufsize = SISUSB_OBUF_SIZE; |
3144 | for (i = 0; i < NUMOBUFS; i++) { | 3119 | for (i = 0; i < NUMOBUFS; i++) { |
3145 | if (!(sisusb->obuf[i] = usb_buffer_alloc(dev, SISUSB_OBUF_SIZE, | 3120 | if (!(sisusb->obuf[i] = kmalloc(SISUSB_OBUF_SIZE, GFP_KERNEL))) { |
3146 | GFP_KERNEL, | ||
3147 | &sisusb->transfer_dma_out[i]))) { | ||
3148 | if (i == 0) { | 3121 | if (i == 0) { |
3149 | dev_err(&sisusb->sisusb_dev->dev, "Failed to allocate memory for output buffer\n"); | 3122 | dev_err(&sisusb->sisusb_dev->dev, "Failed to allocate memory for output buffer\n"); |
3150 | retval = -ENOMEM; | 3123 | retval = -ENOMEM; |
diff --git a/drivers/usb/misc/sisusbvga/sisusb.h b/drivers/usb/misc/sisusbvga/sisusb.h index cf0b4a5883f6..55492a5930bd 100644 --- a/drivers/usb/misc/sisusbvga/sisusb.h +++ b/drivers/usb/misc/sisusbvga/sisusb.h | |||
@@ -123,8 +123,6 @@ struct sisusb_usb_data { | |||
123 | int numobufs; /* number of obufs = number of out urbs */ | 123 | int numobufs; /* number of obufs = number of out urbs */ |
124 | char *obuf[NUMOBUFS], *ibuf; /* transfer buffers */ | 124 | char *obuf[NUMOBUFS], *ibuf; /* transfer buffers */ |
125 | int obufsize, ibufsize; | 125 | int obufsize, ibufsize; |
126 | dma_addr_t transfer_dma_out[NUMOBUFS]; | ||
127 | dma_addr_t transfer_dma_in; | ||
128 | struct urb *sisurbout[NUMOBUFS]; | 126 | struct urb *sisurbout[NUMOBUFS]; |
129 | struct urb *sisurbin; | 127 | struct urb *sisurbin; |
130 | unsigned char urbstatus[NUMOBUFS]; | 128 | unsigned char urbstatus[NUMOBUFS]; |