Commit 9fd68c4e authored by Jens Axboe's avatar Jens Axboe

ide-pnp updates:

o remove *_FUNC abstraction
o remove MODULE ifdefs
o small style changes
parent 5023a3cb
...@@ -21,12 +21,6 @@ ...@@ -21,12 +21,6 @@
#include <linux/isapnp.h> #include <linux/isapnp.h>
#ifndef PREPARE_FUNC
#define PREPARE_FUNC(dev) (dev->prepare)
#define ACTIVATE_FUNC(dev) (dev->activate)
#define DEACTIVATE_FUNC(dev) (dev->deactivate)
#endif
#define DEV_IO(dev, index) (dev->resource[index].start) #define DEV_IO(dev, index) (dev->resource[index].start)
#define DEV_IRQ(dev, index) (dev->irq_resource[index].start) #define DEV_IRQ(dev, index) (dev->irq_resource[index].start)
...@@ -54,6 +48,7 @@ struct pnp_dev_t { ...@@ -54,6 +48,7 @@ struct pnp_dev_t {
}; };
/* Generic initialisation function for ISA PnP IDE interface */ /* Generic initialisation function for ISA PnP IDE interface */
static int __init pnpide_generic_init(struct pci_dev *dev, int enable) static int __init pnpide_generic_init(struct pci_dev *dev, int enable)
{ {
hw_regs_t hw; hw_regs_t hw;
...@@ -66,13 +61,16 @@ static int __init pnpide_generic_init(struct pci_dev *dev, int enable) ...@@ -66,13 +61,16 @@ static int __init pnpide_generic_init(struct pci_dev *dev, int enable)
return 1; return 1;
ide_setup_ports(&hw, (ide_ioreg_t) DEV_IO(dev, 0), ide_setup_ports(&hw, (ide_ioreg_t) DEV_IO(dev, 0),
generic_ide_offsets, (ide_ioreg_t) DEV_IO(dev, 1), generic_ide_offsets,
0, NULL, DEV_IRQ(dev, 0)); (ide_ioreg_t) DEV_IO(dev, 1),
0, NULL,
// generic_pnp_ide_iops,
DEV_IRQ(dev, 0));
index = ide_register_hw(&hw, NULL); index = ide_register_hw(&hw, NULL);
if (index != -1) { if (index != -1) {
printk("ide%d: %s IDE interface\n", index, DEV_NAME(dev)); printk(KERN_INFO "ide%d: %s IDE interface\n", index, DEV_NAME(dev));
return 0; return 0;
} }
...@@ -88,7 +86,6 @@ struct pnp_dev_t idepnp_devices[] __initdata = { ...@@ -88,7 +86,6 @@ struct pnp_dev_t idepnp_devices[] __initdata = {
{ 0 } { 0 }
}; };
#ifdef MODULE
#define NR_PNP_DEVICES 8 #define NR_PNP_DEVICES 8
struct pnp_dev_inst { struct pnp_dev_inst {
struct pci_dev *dev; struct pci_dev *dev;
...@@ -96,11 +93,11 @@ struct pnp_dev_inst { ...@@ -96,11 +93,11 @@ struct pnp_dev_inst {
}; };
static struct pnp_dev_inst devices[NR_PNP_DEVICES]; static struct pnp_dev_inst devices[NR_PNP_DEVICES];
static int pnp_ide_dev_idx = 0; static int pnp_ide_dev_idx = 0;
#endif
/* /*
* Probe for ISA PnP IDE interfaces. * Probe for ISA PnP IDE interfaces.
*/ */
void __init pnpide_init(int enable) void __init pnpide_init(int enable)
{ {
struct pci_dev *dev = NULL; struct pci_dev *dev = NULL;
...@@ -109,19 +106,18 @@ void __init pnpide_init(int enable) ...@@ -109,19 +106,18 @@ void __init pnpide_init(int enable)
if (!isapnp_present()) if (!isapnp_present())
return; return;
#ifdef MODULE
/* Module unload, deactivate all registered devices. */ /* Module unload, deactivate all registered devices. */
if (!enable) { if (!enable) {
int i; int i;
for (i = 0; i < pnp_ide_dev_idx; i++) { for (i = 0; i < pnp_ide_dev_idx; i++) {
dev = devices[i].dev;
devices[i].dev_type->init_fn(dev, 0); devices[i].dev_type->init_fn(dev, 0);
if (dev->deactivate)
if (DEACTIVATE_FUNC(devices[i].dev)) dev->deactivate(dev);
DEACTIVATE_FUNC(devices[i].dev)(devices[i].dev);
} }
return; return;
} }
#endif
for (dev_type = idepnp_devices; dev_type->vendor; dev_type++) { for (dev_type = idepnp_devices; dev_type->vendor; dev_type++) {
while ((dev = isapnp_find_dev(NULL, dev_type->vendor, while ((dev = isapnp_find_dev(NULL, dev_type->vendor,
dev_type->device, dev))) { dev_type->device, dev))) {
...@@ -129,20 +125,20 @@ void __init pnpide_init(int enable) ...@@ -129,20 +125,20 @@ void __init pnpide_init(int enable)
if (dev->active) if (dev->active)
continue; continue;
if (PREPARE_FUNC(dev) && (PREPARE_FUNC(dev))(dev) < 0) { if (dev->prepare && dev->prepare(dev) < 0) {
printk("ide: %s prepare failed\n", DEV_NAME(dev)); printk(KERN_ERR"ide-pnp: %s prepare failed\n", DEV_NAME(dev));
continue; continue;
} }
if (ACTIVATE_FUNC(dev) && (ACTIVATE_FUNC(dev))(dev) < 0) { if (dev->activate && dev->activate(dev) < 0) {
printk("ide: %s activate failed\n", DEV_NAME(dev)); printk(KERN_ERR"ide: %s activate failed\n", DEV_NAME(dev));
continue; continue;
} }
/* Call device initialization function */ /* Call device initialization function */
if (dev_type->init_fn(dev, 1)) { if (dev_type->init_fn(dev, 1)) {
if (DEACTIVATE_FUNC(dev)) if (dev->deactivate(dev))
DEACTIVATE_FUNC(dev)(dev); dev->deactivate(dev);
} else { } else {
#ifdef MODULE #ifdef MODULE
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment