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 @@
#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_IRQ(dev, index) (dev->irq_resource[index].start)
......@@ -54,6 +48,7 @@ struct pnp_dev_t {
};
/* Generic initialisation function for ISA PnP IDE interface */
static int __init pnpide_generic_init(struct pci_dev *dev, int enable)
{
hw_regs_t hw;
......@@ -66,13 +61,16 @@ static int __init pnpide_generic_init(struct pci_dev *dev, int enable)
return 1;
ide_setup_ports(&hw, (ide_ioreg_t) DEV_IO(dev, 0),
generic_ide_offsets, (ide_ioreg_t) DEV_IO(dev, 1),
0, NULL, DEV_IRQ(dev, 0));
generic_ide_offsets,
(ide_ioreg_t) DEV_IO(dev, 1),
0, NULL,
// generic_pnp_ide_iops,
DEV_IRQ(dev, 0));
index = ide_register_hw(&hw, NULL);
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;
}
......@@ -88,7 +86,6 @@ struct pnp_dev_t idepnp_devices[] __initdata = {
{ 0 }
};
#ifdef MODULE
#define NR_PNP_DEVICES 8
struct pnp_dev_inst {
struct pci_dev *dev;
......@@ -96,11 +93,11 @@ struct pnp_dev_inst {
};
static struct pnp_dev_inst devices[NR_PNP_DEVICES];
static int pnp_ide_dev_idx = 0;
#endif
/*
* Probe for ISA PnP IDE interfaces.
*/
void __init pnpide_init(int enable)
{
struct pci_dev *dev = NULL;
......@@ -109,19 +106,18 @@ void __init pnpide_init(int enable)
if (!isapnp_present())
return;
#ifdef MODULE
/* Module unload, deactivate all registered devices. */
if (!enable) {
int i;
for (i = 0; i < pnp_ide_dev_idx; i++) {
dev = devices[i].dev;
devices[i].dev_type->init_fn(dev, 0);
if (DEACTIVATE_FUNC(devices[i].dev))
DEACTIVATE_FUNC(devices[i].dev)(devices[i].dev);
if (dev->deactivate)
dev->deactivate(dev);
}
return;
}
#endif
for (dev_type = idepnp_devices; dev_type->vendor; dev_type++) {
while ((dev = isapnp_find_dev(NULL, dev_type->vendor,
dev_type->device, dev))) {
......@@ -129,20 +125,20 @@ void __init pnpide_init(int enable)
if (dev->active)
continue;
if (PREPARE_FUNC(dev) && (PREPARE_FUNC(dev))(dev) < 0) {
printk("ide: %s prepare failed\n", DEV_NAME(dev));
if (dev->prepare && dev->prepare(dev) < 0) {
printk(KERN_ERR"ide-pnp: %s prepare failed\n", DEV_NAME(dev));
continue;
}
if (ACTIVATE_FUNC(dev) && (ACTIVATE_FUNC(dev))(dev) < 0) {
printk("ide: %s activate failed\n", DEV_NAME(dev));
if (dev->activate && dev->activate(dev) < 0) {
printk(KERN_ERR"ide: %s activate failed\n", DEV_NAME(dev));
continue;
}
/* Call device initialization function */
if (dev_type->init_fn(dev, 1)) {
if (DEACTIVATE_FUNC(dev))
DEACTIVATE_FUNC(dev)(dev);
if (dev->deactivate(dev))
dev->deactivate(dev);
} else {
#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