aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/parport/parport_pc.c
diff options
context:
space:
mode:
authorAlan Cox <alan@lxorguk.ukuu.org.uk>2009-04-07 10:30:57 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-04-07 11:44:06 -0400
commit51dcdfec6a274afc1c6fce180d582add9ff512c0 (patch)
tree51442c7adc06f36977859e8133b645c6c42ea0c9 /drivers/parport/parport_pc.c
parent8e7d91c97570ba1a16c0b4f984c04f04f039a231 (diff)
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. Signed-off-by: Alan Cox <alan@lxorguk.ukuu.org.uk> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/parport/parport_pc.c')
-rw-r--r--drivers/parport/parport_pc.c57
1 files changed, 36 insertions, 21 deletions
diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c
index 96f3bdf0ec4b..4e63cc9e2778 100644
--- a/drivers/parport/parport_pc.c
+++ b/drivers/parport/parport_pc.c
@@ -2170,10 +2170,11 @@ static int parport_dma_probe (struct parport *p)
2170static LIST_HEAD(ports_list); 2170static LIST_HEAD(ports_list);
2171static DEFINE_SPINLOCK(ports_lock); 2171static DEFINE_SPINLOCK(ports_lock);
2172 2172
2173struct parport *parport_pc_probe_port (unsigned long int base, 2173struct parport *parport_pc_probe_port(unsigned long int base,
2174 unsigned long int base_hi, 2174 unsigned long int base_hi,
2175 int irq, int dma, 2175 int irq, int dma,
2176 struct device *dev) 2176 struct device *dev,
2177 int irqflags)
2177{ 2178{
2178 struct parport_pc_private *priv; 2179 struct parport_pc_private *priv;
2179 struct parport_operations *ops; 2180 struct parport_operations *ops;
@@ -2194,11 +2195,11 @@ struct parport *parport_pc_probe_port (unsigned long int base,
2194 dev = &pdev->dev; 2195 dev = &pdev->dev;
2195 } 2196 }
2196 2197
2197 ops = kmalloc(sizeof (struct parport_operations), GFP_KERNEL); 2198 ops = kmalloc(sizeof(struct parport_operations), GFP_KERNEL);
2198 if (!ops) 2199 if (!ops)
2199 goto out1; 2200 goto out1;
2200 2201
2201 priv = kmalloc (sizeof (struct parport_pc_private), GFP_KERNEL); 2202 priv = kmalloc(sizeof(struct parport_pc_private), GFP_KERNEL);
2202 if (!priv) 2203 if (!priv)
2203 goto out2; 2204 goto out2;
2204 2205
@@ -2325,8 +2326,8 @@ struct parport *parport_pc_probe_port (unsigned long int base,
2325 EPP_res = NULL; 2326 EPP_res = NULL;
2326 } 2327 }
2327 if (p->irq != PARPORT_IRQ_NONE) { 2328 if (p->irq != PARPORT_IRQ_NONE) {
2328 if (request_irq (p->irq, parport_irq_handler, 2329 if (request_irq(p->irq, parport_irq_handler,
2329 0, p->name, p)) { 2330 irqflags, p->name, p)) {
2330 printk (KERN_WARNING "%s: irq %d in use, " 2331 printk (KERN_WARNING "%s: irq %d in use, "
2331 "resorting to polled operation\n", 2332 "resorting to polled operation\n",
2332 p->name, p->irq); 2333 p->name, p->irq);
@@ -2530,7 +2531,7 @@ static int __devinit sio_ite_8872_probe (struct pci_dev *pdev, int autoirq,
2530 */ 2531 */
2531 release_resource(base_res); 2532 release_resource(base_res);
2532 if (parport_pc_probe_port (ite8872_lpt, ite8872_lpthi, 2533 if (parport_pc_probe_port (ite8872_lpt, ite8872_lpthi,
2533 irq, PARPORT_DMA_NONE, &pdev->dev)) { 2534 irq, PARPORT_DMA_NONE, &pdev->dev, 0)) {
2534 printk (KERN_INFO 2535 printk (KERN_INFO
2535 "parport_pc: ITE 8872 parallel port: io=0x%X", 2536 "parport_pc: ITE 8872 parallel port: io=0x%X",
2536 ite8872_lpt); 2537 ite8872_lpt);
@@ -2713,7 +2714,7 @@ static int __devinit sio_via_probe (struct pci_dev *pdev, int autoirq,
2713 } 2714 }
2714 2715
2715 /* finally, do the probe with values obtained */ 2716 /* finally, do the probe with values obtained */
2716 if (parport_pc_probe_port (port1, port2, irq, dma, &pdev->dev)) { 2717 if (parport_pc_probe_port (port1, port2, irq, dma, &pdev->dev, 0)) {
2717 printk (KERN_INFO 2718 printk (KERN_INFO
2718 "parport_pc: VIA parallel port: io=0x%X", port1); 2719 "parport_pc: VIA parallel port: io=0x%X", port1);
2719 if (irq != PARPORT_IRQ_NONE) 2720 if (irq != PARPORT_IRQ_NONE)
@@ -3018,6 +3019,7 @@ static int parport_pc_pci_probe (struct pci_dev *dev,
3018 for (n = 0; n < cards[i].numports; n++) { 3019 for (n = 0; n < cards[i].numports; n++) {
3019 int lo = cards[i].addr[n].lo; 3020 int lo = cards[i].addr[n].lo;
3020 int hi = cards[i].addr[n].hi; 3021 int hi = cards[i].addr[n].hi;
3022 int irq;
3021 unsigned long io_lo, io_hi; 3023 unsigned long io_lo, io_hi;
3022 io_lo = pci_resource_start (dev, lo); 3024 io_lo = pci_resource_start (dev, lo);
3023 io_hi = 0; 3025 io_hi = 0;
@@ -3028,13 +3030,25 @@ static int parport_pc_pci_probe (struct pci_dev *dev,
3028 "hi" as an offset (see SYBA 3030 "hi" as an offset (see SYBA
3029 def.) */ 3031 def.) */
3030 /* TODO: test if sharing interrupts works */ 3032 /* TODO: test if sharing interrupts works */
3031 printk (KERN_DEBUG "PCI parallel port detected: %04x:%04x, " 3033 irq = dev->irq;
3032 "I/O at %#lx(%#lx)\n", 3034 if (irq == IRQ_NONE) {
3033 parport_pc_pci_tbl[i + last_sio].vendor, 3035 printk (KERN_DEBUG
3034 parport_pc_pci_tbl[i + last_sio].device, io_lo, io_hi); 3036 "PCI parallel port detected: %04x:%04x, I/O at %#lx(%#lx)\n",
3037 parport_pc_pci_tbl[i + last_sio].vendor,
3038 parport_pc_pci_tbl[i + last_sio].device,
3039 io_lo, io_hi);
3040 irq = PARPORT_IRQ_NONE;
3041 } else {
3042 printk (KERN_DEBUG
3043 "PCI parallel port detected: %04x:%04x, I/O at %#lx(%#lx), IRQ %d\n",
3044 parport_pc_pci_tbl[i + last_sio].vendor,
3045 parport_pc_pci_tbl[i + last_sio].device,
3046 io_lo, io_hi, irq);
3047 }
3035 data->ports[count] = 3048 data->ports[count] =
3036 parport_pc_probe_port (io_lo, io_hi, PARPORT_IRQ_NONE, 3049 parport_pc_probe_port(io_lo, io_hi, irq,
3037 PARPORT_DMA_NONE, &dev->dev); 3050 PARPORT_DMA_NONE, &dev->dev,
3051 IRQF_SHARED);
3038 if (data->ports[count]) 3052 if (data->ports[count])
3039 count++; 3053 count++;
3040 } 3054 }
@@ -3143,7 +3157,8 @@ static int parport_pc_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id
3143 dma = PARPORT_DMA_NONE; 3157 dma = PARPORT_DMA_NONE;
3144 3158
3145 dev_info(&dev->dev, "reported by %s\n", dev->protocol->name); 3159 dev_info(&dev->dev, "reported by %s\n", dev->protocol->name);
3146 if (!(pdata = parport_pc_probe_port (io_lo, io_hi, irq, dma, &dev->dev))) 3160 if (!(pdata = parport_pc_probe_port(io_lo, io_hi,
3161 irq, dma, &dev->dev, 0)))
3147 return -ENODEV; 3162 return -ENODEV;
3148 3163
3149 pnp_set_drvdata(dev,pdata); 3164 pnp_set_drvdata(dev,pdata);
@@ -3192,11 +3207,11 @@ parport_pc_find_isa_ports (int autoirq, int autodma)
3192{ 3207{
3193 int count = 0; 3208 int count = 0;
3194 3209
3195 if (parport_pc_probe_port(0x3bc, 0x7bc, autoirq, autodma, NULL)) 3210 if (parport_pc_probe_port(0x3bc, 0x7bc, autoirq, autodma, NULL, 0))
3196 count++; 3211 count++;
3197 if (parport_pc_probe_port(0x378, 0x778, autoirq, autodma, NULL)) 3212 if (parport_pc_probe_port(0x378, 0x778, autoirq, autodma, NULL, 0))
3198 count++; 3213 count++;
3199 if (parport_pc_probe_port(0x278, 0x678, autoirq, autodma, NULL)) 3214 if (parport_pc_probe_port(0x278, 0x678, autoirq, autodma, NULL, 0))
3200 count++; 3215 count++;
3201 3216
3202 return count; 3217 return count;
@@ -3481,7 +3496,7 @@ static int __init parport_pc_init(void)
3481 if ((io_hi[i]) == PARPORT_IOHI_AUTO) 3496 if ((io_hi[i]) == PARPORT_IOHI_AUTO)
3482 io_hi[i] = 0x400 + io[i]; 3497 io_hi[i] = 0x400 + io[i];
3483 parport_pc_probe_port(io[i], io_hi[i], 3498 parport_pc_probe_port(io[i], io_hi[i],
3484 irqval[i], dmaval[i], NULL); 3499 irqval[i], dmaval[i], NULL, 0);
3485 } 3500 }
3486 } else 3501 } else
3487 parport_pc_find_ports (irqval[0], dmaval[0]); 3502 parport_pc_find_ports (irqval[0], dmaval[0]);