aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/ir-usb.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/serial/ir-usb.c')
-rw-r--r--drivers/usb/serial/ir-usb.c53
1 files changed, 25 insertions, 28 deletions
diff --git a/drivers/usb/serial/ir-usb.c b/drivers/usb/serial/ir-usb.c
index 6b803ab98543..004d57385a75 100644
--- a/drivers/usb/serial/ir-usb.c
+++ b/drivers/usb/serial/ir-usb.c
@@ -145,9 +145,6 @@ static struct usb_serial_driver ir_device = {
145 .description = "IR Dongle", 145 .description = "IR Dongle",
146 .usb_driver = &ir_driver, 146 .usb_driver = &ir_driver,
147 .id_table = id_table, 147 .id_table = id_table,
148 .num_interrupt_in = 1,
149 .num_bulk_in = 1,
150 .num_bulk_out = 1,
151 .num_ports = 1, 148 .num_ports = 1,
152 .set_termios = ir_set_termios, 149 .set_termios = ir_set_termios,
153 .attach = ir_startup, 150 .attach = ir_startup,
@@ -198,16 +195,16 @@ static struct irda_class_desc *irda_usb_find_class_desc(struct usb_device *dev,
198 USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE, 195 USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
199 0, ifnum, desc, sizeof(*desc), 1000); 196 0, ifnum, desc, sizeof(*desc), 1000);
200 197
201 dbg("%s - ret=%d", __FUNCTION__, ret); 198 dbg("%s - ret=%d", __func__, ret);
202 if (ret < sizeof(*desc)) { 199 if (ret < sizeof(*desc)) {
203 dbg("%s - class descriptor read %s (%d)", 200 dbg("%s - class descriptor read %s (%d)",
204 __FUNCTION__, 201 __func__,
205 (ret<0) ? "failed" : "too short", 202 (ret<0) ? "failed" : "too short",
206 ret); 203 ret);
207 goto error; 204 goto error;
208 } 205 }
209 if (desc->bDescriptorType != USB_DT_IRDA) { 206 if (desc->bDescriptorType != USB_DT_IRDA) {
210 dbg("%s - bad class descriptor type", __FUNCTION__); 207 dbg("%s - bad class descriptor type", __func__);
211 goto error; 208 goto error;
212 } 209 }
213 210
@@ -251,7 +248,7 @@ static int ir_startup (struct usb_serial *serial)
251 } 248 }
252 249
253 dbg ("%s - Baud rates supported:%s%s%s%s%s%s%s%s%s", 250 dbg ("%s - Baud rates supported:%s%s%s%s%s%s%s%s%s",
254 __FUNCTION__, 251 __func__,
255 (irda_desc->wBaudRate & 0x0001) ? " 2400" : "", 252 (irda_desc->wBaudRate & 0x0001) ? " 2400" : "",
256 (irda_desc->wBaudRate & 0x0002) ? " 9600" : "", 253 (irda_desc->wBaudRate & 0x0002) ? " 9600" : "",
257 (irda_desc->wBaudRate & 0x0004) ? " 19200" : "", 254 (irda_desc->wBaudRate & 0x0004) ? " 19200" : "",
@@ -284,13 +281,13 @@ static int ir_open (struct usb_serial_port *port, struct file *filp)
284 char *buffer; 281 char *buffer;
285 int result = 0; 282 int result = 0;
286 283
287 dbg("%s - port %d", __FUNCTION__, port->number); 284 dbg("%s - port %d", __func__, port->number);
288 285
289 if (buffer_size) { 286 if (buffer_size) {
290 /* override the default buffer sizes */ 287 /* override the default buffer sizes */
291 buffer = kmalloc (buffer_size, GFP_KERNEL); 288 buffer = kmalloc (buffer_size, GFP_KERNEL);
292 if (!buffer) { 289 if (!buffer) {
293 dev_err (&port->dev, "%s - out of memory.\n", __FUNCTION__); 290 dev_err (&port->dev, "%s - out of memory.\n", __func__);
294 return -ENOMEM; 291 return -ENOMEM;
295 } 292 }
296 kfree (port->read_urb->transfer_buffer); 293 kfree (port->read_urb->transfer_buffer);
@@ -299,7 +296,7 @@ static int ir_open (struct usb_serial_port *port, struct file *filp)
299 296
300 buffer = kmalloc (buffer_size, GFP_KERNEL); 297 buffer = kmalloc (buffer_size, GFP_KERNEL);
301 if (!buffer) { 298 if (!buffer) {
302 dev_err (&port->dev, "%s - out of memory.\n", __FUNCTION__); 299 dev_err (&port->dev, "%s - out of memory.\n", __func__);
303 return -ENOMEM; 300 return -ENOMEM;
304 } 301 }
305 kfree (port->write_urb->transfer_buffer); 302 kfree (port->write_urb->transfer_buffer);
@@ -319,14 +316,14 @@ static int ir_open (struct usb_serial_port *port, struct file *filp)
319 port); 316 port);
320 result = usb_submit_urb(port->read_urb, GFP_KERNEL); 317 result = usb_submit_urb(port->read_urb, GFP_KERNEL);
321 if (result) 318 if (result)
322 dev_err(&port->dev, "%s - failed submitting read urb, error %d\n", __FUNCTION__, result); 319 dev_err(&port->dev, "%s - failed submitting read urb, error %d\n", __func__, result);
323 320
324 return result; 321 return result;
325} 322}
326 323
327static void ir_close (struct usb_serial_port *port, struct file * filp) 324static void ir_close (struct usb_serial_port *port, struct file * filp)
328{ 325{
329 dbg("%s - port %d", __FUNCTION__, port->number); 326 dbg("%s - port %d", __func__, port->number);
330 327
331 /* shutdown our bulk read */ 328 /* shutdown our bulk read */
332 usb_kill_urb(port->read_urb); 329 usb_kill_urb(port->read_urb);
@@ -338,10 +335,10 @@ static int ir_write (struct usb_serial_port *port, const unsigned char *buf, int
338 int result; 335 int result;
339 int transfer_size; 336 int transfer_size;
340 337
341 dbg("%s - port = %d, count = %d", __FUNCTION__, port->number, count); 338 dbg("%s - port = %d, count = %d", __func__, port->number, count);
342 339
343 if (!port->tty) { 340 if (!port->tty) {
344 dev_err (&port->dev, "%s - no tty???\n", __FUNCTION__); 341 dev_err (&port->dev, "%s - no tty???\n", __func__);
345 return 0; 342 return 0;
346 } 343 }
347 344
@@ -351,7 +348,7 @@ static int ir_write (struct usb_serial_port *port, const unsigned char *buf, int
351 spin_lock_bh(&port->lock); 348 spin_lock_bh(&port->lock);
352 if (port->write_urb_busy) { 349 if (port->write_urb_busy) {
353 spin_unlock_bh(&port->lock); 350 spin_unlock_bh(&port->lock);
354 dbg("%s - already writing", __FUNCTION__); 351 dbg("%s - already writing", __func__);
355 return 0; 352 return 0;
356 } 353 }
357 port->write_urb_busy = 1; 354 port->write_urb_busy = 1;
@@ -387,7 +384,7 @@ static int ir_write (struct usb_serial_port *port, const unsigned char *buf, int
387 result = usb_submit_urb (port->write_urb, GFP_ATOMIC); 384 result = usb_submit_urb (port->write_urb, GFP_ATOMIC);
388 if (result) { 385 if (result) {
389 port->write_urb_busy = 0; 386 port->write_urb_busy = 0;
390 dev_err(&port->dev, "%s - failed submitting write urb, error %d\n", __FUNCTION__, result); 387 dev_err(&port->dev, "%s - failed submitting write urb, error %d\n", __func__, result);
391 } else 388 } else
392 result = transfer_size; 389 result = transfer_size;
393 390
@@ -396,22 +393,22 @@ static int ir_write (struct usb_serial_port *port, const unsigned char *buf, int
396 393
397static void ir_write_bulk_callback (struct urb *urb) 394static void ir_write_bulk_callback (struct urb *urb)
398{ 395{
399 struct usb_serial_port *port = (struct usb_serial_port *)urb->context; 396 struct usb_serial_port *port = urb->context;
400 int status = urb->status; 397 int status = urb->status;
401 398
402 dbg("%s - port %d", __FUNCTION__, port->number); 399 dbg("%s - port %d", __func__, port->number);
403 400
404 port->write_urb_busy = 0; 401 port->write_urb_busy = 0;
405 if (status) { 402 if (status) {
406 dbg("%s - nonzero write bulk status received: %d", 403 dbg("%s - nonzero write bulk status received: %d",
407 __FUNCTION__, status); 404 __func__, status);
408 return; 405 return;
409 } 406 }
410 407
411 usb_serial_debug_data ( 408 usb_serial_debug_data (
412 debug, 409 debug,
413 &port->dev, 410 &port->dev,
414 __FUNCTION__, 411 __func__,
415 urb->actual_length, 412 urb->actual_length,
416 urb->transfer_buffer); 413 urb->transfer_buffer);
417 414
@@ -420,16 +417,16 @@ static void ir_write_bulk_callback (struct urb *urb)
420 417
421static void ir_read_bulk_callback (struct urb *urb) 418static void ir_read_bulk_callback (struct urb *urb)
422{ 419{
423 struct usb_serial_port *port = (struct usb_serial_port *)urb->context; 420 struct usb_serial_port *port = urb->context;
424 struct tty_struct *tty; 421 struct tty_struct *tty;
425 unsigned char *data = urb->transfer_buffer; 422 unsigned char *data = urb->transfer_buffer;
426 int result; 423 int result;
427 int status = urb->status; 424 int status = urb->status;
428 425
429 dbg("%s - port %d", __FUNCTION__, port->number); 426 dbg("%s - port %d", __func__, port->number);
430 427
431 if (!port->open_count) { 428 if (!port->open_count) {
432 dbg("%s - port closed.", __FUNCTION__); 429 dbg("%s - port closed.", __func__);
433 return; 430 return;
434 } 431 }
435 432
@@ -447,7 +444,7 @@ static void ir_read_bulk_callback (struct urb *urb)
447 usb_serial_debug_data ( 444 usb_serial_debug_data (
448 debug, 445 debug,
449 &port->dev, 446 &port->dev,
450 __FUNCTION__, 447 __func__,
451 urb->actual_length, 448 urb->actual_length,
452 data); 449 data);
453 450
@@ -480,13 +477,13 @@ static void ir_read_bulk_callback (struct urb *urb)
480 result = usb_submit_urb(port->read_urb, GFP_ATOMIC); 477 result = usb_submit_urb(port->read_urb, GFP_ATOMIC);
481 if (result) 478 if (result)
482 dev_err(&port->dev, "%s - failed resubmitting read urb, error %d\n", 479 dev_err(&port->dev, "%s - failed resubmitting read urb, error %d\n",
483 __FUNCTION__, result); 480 __func__, result);
484 481
485 break ; 482 break ;
486 483
487 default: 484 default:
488 dbg("%s - nonzero read bulk status received: %d", 485 dbg("%s - nonzero read bulk status received: %d",
489 __FUNCTION__, 486 __func__,
490 status); 487 status);
491 break ; 488 break ;
492 489
@@ -502,7 +499,7 @@ static void ir_set_termios (struct usb_serial_port *port, struct ktermios *old_t
502 speed_t baud; 499 speed_t baud;
503 int ir_baud; 500 int ir_baud;
504 501
505 dbg("%s - port %d", __FUNCTION__, port->number); 502 dbg("%s - port %d", __func__, port->number);
506 503
507 baud = tty_get_baud_rate(port->tty); 504 baud = tty_get_baud_rate(port->tty);
508 505
@@ -554,7 +551,7 @@ static void ir_set_termios (struct usb_serial_port *port, struct ktermios *old_t
554 551
555 result = usb_submit_urb (port->write_urb, GFP_KERNEL); 552 result = usb_submit_urb (port->write_urb, GFP_KERNEL);
556 if (result) 553 if (result)
557 dev_err(&port->dev, "%s - failed submitting write urb, error %d\n", __FUNCTION__, result); 554 dev_err(&port->dev, "%s - failed submitting write urb, error %d\n", __func__, result);
558 555
559 /* Only speed changes are supported */ 556 /* Only speed changes are supported */
560 tty_termios_copy_hw(port->tty->termios, old_termios); 557 tty_termios_copy_hw(port->tty->termios, old_termios);