mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-09 23:39:18 +00:00
[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>
This commit is contained in:
parent
ad93375a30
commit
cf2c7481d2
@ -469,7 +469,7 @@ static void cyberjack_write_bulk_callback (struct urb *urb, struct pt_regs *regs
|
|||||||
|
|
||||||
exit:
|
exit:
|
||||||
spin_unlock(&priv->lock);
|
spin_unlock(&priv->lock);
|
||||||
schedule_work(&port->work);
|
usb_serial_port_softint(port);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __init cyberjack_init (void)
|
static int __init cyberjack_init (void)
|
||||||
|
@ -824,7 +824,7 @@ send:
|
|||||||
priv->bytes_out += count; /* do not count the line control and size bytes */
|
priv->bytes_out += count; /* do not count the line control and size bytes */
|
||||||
spin_unlock_irqrestore(&priv->lock, flags);
|
spin_unlock_irqrestore(&priv->lock, flags);
|
||||||
|
|
||||||
schedule_work(&port->work);
|
usb_serial_port_softint(port);
|
||||||
} /* cypress_send */
|
} /* cypress_send */
|
||||||
|
|
||||||
|
|
||||||
|
@ -335,7 +335,7 @@ static void empeg_write_bulk_callback (struct urb *urb, struct pt_regs *regs)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
schedule_work(&port->work);
|
usb_serial_port_softint(port);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1472,7 +1472,7 @@ static void ftdi_write_bulk_callback (struct urb *urb, struct pt_regs *regs)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
schedule_work(&port->work);
|
usb_serial_port_softint(port);
|
||||||
} /* ftdi_write_bulk_callback */
|
} /* ftdi_write_bulk_callback */
|
||||||
|
|
||||||
|
|
||||||
|
@ -1012,7 +1012,7 @@ static void garmin_write_bulk_callback (struct urb *urb, struct pt_regs *regs)
|
|||||||
garmin_data_p->flags |= CLEAR_HALT_REQUIRED;
|
garmin_data_p->flags |= CLEAR_HALT_REQUIRED;
|
||||||
}
|
}
|
||||||
|
|
||||||
schedule_work(&port->work);
|
usb_serial_port_softint(port);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -299,9 +299,7 @@ void usb_serial_generic_write_bulk_callback (struct urb *urb, struct pt_regs *re
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
usb_serial_port_softint((void *)port);
|
usb_serial_port_softint(port);
|
||||||
|
|
||||||
schedule_work(&port->work);
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(usb_serial_generic_write_bulk_callback);
|
EXPORT_SYMBOL_GPL(usb_serial_generic_write_bulk_callback);
|
||||||
|
|
||||||
|
@ -870,7 +870,7 @@ static void ipaq_write_bulk_callback(struct urb *urb, struct pt_regs *regs)
|
|||||||
spin_unlock_irqrestore(&write_list_lock, flags);
|
spin_unlock_irqrestore(&write_list_lock, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
schedule_work(&port->work);
|
usb_serial_port_softint(port);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ipaq_write_room(struct usb_serial_port *port)
|
static int ipaq_write_room(struct usb_serial_port *port)
|
||||||
|
@ -376,7 +376,7 @@ static void ipw_write_bulk_callback(struct urb *urb, struct pt_regs *regs)
|
|||||||
if (urb->status)
|
if (urb->status)
|
||||||
dbg("%s - nonzero write bulk status received: %d", __FUNCTION__, urb->status);
|
dbg("%s - nonzero write bulk status received: %d", __FUNCTION__, urb->status);
|
||||||
|
|
||||||
schedule_work(&port->work);
|
usb_serial_port_softint(port);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ipw_write(struct usb_serial_port *port, const unsigned char *buf, int count)
|
static int ipw_write(struct usb_serial_port *port, const unsigned char *buf, int count)
|
||||||
|
@ -408,7 +408,7 @@ static void ir_write_bulk_callback (struct urb *urb, struct pt_regs *regs)
|
|||||||
urb->actual_length,
|
urb->actual_length,
|
||||||
urb->transfer_buffer);
|
urb->transfer_buffer);
|
||||||
|
|
||||||
schedule_work(&port->work);
|
usb_serial_port_softint(port);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ir_read_bulk_callback (struct urb *urb, struct pt_regs *regs)
|
static void ir_read_bulk_callback (struct urb *urb, struct pt_regs *regs)
|
||||||
|
@ -481,7 +481,7 @@ static void usa2x_outdat_callback(struct urb *urb, struct pt_regs *regs)
|
|||||||
dbg ("%s - urb %d", __FUNCTION__, urb == p_priv->out_urbs[1]);
|
dbg ("%s - urb %d", __FUNCTION__, urb == p_priv->out_urbs[1]);
|
||||||
|
|
||||||
if (port->open_count)
|
if (port->open_count)
|
||||||
schedule_work(&port->work);
|
usb_serial_port_softint(port);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void usa26_inack_callback(struct urb *urb, struct pt_regs *regs)
|
static void usa26_inack_callback(struct urb *urb, struct pt_regs *regs)
|
||||||
|
@ -569,8 +569,7 @@ static void klsi_105_write_bulk_callback ( struct urb *urb, struct pt_regs *regs
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* from generic_write_bulk_callback */
|
usb_serial_port_softint(port);
|
||||||
schedule_work(&port->work);
|
|
||||||
} /* klsi_105_write_bulk_completion_callback */
|
} /* klsi_105_write_bulk_completion_callback */
|
||||||
|
|
||||||
|
|
||||||
|
@ -320,7 +320,7 @@ static void omninet_write_bulk_callback (struct urb *urb, struct pt_regs *regs)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
schedule_work(&port->work);
|
usb_serial_port_softint(port);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -365,8 +365,7 @@ static void option_outdat_callback(struct urb *urb, struct pt_regs *regs)
|
|||||||
|
|
||||||
port = (struct usb_serial_port *) urb->context;
|
port = (struct usb_serial_port *) urb->context;
|
||||||
|
|
||||||
if (port->open_count)
|
usb_serial_port_softint(port);
|
||||||
schedule_work(&port->work);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void option_instat_callback(struct urb *urb, struct pt_regs *regs)
|
static void option_instat_callback(struct urb *urb, struct pt_regs *regs)
|
||||||
|
@ -314,7 +314,7 @@ static void pl2303_send(struct usb_serial_port *port)
|
|||||||
// TODO: reschedule pl2303_send
|
// TODO: reschedule pl2303_send
|
||||||
}
|
}
|
||||||
|
|
||||||
schedule_work(&port->work);
|
usb_serial_port_softint(port);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pl2303_write_room(struct usb_serial_port *port)
|
static int pl2303_write_room(struct usb_serial_port *port)
|
||||||
|
@ -531,7 +531,17 @@ exit:
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void usb_serial_port_softint(void *private)
|
/*
|
||||||
|
* We would be calling tty_wakeup here, but unfortunately some line
|
||||||
|
* disciplines have an annoying habit of calling tty->write from
|
||||||
|
* the write wakeup callback (e.g. n_hdlc.c).
|
||||||
|
*/
|
||||||
|
void usb_serial_port_softint(struct usb_serial_port *port)
|
||||||
|
{
|
||||||
|
schedule_work(&port->work);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void usb_serial_port_work(void *private)
|
||||||
{
|
{
|
||||||
struct usb_serial_port *port = private;
|
struct usb_serial_port *port = private;
|
||||||
struct tty_struct *tty;
|
struct tty_struct *tty;
|
||||||
@ -794,7 +804,7 @@ int usb_serial_probe(struct usb_interface *interface,
|
|||||||
port->serial = serial;
|
port->serial = serial;
|
||||||
spin_lock_init(&port->lock);
|
spin_lock_init(&port->lock);
|
||||||
mutex_init(&port->mutex);
|
mutex_init(&port->mutex);
|
||||||
INIT_WORK(&port->work, usb_serial_port_softint, port);
|
INIT_WORK(&port->work, usb_serial_port_work, port);
|
||||||
serial->port[i] = port;
|
serial->port[i] = port;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -236,7 +236,7 @@ struct usb_serial_driver {
|
|||||||
|
|
||||||
extern int usb_serial_register(struct usb_serial_driver *driver);
|
extern int usb_serial_register(struct usb_serial_driver *driver);
|
||||||
extern void usb_serial_deregister(struct usb_serial_driver *driver);
|
extern void usb_serial_deregister(struct usb_serial_driver *driver);
|
||||||
extern void usb_serial_port_softint(void *private);
|
extern void usb_serial_port_softint(struct usb_serial_port *port);
|
||||||
|
|
||||||
extern int usb_serial_probe(struct usb_interface *iface, const struct usb_device_id *id);
|
extern int usb_serial_probe(struct usb_interface *iface, const struct usb_device_id *id);
|
||||||
extern void usb_serial_disconnect(struct usb_interface *iface);
|
extern void usb_serial_disconnect(struct usb_interface *iface);
|
||||||
|
@ -480,7 +480,7 @@ static void visor_write_bulk_callback (struct urb *urb, struct pt_regs *regs)
|
|||||||
--priv->outstanding_urbs;
|
--priv->outstanding_urbs;
|
||||||
spin_unlock_irqrestore(&priv->lock, flags);
|
spin_unlock_irqrestore(&priv->lock, flags);
|
||||||
|
|
||||||
schedule_work(&port->work);
|
usb_serial_port_softint(port);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1089,9 +1089,7 @@ static void whiteheat_write_callback(struct urb *urb, struct pt_regs *regs)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
usb_serial_port_softint((void *)port);
|
usb_serial_port_softint(port);
|
||||||
|
|
||||||
schedule_work(&port->work);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user