aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial
diff options
context:
space:
mode:
authorJohan Hovold <jhovold@gmail.com>2009-12-28 17:01:54 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2010-03-02 17:53:56 -0500
commiteb771e2c6507e0a317e576a3147252ebcb64035a (patch)
tree0ac79e2e623c69e5f9143ad61e88f328efec39c3 /drivers/usb/serial
parentabf492e7b3ae74873688cf9960283853a3054471 (diff)
USB: mos7720: fix DMA buffers on stack and clean up send_mos_cmd
Change data-argument type from (void *) to (u8 *) to prevent endianess problems. Signed-off-by: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/serial')
-rw-r--r--drivers/usb/serial/mos7720.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c
index 763e32a44be..e081dc0d21d 100644
--- a/drivers/usb/serial/mos7720.c
+++ b/drivers/usb/serial/mos7720.c
@@ -275,13 +275,11 @@ static void mos7720_bulk_out_data_callback(struct urb *urb)
275 * this function will be used for sending command to device 275 * this function will be used for sending command to device
276 */ 276 */
277static int send_mos_cmd(struct usb_serial *serial, __u8 request, __u16 value, 277static int send_mos_cmd(struct usb_serial *serial, __u8 request, __u16 value,
278 __u16 index, void *data) 278 __u16 index, u8 *data)
279{ 279{
280 int status; 280 int status;
281 unsigned int pipe; 281 u8 *buf;
282 u16 product = le16_to_cpu(serial->dev->descriptor.idProduct); 282 u16 product = le16_to_cpu(serial->dev->descriptor.idProduct);
283 __u8 requesttype;
284 __u16 size = 0x0000;
285 283
286 if (value < MOS_MAX_PORT) { 284 if (value < MOS_MAX_PORT) {
287 if (product == MOSCHIP_DEVICE_ID_7715) 285 if (product == MOSCHIP_DEVICE_ID_7715)
@@ -298,21 +296,23 @@ static int send_mos_cmd(struct usb_serial *serial, __u8 request, __u16 value,
298 } 296 }
299 297
300 if (request == MOS_WRITE) { 298 if (request == MOS_WRITE) {
301 request = (__u8)MOS_WRITE; 299 value = value + *data;
302 requesttype = (__u8)0x40; 300 status = usb_control_msg(serial->dev,
303 value = value + (__u16)*((unsigned char *)data); 301 usb_sndctrlpipe(serial->dev, 0), MOS_WRITE,
304 data = NULL; 302 0x40, value, index, NULL, 0, MOS_WDR_TIMEOUT);
305 pipe = usb_sndctrlpipe(serial->dev, 0);
306 } else { 303 } else {
307 request = (__u8)MOS_READ; 304 buf = kmalloc(1, GFP_KERNEL);
308 requesttype = (__u8)0xC0; 305 if (!buf) {
309 size = 0x01; 306 status = -ENOMEM;
310 pipe = usb_rcvctrlpipe(serial->dev, 0); 307 goto out;
308 }
309 status = usb_control_msg(serial->dev,
310 usb_rcvctrlpipe(serial->dev, 0), MOS_READ,
311 0xc0, value, index, buf, 1, MOS_WDR_TIMEOUT);
312 *data = *buf;
313 kfree(buf);
311 } 314 }
312 315out:
313 status = usb_control_msg(serial->dev, pipe, request, requesttype,
314 value, index, data, size, MOS_WDR_TIMEOUT);
315
316 if (status < 0) 316 if (status < 0)
317 dbg("Command Write failed Value %x index %x\n", value, index); 317 dbg("Command Write failed Value %x index %x\n", value, index);
318 318