diff options
Diffstat (limited to 'drivers/usb/serial/generic.c')
-rw-r--r-- | drivers/usb/serial/generic.c | 68 |
1 files changed, 15 insertions, 53 deletions
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index 664deb63807c..105a6d898ca4 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c | |||
@@ -28,9 +28,6 @@ static int debug; | |||
28 | 28 | ||
29 | #ifdef CONFIG_USB_SERIAL_GENERIC | 29 | #ifdef CONFIG_USB_SERIAL_GENERIC |
30 | 30 | ||
31 | static int generic_probe(struct usb_interface *interface, | ||
32 | const struct usb_device_id *id); | ||
33 | |||
34 | static __u16 vendor = 0x05f9; | 31 | static __u16 vendor = 0x05f9; |
35 | static __u16 product = 0xffff; | 32 | static __u16 product = 0xffff; |
36 | 33 | ||
@@ -49,13 +46,6 @@ static const struct usb_device_id generic_serial_ids[] = { | |||
49 | {} | 46 | {} |
50 | }; | 47 | }; |
51 | 48 | ||
52 | static struct usb_driver generic_driver = { | ||
53 | .name = "usbserial_generic", | ||
54 | .probe = generic_probe, | ||
55 | .disconnect = usb_serial_disconnect, | ||
56 | .id_table = generic_serial_ids, | ||
57 | }; | ||
58 | |||
59 | /* All of the device info needed for the Generic Serial Converter */ | 49 | /* All of the device info needed for the Generic Serial Converter */ |
60 | struct usb_serial_driver usb_serial_generic_device = { | 50 | struct usb_serial_driver usb_serial_generic_device = { |
61 | .driver = { | 51 | .driver = { |
@@ -75,16 +65,6 @@ static struct usb_serial_driver * const serial_drivers[] = { | |||
75 | &usb_serial_generic_device, NULL | 65 | &usb_serial_generic_device, NULL |
76 | }; | 66 | }; |
77 | 67 | ||
78 | static int generic_probe(struct usb_interface *interface, | ||
79 | const struct usb_device_id *id) | ||
80 | { | ||
81 | const struct usb_device_id *id_pattern; | ||
82 | |||
83 | id_pattern = usb_match_id(interface, generic_device_ids); | ||
84 | if (id_pattern != NULL) | ||
85 | return usb_serial_probe(interface, id); | ||
86 | return -ENODEV; | ||
87 | } | ||
88 | #endif | 68 | #endif |
89 | 69 | ||
90 | int usb_serial_generic_register(int _debug) | 70 | int usb_serial_generic_register(int _debug) |
@@ -99,7 +79,7 @@ int usb_serial_generic_register(int _debug) | |||
99 | USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_PRODUCT; | 79 | USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_PRODUCT; |
100 | 80 | ||
101 | /* register our generic driver with ourselves */ | 81 | /* register our generic driver with ourselves */ |
102 | retval = usb_serial_register_drivers(&generic_driver, serial_drivers); | 82 | retval = usb_serial_register_drivers(serial_drivers, "usbserial_generic", generic_serial_ids); |
103 | #endif | 83 | #endif |
104 | return retval; | 84 | return retval; |
105 | } | 85 | } |
@@ -108,7 +88,7 @@ void usb_serial_generic_deregister(void) | |||
108 | { | 88 | { |
109 | #ifdef CONFIG_USB_SERIAL_GENERIC | 89 | #ifdef CONFIG_USB_SERIAL_GENERIC |
110 | /* remove our generic driver */ | 90 | /* remove our generic driver */ |
111 | usb_serial_deregister_drivers(&generic_driver, serial_drivers); | 91 | usb_serial_deregister_drivers(serial_drivers); |
112 | #endif | 92 | #endif |
113 | } | 93 | } |
114 | 94 | ||
@@ -117,8 +97,6 @@ int usb_serial_generic_open(struct tty_struct *tty, struct usb_serial_port *port | |||
117 | int result = 0; | 97 | int result = 0; |
118 | unsigned long flags; | 98 | unsigned long flags; |
119 | 99 | ||
120 | dbg("%s - port %d", __func__, port->number); | ||
121 | |||
122 | /* clear the throttle flags */ | 100 | /* clear the throttle flags */ |
123 | spin_lock_irqsave(&port->lock, flags); | 101 | spin_lock_irqsave(&port->lock, flags); |
124 | port->throttled = 0; | 102 | port->throttled = 0; |
@@ -139,12 +117,9 @@ static void generic_cleanup(struct usb_serial_port *port) | |||
139 | unsigned long flags; | 117 | unsigned long flags; |
140 | int i; | 118 | int i; |
141 | 119 | ||
142 | dbg("%s - port %d", __func__, port->number); | ||
143 | |||
144 | if (serial->dev) { | 120 | if (serial->dev) { |
145 | /* shutdown any bulk transfers that might be going on */ | 121 | /* shutdown any bulk transfers that might be going on */ |
146 | if (port->bulk_out_size) { | 122 | if (port->bulk_out_size) { |
147 | usb_kill_urb(port->write_urb); | ||
148 | for (i = 0; i < ARRAY_SIZE(port->write_urbs); ++i) | 123 | for (i = 0; i < ARRAY_SIZE(port->write_urbs); ++i) |
149 | usb_kill_urb(port->write_urbs[i]); | 124 | usb_kill_urb(port->write_urbs[i]); |
150 | 125 | ||
@@ -161,7 +136,6 @@ static void generic_cleanup(struct usb_serial_port *port) | |||
161 | 136 | ||
162 | void usb_serial_generic_close(struct usb_serial_port *port) | 137 | void usb_serial_generic_close(struct usb_serial_port *port) |
163 | { | 138 | { |
164 | dbg("%s - port %d", __func__, port->number); | ||
165 | generic_cleanup(port); | 139 | generic_cleanup(port); |
166 | } | 140 | } |
167 | EXPORT_SYMBOL_GPL(usb_serial_generic_close); | 141 | EXPORT_SYMBOL_GPL(usb_serial_generic_close); |
@@ -249,8 +223,6 @@ int usb_serial_generic_write(struct tty_struct *tty, | |||
249 | { | 223 | { |
250 | int result; | 224 | int result; |
251 | 225 | ||
252 | dbg("%s - port %d", __func__, port->number); | ||
253 | |||
254 | /* only do something if we have a bulk out endpoint */ | 226 | /* only do something if we have a bulk out endpoint */ |
255 | if (!port->bulk_out_size) | 227 | if (!port->bulk_out_size) |
256 | return -ENODEV; | 228 | return -ENODEV; |
@@ -273,8 +245,6 @@ int usb_serial_generic_write_room(struct tty_struct *tty) | |||
273 | unsigned long flags; | 245 | unsigned long flags; |
274 | int room; | 246 | int room; |
275 | 247 | ||
276 | dbg("%s - port %d", __func__, port->number); | ||
277 | |||
278 | if (!port->bulk_out_size) | 248 | if (!port->bulk_out_size) |
279 | return 0; | 249 | return 0; |
280 | 250 | ||
@@ -282,7 +252,7 @@ int usb_serial_generic_write_room(struct tty_struct *tty) | |||
282 | room = kfifo_avail(&port->write_fifo); | 252 | room = kfifo_avail(&port->write_fifo); |
283 | spin_unlock_irqrestore(&port->lock, flags); | 253 | spin_unlock_irqrestore(&port->lock, flags); |
284 | 254 | ||
285 | dbg("%s - returns %d", __func__, room); | 255 | dev_dbg(&port->dev, "%s - returns %d\n", __func__, room); |
286 | return room; | 256 | return room; |
287 | } | 257 | } |
288 | 258 | ||
@@ -292,8 +262,6 @@ int usb_serial_generic_chars_in_buffer(struct tty_struct *tty) | |||
292 | unsigned long flags; | 262 | unsigned long flags; |
293 | int chars; | 263 | int chars; |
294 | 264 | ||
295 | dbg("%s - port %d", __func__, port->number); | ||
296 | |||
297 | if (!port->bulk_out_size) | 265 | if (!port->bulk_out_size) |
298 | return 0; | 266 | return 0; |
299 | 267 | ||
@@ -301,7 +269,7 @@ int usb_serial_generic_chars_in_buffer(struct tty_struct *tty) | |||
301 | chars = kfifo_len(&port->write_fifo) + port->tx_bytes; | 269 | chars = kfifo_len(&port->write_fifo) + port->tx_bytes; |
302 | spin_unlock_irqrestore(&port->lock, flags); | 270 | spin_unlock_irqrestore(&port->lock, flags); |
303 | 271 | ||
304 | dbg("%s - returns %d", __func__, chars); | 272 | dev_dbg(&port->dev, "%s - returns %d\n", __func__, chars); |
305 | return chars; | 273 | return chars; |
306 | } | 274 | } |
307 | 275 | ||
@@ -313,7 +281,8 @@ static int usb_serial_generic_submit_read_urb(struct usb_serial_port *port, | |||
313 | if (!test_and_clear_bit(index, &port->read_urbs_free)) | 281 | if (!test_and_clear_bit(index, &port->read_urbs_free)) |
314 | return 0; | 282 | return 0; |
315 | 283 | ||
316 | dbg("%s - port %d, urb %d\n", __func__, port->number, index); | 284 | dev_dbg(&port->dev, "%s - port %d, urb %d\n", __func__, |
285 | port->number, index); | ||
317 | 286 | ||
318 | res = usb_submit_urb(port->read_urbs[index], mem_flags); | 287 | res = usb_submit_urb(port->read_urbs[index], mem_flags); |
319 | if (res) { | 288 | if (res) { |
@@ -335,8 +304,6 @@ int usb_serial_generic_submit_read_urbs(struct usb_serial_port *port, | |||
335 | int res; | 304 | int res; |
336 | int i; | 305 | int i; |
337 | 306 | ||
338 | dbg("%s - port %d", __func__, port->number); | ||
339 | |||
340 | for (i = 0; i < ARRAY_SIZE(port->read_urbs); ++i) { | 307 | for (i = 0; i < ARRAY_SIZE(port->read_urbs); ++i) { |
341 | res = usb_serial_generic_submit_read_urb(port, i, mem_flags); | 308 | res = usb_serial_generic_submit_read_urb(port, i, mem_flags); |
342 | if (res) | 309 | if (res) |
@@ -395,10 +362,12 @@ void usb_serial_generic_read_bulk_callback(struct urb *urb) | |||
395 | } | 362 | } |
396 | set_bit(i, &port->read_urbs_free); | 363 | set_bit(i, &port->read_urbs_free); |
397 | 364 | ||
398 | dbg("%s - port %d, urb %d, len %d\n", __func__, port->number, i, | 365 | dev_dbg(&port->dev, "%s - port %d, urb %d, len %d\n", |
399 | urb->actual_length); | 366 | __func__, port->number, i, urb->actual_length); |
367 | |||
400 | if (urb->status) { | 368 | if (urb->status) { |
401 | dbg("%s - non-zero urb status: %d\n", __func__, urb->status); | 369 | dev_dbg(&port->dev, "%s - non-zero urb status: %d\n", |
370 | __func__, urb->status); | ||
402 | return; | 371 | return; |
403 | } | 372 | } |
404 | 373 | ||
@@ -424,8 +393,6 @@ void usb_serial_generic_write_bulk_callback(struct urb *urb) | |||
424 | int status = urb->status; | 393 | int status = urb->status; |
425 | int i; | 394 | int i; |
426 | 395 | ||
427 | dbg("%s - port %d", __func__, port->number); | ||
428 | |||
429 | for (i = 0; i < ARRAY_SIZE(port->write_urbs); ++i) | 396 | for (i = 0; i < ARRAY_SIZE(port->write_urbs); ++i) |
430 | if (port->write_urbs[i] == urb) | 397 | if (port->write_urbs[i] == urb) |
431 | break; | 398 | break; |
@@ -436,7 +403,8 @@ void usb_serial_generic_write_bulk_callback(struct urb *urb) | |||
436 | spin_unlock_irqrestore(&port->lock, flags); | 403 | spin_unlock_irqrestore(&port->lock, flags); |
437 | 404 | ||
438 | if (status) { | 405 | if (status) { |
439 | dbg("%s - non-zero urb status: %d", __func__, status); | 406 | dev_dbg(&port->dev, "%s - non-zero urb status: %d\n", |
407 | __func__, status); | ||
440 | 408 | ||
441 | spin_lock_irqsave(&port->lock, flags); | 409 | spin_lock_irqsave(&port->lock, flags); |
442 | kfifo_reset_out(&port->write_fifo); | 410 | kfifo_reset_out(&port->write_fifo); |
@@ -454,8 +422,6 @@ void usb_serial_generic_throttle(struct tty_struct *tty) | |||
454 | struct usb_serial_port *port = tty->driver_data; | 422 | struct usb_serial_port *port = tty->driver_data; |
455 | unsigned long flags; | 423 | unsigned long flags; |
456 | 424 | ||
457 | dbg("%s - port %d", __func__, port->number); | ||
458 | |||
459 | /* Set the throttle request flag. It will be picked up | 425 | /* Set the throttle request flag. It will be picked up |
460 | * by usb_serial_generic_read_bulk_callback(). */ | 426 | * by usb_serial_generic_read_bulk_callback(). */ |
461 | spin_lock_irqsave(&port->lock, flags); | 427 | spin_lock_irqsave(&port->lock, flags); |
@@ -469,8 +435,6 @@ void usb_serial_generic_unthrottle(struct tty_struct *tty) | |||
469 | struct usb_serial_port *port = tty->driver_data; | 435 | struct usb_serial_port *port = tty->driver_data; |
470 | int was_throttled; | 436 | int was_throttled; |
471 | 437 | ||
472 | dbg("%s - port %d", __func__, port->number); | ||
473 | |||
474 | /* Clear the throttle flags */ | 438 | /* Clear the throttle flags */ |
475 | spin_lock_irq(&port->lock); | 439 | spin_lock_irq(&port->lock); |
476 | was_throttled = port->throttled; | 440 | was_throttled = port->throttled; |
@@ -525,7 +489,8 @@ void usb_serial_handle_dcd_change(struct usb_serial_port *usb_port, | |||
525 | { | 489 | { |
526 | struct tty_port *port = &usb_port->port; | 490 | struct tty_port *port = &usb_port->port; |
527 | 491 | ||
528 | dbg("%s - port %d, status %d", __func__, usb_port->number, status); | 492 | dev_dbg(&usb_port->dev, "%s - port %d, status %d\n", __func__, |
493 | usb_port->number, status); | ||
529 | 494 | ||
530 | if (status) | 495 | if (status) |
531 | wake_up_interruptible(&port->open_wait); | 496 | wake_up_interruptible(&port->open_wait); |
@@ -566,8 +531,6 @@ void usb_serial_generic_disconnect(struct usb_serial *serial) | |||
566 | { | 531 | { |
567 | int i; | 532 | int i; |
568 | 533 | ||
569 | dbg("%s", __func__); | ||
570 | |||
571 | /* stop reads and writes on all ports */ | 534 | /* stop reads and writes on all ports */ |
572 | for (i = 0; i < serial->num_ports; ++i) | 535 | for (i = 0; i < serial->num_ports; ++i) |
573 | generic_cleanup(serial->port[i]); | 536 | generic_cleanup(serial->port[i]); |
@@ -576,5 +539,4 @@ EXPORT_SYMBOL_GPL(usb_serial_generic_disconnect); | |||
576 | 539 | ||
577 | void usb_serial_generic_release(struct usb_serial *serial) | 540 | void usb_serial_generic_release(struct usb_serial *serial) |
578 | { | 541 | { |
579 | dbg("%s", __func__); | ||
580 | } | 542 | } |