diff options
author | Jean-Francois Moine <moinejf@free.fr> | 2008-09-03 16:12:19 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-09-03 17:37:42 -0400 |
commit | 8295d99ee5340f1e62b53c8adc979e0789299445 (patch) | |
tree | d537fd27c8079bec09b513845dc2cf9c21234482 /drivers/media/video/gspca/sonixb.c | |
parent | 91de65ac00f976c972940bedd9dbfe38bb8bfec3 (diff) |
V4L/DVB (8829): gspca: Have a clean kmalloc-ated buffer for USB exchanges.
The USB buffer may be used for DMA and there may be a caching problem
if the buffer is part of the device structure.
Thanks to Alan Stern.
Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/gspca/sonixb.c')
-rw-r--r-- | drivers/media/video/gspca/sonixb.c | 24 |
1 files changed, 2 insertions, 22 deletions
diff --git a/drivers/media/video/gspca/sonixb.c b/drivers/media/video/gspca/sonixb.c index 044a9ec58db5..162beb3feadb 100644 --- a/drivers/media/video/gspca/sonixb.c +++ b/drivers/media/video/gspca/sonixb.c | |||
@@ -410,7 +410,7 @@ static void reg_w(struct gspca_dev *gspca_dev, | |||
410 | int len) | 410 | int len) |
411 | { | 411 | { |
412 | #ifdef GSPCA_DEBUG | 412 | #ifdef GSPCA_DEBUG |
413 | if (len > sizeof gspca_dev->usb_buf) { | 413 | if (len > USB_BUF_SZ) { |
414 | PDEBUG(D_ERR|D_PACK, "reg_w: buffer overflow"); | 414 | PDEBUG(D_ERR|D_PACK, "reg_w: buffer overflow"); |
415 | return; | 415 | return; |
416 | } | 416 | } |
@@ -426,26 +426,6 @@ static void reg_w(struct gspca_dev *gspca_dev, | |||
426 | 500); | 426 | 500); |
427 | } | 427 | } |
428 | 428 | ||
429 | static void reg_w_big(struct gspca_dev *gspca_dev, | ||
430 | __u16 value, | ||
431 | const __u8 *buffer, | ||
432 | int len) | ||
433 | { | ||
434 | __u8 *tmpbuf; | ||
435 | |||
436 | tmpbuf = kmalloc(len, GFP_KERNEL); | ||
437 | memcpy(tmpbuf, buffer, len); | ||
438 | usb_control_msg(gspca_dev->dev, | ||
439 | usb_sndctrlpipe(gspca_dev->dev, 0), | ||
440 | 0x08, /* request */ | ||
441 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, | ||
442 | value, | ||
443 | 0, /* index */ | ||
444 | tmpbuf, len, | ||
445 | 500); | ||
446 | kfree(tmpbuf); | ||
447 | } | ||
448 | |||
449 | static int i2c_w(struct gspca_dev *gspca_dev, const __u8 *buffer) | 429 | static int i2c_w(struct gspca_dev *gspca_dev, const __u8 *buffer) |
450 | { | 430 | { |
451 | int retry = 60; | 431 | int retry = 60; |
@@ -886,7 +866,7 @@ static void sd_start(struct gspca_dev *gspca_dev) | |||
886 | /* reg 0x17 SensorClk enable inv Clk 0x60 */ | 866 | /* reg 0x17 SensorClk enable inv Clk 0x60 */ |
887 | reg_w(gspca_dev, 0x17, &sn9c10x[0x17 - 1], 1); | 867 | reg_w(gspca_dev, 0x17, &sn9c10x[0x17 - 1], 1); |
888 | /* Set the registers from the template */ | 868 | /* Set the registers from the template */ |
889 | reg_w_big(gspca_dev, 0x01, sn9c10x, l); | 869 | reg_w(gspca_dev, 0x01, sn9c10x, l); |
890 | switch (sd->sensor) { | 870 | switch (sd->sensor) { |
891 | case SENSOR_HV7131R: | 871 | case SENSOR_HV7131R: |
892 | i2c_w_vector(gspca_dev, hv7131_sensor_init, | 872 | i2c_w_vector(gspca_dev, hv7131_sensor_init, |