X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fide%2Fide-pnp.c;h=b163b2e522128d16bd513b1eac2346042878a377;hb=e0b005fa1479045fe879944036268af3ebcd1835;hp=2b8009c50e91363c1316c3a8bbfad6208e823942;hpb=5c34202b8bf942da411b6599668a76b07449bbfd;p=linux-2.6-omap-h63xx.git diff --git a/drivers/ide/ide-pnp.c b/drivers/ide/ide-pnp.c index 2b8009c50e9..b163b2e5221 100644 --- a/drivers/ide/ide-pnp.c +++ b/drivers/ide/ide-pnp.c @@ -1,6 +1,4 @@ /* - * linux/drivers/ide/ide-pnp.c - * * This file provides autodetection for ISA PnP IDE interfaces. * It was tested with "ESS ES1868 Plug and Play AudioDrive" IDE interface. * @@ -31,7 +29,6 @@ static int idepnp_probe(struct pnp_dev * dev, const struct pnp_device_id *dev_id { hw_regs_t hw; ide_hwif_t *hwif; - int index; if (!(pnp_port_valid(dev, 0) && pnp_port_valid(dev, 1) && pnp_irq_valid(dev, 0))) return -1; @@ -40,13 +37,20 @@ static int idepnp_probe(struct pnp_dev * dev, const struct pnp_device_id *dev_id ide_std_init_ports(&hw, pnp_port_start(dev, 0), pnp_port_start(dev, 1)); hw.irq = pnp_irq(dev, 0); - hw.dma = NO_DMA; - index = ide_register_hw(&hw, 1, &hwif); + hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]); + if (hwif) { + u8 index = hwif->index; + u8 idx[4] = { index, 0xff, 0xff, 0xff }; + + ide_init_port_data(hwif, index); + ide_init_port_hw(hwif, &hw); - if (index != -1) { - printk(KERN_INFO "ide%d: generic PnP IDE interface\n", index); + printk(KERN_INFO "ide%d: generic PnP IDE interface\n", index); pnp_set_drvdata(dev,hwif); + + ide_device_add(idx, NULL); + return 0; } @@ -56,9 +60,10 @@ static int idepnp_probe(struct pnp_dev * dev, const struct pnp_device_id *dev_id static void idepnp_remove(struct pnp_dev * dev) { ide_hwif_t *hwif = pnp_get_drvdata(dev); - if (hwif) { - ide_unregister(hwif->index); - } else + + if (hwif) + ide_unregister(hwif->index, 0, 0); + else printk(KERN_ERR "idepnp: Unable to remove device, please report.\n"); } @@ -69,12 +74,15 @@ static struct pnp_driver idepnp_driver = { .remove = idepnp_remove, }; -void __init pnpide_init(void) +static int __init pnpide_init(void) { - pnp_register_driver(&idepnp_driver); + return pnp_register_driver(&idepnp_driver); } -void __exit pnpide_exit(void) +static void __exit pnpide_exit(void) { pnp_unregister_driver(&idepnp_driver); } + +module_init(pnpide_init); +module_exit(pnpide_exit);