Skip to contentSkip to conversation

parport: serial: Get rid of IRQ_NONE abuse

PATCH In review Andy Shevchenko 2 participants 3 messages Jul 21, 2021 – Jul 29, 2021 Parallel port

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 parport: serial: Get rid of IRQ_NONE abuse

IRQ_NONE definition is solely for IRQ handlers and not for generic probe code. Replace it with plain integer.

---
 drivers/parport/parport_serial.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/parport/parport_serial.c +3 -2
index 96b888bb49c6..14e2427676f0 100644
@@ -607,11 +607,12 @@ static int parport_register(struct pci_dev *dev, const struct pci_device_id *id)
                                         def.) */
 		/* TODO: test if sharing interrupts works */
 		irq = dev->irq;
-		if (irq == IRQ_NONE) {
+		if (irq == 0)
+			irq = PARPORT_IRQ_NONE;
+		if (irq == PARPORT_IRQ_NONE) {
 			dev_dbg(&dev->dev,
 				"PCI parallel port detected: I/O at %#lx(%#lx)\n",
 				io_lo, io_hi);
-			irq = PARPORT_IRQ_NONE;
 		} else {
 			dev_dbg(&dev->dev,
 				"PCI parallel port detected: I/O at %#lx(%#lx), IRQ %d\n",
Signature · 1 line
2.30.2
#1 lore raw

PATCH 2/2 parport: serial: Retrieve IRQ vector with help of special getter

pci_irq_vector() may be used to retrieve IRQ vector for a PCI device. Use it instead of direct access.

---
 drivers/parport/parport_serial.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/parport/parport_serial.c +3 -1
index 14e2427676f0..9f5d784cd95d 100644
@@ -606,7 +606,9 @@ static int parport_register(struct pci_dev *dev, const struct pci_device_id *id)
                                         "hi" as an offset (see SYBA
                                         def.) */
 		/* TODO: test if sharing interrupts works */
-		irq = dev->irq;
+		irq = pci_irq_vector(dev, 0);
+		if (irq < 0)
+			return irq;
 		if (irq == 0)
 			irq = PARPORT_IRQ_NONE;
 		if (irq == PARPORT_IRQ_NONE) {
Signature · 1 line
2.30.2