Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 164943
b: refs/heads/master
c: d2fb1bb
h: refs/heads/master
i:
  164941: 2a53ed8
  164939: 28eb3f3
  164935: d913666
  164927: 57aef05
v: v3
  • Loading branch information
Pete Zaitcev authored and Greg Kroah-Hartman committed Sep 23, 2009
1 parent a73daa0 commit 1fce0df
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 43 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f8086a07c4740ae37e5221508b9cabc8fef4bf6e
refs/heads/master: d2fb1bb32b9b379a029aeca969b45d28bd91ae89
53 changes: 13 additions & 40 deletions trunk/drivers/usb/misc/sisusbvga/sisusb.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,12 @@ sisusb_free_buffers(struct sisusb_usb_data *sisusb)

for (i = 0; i < NUMOBUFS; i++) {
if (sisusb->obuf[i]) {
usb_buffer_free(sisusb->sisusb_dev, sisusb->obufsize,
sisusb->obuf[i], sisusb->transfer_dma_out[i]);
kfree(sisusb->obuf[i]);
sisusb->obuf[i] = NULL;
}
}
if (sisusb->ibuf) {
usb_buffer_free(sisusb->sisusb_dev, sisusb->ibufsize,
sisusb->ibuf, sisusb->transfer_dma_in);
kfree(sisusb->ibuf);
sisusb->ibuf = NULL;
}
}
Expand Down Expand Up @@ -230,8 +228,7 @@ sisusb_bulk_completeout(struct urb *urb)

static int
sisusb_bulkout_msg(struct sisusb_usb_data *sisusb, int index, unsigned int pipe, void *data,
int len, int *actual_length, int timeout, unsigned int tflags,
dma_addr_t transfer_dma)
int len, int *actual_length, int timeout, unsigned int tflags)
{
struct urb *urb = sisusb->sisurbout[index];
int retval, byteswritten = 0;
Expand All @@ -245,9 +242,6 @@ sisusb_bulkout_msg(struct sisusb_usb_data *sisusb, int index, unsigned int pipe,
urb->transfer_flags |= tflags;
urb->actual_length = 0;

if ((urb->transfer_dma = transfer_dma))
urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;

/* Set up context */
sisusb->urbout_context[index].actual_length = (timeout) ?
NULL : actual_length;
Expand Down Expand Up @@ -297,8 +291,8 @@ sisusb_bulk_completein(struct urb *urb)
}

static int
sisusb_bulkin_msg(struct sisusb_usb_data *sisusb, unsigned int pipe, void *data, int len,
int *actual_length, int timeout, unsigned int tflags, dma_addr_t transfer_dma)
sisusb_bulkin_msg(struct sisusb_usb_data *sisusb, unsigned int pipe, void *data,
int len, int *actual_length, int timeout, unsigned int tflags)
{
struct urb *urb = sisusb->sisurbin;
int retval, readbytes = 0;
Expand All @@ -311,9 +305,6 @@ sisusb_bulkin_msg(struct sisusb_usb_data *sisusb, unsigned int pipe, void *data,
urb->transfer_flags |= tflags;
urb->actual_length = 0;

if ((urb->transfer_dma = transfer_dma))
urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;

sisusb->completein = 0;
retval = usb_submit_urb(urb, GFP_ATOMIC);
if (retval == 0) {
Expand Down Expand Up @@ -422,8 +413,7 @@ static int sisusb_send_bulk_msg(struct sisusb_usb_data *sisusb, int ep, int len,
thispass,
&transferred_len,
async ? 0 : 5 * HZ,
tflags,
sisusb->transfer_dma_out[index]);
tflags);

if (result == -ETIMEDOUT) {

Expand All @@ -432,29 +422,16 @@ static int sisusb_send_bulk_msg(struct sisusb_usb_data *sisusb, int ep, int len,
return -ETIME;

continue;
}

} else if ((result == 0) && !async && transferred_len) {
if ((result == 0) && !async && transferred_len) {

thispass -= transferred_len;
if (thispass) {
if (sisusb->transfer_dma_out) {
/* If DMA, copy remaining
* to beginning of buffer
*/
memcpy(buffer,
buffer + transferred_len,
thispass);
} else {
/* If not DMA, simply increase
* the pointer
*/
buffer += transferred_len;
}
}
buffer += transferred_len;

} else
break;
};
}

if (result)
return result;
Expand Down Expand Up @@ -530,8 +507,7 @@ static int sisusb_recv_bulk_msg(struct sisusb_usb_data *sisusb, int ep, int len,
thispass,
&transferred_len,
5 * HZ,
tflags,
sisusb->transfer_dma_in);
tflags);

if (transferred_len)
thispass = transferred_len;
Expand Down Expand Up @@ -3132,8 +3108,7 @@ static int sisusb_probe(struct usb_interface *intf,

/* Allocate buffers */
sisusb->ibufsize = SISUSB_IBUF_SIZE;
if (!(sisusb->ibuf = usb_buffer_alloc(dev, SISUSB_IBUF_SIZE,
GFP_KERNEL, &sisusb->transfer_dma_in))) {
if (!(sisusb->ibuf = kmalloc(SISUSB_IBUF_SIZE, GFP_KERNEL))) {
dev_err(&sisusb->sisusb_dev->dev, "Failed to allocate memory for input buffer");
retval = -ENOMEM;
goto error_2;
Expand All @@ -3142,9 +3117,7 @@ static int sisusb_probe(struct usb_interface *intf,
sisusb->numobufs = 0;
sisusb->obufsize = SISUSB_OBUF_SIZE;
for (i = 0; i < NUMOBUFS; i++) {
if (!(sisusb->obuf[i] = usb_buffer_alloc(dev, SISUSB_OBUF_SIZE,
GFP_KERNEL,
&sisusb->transfer_dma_out[i]))) {
if (!(sisusb->obuf[i] = kmalloc(SISUSB_OBUF_SIZE, GFP_KERNEL))) {
if (i == 0) {
dev_err(&sisusb->sisusb_dev->dev, "Failed to allocate memory for output buffer\n");
retval = -ENOMEM;
Expand Down
2 changes: 0 additions & 2 deletions trunk/drivers/usb/misc/sisusbvga/sisusb.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,6 @@ struct sisusb_usb_data {
int numobufs; /* number of obufs = number of out urbs */
char *obuf[NUMOBUFS], *ibuf; /* transfer buffers */
int obufsize, ibufsize;
dma_addr_t transfer_dma_out[NUMOBUFS];
dma_addr_t transfer_dma_in;
struct urb *sisurbout[NUMOBUFS];
struct urb *sisurbin;
unsigned char urbstatus[NUMOBUFS];
Expand Down

0 comments on commit 1fce0df

Please sign in to comment.