Commit 13c61339 authored by Johan Hovold's avatar Johan Hovold

USB: serial: io_ti: add read-port-command helper

Add a read-port-command helper analogous to the send-port-command
helper to take care of the UART module id instead of open coding.
Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
parent 7a14fac0
...@@ -284,6 +284,14 @@ static int ti_vsend_sync(struct usb_device *dev, u8 request, u16 value, ...@@ -284,6 +284,14 @@ static int ti_vsend_sync(struct usb_device *dev, u8 request, u16 value,
return 0; return 0;
} }
static int read_port_cmd(struct usb_serial_port *port, u8 command, u16 value,
void *data, int size)
{
return ti_vread_sync(port->serial->dev, command, value,
UMPM_UART1_PORT + port->port_number,
data, size);
}
static int send_port_cmd(struct usb_serial_port *port, u8 command, u16 value, static int send_port_cmd(struct usb_serial_port *port, u8 command, u16 value,
void *data, int size) void *data, int size)
{ {
...@@ -1826,7 +1834,6 @@ static int edge_open(struct tty_struct *tty, struct usb_serial_port *port) ...@@ -1826,7 +1834,6 @@ static int edge_open(struct tty_struct *tty, struct usb_serial_port *port)
struct edgeport_serial *edge_serial; struct edgeport_serial *edge_serial;
struct usb_device *dev; struct usb_device *dev;
struct urb *urb; struct urb *urb;
int port_number;
int status; int status;
u16 open_settings; u16 open_settings;
u8 transaction_timeout; u8 transaction_timeout;
...@@ -1834,8 +1841,6 @@ static int edge_open(struct tty_struct *tty, struct usb_serial_port *port) ...@@ -1834,8 +1841,6 @@ static int edge_open(struct tty_struct *tty, struct usb_serial_port *port)
if (edge_port == NULL) if (edge_port == NULL)
return -ENODEV; return -ENODEV;
port_number = port->port_number;
dev = port->serial->dev; dev = port->serial->dev;
/* turn off loopback */ /* turn off loopback */
...@@ -1892,9 +1897,7 @@ static int edge_open(struct tty_struct *tty, struct usb_serial_port *port) ...@@ -1892,9 +1897,7 @@ static int edge_open(struct tty_struct *tty, struct usb_serial_port *port)
} }
/* Read Initial MSR */ /* Read Initial MSR */
status = ti_vread_sync(dev, UMPC_READ_MSR, 0, status = read_port_cmd(port, UMPC_READ_MSR, 0, &edge_port->shadow_msr, 1);
(__u16)(UMPM_UART1_PORT + port_number),
&edge_port->shadow_msr, 1);
if (status) { if (status) {
dev_err(&port->dev, "%s - cannot send read MSR command, %d\n", dev_err(&port->dev, "%s - cannot send read MSR command, %d\n",
__func__, status); __func__, status);
......
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