Commit 8e791974 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

usb serial drivers:

	- removed all usage of port->sem as the usb serial core now does this.
parent 5faeb88a
......@@ -207,8 +207,6 @@ static int belkin_sa_open (struct usb_serial_port *port, struct file *filp)
dbg(__FUNCTION__" port %d", port->number);
down (&port->sem);
++port->open_count;
if (port->open_count == 1) {
......@@ -230,8 +228,6 @@ static int belkin_sa_open (struct usb_serial_port *port, struct file *filp)
}
exit:
up (&port->sem);
return retval;
} /* belkin_sa_open */
......@@ -249,8 +245,6 @@ static void belkin_sa_close (struct usb_serial_port *port, struct file *filp)
dbg(__FUNCTION__" port %d", port->number);
down (&port->sem);
--port->open_count;
if (port->open_count <= 0) {
......@@ -262,8 +256,6 @@ static void belkin_sa_close (struct usb_serial_port *port, struct file *filp)
}
port->open_count = 0;
}
up (&port->sem);
} /* belkin_sa_close */
......
......@@ -151,8 +151,6 @@ static int cyberjack_open (struct usb_serial_port *port, struct file *filp)
dbg(__FUNCTION__ " - port %d", port->number);
down (&port->sem);
++port->open_count;
if (port->open_count == 1) {
......@@ -179,8 +177,6 @@ static int cyberjack_open (struct usb_serial_port *port, struct file *filp)
dbg(__FUNCTION__ " - usb_submit_urb(int urb)");
}
up (&port->sem);
return result;
}
......@@ -188,8 +184,6 @@ static void cyberjack_close (struct usb_serial_port *port, struct file *filp)
{
dbg(__FUNCTION__ " - port %d", port->number);
down (&port->sem);
--port->open_count;
if (port->open_count <= 0) {
......@@ -201,8 +195,6 @@ static void cyberjack_close (struct usb_serial_port *port, struct file *filp)
}
port->open_count = 0;
}
up (&port->sem);
}
static int cyberjack_write (struct usb_serial_port *port, int from_user, const unsigned char *buf, int count)
......@@ -225,8 +217,6 @@ static int cyberjack_write (struct usb_serial_port *port, int from_user, const u
return (0);
}
down (&port->sem);
if( (count+priv->wrfilled)>sizeof(priv->wrbuf) ) {
/* To much data for buffer. Reset buffer. */
priv->wrfilled=0;
......@@ -235,8 +225,9 @@ static int cyberjack_write (struct usb_serial_port *port, int from_user, const u
/* Copy data */
if (from_user) {
if (copy_from_user(priv->wrbuf+priv->wrfilled, buf, count))
if (copy_from_user(priv->wrbuf+priv->wrfilled, buf, count)) {
return -EFAULT;
}
} else {
memcpy (priv->wrbuf+priv->wrfilled, buf, count);
}
......@@ -277,7 +268,6 @@ static int cyberjack_write (struct usb_serial_port *port, int from_user, const u
/* Throw away data. No better idea what to do with it. */
priv->wrfilled=0;
priv->wrsent=0;
up (&port->sem);
return 0;
}
......@@ -292,7 +282,6 @@ static int cyberjack_write (struct usb_serial_port *port, int from_user, const u
}
}
up (&port->sem);
return (count);
}
......@@ -432,8 +421,6 @@ static void cyberjack_write_bulk_callback (struct urb *urb)
return;
}
down (&port->sem);
dbg(__FUNCTION__ " - transmitting data (frame n)");
length = ((priv->wrfilled - priv->wrsent) > port->bulk_out_size) ?
......@@ -459,7 +446,6 @@ static void cyberjack_write_bulk_callback (struct urb *urb)
/* Throw away data. No better idea what to do with it. */
priv->wrfilled=0;
priv->wrsent=0;
up (&port->sem);
queue_task(&port->tqueue, &tq_immediate);
mark_bh(IMMEDIATE_BH);
return;
......@@ -477,7 +463,6 @@ static void cyberjack_write_bulk_callback (struct urb *urb)
priv->wrsent=0;
}
up (&port->sem);
queue_task(&port->tqueue, &tq_immediate);
mark_bh(IMMEDIATE_BH);
return;
......
......@@ -157,8 +157,6 @@ static int empeg_open (struct usb_serial_port *port, struct file *filp)
dbg(__FUNCTION__ " - port %d", port->number);
down (&port->sem);
++port->open_count;
if (port->open_count == 1) {
......@@ -189,8 +187,6 @@ static int empeg_open (struct usb_serial_port *port, struct file *filp)
}
up (&port->sem);
return result;
}
......@@ -208,8 +204,6 @@ static void empeg_close (struct usb_serial_port *port, struct file * filp)
if (!serial)
return;
down (&port->sem);
--port->open_count;
if (port->open_count <= 0) {
......@@ -220,8 +214,6 @@ static void empeg_close (struct usb_serial_port *port, struct file * filp)
port->open_count = 0;
}
up (&port->sem);
/* Uncomment the following line if you want to see some statistics in your syslog */
/* info ("Bytes In = %d Bytes Out = %d", bytes_in, bytes_out); */
}
......@@ -462,15 +454,7 @@ static void empeg_read_bulk_callback (struct urb *urb)
static void empeg_throttle (struct usb_serial_port *port)
{
dbg(__FUNCTION__ " - port %d", port->number);
down (&port->sem);
usb_unlink_urb (port->read_urb);
up (&port->sem);
return;
}
......@@ -480,8 +464,6 @@ static void empeg_unthrottle (struct usb_serial_port *port)
dbg(__FUNCTION__ " - port %d", port->number);
down (&port->sem);
port->read_urb->dev = port->serial->dev;
result = usb_submit_urb(port->read_urb, GFP_KERNEL);
......@@ -489,10 +471,7 @@ static void empeg_unthrottle (struct usb_serial_port *port)
if (result)
err(__FUNCTION__ " - failed submitting read urb, error %d", result);
up (&port->sem);
return;
}
......
......@@ -319,8 +319,6 @@ static int ftdi_sio_open (struct usb_serial_port *port, struct file *filp)
dbg(__FUNCTION__);
down (&port->sem);
++port->open_count;
if (port->open_count == 1){
......@@ -361,7 +359,6 @@ static int ftdi_sio_open (struct usb_serial_port *port, struct file *filp)
err(__FUNCTION__ " - failed submitting read urb, error %d", result);
}
up (&port->sem);
return result;
} /* ftdi_sio_open */
......@@ -374,7 +371,6 @@ static void ftdi_sio_close (struct usb_serial_port *port, struct file *filp)
dbg( __FUNCTION__);
down (&port->sem);
--port->open_count;
if (port->open_count <= 0) {
......@@ -411,9 +407,6 @@ static void ftdi_sio_close (struct usb_serial_port *port, struct file *filp)
tty_hangup(port->tty);
}
}
up (&port->sem);
} /* ftdi_sio_close */
......@@ -447,8 +440,6 @@ static int ftdi_sio_write (struct usb_serial_port *port, int from_user,
return (0);
}
down(&port->sem);
count += data_offset;
count = (count > port->bulk_out_size) ? port->bulk_out_size : count;
......@@ -456,7 +447,6 @@ static int ftdi_sio_write (struct usb_serial_port *port, int from_user,
if (from_user) {
if (copy_from_user(port->write_urb->transfer_buffer + data_offset,
buf, count - data_offset )){
up (&port->sem);
return -EFAULT;
}
} else {
......@@ -482,14 +472,11 @@ static int ftdi_sio_write (struct usb_serial_port *port, int from_user,
result = usb_submit_urb(port->write_urb, GFP_KERNEL);
if (result) {
err(__FUNCTION__ " - failed submitting write urb, error %d", result);
up (&port->sem);
return 0;
}
up (&port->sem);
dbg(__FUNCTION__ " write returning: %d", count - data_offset);
return (count - data_offset);
} /* ftdi_sio_write */
static void ftdi_sio_write_bulk_callback (struct urb *urb)
......
......@@ -252,8 +252,6 @@ static int ir_open (struct usb_serial_port *port, struct file *filp)
dbg("%s - port %d", __FUNCTION__, port->number);
down (&port->sem);
++port->open_count;
if (port->open_count == 1) {
......@@ -293,9 +291,6 @@ static int ir_open (struct usb_serial_port *port, struct file *filp)
if (result)
err("%s - failed submitting read urb, error %d", __FUNCTION__, result);
}
up (&port->sem);
return result;
}
......@@ -312,8 +307,6 @@ static void ir_close (struct usb_serial_port *port, struct file * filp)
if (!serial)
return;
down (&port->sem);
--port->open_count;
if (port->open_count <= 0) {
......@@ -324,7 +317,6 @@ static void ir_close (struct usb_serial_port *port, struct file * filp)
port->open_count = 0;
}
up (&port->sem);
}
static int ir_write (struct usb_serial_port *port, int from_user, const unsigned char *buf, int count)
......
......@@ -861,10 +861,8 @@ static int keyspan_open (struct usb_serial_port *port, struct file *filp)
dbg("keyspan_open called for port%d.\n", port->number);
down (&port->sem);
already_active = port->open_count;
++port->open_count;
up (&port->sem);
if (already_active)
return 0;
......@@ -926,8 +924,6 @@ static void keyspan_close(struct usb_serial_port *port, struct file *filp)
p_priv->out_flip = 0;
p_priv->in_flip = 0;
down (&port->sem);
if (--port->open_count <= 0) {
if (serial->dev) {
/* Stop reading/writing urbs */
......@@ -941,7 +937,6 @@ static void keyspan_close(struct usb_serial_port *port, struct file *filp)
port->open_count = 0;
port->tty = 0;
}
up (&port->sem);
}
......
......@@ -662,8 +662,6 @@ static int keyspan_pda_open (struct usb_serial_port *port, struct file *filp)
int rc = 0;
struct keyspan_pda_private *priv;
down (&port->sem);
++port->open_count;
if (port->open_count == 1) {
......@@ -707,12 +705,9 @@ static int keyspan_pda_open (struct usb_serial_port *port, struct file *filp)
}
up (&port->sem);
return rc;
error:
--port->open_count;
up (&port->sem);
return rc;
}
......@@ -721,8 +716,6 @@ static void keyspan_pda_close(struct usb_serial_port *port, struct file *filp)
{
struct usb_serial *serial = port->serial;
down (&port->sem);
--port->open_count;
if (port->open_count <= 0) {
......@@ -737,8 +730,6 @@ static void keyspan_pda_close(struct usb_serial_port *port, struct file *filp)
}
port->open_count = 0;
}
up (&port->sem);
}
......
......@@ -358,8 +358,6 @@ static int klsi_105_open (struct usb_serial_port *port, struct file *filp)
dbg(__FUNCTION__" port %d", port->number);
down (&port->sem);
++port->open_count;
if (port->open_count == 1) {
......@@ -437,8 +435,6 @@ static int klsi_105_open (struct usb_serial_port *port, struct file *filp)
}
exit:
up (&port->sem);
return retval;
} /* klsi_105_open */
......@@ -455,8 +451,6 @@ static void klsi_105_close (struct usb_serial_port *port, struct file *filp)
if(!serial)
return;
down (&port->sem);
--port->open_count;
if (port->open_count <= 0) {
......@@ -482,8 +476,6 @@ static void klsi_105_close (struct usb_serial_port *port, struct file *filp)
port->open_count = 0;
info("kl5kusb105 port stats: %ld bytes in, %ld bytes out", priv->bytes_in, priv->bytes_out);
}
up (&port->sem);
} /* klsi_105_close */
......@@ -505,9 +497,6 @@ static int klsi_105_write (struct usb_serial_port *port, int from_user,
dbg(__FUNCTION__ " - port %d", port->number);
down (&port->sem); /* to lock against someone else trying to
take an URB we just selected from the pool */
while (count > 0) {
/* try to find a free urb (write 0 bytes if none) */
struct urb *urb = NULL;
......@@ -543,7 +532,6 @@ static int klsi_105_write (struct usb_serial_port *port, int from_user,
if (from_user) {
if (copy_from_user(urb->transfer_buffer
+ KLSI_105_DATA_OFFSET, buf, size)) {
up (&port->sem);
return -EFAULT;
}
} else {
......@@ -578,7 +566,6 @@ static int klsi_105_write (struct usb_serial_port *port, int from_user,
count -= size;
}
exit:
up (&port->sem);
priv->bytes_out+=bytes_sent;
return bytes_sent; /* that's how much we wrote */
......@@ -1021,34 +1008,21 @@ static int klsi_105_ioctl (struct usb_serial_port *port, struct file * file,
static void klsi_105_throttle (struct usb_serial_port *port)
{
dbg(__FUNCTION__ " - port %d", port->number);
down (&port->sem);
usb_unlink_urb (port->read_urb);
up (&port->sem);
return;
}
static void klsi_105_unthrottle (struct usb_serial_port *port)
{
int result;
dbg(__FUNCTION__ " - port %d", port->number);
down (&port->sem);
port->read_urb->dev = port->serial->dev;
result = usb_submit_urb(port->read_urb, GFP_KERNEL);
if (result)
err(__FUNCTION__ " - failed submitting read urb, error %d",
result);
up (&port->sem);
return;
}
......
......@@ -341,8 +341,6 @@ static int mct_u232_open (struct usb_serial_port *port, struct file *filp)
dbg(__FUNCTION__" port %d", port->number);
down (&port->sem);
++port->open_count;
if (port->open_count == 1) {
......@@ -398,8 +396,6 @@ static int mct_u232_open (struct usb_serial_port *port, struct file *filp)
}
exit:
up (&port->sem);
return 0;
} /* mct_u232_open */
......@@ -408,8 +404,6 @@ static void mct_u232_close (struct usb_serial_port *port, struct file *filp)
{
dbg(__FUNCTION__" port %d", port->number);
down (&port->sem);
--port->open_count;
if (port->open_count <= 0) {
......@@ -421,8 +415,6 @@ static void mct_u232_close (struct usb_serial_port *port, struct file *filp)
}
port->open_count = 0;
}
up (&port->sem);
} /* mct_u232_close */
......@@ -454,16 +446,12 @@ static int mct_u232_write (struct usb_serial_port *port, int from_user,
bytes_sent = 0;
while (count > 0) {
down (&port->sem);
size = (count > port->bulk_out_size) ? port->bulk_out_size : count;
usb_serial_debug_data (__FILE__, __FUNCTION__, size, buf);
if (from_user) {
if (copy_from_user(port->write_urb->transfer_buffer, buf, size)) {
up (&port->sem);
return -EFAULT;
}
}
......@@ -486,12 +474,9 @@ static int mct_u232_write (struct usb_serial_port *port, int from_user,
if (result) {
err(__FUNCTION__
" - failed submitting write urb, error %d", result);
up (&port->sem);
return result;
}
up (&port->sem);
bytes_sent += size;
if (write_blocking)
interruptible_sleep_on(&port->write_wait);
......
......@@ -157,8 +157,6 @@ static int omninet_open (struct usb_serial_port *port, struct file *filp)
if (!serial)
return -ENODEV;
down (&port->sem);
++port->open_count;
if (port->open_count == 1) {
......@@ -166,7 +164,6 @@ static int omninet_open (struct usb_serial_port *port, struct file *filp)
if( !od ) {
err(__FUNCTION__"- kmalloc(%Zd) failed.", sizeof(struct omninet_data));
port->open_count = 0;
up (&port->sem);
return -ENOMEM;
}
......@@ -184,8 +181,6 @@ static int omninet_open (struct usb_serial_port *port, struct file *filp)
err(__FUNCTION__ " - failed submitting read urb, error %d", result);
}
up (&port->sem);
return result;
}
......@@ -204,8 +199,6 @@ static void omninet_close (struct usb_serial_port *port, struct file * filp)
if (!serial)
return;
down (&port->sem);
--port->open_count;
if (port->open_count <= 0) {
......@@ -220,8 +213,6 @@ static void omninet_close (struct usb_serial_port *port, struct file * filp)
if (od)
kfree(od);
}
up (&port->sem);
}
......
......@@ -367,8 +367,6 @@ static int pl2303_open (struct usb_serial_port *port, struct file *filp)
dbg (__FUNCTION__ " - port %d", port->number);
down (&port->sem);
++port->open_count;
if (port->open_count == 1) {
......@@ -407,7 +405,6 @@ static int pl2303_open (struct usb_serial_port *port, struct file *filp)
result = usb_submit_urb (port->read_urb, GFP_KERNEL);
if (result) {
err(__FUNCTION__ " - failed submitting read urb, error %d", result);
up (&port->sem);
pl2303_close (port, NULL);
return -EPROTO;
}
......@@ -417,12 +414,10 @@ static int pl2303_open (struct usb_serial_port *port, struct file *filp)
result = usb_submit_urb (port->interrupt_in_urb, GFP_KERNEL);
if (result) {
err(__FUNCTION__ " - failed submitting interrupt urb, error %d", result);
up (&port->sem);
pl2303_close (port, NULL);
return -EPROTO;
}
}
up (&port->sem);
return 0;
}
......@@ -442,8 +437,6 @@ static void pl2303_close (struct usb_serial_port *port, struct file *filp)
dbg (__FUNCTION__ " - port %d", port->number);
down (&port->sem);
--port->open_count;
if (port->open_count <= 0) {
if (serial->dev) {
......@@ -478,8 +471,6 @@ static void pl2303_close (struct usb_serial_port *port, struct file *filp)
}
port->open_count = 0;
}
up (&port->sem);
}
static int set_modem_info (struct usb_serial_port *port, unsigned int cmd, unsigned int *value)
......
......@@ -306,8 +306,6 @@ static int whiteheat_open (struct usb_serial_port *port, struct file *filp)
dbg(__FUNCTION__" - port %d", port->number);
down (&port->sem);
++port->open_count;
if (port->open_count == 1) {
......@@ -354,16 +352,12 @@ static int whiteheat_open (struct usb_serial_port *port, struct file *filp)
}
dbg(__FUNCTION__ " - exit");
up (&port->sem);
return retval;
error_exit:
--port->open_count;
dbg(__FUNCTION__ " - error_exit");
up (&port->sem);
return retval;
}
......@@ -374,7 +368,6 @@ static void whiteheat_close(struct usb_serial_port *port, struct file * filp)
dbg(__FUNCTION__ " - port %d", port->number);
down (&port->sem);
--port->open_count;
if (port->open_count <= 0) {
......@@ -391,7 +384,6 @@ static void whiteheat_close(struct usb_serial_port *port, struct file * filp)
usb_unlink_urb (port->read_urb);
port->open_count = 0;
}
up (&port->sem);
}
......@@ -410,8 +402,6 @@ static void whiteheat_set_termios (struct usb_serial_port *port, struct termios
dbg(__FUNCTION__ " -port %d", port->number);
down (&port->sem);
if ((!port->tty) || (!port->tty->termios)) {
dbg(__FUNCTION__" - no tty structures");
goto exit;
......@@ -492,7 +482,6 @@ static void whiteheat_set_termios (struct usb_serial_port *port, struct termios
whiteheat_send_cmd (port->serial, WHITEHEAT_SETUP_PORT, (__u8 *)&port_settings, sizeof(port_settings));
exit:
up (&port->sem);
return;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment