Skip to contentSkip to conversation

serial: 8250_pci: Remove empty stub pci_quatech_exit()

PATCH In review Andy Shevchenko 2 participants 4 messages Oct 25, 2021 TTY layer and serial drivers

lore
Share & tools
lore
#1 lore raw

PATCH 2/2 serial: 8250_port: properly handle runtime PM in IRQ

In reply to Andy Shevchenko

We can't and basically don't need to call runtime PM in IRQ handler. If IRQ is ours, device must be powered on. Otherwise check if the device is powered off and return immediately.

---
 drivers/tty/serial/8250/8250_port.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
drivers/tty/serial/8250/8250_port.c +9 -7
index 5775cbff8f6e..89387d86d495 100644
@@ -1939,17 +1939,19 @@ EXPORT_SYMBOL_GPL(serial8250_handle_irq);
 
 static int serial8250_default_handle_irq(struct uart_port *port)
 {
-	struct uart_8250_port *up = up_to_u8250p(port);
 	unsigned int iir;
-	int ret;
 
-	serial8250_rpm_get(up);
+	/*
+	 * The IRQ might be shared with other peripherals so we must first
+	 * check that are we RPM suspended or not. If we are we assume that
+	 * the IRQ was not for us (we shouldn't be RPM suspended when the
+	 * interrupt is enabled).
+	 */
+	if (pm_runtime_suspended(port->dev))
+		return 0;
 
 	iir = serial_port_in(port, UART_IIR);
-	ret = serial8250_handle_irq(port, iir);
-
-	serial8250_rpm_put(up);
-	return ret;
+	return serial8250_handle_irq(port, iir);
 }
 
 /*
Signature · 1 line
2.33.0
#0 lore raw

PATCH 1/2 serial: 8250_pci: Remove empty stub pci_quatech_exit()

The ->exit() callback is checked for presence anyway, no need to have an empty stub.

---
 drivers/tty/serial/8250/8250_pci.c | 5 -----
 1 file changed, 5 deletions(-)
drivers/tty/serial/8250/8250_pci.c +0 -5
index 1d5579143fc8..80ac3235ec35 100644
@@ -1298,10 +1298,6 @@ static int pci_quatech_setup(struct serial_private *priv,
 	return pci_default_setup(priv, board, port, idx);
 }
 
-static void pci_quatech_exit(struct pci_dev *dev)
-{
-}
-
 static int pci_default_setup(struct serial_private *priv,
 		  const struct pciserial_board *board,
 		  struct uart_8250_port *port, int idx)
@@ -2176,7 +2172,6 @@ static struct pci_serial_quirk pci_serial_quirks[] = {
 		.subdevice	= PCI_ANY_ID,
 		.init		= pci_quatech_init,
 		.setup		= pci_quatech_setup,
-		.exit		= pci_quatech_exit,
 	},
 	/*
 	 * Panacom
Signature · 1 line
2.33.0
#3 lore raw
Quoted 3 lines · Andy Shevchenko

The ->exit() callback is checked for presence anyway, no need to have an empty stub.

Sorry, wrong set, please ignore both patches.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#2 lore raw

Re: [PATCH v1 2/2] serial: 8250_port: properly handle runtime PM in IRQ

In reply to Andy Shevchenko
Quoted 4 lines · Andy Shevchenko

We can't and basically don't need to call runtime PM in IRQ handler. If IRQ is ours, device must be powered on. Otherwise check if the device is powered off and return immediately.

Please, ignore.

Signature · 2 lines
With Best Regards,
Andy Shevchenko