aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb
diff options
context:
space:
mode:
authorFlorian Mickler <florian@mickler.org>2011-03-21 14:33:46 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-05-20 08:28:02 -0400
commit12fe2a6193df97b28f5ff9fd3f12d460e96c6a95 (patch)
tree72639018f821d6adebc8359fab143005c6d7ec1a /drivers/media/dvb
parent513ea35ff9cd332abe650f5da3689bdb41824b43 (diff)
[media] opera1: get rid of on-stack dma buffer
usb_control_msg initiates (and waits for completion of) a dma transfer using the supplied buffer. That buffer thus has to be seperately allocated on the heap. In lib/dma_debug.c the function check_for_stack even warns about it: WARNING: at lib/dma-debug.c:866 check_for_stack Note: This change is tested to compile only, as I don't have the hardware. Signed-off-by: Florian Mickler <florian@mickler.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb')
-rw-r--r--drivers/media/dvb/dvb-usb/opera1.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/drivers/media/dvb/dvb-usb/opera1.c b/drivers/media/dvb/dvb-usb/opera1.c
index 7e569f4dd80..4258f127ea3 100644
--- a/drivers/media/dvb/dvb-usb/opera1.c
+++ b/drivers/media/dvb/dvb-usb/opera1.c
@@ -53,27 +53,36 @@ static int opera1_xilinx_rw(struct usb_device *dev, u8 request, u16 value,
53 u8 * data, u16 len, int flags) 53 u8 * data, u16 len, int flags)
54{ 54{
55 int ret; 55 int ret;
56 u8 r; 56 u8 tmp;
57 u8 u8buf[len]; 57 u8 *buf;
58
59 unsigned int pipe = (flags == OPERA_READ_MSG) ? 58 unsigned int pipe = (flags == OPERA_READ_MSG) ?
60 usb_rcvctrlpipe(dev,0) : usb_sndctrlpipe(dev, 0); 59 usb_rcvctrlpipe(dev,0) : usb_sndctrlpipe(dev, 0);
61 u8 request_type = (flags == OPERA_READ_MSG) ? USB_DIR_IN : USB_DIR_OUT; 60 u8 request_type = (flags == OPERA_READ_MSG) ? USB_DIR_IN : USB_DIR_OUT;
62 61
62 buf = kmalloc(len, GFP_KERNEL);
63 if (!buf)
64 return -ENOMEM;
65
63 if (flags == OPERA_WRITE_MSG) 66 if (flags == OPERA_WRITE_MSG)
64 memcpy(u8buf, data, len); 67 memcpy(buf, data, len);
65 ret = 68 ret = usb_control_msg(dev, pipe, request,
66 usb_control_msg(dev, pipe, request, request_type | USB_TYPE_VENDOR, 69 request_type | USB_TYPE_VENDOR, value, 0x0,
67 value, 0x0, u8buf, len, 2000); 70 buf, len, 2000);
68 71
69 if (request == OPERA_TUNER_REQ) { 72 if (request == OPERA_TUNER_REQ) {
73 tmp = buf[0];
70 if (usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), 74 if (usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
71 OPERA_TUNER_REQ, USB_DIR_IN | USB_TYPE_VENDOR, 75 OPERA_TUNER_REQ, USB_DIR_IN | USB_TYPE_VENDOR,
72 0x01, 0x0, &r, 1, 2000)<1 || r!=0x08) 76 0x01, 0x0, buf, 1, 2000) < 1 || buf[0] != 0x08) {
73 return 0; 77 ret = 0;
78 goto out;
79 }
80 buf[0] = tmp;
74 } 81 }
75 if (flags == OPERA_READ_MSG) 82 if (flags == OPERA_READ_MSG)
76 memcpy(data, u8buf, len); 83 memcpy(data, buf, len);
84out:
85 kfree(buf);
77 return ret; 86 return ret;
78} 87}
79 88