parport: Use the PCI IRQ if offered
PATCH 1/1 parport: Use the PCI IRQ if offered
PCI parallel port devices can IRQ share so we should stop them hogging the line and making a mess on modern PC systems. We know the sharing side works as the PCMCIA driver has shared the parallel port IRQ for some time.
---
drivers/parport/parport_cs.c | 3 +- drivers/parport/parport_pc.c | 57 ++++++++++++++++++++++++-------------- drivers/parport/parport_serial.c | 20 +++++++++++-- include/linux/parport_pc.h | 11 ++++--- 4 files changed, 60 insertions(+), 31 deletions(-)
drivers/parport/parport_cs.c +2 -1
@@ -43,6 +43,7 @@#include <linux/timer.h> #include <linux/ioport.h> #include <linux/major.h> +#include <linux/interrupt.h> #include <linux/parport.h> #include <linux/parport_pc.h>
@@ -192,7 +193,7 @@ static int parport_config(struct pcmcia_device *link) p =parport_pc_probe_port (link->io.BasePort1, link->io.BasePort2, link->irq.AssignedIRQ,PARPORT_DMA_NONE , - &link->dev); + &link->dev,IRQF_SHARED );if (p ==NULL ) { printk(KERN_NOTICE "parport_cs: parport_pc_probe_port() at " "0x%3x, irq %u failed\n", link->io.BasePort1,
drivers/parport/parport_pc.c +36 -21
123 lines not on this page · raw message
drivers/parport/parport_serial.c +16 -4
@@ -21,6 +21,7 @@#include <linux/module.h> #include <linux/init.h> #include <linux/pci.h> +#include <linux/interrupt.h> #include <linux/parport.h> #include <linux/parport_pc.h> #include <linux/8250_pci.h>
@@ -311,6 +312,7 @@ static int __devinit parport_register (struct pci_dev *dev,int lo = card->addr[n].lo;int hi = card->addr[n].hi;unsigned long io_lo, io_hi; +int irq;if (priv->num_par ==ARRAY_SIZE (priv->port)) { printk (KERN_WARNING
@@ -329,10 +331,20 @@ static int __devinit parport_register (struct pci_dev *dev,"hi" as an offset (see SYBA def.) */ /* TODO: test if sharing interrupts works */ -dev_dbg (&dev->dev,"PCI parallel port detected: I/O at " -"%#lx(%#lx)\n" , io_lo, io_hi); - port =parport_pc_probe_port (io_lo, io_hi,PARPORT_IRQ_NONE , -PARPORT_DMA_NONE , &dev->dev); + irq = dev->irq; +if (irq ==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" , + io_lo, io_hi, irq); + irq =PARPORT_IRQ_NONE ; + } + port =parport_pc_probe_port (io_lo, io_hi, irq, +PARPORT_DMA_NONE , &dev->dev,IRQF_SHARED );if (port) { priv->port[priv->num_par++] = port; success =1 ;
include/linux/parport_pc.h +6 -5
@@ -228,10 +228,11 @@ extern void parport_pc_release_resources(struct parport *p);extern int parport_pc_claim_resources (struct parport *p);/* PCMCIA code will want to get us to look at a port. Provide a mechanism. */ -extern struct parport *parport_pc_probe_port (unsigned long base, -unsigned long base_hi, -int irq,int dma, -struct device *dev); -extern void parport_pc_unregister_port (struct parport *p); +extern struct parport *parport_pc_probe_port (unsigned long base, +unsigned long base_hi, +int irq,int dma, +struct device *dev, +int irqflags); +extern void parport_pc_unregister_port (struct parport *p);#endif
Quoted 4 lines · Alan Cox
PCI parallel port devices can IRQ share so we should stop them hogging the line and making a mess on modern PC systems. We know the sharing side works as the PCMCIA driver has shared the parallel port IRQ for some time.
Quoted 8 lines
Signed-off-by Alan Cox <[email protected]>---
drivers/parport/parport_cs.c | 3 +- drivers/parport/parport_pc.c | 57 ++++++++++++++++++++++++-------------- drivers/parport/parport_serial.c | 20 +++++++++++-- include/linux/parport_pc.h | 11 ++++--- 4 files changed, 60 insertions(+), 31 deletions(-)
(I did some parport work many years ago, trying to improve the parport driver's integration with modern on-mainboard parallel port controls; this was one of the goals, only now realized)
include/linux/parport_pc.h extern void parport_pc_release_resources(struct parport *p); · line 236
Quoted 13 lines · Alan Cox
PCI parallel port devices can IRQ share so we should stop them hogging the line and making a mess on modern PC systems. We know the sharing side works as the PCMCIA driver has shared the parallel port IRQ for some time.
Signed-off-by Alan Cox <[email protected]>include/linux/parport_pc.h +6
-0+extern struct parport *parport_pc_probe_port (unsigned long base, +unsigned long base_hi, +int irq,int dma, +struct device *dev, +int irqflags); +extern void parport_pc_unregister_port (struct parport *p);
You missed a bunch of uses of parport_pc_probe_port and broke the build on powerpc, sparc, parisc, and probably several more.
regards, Kyle