diff options
Diffstat (limited to 'drivers/usb/misc/rio500.c')
-rw-r--r-- | drivers/usb/misc/rio500.c | 65 |
1 files changed, 40 insertions, 25 deletions
diff --git a/drivers/usb/misc/rio500.c b/drivers/usb/misc/rio500.c index 487a8ce0775..1084124c4a4 100644 --- a/drivers/usb/misc/rio500.c +++ b/drivers/usb/misc/rio500.c | |||
@@ -153,10 +153,10 @@ static long ioctl_rio(struct file *file, unsigned int cmd, unsigned long arg) | |||
153 | 153 | ||
154 | requesttype = rio_cmd.requesttype | USB_DIR_IN | | 154 | requesttype = rio_cmd.requesttype | USB_DIR_IN | |
155 | USB_TYPE_VENDOR | USB_RECIP_DEVICE; | 155 | USB_TYPE_VENDOR | USB_RECIP_DEVICE; |
156 | dbg | 156 | dev_dbg(&rio->rio_dev->dev, |
157 | ("sending command:reqtype=%0x req=%0x value=%0x index=%0x len=%0x", | 157 | "sending command:reqtype=%0x req=%0x value=%0x index=%0x len=%0x\n", |
158 | requesttype, rio_cmd.request, rio_cmd.value, | 158 | requesttype, rio_cmd.request, rio_cmd.value, |
159 | rio_cmd.index, rio_cmd.length); | 159 | rio_cmd.index, rio_cmd.length); |
160 | /* Send rio control message */ | 160 | /* Send rio control message */ |
161 | retries = 3; | 161 | retries = 3; |
162 | while (retries) { | 162 | while (retries) { |
@@ -171,11 +171,14 @@ static long ioctl_rio(struct file *file, unsigned int cmd, unsigned long arg) | |||
171 | if (result == -ETIMEDOUT) | 171 | if (result == -ETIMEDOUT) |
172 | retries--; | 172 | retries--; |
173 | else if (result < 0) { | 173 | else if (result < 0) { |
174 | err("Error executing ioctrl. code = %d", result); | 174 | dev_err(&rio->rio_dev->dev, |
175 | "Error executing ioctrl. code = %d\n", | ||
176 | result); | ||
175 | retries = 0; | 177 | retries = 0; |
176 | } else { | 178 | } else { |
177 | dbg("Executed ioctl. Result = %d (data=%02x)", | 179 | dev_dbg(&rio->rio_dev->dev, |
178 | result, buffer[0]); | 180 | "Executed ioctl. Result = %d (data=%02x)\n", |
181 | result, buffer[0]); | ||
179 | if (copy_to_user(rio_cmd.buffer, buffer, | 182 | if (copy_to_user(rio_cmd.buffer, buffer, |
180 | rio_cmd.length)) { | 183 | rio_cmd.length)) { |
181 | free_page((unsigned long) buffer); | 184 | free_page((unsigned long) buffer); |
@@ -221,9 +224,10 @@ static long ioctl_rio(struct file *file, unsigned int cmd, unsigned long arg) | |||
221 | 224 | ||
222 | requesttype = rio_cmd.requesttype | USB_DIR_OUT | | 225 | requesttype = rio_cmd.requesttype | USB_DIR_OUT | |
223 | USB_TYPE_VENDOR | USB_RECIP_DEVICE; | 226 | USB_TYPE_VENDOR | USB_RECIP_DEVICE; |
224 | dbg("sending command: reqtype=%0x req=%0x value=%0x index=%0x len=%0x", | 227 | dev_dbg(&rio->rio_dev->dev, |
225 | requesttype, rio_cmd.request, rio_cmd.value, | 228 | "sending command: reqtype=%0x req=%0x value=%0x index=%0x len=%0x\n", |
226 | rio_cmd.index, rio_cmd.length); | 229 | requesttype, rio_cmd.request, rio_cmd.value, |
230 | rio_cmd.index, rio_cmd.length); | ||
227 | /* Send rio control message */ | 231 | /* Send rio control message */ |
228 | retries = 3; | 232 | retries = 3; |
229 | while (retries) { | 233 | while (retries) { |
@@ -238,10 +242,13 @@ static long ioctl_rio(struct file *file, unsigned int cmd, unsigned long arg) | |||
238 | if (result == -ETIMEDOUT) | 242 | if (result == -ETIMEDOUT) |
239 | retries--; | 243 | retries--; |
240 | else if (result < 0) { | 244 | else if (result < 0) { |
241 | err("Error executing ioctrl. code = %d", result); | 245 | dev_err(&rio->rio_dev->dev, |
246 | "Error executing ioctrl. code = %d\n", | ||
247 | result); | ||
242 | retries = 0; | 248 | retries = 0; |
243 | } else { | 249 | } else { |
244 | dbg("Executed ioctl. Result = %d", result); | 250 | dev_dbg(&rio->rio_dev->dev, |
251 | "Executed ioctl. Result = %d\n", result); | ||
245 | retries = 0; | 252 | retries = 0; |
246 | 253 | ||
247 | } | 254 | } |
@@ -313,8 +320,9 @@ write_rio(struct file *file, const char __user *buffer, | |||
313 | usb_sndbulkpipe(rio->rio_dev, 2), | 320 | usb_sndbulkpipe(rio->rio_dev, 2), |
314 | obuf, thistime, &partial, 5000); | 321 | obuf, thistime, &partial, 5000); |
315 | 322 | ||
316 | dbg("write stats: result:%d thistime:%lu partial:%u", | 323 | dev_dbg(&rio->rio_dev->dev, |
317 | result, thistime, partial); | 324 | "write stats: result:%d thistime:%lu partial:%u\n", |
325 | result, thistime, partial); | ||
318 | 326 | ||
319 | if (result == -ETIMEDOUT) { /* NAK - so hold for a while */ | 327 | if (result == -ETIMEDOUT) { /* NAK - so hold for a while */ |
320 | if (!maxretry--) { | 328 | if (!maxretry--) { |
@@ -332,7 +340,8 @@ write_rio(struct file *file, const char __user *buffer, | |||
332 | break; | 340 | break; |
333 | }; | 341 | }; |
334 | if (result) { | 342 | if (result) { |
335 | err("Write Whoops - %x", result); | 343 | dev_err(&rio->rio_dev->dev, "Write Whoops - %x\n", |
344 | result); | ||
336 | errn = -EIO; | 345 | errn = -EIO; |
337 | goto error; | 346 | goto error; |
338 | } | 347 | } |
@@ -393,15 +402,17 @@ read_rio(struct file *file, char __user *buffer, size_t count, loff_t * ppos) | |||
393 | ibuf, this_read, &partial, | 402 | ibuf, this_read, &partial, |
394 | 8000); | 403 | 8000); |
395 | 404 | ||
396 | dbg("read stats: result:%d this_read:%u partial:%u", | 405 | dev_dbg(&rio->rio_dev->dev, |
397 | result, this_read, partial); | 406 | "read stats: result:%d this_read:%u partial:%u\n", |
407 | result, this_read, partial); | ||
398 | 408 | ||
399 | if (partial) { | 409 | if (partial) { |
400 | count = this_read = partial; | 410 | count = this_read = partial; |
401 | } else if (result == -ETIMEDOUT || result == 15) { /* FIXME: 15 ??? */ | 411 | } else if (result == -ETIMEDOUT || result == 15) { /* FIXME: 15 ??? */ |
402 | if (!maxretry--) { | 412 | if (!maxretry--) { |
403 | mutex_unlock(&(rio->lock)); | 413 | mutex_unlock(&(rio->lock)); |
404 | err("read_rio: maxretry timeout"); | 414 | dev_err(&rio->rio_dev->dev, |
415 | "read_rio: maxretry timeout\n"); | ||
405 | return -ETIME; | 416 | return -ETIME; |
406 | } | 417 | } |
407 | prepare_to_wait(&rio->wait_q, &wait, TASK_INTERRUPTIBLE); | 418 | prepare_to_wait(&rio->wait_q, &wait, TASK_INTERRUPTIBLE); |
@@ -410,8 +421,9 @@ read_rio(struct file *file, char __user *buffer, size_t count, loff_t * ppos) | |||
410 | continue; | 421 | continue; |
411 | } else if (result != -EREMOTEIO) { | 422 | } else if (result != -EREMOTEIO) { |
412 | mutex_unlock(&(rio->lock)); | 423 | mutex_unlock(&(rio->lock)); |
413 | err("Read Whoops - result:%u partial:%u this_read:%u", | 424 | dev_err(&rio->rio_dev->dev, |
414 | result, partial, this_read); | 425 | "Read Whoops - result:%u partial:%u this_read:%u\n", |
426 | result, partial, this_read); | ||
415 | return -EIO; | 427 | return -EIO; |
416 | } else { | 428 | } else { |
417 | mutex_unlock(&(rio->lock)); | 429 | mutex_unlock(&(rio->lock)); |
@@ -459,26 +471,29 @@ static int probe_rio(struct usb_interface *intf, | |||
459 | 471 | ||
460 | retval = usb_register_dev(intf, &usb_rio_class); | 472 | retval = usb_register_dev(intf, &usb_rio_class); |
461 | if (retval) { | 473 | if (retval) { |
462 | err("Not able to get a minor for this device."); | 474 | dev_err(&dev->dev, |
475 | "Not able to get a minor for this device.\n"); | ||
463 | return -ENOMEM; | 476 | return -ENOMEM; |
464 | } | 477 | } |
465 | 478 | ||
466 | rio->rio_dev = dev; | 479 | rio->rio_dev = dev; |
467 | 480 | ||
468 | if (!(rio->obuf = kmalloc(OBUF_SIZE, GFP_KERNEL))) { | 481 | if (!(rio->obuf = kmalloc(OBUF_SIZE, GFP_KERNEL))) { |
469 | err("probe_rio: Not enough memory for the output buffer"); | 482 | dev_err(&dev->dev, |
483 | "probe_rio: Not enough memory for the output buffer\n"); | ||
470 | usb_deregister_dev(intf, &usb_rio_class); | 484 | usb_deregister_dev(intf, &usb_rio_class); |
471 | return -ENOMEM; | 485 | return -ENOMEM; |
472 | } | 486 | } |
473 | dbg("probe_rio: obuf address:%p", rio->obuf); | 487 | dev_dbg(&intf->dev, "obuf address:%p\n", rio->obuf); |
474 | 488 | ||
475 | if (!(rio->ibuf = kmalloc(IBUF_SIZE, GFP_KERNEL))) { | 489 | if (!(rio->ibuf = kmalloc(IBUF_SIZE, GFP_KERNEL))) { |
476 | err("probe_rio: Not enough memory for the input buffer"); | 490 | dev_err(&dev->dev, |
491 | "probe_rio: Not enough memory for the input buffer\n"); | ||
477 | usb_deregister_dev(intf, &usb_rio_class); | 492 | usb_deregister_dev(intf, &usb_rio_class); |
478 | kfree(rio->obuf); | 493 | kfree(rio->obuf); |
479 | return -ENOMEM; | 494 | return -ENOMEM; |
480 | } | 495 | } |
481 | dbg("probe_rio: ibuf address:%p", rio->ibuf); | 496 | dev_dbg(&intf->dev, "ibuf address:%p\n", rio->ibuf); |
482 | 497 | ||
483 | mutex_init(&(rio->lock)); | 498 | mutex_init(&(rio->lock)); |
484 | 499 | ||