Re: [PATCH] tty: serial: jsm: hold port lock when reporting modem line changes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10. 07. 21, 16:05, Zheyu Ma wrote:
uart_handle_dcd_change() requires a port lock to be held and will emit a
warning when lockdep is enabled.

Please attach an excerpt from the warning to the commit log.

Held corresponding lock to fix warnings.

Signed-off-by: Zheyu Ma <zheyuma97@xxxxxxxxx>
---
  drivers/tty/serial/jsm/jsm_neo.c | 2 ++
  drivers/tty/serial/jsm/jsm_tty.c | 3 +++
  2 files changed, 5 insertions(+)

diff --git a/drivers/tty/serial/jsm/jsm_neo.c b/drivers/tty/serial/jsm/jsm_neo.c
index bf0e2a4cb0ce..c6f927a76c3b 100644
--- a/drivers/tty/serial/jsm/jsm_neo.c
+++ b/drivers/tty/serial/jsm/jsm_neo.c
@@ -815,7 +815,9 @@ static void neo_parse_isr(struct jsm_board *brd, u32 port)
  		/* Parse any modem signal changes */
  		jsm_dbg(INTR, &ch->ch_bd->pci_dev,
  			"MOD_STAT: sending to parse_modem_sigs\n");
+		spin_lock_irqsave(&ch->uart_port.lock, lock_flags);
  		neo_parse_modem(ch, readb(&ch->ch_neo_uart->msr));
+		spin_unlock_irqrestore(&ch->uart_port.lock, lock_flags);
  	}
  }
diff --git a/drivers/tty/serial/jsm/jsm_tty.c b/drivers/tty/serial/jsm/jsm_tty.c
index 8e42a7682c63..d74cbbbf33c6 100644
--- a/drivers/tty/serial/jsm/jsm_tty.c
+++ b/drivers/tty/serial/jsm/jsm_tty.c
@@ -187,6 +187,7 @@ static void jsm_tty_break(struct uart_port *port, int break_state)
static int jsm_tty_open(struct uart_port *port)
  {
+	unsigned long lock_flags;
  	struct jsm_board *brd;
  	struct jsm_channel *channel =
  		container_of(port, struct jsm_channel, uart_port);
@@ -240,6 +241,7 @@ static int jsm_tty_open(struct uart_port *port)
  	channel->ch_cached_lsr = 0;
  	channel->ch_stops_sent = 0;
+ spin_lock_irqsave(&port->lock, lock_flags);
  	termios = &port->state->port.tty->termios;
  	channel->ch_c_cflag	= termios->c_cflag;
  	channel->ch_c_iflag	= termios->c_iflag;
@@ -259,6 +261,7 @@ static int jsm_tty_open(struct uart_port *port)
  	jsm_carrier(channel);
channel->ch_open_count++;
+	spin_unlock_irqrestore(&port->lock, lock_flags);
jsm_dbg(OPEN, &channel->ch_bd->pci_dev, "finish\n");
  	return 0;



--
js
suse labs



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux