Subject: [patch 04/12] USB: serial: digi_acceleport: Remove in_interrupt() usage

From: Thomas Gleixner <[email-masked]>
Date: Wed, 14 Oct 2020 16:52:19 +0200

From: Ahmed S. Darwish <[email-masked]>

The usage of in_interrupt() in drivers is phased out and Linus clearly
requested that code which changes behaviour depending on context should
either be separated or the context be conveyed in an argument passed by the
caller, which usually knows the context.

The debug printk() in digi_write() prints in_interrupt() as context
information. TTY writes happen always in preemptible task context and
console writes can happen from almost any context, so in_interrupt() is not
really helpful.

Aside of that issuing a printk() from a console->write() callback is not a
really brilliant idea for obvious reasons.

Remove the in_interrupt() printout and make the printk() depend on tty.

Signed-off-by: Ahmed S. Darwish <[email-masked]>
Signed-off-by: Sebastian Andrzej Siewior <[email-masked]>
Signed-off-by: Thomas Gleixner <[email-masked]>
Cc: Johan Hovold <[email-masked]>
Cc: Greg Kroah-Hartman <[email-masked]>
Cc: [email-masked]

---
 drivers/usb/serial/digi_acceleport.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

--- a/drivers/usb/serial/digi_acceleport.c
+++ b/drivers/usb/serial/digi_acceleport.c
@@ -911,9 +911,10 @@ static int digi_write(struct tty_struct
 	unsigned char *data = port->write_urb->transfer_buffer;
 	unsigned long flags = 0;
 
-	dev_dbg(&port->dev,
-		"digi_write: TOP: port=%d, count=%d, in_interrupt=%ld\n",
-		priv->dp_port_num, count, in_interrupt());
+	if (tty) {
+		dev_dbg(&port->dev, "digi_write: TOP: port=%d, count=%d\n",
+			priv->dp_port_num, count);
+	}
 
 	/* copy user data (which can sleep) before getting spin lock */
 	count = min(count, port->bulk_out_size-2);

_______________________________________________
linux-arm-kernel mailing list
[email-masked]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel