Commit a39cf72ceb406e152c4682c0b635a96f1439c5ed

Authored by Kyle McMartin
1 parent 29a622dd2b

[PARISC] Make superio.c initialize before any driver needs it

Convert superio_init to use PCI_FIXUP_FINAL as ohci_pci being called
before superio_probe really makes a mess. superio_init will then fail
to register irq 20 (the "SuperIO" irq) and BUG() because ohci_pci has
stolen it before superio_fixup_irq can be moved USB to irq 1.

Signed-off-by: Kyle McMartin <kyle@parisc-linux.org>

Showing 1 changed file with 21 additions and 14 deletions Side-by-side Diff

drivers/parisc/superio.c
... ... @@ -24,6 +24,9 @@
24 24 * Major changes to get basic interrupt infrastructure working to
25 25 * hopefully be able to support all SuperIO devices. Currently
26 26 * works with serial. -- John Marvin <jsm@fc.hp.com>
  27 + *
  28 + * Converted superio_init() to be a PCI_FIXUP_FINAL callee.
  29 + * -- Kyle McMartin <kyle@parisc-linux.org>
27 30 */
28 31  
29 32  
30 33  
... ... @@ -141,10 +144,10 @@
141 144 }
142 145  
143 146 /* Initialize Super I/O device */
144   -
145   -static void __devinit
146   -superio_init(struct superio_device *sio)
  147 +static void
  148 +superio_init(struct pci_dev *pcidev)
147 149 {
  150 + struct superio_device *sio = &sio_dev;
148 151 struct pci_dev *pdev = sio->lio_pdev;
149 152 u16 word;
150 153  
... ... @@ -160,8 +163,8 @@
160 163 /* ...then properly fixup the USB to point at suckyio PIC */
161 164 sio->usb_pdev->irq = superio_fixup_irq(sio->usb_pdev);
162 165  
163   - printk (KERN_INFO "SuperIO: Found NS87560 Legacy I/O device at %s (IRQ %i) \n",
164   - pci_name(pdev),pdev->irq);
  166 + printk(KERN_INFO "SuperIO: Found NS87560 Legacy I/O device at %s (IRQ %i) \n",
  167 + pci_name(pdev), pdev->irq);
165 168  
166 169 pci_read_config_dword (pdev, SIO_SP1BAR, &sio->sp1_base);
167 170 sio->sp1_base &= ~1;
168 171  
... ... @@ -274,8 +277,8 @@
274 277  
275 278 sio->suckyio_irq_enabled = 1;
276 279 }
  280 +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_87560_LIO, superio_init);
277 281  
278   -
279 282 static void superio_disable_irq(unsigned int irq)
280 283 {
281 284 u8 r8;
282 285  
... ... @@ -452,8 +455,10 @@
452 455 DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_87415, superio_fixup_pci);
453 456  
454 457  
455   -static int __devinit superio_probe(struct pci_dev *dev, const struct pci_device_id *id)
  458 +static int __devinit
  459 +superio_probe(struct pci_dev *dev, const struct pci_device_id *id)
456 460 {
  461 + struct superio_device *sio = &sio_dev;
457 462  
458 463 /*
459 464 ** superio_probe(00:0e.0) ven 0x100b dev 0x2 sv 0x0 sd 0x0 class 0x1018a
... ... @@ -466,7 +471,8 @@
466 471 dev->subsystem_vendor, dev->subsystem_device,
467 472 dev->class);
468 473  
469   - superio_init(&sio_dev);
  474 + if (!sio->suckyio_irq_enabled)
  475 + BUG(); /* Enabled by PCI_FIXUP_FINAL */
470 476  
471 477 if (dev->device == PCI_DEVICE_ID_NS_87560_LIO) { /* Function 1 */
472 478 superio_parport_init();
473 479  
474 480  
... ... @@ -481,19 +487,21 @@
481 487 DBG_INIT("superio_probe: WTF? Fire Extinguisher?\n");
482 488 }
483 489  
484   - /* Let appropriate other driver claim this device. */
  490 + /* Let appropriate other driver claim this device. */
485 491 return -ENODEV;
486 492 }
487 493  
488 494 static struct pci_device_id superio_tbl[] = {
489   - { PCI_VENDOR_ID_NS, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
  495 + { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_87560_LIO) },
  496 + { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_87560_USB) },
  497 + { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_87415) },
490 498 { 0, }
491 499 };
492 500  
493 501 static struct pci_driver superio_driver = {
494   - .name = "SuperIO",
495   - .id_table = superio_tbl,
496   - .probe = superio_probe,
  502 + .name = "SuperIO",
  503 + .id_table = superio_tbl,
  504 + .probe = superio_probe,
497 505 };
498 506  
499 507 static int __init superio_modinit(void)
... ... @@ -505,7 +513,6 @@
505 513 {
506 514 pci_unregister_driver(&superio_driver);
507 515 }
508   -
509 516  
510 517 module_init(superio_modinit);
511 518 module_exit(superio_exit);