Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Alan Cox and committed by
Linus Torvalds
51dcdfec 8e7d91c9

+60 -31
+2 -1
drivers/parport/parport_cs.c
··· 43 43 #include <linux/timer.h> 44 44 #include <linux/ioport.h> 45 45 #include <linux/major.h> 46 + #include <linux/interrupt.h> 46 47 47 48 #include <linux/parport.h> 48 49 #include <linux/parport_pc.h> ··· 193 192 194 193 p = parport_pc_probe_port(link->io.BasePort1, link->io.BasePort2, 195 194 link->irq.AssignedIRQ, PARPORT_DMA_NONE, 196 - &link->dev); 195 + &link->dev, IRQF_SHARED); 197 196 if (p == NULL) { 198 197 printk(KERN_NOTICE "parport_cs: parport_pc_probe_port() at " 199 198 "0x%3x, irq %u failed\n", link->io.BasePort1,
+36 -21
drivers/parport/parport_pc.c
··· 2170 2170 static LIST_HEAD(ports_list); 2171 2171 static DEFINE_SPINLOCK(ports_lock); 2172 2172 2173 - struct parport *parport_pc_probe_port (unsigned long int base, 2174 - unsigned long int base_hi, 2175 - int irq, int dma, 2176 - struct device *dev) 2173 + struct parport *parport_pc_probe_port(unsigned long int base, 2174 + unsigned long int base_hi, 2175 + int irq, int dma, 2176 + struct device *dev, 2177 + int irqflags) 2177 2178 { 2178 2179 struct parport_pc_private *priv; 2179 2180 struct parport_operations *ops; ··· 2195 2194 dev = &pdev->dev; 2196 2195 } 2197 2196 2198 - ops = kmalloc(sizeof (struct parport_operations), GFP_KERNEL); 2197 + ops = kmalloc(sizeof(struct parport_operations), GFP_KERNEL); 2199 2198 if (!ops) 2200 2199 goto out1; 2201 2200 2202 - priv = kmalloc (sizeof (struct parport_pc_private), GFP_KERNEL); 2201 + priv = kmalloc(sizeof(struct parport_pc_private), GFP_KERNEL); 2203 2202 if (!priv) 2204 2203 goto out2; 2205 2204 ··· 2326 2325 EPP_res = NULL; 2327 2326 } 2328 2327 if (p->irq != PARPORT_IRQ_NONE) { 2329 - if (request_irq (p->irq, parport_irq_handler, 2330 - 0, p->name, p)) { 2328 + if (request_irq(p->irq, parport_irq_handler, 2329 + irqflags, p->name, p)) { 2331 2330 printk (KERN_WARNING "%s: irq %d in use, " 2332 2331 "resorting to polled operation\n", 2333 2332 p->name, p->irq); ··· 2531 2530 */ 2532 2531 release_resource(base_res); 2533 2532 if (parport_pc_probe_port (ite8872_lpt, ite8872_lpthi, 2534 - irq, PARPORT_DMA_NONE, &pdev->dev)) { 2533 + irq, PARPORT_DMA_NONE, &pdev->dev, 0)) { 2535 2534 printk (KERN_INFO 2536 2535 "parport_pc: ITE 8872 parallel port: io=0x%X", 2537 2536 ite8872_lpt); ··· 2714 2713 } 2715 2714 2716 2715 /* finally, do the probe with values obtained */ 2717 - if (parport_pc_probe_port (port1, port2, irq, dma, &pdev->dev)) { 2716 + if (parport_pc_probe_port (port1, port2, irq, dma, &pdev->dev, 0)) { 2718 2717 printk (KERN_INFO 2719 2718 "parport_pc: VIA parallel port: io=0x%X", port1); 2720 2719 if (irq != PARPORT_IRQ_NONE) ··· 3019 3018 for (n = 0; n < cards[i].numports; n++) { 3020 3019 int lo = cards[i].addr[n].lo; 3021 3020 int hi = cards[i].addr[n].hi; 3021 + int irq; 3022 3022 unsigned long io_lo, io_hi; 3023 3023 io_lo = pci_resource_start (dev, lo); 3024 3024 io_hi = 0; ··· 3030 3028 "hi" as an offset (see SYBA 3031 3029 def.) */ 3032 3030 /* TODO: test if sharing interrupts works */ 3033 - printk (KERN_DEBUG "PCI parallel port detected: %04x:%04x, " 3034 - "I/O at %#lx(%#lx)\n", 3035 - parport_pc_pci_tbl[i + last_sio].vendor, 3036 - parport_pc_pci_tbl[i + last_sio].device, io_lo, io_hi); 3031 + irq = dev->irq; 3032 + if (irq == IRQ_NONE) { 3033 + printk (KERN_DEBUG 3034 + "PCI parallel port detected: %04x:%04x, I/O at %#lx(%#lx)\n", 3035 + parport_pc_pci_tbl[i + last_sio].vendor, 3036 + parport_pc_pci_tbl[i + last_sio].device, 3037 + io_lo, io_hi); 3038 + irq = PARPORT_IRQ_NONE; 3039 + } else { 3040 + printk (KERN_DEBUG 3041 + "PCI parallel port detected: %04x:%04x, I/O at %#lx(%#lx), IRQ %d\n", 3042 + parport_pc_pci_tbl[i + last_sio].vendor, 3043 + parport_pc_pci_tbl[i + last_sio].device, 3044 + io_lo, io_hi, irq); 3045 + } 3037 3046 data->ports[count] = 3038 - parport_pc_probe_port (io_lo, io_hi, PARPORT_IRQ_NONE, 3039 - PARPORT_DMA_NONE, &dev->dev); 3047 + parport_pc_probe_port(io_lo, io_hi, irq, 3048 + PARPORT_DMA_NONE, &dev->dev, 3049 + IRQF_SHARED); 3040 3050 if (data->ports[count]) 3041 3051 count++; 3042 3052 } ··· 3157 3143 dma = PARPORT_DMA_NONE; 3158 3144 3159 3145 dev_info(&dev->dev, "reported by %s\n", dev->protocol->name); 3160 - if (!(pdata = parport_pc_probe_port (io_lo, io_hi, irq, dma, &dev->dev))) 3146 + if (!(pdata = parport_pc_probe_port(io_lo, io_hi, 3147 + irq, dma, &dev->dev, 0))) 3161 3148 return -ENODEV; 3162 3149 3163 3150 pnp_set_drvdata(dev,pdata); ··· 3207 3192 { 3208 3193 int count = 0; 3209 3194 3210 - if (parport_pc_probe_port(0x3bc, 0x7bc, autoirq, autodma, NULL)) 3195 + if (parport_pc_probe_port(0x3bc, 0x7bc, autoirq, autodma, NULL, 0)) 3211 3196 count++; 3212 - if (parport_pc_probe_port(0x378, 0x778, autoirq, autodma, NULL)) 3197 + if (parport_pc_probe_port(0x378, 0x778, autoirq, autodma, NULL, 0)) 3213 3198 count++; 3214 - if (parport_pc_probe_port(0x278, 0x678, autoirq, autodma, NULL)) 3199 + if (parport_pc_probe_port(0x278, 0x678, autoirq, autodma, NULL, 0)) 3215 3200 count++; 3216 3201 3217 3202 return count; ··· 3496 3481 if ((io_hi[i]) == PARPORT_IOHI_AUTO) 3497 3482 io_hi[i] = 0x400 + io[i]; 3498 3483 parport_pc_probe_port(io[i], io_hi[i], 3499 - irqval[i], dmaval[i], NULL); 3484 + irqval[i], dmaval[i], NULL, 0); 3500 3485 } 3501 3486 } else 3502 3487 parport_pc_find_ports (irqval[0], dmaval[0]);
+16 -4
drivers/parport/parport_serial.c
··· 21 21 #include <linux/module.h> 22 22 #include <linux/init.h> 23 23 #include <linux/pci.h> 24 + #include <linux/interrupt.h> 24 25 #include <linux/parport.h> 25 26 #include <linux/parport_pc.h> 26 27 #include <linux/8250_pci.h> ··· 312 311 int lo = card->addr[n].lo; 313 312 int hi = card->addr[n].hi; 314 313 unsigned long io_lo, io_hi; 314 + int irq; 315 315 316 316 if (priv->num_par == ARRAY_SIZE (priv->port)) { 317 317 printk (KERN_WARNING ··· 331 329 "hi" as an offset (see SYBA 332 330 def.) */ 333 331 /* TODO: test if sharing interrupts works */ 334 - dev_dbg(&dev->dev, "PCI parallel port detected: I/O at " 335 - "%#lx(%#lx)\n", io_lo, io_hi); 336 - port = parport_pc_probe_port (io_lo, io_hi, PARPORT_IRQ_NONE, 337 - PARPORT_DMA_NONE, &dev->dev); 332 + irq = dev->irq; 333 + if (irq == IRQ_NONE) { 334 + dev_dbg(&dev->dev, 335 + "PCI parallel port detected: I/O at %#lx(%#lx)\n", 336 + io_lo, io_hi); 337 + irq = PARPORT_IRQ_NONE; 338 + } else { 339 + dev_dbg(&dev->dev, 340 + "PCI parallel port detected: I/O at %#lx(%#lx), IRQ %d\n", 341 + io_lo, io_hi, irq); 342 + irq = PARPORT_IRQ_NONE; 343 + } 344 + port = parport_pc_probe_port (io_lo, io_hi, irq, 345 + PARPORT_DMA_NONE, &dev->dev, IRQF_SHARED); 338 346 if (port) { 339 347 priv->port[priv->num_par++] = port; 340 348 success = 1;
+6 -5
include/linux/parport_pc.h
··· 228 228 extern int parport_pc_claim_resources(struct parport *p); 229 229 230 230 /* PCMCIA code will want to get us to look at a port. Provide a mechanism. */ 231 - extern struct parport *parport_pc_probe_port (unsigned long base, 232 - unsigned long base_hi, 233 - int irq, int dma, 234 - struct device *dev); 235 - extern void parport_pc_unregister_port (struct parport *p); 231 + extern struct parport *parport_pc_probe_port(unsigned long base, 232 + unsigned long base_hi, 233 + int irq, int dma, 234 + struct device *dev, 235 + int irqflags); 236 + extern void parport_pc_unregister_port(struct parport *p); 236 237 237 238 #endif