USB: pl2303: make set_control_lines a port operation

Pass usb-serial port rather than usb device to set_control_lines, and
make sure port device is used for all port related debugging.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Johan Hovold 2013-03-21 12:36:22 +01:00 коммит произвёл Greg Kroah-Hartman
Родитель 7b5789a868
Коммит f45d0a5aa5
1 изменённых файлов: 6 добавлений и 5 удалений

Просмотреть файл

@ -248,14 +248,15 @@ static int pl2303_port_remove(struct usb_serial_port *port)
return 0; return 0;
} }
static int set_control_lines(struct usb_device *dev, u8 value) static int pl2303_set_control_lines(struct usb_serial_port *port, u8 value)
{ {
struct usb_device *dev = port->serial->dev;
int retval; int retval;
retval = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), retval = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
SET_CONTROL_REQUEST, SET_CONTROL_REQUEST_TYPE, SET_CONTROL_REQUEST, SET_CONTROL_REQUEST_TYPE,
value, 0, NULL, 0, 100); value, 0, NULL, 0, 100);
dev_dbg(&dev->dev, "%s - value = %d, retval = %d\n", __func__, dev_dbg(&port->dev, "%s - value = %d, retval = %d\n", __func__,
value, retval); value, retval);
return retval; return retval;
} }
@ -437,7 +438,7 @@ static void pl2303_set_termios(struct tty_struct *tty,
if (control != priv->line_control) { if (control != priv->line_control) {
control = priv->line_control; control = priv->line_control;
spin_unlock_irqrestore(&priv->lock, flags); spin_unlock_irqrestore(&priv->lock, flags);
set_control_lines(serial->dev, control); pl2303_set_control_lines(port, control);
} else { } else {
spin_unlock_irqrestore(&priv->lock, flags); spin_unlock_irqrestore(&priv->lock, flags);
} }
@ -480,7 +481,7 @@ static void pl2303_dtr_rts(struct usb_serial_port *port, int on)
priv->line_control &= ~(CONTROL_DTR | CONTROL_RTS); priv->line_control &= ~(CONTROL_DTR | CONTROL_RTS);
control = priv->line_control; control = priv->line_control;
spin_unlock_irqrestore(&priv->lock, flags); spin_unlock_irqrestore(&priv->lock, flags);
set_control_lines(port->serial->dev, control); pl2303_set_control_lines(port, control);
} }
static void pl2303_close(struct usb_serial_port *port) static void pl2303_close(struct usb_serial_port *port)
@ -550,7 +551,7 @@ static int pl2303_tiocmset(struct tty_struct *tty,
mutex_lock(&serial->disc_mutex); mutex_lock(&serial->disc_mutex);
if (!serial->disconnected) if (!serial->disconnected)
ret = set_control_lines(serial->dev, control); ret = pl2303_set_control_lines(port, control);
else else
ret = -ENODEV; ret = -ENODEV;
mutex_unlock(&serial->disc_mutex); mutex_unlock(&serial->disc_mutex);