Skip to content

Commit 067814c

Browse files
committed
USB: serial: mos7840: drop port open flag
Drop the redundant port open flag and corresponding checks. USB serial core will not call any of these driver callbacks for a closed port, and the write URBs are stopped at close(). Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Johan Hovold <johan@kernel.org>
1 parent f8e8dca commit 067814c

File tree

1 file changed

+1
-28
lines changed

1 file changed

+1
-28
lines changed

drivers/usb/serial/mos7840.c

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,6 @@ struct moschip_port {
198198
struct urb *read_urb; /* read URB for this port */
199199
__u8 shadowLCR; /* last LCR value received */
200200
__u8 shadowMCR; /* last MCR value received */
201-
char open;
202201
struct usb_serial_port *port; /* loop back to the owner of this object */
203202

204203
/* Offsets */
@@ -497,8 +496,7 @@ static void mos7840_bulk_out_data_callback(struct urb *urb)
497496
return;
498497
}
499498

500-
if (mos7840_port->open)
501-
tty_port_tty_wakeup(&port->port);
499+
tty_port_tty_wakeup(&port->port);
502500

503501
}
504502

@@ -714,9 +712,6 @@ static int mos7840_open(struct tty_struct *tty, struct usb_serial_port *port)
714712
/* initialize our port settings */
715713
/* Must set to enable ints! */
716714
mos7840_port->shadowMCR = MCR_MASTER_IE;
717-
/* send a open port command */
718-
mos7840_port->open = 1;
719-
/* mos7840_change_port_settings(mos7840_port,old_termios); */
720715

721716
return 0;
722717
err:
@@ -791,8 +786,6 @@ static void mos7840_close(struct usb_serial_port *port)
791786

792787
Data = 0x00;
793788
mos7840_set_uart_reg(port, INTERRUPT_ENABLE_REGISTER, Data);
794-
795-
mos7840_port->open = 0;
796789
}
797790

798791
/*****************************************************************************
@@ -951,11 +944,6 @@ static void mos7840_throttle(struct tty_struct *tty)
951944
struct moschip_port *mos7840_port = usb_get_serial_port_data(port);
952945
int status;
953946

954-
if (!mos7840_port->open) {
955-
dev_dbg(&port->dev, "%s", "port not opened\n");
956-
return;
957-
}
958-
959947
/* if we are implementing XON/XOFF, send the stop character */
960948
if (I_IXOFF(tty)) {
961949
unsigned char stop_char = STOP_CHAR(tty);
@@ -985,11 +973,6 @@ static void mos7840_unthrottle(struct tty_struct *tty)
985973
struct moschip_port *mos7840_port = usb_get_serial_port_data(port);
986974
int status;
987975

988-
if (!mos7840_port->open) {
989-
dev_dbg(&port->dev, "%s - port not opened\n", __func__);
990-
return;
991-
}
992-
993976
/* if we are implementing XON/XOFF, send the start character */
994977
if (I_IXOFF(tty)) {
995978
unsigned char start_char = START_CHAR(tty);
@@ -1221,11 +1204,6 @@ static void mos7840_change_port_settings(struct tty_struct *tty,
12211204
int status;
12221205
__u16 Data;
12231206

1224-
if (!mos7840_port->open) {
1225-
dev_dbg(&port->dev, "%s - port not opened\n", __func__);
1226-
return;
1227-
}
1228-
12291207
lData = LCR_BITS_8;
12301208
lStop = LCR_STOP_1;
12311209
lParity = LCR_PAR_NONE;
@@ -1362,11 +1340,6 @@ static void mos7840_set_termios(struct tty_struct *tty,
13621340
struct moschip_port *mos7840_port = usb_get_serial_port_data(port);
13631341
int status;
13641342

1365-
if (!mos7840_port->open) {
1366-
dev_dbg(&port->dev, "%s - port not opened\n", __func__);
1367-
return;
1368-
}
1369-
13701343
/* change the port settings to the new ones specified */
13711344

13721345
mos7840_change_port_settings(tty, mos7840_port, old_termios);

0 commit comments

Comments
 (0)