diff options
author | Pete Zaitcev <zaitcev@redhat.com> | 2006-05-23 00:58:49 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-06-21 18:04:13 -0400 |
commit | cf2c7481d2ff7f0c266de873b2fe93883e9782f9 (patch) | |
tree | 35dba35b3969f431feb0dfe5732c3825aa077a22 | |
parent | ad93375a30334cd97a61f7076d242e1cfdb66abc (diff) |
[PATCH] USB serial: encapsulate schedule_work, remove double-calling
I'm going to throw schedule_work away, it's retarded. But for starters,
let's have it encapsulated.
Also, generic and whiteheat were both calling usb_serial_port_softint
and scheduled work. Only one was necessary.
Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/usb/serial/cyberjack.c | 2 | ||||
-rw-r--r-- | drivers/usb/serial/cypress_m8.c | 2 | ||||
-rw-r--r-- | drivers/usb/serial/empeg.c | 2 | ||||
-rw-r--r-- | drivers/usb/serial/ftdi_sio.c | 2 | ||||
-rw-r--r-- | drivers/usb/serial/garmin_gps.c | 2 | ||||
-rw-r--r-- | drivers/usb/serial/generic.c | 4 | ||||
-rw-r--r-- | drivers/usb/serial/ipaq.c | 2 | ||||
-rw-r--r-- | drivers/usb/serial/ipw.c | 2 | ||||
-rw-r--r-- | drivers/usb/serial/ir-usb.c | 2 | ||||
-rw-r--r-- | drivers/usb/serial/keyspan.c | 2 | ||||
-rw-r--r-- | drivers/usb/serial/kl5kusb105.c | 3 | ||||
-rw-r--r-- | drivers/usb/serial/omninet.c | 2 | ||||
-rw-r--r-- | drivers/usb/serial/option.c | 3 | ||||
-rw-r--r-- | drivers/usb/serial/pl2303.c | 2 | ||||
-rw-r--r-- | drivers/usb/serial/usb-serial.c | 14 | ||||
-rw-r--r-- | drivers/usb/serial/usb-serial.h | 2 | ||||
-rw-r--r-- | drivers/usb/serial/visor.c | 2 | ||||
-rw-r--r-- | drivers/usb/serial/whiteheat.c | 4 |
18 files changed, 29 insertions, 25 deletions
diff --git a/drivers/usb/serial/cyberjack.c b/drivers/usb/serial/cyberjack.c index 2357b1d102d7..1fd5c5a9f2ef 100644 --- a/drivers/usb/serial/cyberjack.c +++ b/drivers/usb/serial/cyberjack.c | |||
@@ -469,7 +469,7 @@ static void cyberjack_write_bulk_callback (struct urb *urb, struct pt_regs *regs | |||
469 | 469 | ||
470 | exit: | 470 | exit: |
471 | spin_unlock(&priv->lock); | 471 | spin_unlock(&priv->lock); |
472 | schedule_work(&port->work); | 472 | usb_serial_port_softint(port); |
473 | } | 473 | } |
474 | 474 | ||
475 | static int __init cyberjack_init (void) | 475 | static int __init cyberjack_init (void) |
diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c index 7212fbe3b6f2..5de76efe1b37 100644 --- a/drivers/usb/serial/cypress_m8.c +++ b/drivers/usb/serial/cypress_m8.c | |||
@@ -824,7 +824,7 @@ send: | |||
824 | priv->bytes_out += count; /* do not count the line control and size bytes */ | 824 | priv->bytes_out += count; /* do not count the line control and size bytes */ |
825 | spin_unlock_irqrestore(&priv->lock, flags); | 825 | spin_unlock_irqrestore(&priv->lock, flags); |
826 | 826 | ||
827 | schedule_work(&port->work); | 827 | usb_serial_port_softint(port); |
828 | } /* cypress_send */ | 828 | } /* cypress_send */ |
829 | 829 | ||
830 | 830 | ||
diff --git a/drivers/usb/serial/empeg.c b/drivers/usb/serial/empeg.c index 63f7c78a1152..afca1eae5fb5 100644 --- a/drivers/usb/serial/empeg.c +++ b/drivers/usb/serial/empeg.c | |||
@@ -335,7 +335,7 @@ static void empeg_write_bulk_callback (struct urb *urb, struct pt_regs *regs) | |||
335 | return; | 335 | return; |
336 | } | 336 | } |
337 | 337 | ||
338 | schedule_work(&port->work); | 338 | usb_serial_port_softint(port); |
339 | } | 339 | } |
340 | 340 | ||
341 | 341 | ||
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 1122a0da41c1..590c7ec851db 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -1472,7 +1472,7 @@ static void ftdi_write_bulk_callback (struct urb *urb, struct pt_regs *regs) | |||
1472 | return; | 1472 | return; |
1473 | } | 1473 | } |
1474 | 1474 | ||
1475 | schedule_work(&port->work); | 1475 | usb_serial_port_softint(port); |
1476 | } /* ftdi_write_bulk_callback */ | 1476 | } /* ftdi_write_bulk_callback */ |
1477 | 1477 | ||
1478 | 1478 | ||
diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c index 5ec9bf5bac8d..04767759cf8a 100644 --- a/drivers/usb/serial/garmin_gps.c +++ b/drivers/usb/serial/garmin_gps.c | |||
@@ -1012,7 +1012,7 @@ static void garmin_write_bulk_callback (struct urb *urb, struct pt_regs *regs) | |||
1012 | garmin_data_p->flags |= CLEAR_HALT_REQUIRED; | 1012 | garmin_data_p->flags |= CLEAR_HALT_REQUIRED; |
1013 | } | 1013 | } |
1014 | 1014 | ||
1015 | schedule_work(&port->work); | 1015 | usb_serial_port_softint(port); |
1016 | } | 1016 | } |
1017 | 1017 | ||
1018 | 1018 | ||
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index c62cc2876519..07a478c59fb2 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c | |||
@@ -299,9 +299,7 @@ void usb_serial_generic_write_bulk_callback (struct urb *urb, struct pt_regs *re | |||
299 | return; | 299 | return; |
300 | } | 300 | } |
301 | 301 | ||
302 | usb_serial_port_softint((void *)port); | 302 | usb_serial_port_softint(port); |
303 | |||
304 | schedule_work(&port->work); | ||
305 | } | 303 | } |
306 | EXPORT_SYMBOL_GPL(usb_serial_generic_write_bulk_callback); | 304 | EXPORT_SYMBOL_GPL(usb_serial_generic_write_bulk_callback); |
307 | 305 | ||
diff --git a/drivers/usb/serial/ipaq.c b/drivers/usb/serial/ipaq.c index 9a5c97989562..9da6d2a8f2b0 100644 --- a/drivers/usb/serial/ipaq.c +++ b/drivers/usb/serial/ipaq.c | |||
@@ -870,7 +870,7 @@ static void ipaq_write_bulk_callback(struct urb *urb, struct pt_regs *regs) | |||
870 | spin_unlock_irqrestore(&write_list_lock, flags); | 870 | spin_unlock_irqrestore(&write_list_lock, flags); |
871 | } | 871 | } |
872 | 872 | ||
873 | schedule_work(&port->work); | 873 | usb_serial_port_softint(port); |
874 | } | 874 | } |
875 | 875 | ||
876 | static int ipaq_write_room(struct usb_serial_port *port) | 876 | static int ipaq_write_room(struct usb_serial_port *port) |
diff --git a/drivers/usb/serial/ipw.c b/drivers/usb/serial/ipw.c index e760a70242c1..a4a0bfeaab00 100644 --- a/drivers/usb/serial/ipw.c +++ b/drivers/usb/serial/ipw.c | |||
@@ -376,7 +376,7 @@ static void ipw_write_bulk_callback(struct urb *urb, struct pt_regs *regs) | |||
376 | if (urb->status) | 376 | if (urb->status) |
377 | dbg("%s - nonzero write bulk status received: %d", __FUNCTION__, urb->status); | 377 | dbg("%s - nonzero write bulk status received: %d", __FUNCTION__, urb->status); |
378 | 378 | ||
379 | schedule_work(&port->work); | 379 | usb_serial_port_softint(port); |
380 | } | 380 | } |
381 | 381 | ||
382 | static int ipw_write(struct usb_serial_port *port, const unsigned char *buf, int count) | 382 | static int ipw_write(struct usb_serial_port *port, const unsigned char *buf, int count) |
diff --git a/drivers/usb/serial/ir-usb.c b/drivers/usb/serial/ir-usb.c index 426182ddc42a..9432c7302275 100644 --- a/drivers/usb/serial/ir-usb.c +++ b/drivers/usb/serial/ir-usb.c | |||
@@ -408,7 +408,7 @@ static void ir_write_bulk_callback (struct urb *urb, struct pt_regs *regs) | |||
408 | urb->actual_length, | 408 | urb->actual_length, |
409 | urb->transfer_buffer); | 409 | urb->transfer_buffer); |
410 | 410 | ||
411 | schedule_work(&port->work); | 411 | usb_serial_port_softint(port); |
412 | } | 412 | } |
413 | 413 | ||
414 | static void ir_read_bulk_callback (struct urb *urb, struct pt_regs *regs) | 414 | static void ir_read_bulk_callback (struct urb *urb, struct pt_regs *regs) |
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c index 052b735c4fbd..2cf6ade704e4 100644 --- a/drivers/usb/serial/keyspan.c +++ b/drivers/usb/serial/keyspan.c | |||
@@ -481,7 +481,7 @@ static void usa2x_outdat_callback(struct urb *urb, struct pt_regs *regs) | |||
481 | dbg ("%s - urb %d", __FUNCTION__, urb == p_priv->out_urbs[1]); | 481 | dbg ("%s - urb %d", __FUNCTION__, urb == p_priv->out_urbs[1]); |
482 | 482 | ||
483 | if (port->open_count) | 483 | if (port->open_count) |
484 | schedule_work(&port->work); | 484 | usb_serial_port_softint(port); |
485 | } | 485 | } |
486 | 486 | ||
487 | static void usa26_inack_callback(struct urb *urb, struct pt_regs *regs) | 487 | static void usa26_inack_callback(struct urb *urb, struct pt_regs *regs) |
diff --git a/drivers/usb/serial/kl5kusb105.c b/drivers/usb/serial/kl5kusb105.c index 78335a5f7743..65d79f630fa4 100644 --- a/drivers/usb/serial/kl5kusb105.c +++ b/drivers/usb/serial/kl5kusb105.c | |||
@@ -569,8 +569,7 @@ static void klsi_105_write_bulk_callback ( struct urb *urb, struct pt_regs *regs | |||
569 | return; | 569 | return; |
570 | } | 570 | } |
571 | 571 | ||
572 | /* from generic_write_bulk_callback */ | 572 | usb_serial_port_softint(port); |
573 | schedule_work(&port->work); | ||
574 | } /* klsi_105_write_bulk_completion_callback */ | 573 | } /* klsi_105_write_bulk_completion_callback */ |
575 | 574 | ||
576 | 575 | ||
diff --git a/drivers/usb/serial/omninet.c b/drivers/usb/serial/omninet.c index 238033a87092..6dcdb5f598b8 100644 --- a/drivers/usb/serial/omninet.c +++ b/drivers/usb/serial/omninet.c | |||
@@ -320,7 +320,7 @@ static void omninet_write_bulk_callback (struct urb *urb, struct pt_regs *regs) | |||
320 | return; | 320 | return; |
321 | } | 321 | } |
322 | 322 | ||
323 | schedule_work(&port->work); | 323 | usb_serial_port_softint(port); |
324 | } | 324 | } |
325 | 325 | ||
326 | 326 | ||
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 5cf2b80add7a..759d36087184 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
@@ -365,8 +365,7 @@ static void option_outdat_callback(struct urb *urb, struct pt_regs *regs) | |||
365 | 365 | ||
366 | port = (struct usb_serial_port *) urb->context; | 366 | port = (struct usb_serial_port *) urb->context; |
367 | 367 | ||
368 | if (port->open_count) | 368 | usb_serial_port_softint(port); |
369 | schedule_work(&port->work); | ||
370 | } | 369 | } |
371 | 370 | ||
372 | static void option_instat_callback(struct urb *urb, struct pt_regs *regs) | 371 | static void option_instat_callback(struct urb *urb, struct pt_regs *regs) |
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index c96714bb1cb8..2ca6dd94796f 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c | |||
@@ -314,7 +314,7 @@ static void pl2303_send(struct usb_serial_port *port) | |||
314 | // TODO: reschedule pl2303_send | 314 | // TODO: reschedule pl2303_send |
315 | } | 315 | } |
316 | 316 | ||
317 | schedule_work(&port->work); | 317 | usb_serial_port_softint(port); |
318 | } | 318 | } |
319 | 319 | ||
320 | static int pl2303_write_room(struct usb_serial_port *port) | 320 | static int pl2303_write_room(struct usb_serial_port *port) |
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 92200f05b531..7a1cc1b04979 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
@@ -531,7 +531,17 @@ exit: | |||
531 | return -EINVAL; | 531 | return -EINVAL; |
532 | } | 532 | } |
533 | 533 | ||
534 | void usb_serial_port_softint(void *private) | 534 | /* |
535 | * We would be calling tty_wakeup here, but unfortunately some line | ||
536 | * disciplines have an annoying habit of calling tty->write from | ||
537 | * the write wakeup callback (e.g. n_hdlc.c). | ||
538 | */ | ||
539 | void usb_serial_port_softint(struct usb_serial_port *port) | ||
540 | { | ||
541 | schedule_work(&port->work); | ||
542 | } | ||
543 | |||
544 | static void usb_serial_port_work(void *private) | ||
535 | { | 545 | { |
536 | struct usb_serial_port *port = private; | 546 | struct usb_serial_port *port = private; |
537 | struct tty_struct *tty; | 547 | struct tty_struct *tty; |
@@ -794,7 +804,7 @@ int usb_serial_probe(struct usb_interface *interface, | |||
794 | port->serial = serial; | 804 | port->serial = serial; |
795 | spin_lock_init(&port->lock); | 805 | spin_lock_init(&port->lock); |
796 | mutex_init(&port->mutex); | 806 | mutex_init(&port->mutex); |
797 | INIT_WORK(&port->work, usb_serial_port_softint, port); | 807 | INIT_WORK(&port->work, usb_serial_port_work, port); |
798 | serial->port[i] = port; | 808 | serial->port[i] = port; |
799 | } | 809 | } |
800 | 810 | ||
diff --git a/drivers/usb/serial/usb-serial.h b/drivers/usb/serial/usb-serial.h index c07ece3fef1d..d53ea9b11e81 100644 --- a/drivers/usb/serial/usb-serial.h +++ b/drivers/usb/serial/usb-serial.h | |||
@@ -236,7 +236,7 @@ struct usb_serial_driver { | |||
236 | 236 | ||
237 | extern int usb_serial_register(struct usb_serial_driver *driver); | 237 | extern int usb_serial_register(struct usb_serial_driver *driver); |
238 | extern void usb_serial_deregister(struct usb_serial_driver *driver); | 238 | extern void usb_serial_deregister(struct usb_serial_driver *driver); |
239 | extern void usb_serial_port_softint(void *private); | 239 | extern void usb_serial_port_softint(struct usb_serial_port *port); |
240 | 240 | ||
241 | extern int usb_serial_probe(struct usb_interface *iface, const struct usb_device_id *id); | 241 | extern int usb_serial_probe(struct usb_interface *iface, const struct usb_device_id *id); |
242 | extern void usb_serial_disconnect(struct usb_interface *iface); | 242 | extern void usb_serial_disconnect(struct usb_interface *iface); |
diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c index f5c3841d4843..9e89b8d54f72 100644 --- a/drivers/usb/serial/visor.c +++ b/drivers/usb/serial/visor.c | |||
@@ -480,7 +480,7 @@ static void visor_write_bulk_callback (struct urb *urb, struct pt_regs *regs) | |||
480 | --priv->outstanding_urbs; | 480 | --priv->outstanding_urbs; |
481 | spin_unlock_irqrestore(&priv->lock, flags); | 481 | spin_unlock_irqrestore(&priv->lock, flags); |
482 | 482 | ||
483 | schedule_work(&port->work); | 483 | usb_serial_port_softint(port); |
484 | } | 484 | } |
485 | 485 | ||
486 | 486 | ||
diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c index f806553cd9a4..582860ac8764 100644 --- a/drivers/usb/serial/whiteheat.c +++ b/drivers/usb/serial/whiteheat.c | |||
@@ -1089,9 +1089,7 @@ static void whiteheat_write_callback(struct urb *urb, struct pt_regs *regs) | |||
1089 | return; | 1089 | return; |
1090 | } | 1090 | } |
1091 | 1091 | ||
1092 | usb_serial_port_softint((void *)port); | 1092 | usb_serial_port_softint(port); |
1093 | |||
1094 | schedule_work(&port->work); | ||
1095 | } | 1093 | } |
1096 | 1094 | ||
1097 | 1095 | ||