Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 267613
b: refs/heads/master
c: fa2d8bb
h: refs/heads/master
i:
  267611: 3b874c5
v: v3
  • Loading branch information
Alexey Khoroshilov authored and Greg Kroah-Hartman committed Aug 23, 2011
1 parent 6133005 commit b3f41d5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 21 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: eb93ca4e83ecf06a94a36571be730a98177c8e14
refs/heads/master: fa2d8bbb6360ec4bf831802e925d9db06d3c9649
34 changes: 14 additions & 20 deletions trunk/drivers/staging/serqt_usb2/serqt_usb2.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ struct quatech_port {

struct usb_serial_port *port; /* owner of this object */
struct qt_get_device_data DeviceData;
spinlock_t lock;
struct mutex lock;
bool read_urb_busy;
int RxHolding;
int ReadBulkStopped;
Expand Down Expand Up @@ -745,7 +745,7 @@ static int qt_startup(struct usb_serial *serial)
}
return -ENOMEM;
}
spin_lock_init(&qt_port->lock);
mutex_init(&qt_port->lock);

usb_set_serial_port_data(port, qt_port);

Expand Down Expand Up @@ -1160,7 +1160,6 @@ static int qt_write_room(struct tty_struct *tty)
struct usb_serial_port *port = tty->driver_data;
struct usb_serial *serial;
struct quatech_port *qt_port;
unsigned long flags;

int retval = -EINVAL;

Expand All @@ -1176,7 +1175,7 @@ static int qt_write_room(struct tty_struct *tty)

qt_port = qt_get_port_private(port);

spin_lock_irqsave(&qt_port->lock, flags);
mutex_lock(&qt_port->lock);

dbg("%s - port %d\n", __func__, port->number);

Expand All @@ -1185,7 +1184,7 @@ static int qt_write_room(struct tty_struct *tty)
retval = port->bulk_out_size;
}

spin_unlock_irqrestore(&qt_port->lock, flags);
mutex_unlock(&qt_port->lock);
return retval;

}
Expand Down Expand Up @@ -1358,7 +1357,6 @@ static void qt_break(struct tty_struct *tty, int break_state)
struct quatech_port *qt_port;
u16 index, onoff;
unsigned int result;
unsigned long flags;

index = tty->index - serial->minor;

Expand All @@ -1369,15 +1367,15 @@ static void qt_break(struct tty_struct *tty, int break_state)
else
onoff = 0;

spin_lock_irqsave(&qt_port->lock, flags);
mutex_lock(&qt_port->lock);

dbg("%s - port %d\n", __func__, port->number);

result =
usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
QT_BREAK_CONTROL, 0x40, onoff, index, NULL, 0, 300);

spin_unlock_irqrestore(&qt_port->lock, flags);
mutex_unlock(&qt_port->lock);
}

static inline int qt_real_tiocmget(struct tty_struct *tty,
Expand Down Expand Up @@ -1466,21 +1464,20 @@ static int qt_tiocmget(struct tty_struct *tty)
struct usb_serial *serial = get_usb_serial(port, __func__);
struct quatech_port *qt_port = qt_get_port_private(port);
int retval = -ENODEV;
unsigned long flags;

dbg("In %s\n", __func__);

if (!serial)
return -ENODEV;

spin_lock_irqsave(&qt_port->lock, flags);
mutex_lock(&qt_port->lock);

dbg("%s - port %d\n", __func__, port->number);
dbg("%s - port->RxHolding = %d\n", __func__, qt_port->RxHolding);

retval = qt_real_tiocmget(tty, port, serial);

spin_unlock_irqrestore(&qt_port->lock, flags);
mutex_unlock(&qt_port->lock);
return retval;
}

Expand All @@ -1491,22 +1488,21 @@ static int qt_tiocmset(struct tty_struct *tty,
struct usb_serial_port *port = tty->driver_data;
struct usb_serial *serial = get_usb_serial(port, __func__);
struct quatech_port *qt_port = qt_get_port_private(port);
unsigned long flags;
int retval = -ENODEV;

dbg("In %s\n", __func__);

if (!serial)
return -ENODEV;

spin_lock_irqsave(&qt_port->lock, flags);
mutex_lock(&qt_port->lock);

dbg("%s - port %d\n", __func__, port->number);
dbg("%s - qt_port->RxHolding = %d\n", __func__, qt_port->RxHolding);

retval = qt_real_tiocmset(tty, port, serial, set);

spin_unlock_irqrestore(&qt_port->lock, flags);
mutex_unlock(&qt_port->lock);
return retval;
}

Expand All @@ -1515,7 +1511,6 @@ static void qt_throttle(struct tty_struct *tty)
struct usb_serial_port *port = tty->driver_data;
struct usb_serial *serial = get_usb_serial(port, __func__);
struct quatech_port *qt_port;
unsigned long flags;

dbg("%s - port %d\n", __func__, port->number);

Expand All @@ -1524,13 +1519,13 @@ static void qt_throttle(struct tty_struct *tty)

qt_port = qt_get_port_private(port);

spin_lock_irqsave(&qt_port->lock, flags);
mutex_lock(&qt_port->lock);

/* pass on to the driver specific version of this function */
qt_port->RxHolding = 1;
dbg("%s - port->RxHolding = 1\n", __func__);

spin_unlock_irqrestore(&qt_port->lock, flags);
mutex_unlock(&qt_port->lock);
return;
}

Expand All @@ -1539,15 +1534,14 @@ static void qt_unthrottle(struct tty_struct *tty)
struct usb_serial_port *port = tty->driver_data;
struct usb_serial *serial = get_usb_serial(port, __func__);
struct quatech_port *qt_port;
unsigned long flags;
unsigned int result;

if (!serial)
return;

qt_port = qt_get_port_private(port);

spin_lock_irqsave(&qt_port->lock, flags);
mutex_lock(&qt_port->lock);

dbg("%s - port %d\n", __func__, port->number);

Expand All @@ -1573,7 +1567,7 @@ static void qt_unthrottle(struct tty_struct *tty)
__func__, result);
}
}
spin_unlock_irqrestore(&qt_port->lock, flags);
mutex_unlock(&qt_port->lock);
return;

}
Expand Down

0 comments on commit b3f41d5

Please sign in to comment.