aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/usb-serial.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/serial/usb-serial.c')
-rw-r--r--drivers/usb/serial/usb-serial.c78
1 files changed, 39 insertions, 39 deletions
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index 5b464811fa4d..baf953d14d82 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -81,7 +81,7 @@ static struct usb_serial *get_free_serial (struct usb_serial *serial, int num_po
81 unsigned int i, j; 81 unsigned int i, j;
82 int good_spot; 82 int good_spot;
83 83
84 dbg("%s %d", __FUNCTION__, num_ports); 84 dbg("%s %d", __func__, num_ports);
85 85
86 *minor = 0; 86 *minor = 0;
87 mutex_lock(&table_lock); 87 mutex_lock(&table_lock);
@@ -101,7 +101,7 @@ static struct usb_serial *get_free_serial (struct usb_serial *serial, int num_po
101 101
102 *minor = i; 102 *minor = i;
103 j = 0; 103 j = 0;
104 dbg("%s - minor base = %d", __FUNCTION__, *minor); 104 dbg("%s - minor base = %d", __func__, *minor);
105 for (i = *minor; (i < (*minor + num_ports)) && (i < SERIAL_TTY_MINORS); ++i) { 105 for (i = *minor; (i < (*minor + num_ports)) && (i < SERIAL_TTY_MINORS); ++i) {
106 serial_table[i] = serial; 106 serial_table[i] = serial;
107 serial->port[j++]->number = i; 107 serial->port[j++]->number = i;
@@ -117,7 +117,7 @@ static void return_serial(struct usb_serial *serial)
117{ 117{
118 int i; 118 int i;
119 119
120 dbg("%s", __FUNCTION__); 120 dbg("%s", __func__);
121 121
122 if (serial == NULL) 122 if (serial == NULL)
123 return; 123 return;
@@ -135,7 +135,7 @@ static void destroy_serial(struct kref *kref)
135 135
136 serial = to_usb_serial(kref); 136 serial = to_usb_serial(kref);
137 137
138 dbg("%s - %s", __FUNCTION__, serial->type->description); 138 dbg("%s - %s", __func__, serial->type->description);
139 139
140 serial->type->shutdown(serial); 140 serial->type->shutdown(serial);
141 141
@@ -187,7 +187,7 @@ static int serial_open (struct tty_struct *tty, struct file * filp)
187 unsigned int portNumber; 187 unsigned int portNumber;
188 int retval; 188 int retval;
189 189
190 dbg("%s", __FUNCTION__); 190 dbg("%s", __func__);
191 191
192 /* get the serial object associated with this tty pointer */ 192 /* get the serial object associated with this tty pointer */
193 serial = usb_serial_get_by_index(tty->index); 193 serial = usb_serial_get_by_index(tty->index);
@@ -259,7 +259,7 @@ static void serial_close(struct tty_struct *tty, struct file * filp)
259 if (!port) 259 if (!port)
260 return; 260 return;
261 261
262 dbg("%s - port %d", __FUNCTION__, port->number); 262 dbg("%s - port %d", __func__, port->number);
263 263
264 mutex_lock(&port->mutex); 264 mutex_lock(&port->mutex);
265 265
@@ -299,11 +299,11 @@ static int serial_write (struct tty_struct * tty, const unsigned char *buf, int
299 if (!port || port->serial->dev->state == USB_STATE_NOTATTACHED) 299 if (!port || port->serial->dev->state == USB_STATE_NOTATTACHED)
300 goto exit; 300 goto exit;
301 301
302 dbg("%s - port %d, %d byte(s)", __FUNCTION__, port->number, count); 302 dbg("%s - port %d, %d byte(s)", __func__, port->number, count);
303 303
304 if (!port->open_count) { 304 if (!port->open_count) {
305 retval = -EINVAL; 305 retval = -EINVAL;
306 dbg("%s - port not opened", __FUNCTION__); 306 dbg("%s - port not opened", __func__);
307 goto exit; 307 goto exit;
308 } 308 }
309 309
@@ -322,10 +322,10 @@ static int serial_write_room (struct tty_struct *tty)
322 if (!port) 322 if (!port)
323 goto exit; 323 goto exit;
324 324
325 dbg("%s - port %d", __FUNCTION__, port->number); 325 dbg("%s - port %d", __func__, port->number);
326 326
327 if (!port->open_count) { 327 if (!port->open_count) {
328 dbg("%s - port not open", __FUNCTION__); 328 dbg("%s - port not open", __func__);
329 goto exit; 329 goto exit;
330 } 330 }
331 331
@@ -344,10 +344,10 @@ static int serial_chars_in_buffer (struct tty_struct *tty)
344 if (!port) 344 if (!port)
345 goto exit; 345 goto exit;
346 346
347 dbg("%s = port %d", __FUNCTION__, port->number); 347 dbg("%s = port %d", __func__, port->number);
348 348
349 if (!port->open_count) { 349 if (!port->open_count) {
350 dbg("%s - port not open", __FUNCTION__); 350 dbg("%s - port not open", __func__);
351 goto exit; 351 goto exit;
352 } 352 }
353 353
@@ -365,10 +365,10 @@ static void serial_throttle (struct tty_struct * tty)
365 if (!port) 365 if (!port)
366 return; 366 return;
367 367
368 dbg("%s - port %d", __FUNCTION__, port->number); 368 dbg("%s - port %d", __func__, port->number);
369 369
370 if (!port->open_count) { 370 if (!port->open_count) {
371 dbg ("%s - port not open", __FUNCTION__); 371 dbg ("%s - port not open", __func__);
372 return; 372 return;
373 } 373 }
374 374
@@ -384,10 +384,10 @@ static void serial_unthrottle (struct tty_struct * tty)
384 if (!port) 384 if (!port)
385 return; 385 return;
386 386
387 dbg("%s - port %d", __FUNCTION__, port->number); 387 dbg("%s - port %d", __func__, port->number);
388 388
389 if (!port->open_count) { 389 if (!port->open_count) {
390 dbg("%s - port not open", __FUNCTION__); 390 dbg("%s - port not open", __func__);
391 return; 391 return;
392 } 392 }
393 393
@@ -405,11 +405,11 @@ static int serial_ioctl (struct tty_struct *tty, struct file * file, unsigned in
405 if (!port) 405 if (!port)
406 goto exit; 406 goto exit;
407 407
408 dbg("%s - port %d, cmd 0x%.4x", __FUNCTION__, port->number, cmd); 408 dbg("%s - port %d, cmd 0x%.4x", __func__, port->number, cmd);
409 409
410 /* Caution - port->open_count is BKL protected */ 410 /* Caution - port->open_count is BKL protected */
411 if (!port->open_count) { 411 if (!port->open_count) {
412 dbg ("%s - port not open", __FUNCTION__); 412 dbg ("%s - port not open", __func__);
413 goto exit; 413 goto exit;
414 } 414 }
415 415
@@ -430,10 +430,10 @@ static void serial_set_termios (struct tty_struct *tty, struct ktermios * old)
430 if (!port) 430 if (!port)
431 return; 431 return;
432 432
433 dbg("%s - port %d", __FUNCTION__, port->number); 433 dbg("%s - port %d", __func__, port->number);
434 434
435 if (!port->open_count) { 435 if (!port->open_count) {
436 dbg("%s - port not open", __FUNCTION__); 436 dbg("%s - port not open", __func__);
437 return; 437 return;
438 } 438 }
439 439
@@ -454,10 +454,10 @@ static void serial_break (struct tty_struct *tty, int break_state)
454 return; 454 return;
455 } 455 }
456 456
457 dbg("%s - port %d", __FUNCTION__, port->number); 457 dbg("%s - port %d", __func__, port->number);
458 458
459 if (!port->open_count) { 459 if (!port->open_count) {
460 dbg("%s - port not open", __FUNCTION__); 460 dbg("%s - port not open", __func__);
461 unlock_kernel(); 461 unlock_kernel();
462 return; 462 return;
463 } 463 }
@@ -476,7 +476,7 @@ static int serial_read_proc (char *page, char **start, off_t off, int count, int
476 off_t begin = 0; 476 off_t begin = 0;
477 char tmp[40]; 477 char tmp[40];
478 478
479 dbg("%s", __FUNCTION__); 479 dbg("%s", __func__);
480 length += sprintf (page, "usbserinfo:1.0 driver:2.0\n"); 480 length += sprintf (page, "usbserinfo:1.0 driver:2.0\n");
481 for (i = 0; i < SERIAL_TTY_MINORS && length < PAGE_SIZE; ++i) { 481 for (i = 0; i < SERIAL_TTY_MINORS && length < PAGE_SIZE; ++i) {
482 serial = usb_serial_get_by_index(i); 482 serial = usb_serial_get_by_index(i);
@@ -522,10 +522,10 @@ static int serial_tiocmget (struct tty_struct *tty, struct file *file)
522 if (!port) 522 if (!port)
523 return -ENODEV; 523 return -ENODEV;
524 524
525 dbg("%s - port %d", __FUNCTION__, port->number); 525 dbg("%s - port %d", __func__, port->number);
526 526
527 if (!port->open_count) { 527 if (!port->open_count) {
528 dbg("%s - port not open", __FUNCTION__); 528 dbg("%s - port not open", __func__);
529 return -ENODEV; 529 return -ENODEV;
530 } 530 }
531 531
@@ -543,10 +543,10 @@ static int serial_tiocmset (struct tty_struct *tty, struct file *file,
543 if (!port) 543 if (!port)
544 return -ENODEV; 544 return -ENODEV;
545 545
546 dbg("%s - port %d", __FUNCTION__, port->number); 546 dbg("%s - port %d", __func__, port->number);
547 547
548 if (!port->open_count) { 548 if (!port->open_count) {
549 dbg("%s - port not open", __FUNCTION__); 549 dbg("%s - port not open", __func__);
550 return -ENODEV; 550 return -ENODEV;
551 } 551 }
552 552
@@ -572,7 +572,7 @@ static void usb_serial_port_work(struct work_struct *work)
572 container_of(work, struct usb_serial_port, work); 572 container_of(work, struct usb_serial_port, work);
573 struct tty_struct *tty; 573 struct tty_struct *tty;
574 574
575 dbg("%s - port %d", __FUNCTION__, port->number); 575 dbg("%s - port %d", __func__, port->number);
576 576
577 if (!port) 577 if (!port)
578 return; 578 return;
@@ -588,7 +588,7 @@ static void port_release(struct device *dev)
588{ 588{
589 struct usb_serial_port *port = to_usb_serial_port(dev); 589 struct usb_serial_port *port = to_usb_serial_port(dev);
590 590
591 dbg ("%s - %s", __FUNCTION__, dev->bus_id); 591 dbg ("%s - %s", __func__, dev->bus_id);
592 port_free(port); 592 port_free(port);
593} 593}
594 594
@@ -634,7 +634,7 @@ static struct usb_serial * create_serial (struct usb_device *dev,
634 634
635 serial = kzalloc(sizeof(*serial), GFP_KERNEL); 635 serial = kzalloc(sizeof(*serial), GFP_KERNEL);
636 if (!serial) { 636 if (!serial) {
637 dev_err(&dev->dev, "%s - out of memory\n", __FUNCTION__); 637 dev_err(&dev->dev, "%s - out of memory\n", __func__);
638 return NULL; 638 return NULL;
639 } 639 }
640 serial->dev = usb_get_dev(dev); 640 serial->dev = usb_get_dev(dev);
@@ -729,7 +729,7 @@ int usb_serial_probe(struct usb_interface *interface,
729 serial = create_serial (dev, interface, type); 729 serial = create_serial (dev, interface, type);
730 if (!serial) { 730 if (!serial) {
731 unlock_kernel(); 731 unlock_kernel();
732 dev_err(&interface->dev, "%s - out of memory\n", __FUNCTION__); 732 dev_err(&interface->dev, "%s - out of memory\n", __func__);
733 return -ENOMEM; 733 return -ENOMEM;
734 } 734 }
735 735
@@ -874,7 +874,7 @@ int usb_serial_probe(struct usb_interface *interface,
874 serial->num_port_pointers = max_endpoints; 874 serial->num_port_pointers = max_endpoints;
875 unlock_kernel(); 875 unlock_kernel();
876 876
877 dbg("%s - setting up %d port structures for this device", __FUNCTION__, max_endpoints); 877 dbg("%s - setting up %d port structures for this device", __func__, max_endpoints);
878 for (i = 0; i < max_endpoints; ++i) { 878 for (i = 0; i < max_endpoints; ++i) {
879 port = kzalloc(sizeof(struct usb_serial_port), GFP_KERNEL); 879 port = kzalloc(sizeof(struct usb_serial_port), GFP_KERNEL);
880 if (!port) 880 if (!port)
@@ -1022,7 +1022,7 @@ int usb_serial_probe(struct usb_interface *interface,
1022 port->dev.release = &port_release; 1022 port->dev.release = &port_release;
1023 1023
1024 snprintf (&port->dev.bus_id[0], sizeof(port->dev.bus_id), "ttyUSB%d", port->number); 1024 snprintf (&port->dev.bus_id[0], sizeof(port->dev.bus_id), "ttyUSB%d", port->number);
1025 dbg ("%s - registering %s", __FUNCTION__, port->dev.bus_id); 1025 dbg ("%s - registering %s", __func__, port->dev.bus_id);
1026 retval = device_register(&port->dev); 1026 retval = device_register(&port->dev);
1027 if (retval) 1027 if (retval)
1028 dev_err(&port->dev, "Error registering port device, " 1028 dev_err(&port->dev, "Error registering port device, "
@@ -1081,7 +1081,7 @@ void usb_serial_disconnect(struct usb_interface *interface)
1081 struct usb_serial_port *port; 1081 struct usb_serial_port *port;
1082 1082
1083 usb_serial_console_disconnect(serial); 1083 usb_serial_console_disconnect(serial);
1084 dbg ("%s", __FUNCTION__); 1084 dbg ("%s", __func__);
1085 1085
1086 mutex_lock(&serial->disc_mutex); 1086 mutex_lock(&serial->disc_mutex);
1087 usb_set_intfdata (interface, NULL); 1087 usb_set_intfdata (interface, NULL);
@@ -1165,7 +1165,7 @@ static int __init usb_serial_init(void)
1165 1165
1166 result = bus_register(&usb_serial_bus_type); 1166 result = bus_register(&usb_serial_bus_type);
1167 if (result) { 1167 if (result) {
1168 err("%s - registering bus driver failed", __FUNCTION__); 1168 err("%s - registering bus driver failed", __func__);
1169 goto exit_bus; 1169 goto exit_bus;
1170 } 1170 }
1171 1171
@@ -1182,21 +1182,21 @@ static int __init usb_serial_init(void)
1182 tty_set_operations(usb_serial_tty_driver, &serial_ops); 1182 tty_set_operations(usb_serial_tty_driver, &serial_ops);
1183 result = tty_register_driver(usb_serial_tty_driver); 1183 result = tty_register_driver(usb_serial_tty_driver);
1184 if (result) { 1184 if (result) {
1185 err("%s - tty_register_driver failed", __FUNCTION__); 1185 err("%s - tty_register_driver failed", __func__);
1186 goto exit_reg_driver; 1186 goto exit_reg_driver;
1187 } 1187 }
1188 1188
1189 /* register the USB driver */ 1189 /* register the USB driver */
1190 result = usb_register(&usb_serial_driver); 1190 result = usb_register(&usb_serial_driver);
1191 if (result < 0) { 1191 if (result < 0) {
1192 err("%s - usb_register failed", __FUNCTION__); 1192 err("%s - usb_register failed", __func__);
1193 goto exit_tty; 1193 goto exit_tty;
1194 } 1194 }
1195 1195
1196 /* register the generic driver, if we should */ 1196 /* register the generic driver, if we should */
1197 result = usb_serial_generic_register(debug); 1197 result = usb_serial_generic_register(debug);
1198 if (result < 0) { 1198 if (result < 0) {
1199 err("%s - registering generic driver failed", __FUNCTION__); 1199 err("%s - registering generic driver failed", __func__);
1200 goto exit_generic; 1200 goto exit_generic;
1201 } 1201 }
1202 1202
@@ -1214,7 +1214,7 @@ exit_reg_driver:
1214 bus_unregister(&usb_serial_bus_type); 1214 bus_unregister(&usb_serial_bus_type);
1215 1215
1216exit_bus: 1216exit_bus:
1217 err ("%s - returning with error %d", __FUNCTION__, result); 1217 err ("%s - returning with error %d", __func__, result);
1218 put_tty_driver(usb_serial_tty_driver); 1218 put_tty_driver(usb_serial_tty_driver);
1219 return result; 1219 return result;
1220} 1220}