diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-07-23 19:55:57 +0200 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-07-23 19:55:57 +0200 |
commit | 6f904d015262dfa43eb1cecc00b0998b4c3543f2 (patch) | |
tree | d12a5818072d04525db6eb2d74668ba03bdead2d /drivers/ide/legacy | |
parent | 48c3c1072651922ed153bcf0a33ea82cf20df390 (diff) | |
download | op-kernel-dev-6f904d015262dfa43eb1cecc00b0998b4c3543f2.zip op-kernel-dev-6f904d015262dfa43eb1cecc00b0998b4c3543f2.tar.gz |
ide: add ide_host_add() helper
Add ide_host_add() helper which does ide_host_alloc()+ide_host_register(),
then convert ide_setup_pci_device[s](), ide_legacy_device_add() and some
host drivers to use it.
While at it:
* Fix ide_setup_pci_device[s](), ide_arm.c, gayle.c, ide-4drives.c,
macide.c, q40ide.c, cmd640.c and cs5520.c to return correct error value.
* -ENOENT -> -ENOMEM in rapide.c, ide-h8300.c, ide-generic.c, au1xxx-ide.c
and pmac.c
* -ENODEV -> -ENOMEM in palm_bk3710.c, ide_platform.c and delkin_cb.c
* -1 -> -ENOMEM in ide-pnp.c
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/legacy')
-rw-r--r-- | drivers/ide/legacy/buddha.c | 5 | ||||
-rw-r--r-- | drivers/ide/legacy/gayle.c | 7 | ||||
-rw-r--r-- | drivers/ide/legacy/ide-4drives.c | 7 | ||||
-rw-r--r-- | drivers/ide/legacy/ide-cs.c | 8 | ||||
-rw-r--r-- | drivers/ide/legacy/ide_platform.c | 8 | ||||
-rw-r--r-- | drivers/ide/legacy/macide.c | 7 | ||||
-rw-r--r-- | drivers/ide/legacy/q40ide.c | 7 |
7 files changed, 10 insertions, 39 deletions
diff --git a/drivers/ide/legacy/buddha.c b/drivers/ide/legacy/buddha.c index 2625667..7c2afa9 100644 --- a/drivers/ide/legacy/buddha.c +++ b/drivers/ide/legacy/buddha.c @@ -151,7 +151,6 @@ static void __init buddha_setup_ports(hw_regs_t *hw, unsigned long base, static int __init buddha_init(void) { struct zorro_dev *z = NULL; - struct ide_host *host; u_long buddha_board = 0; BuddhaType type; int buddha_num_hwifs, i; @@ -226,9 +225,7 @@ fail_base2: hws[i] = &hw[i]; } - host = ide_host_alloc(NULL, hws); - if (host) - ide_host_register(host, NULL, hws); + ide_host_add(NULL, hws, NULL); } return 0; diff --git a/drivers/ide/legacy/gayle.c b/drivers/ide/legacy/gayle.c index 13d22bd..dd5c467 100644 --- a/drivers/ide/legacy/gayle.c +++ b/drivers/ide/legacy/gayle.c @@ -127,7 +127,6 @@ static int __init gayle_init(void) unsigned long phys_base, res_start, res_n; unsigned long base, ctrlport, irqport; ide_ack_intr_t *ack_intr; - struct ide_host *host; int a4000, i; hw_regs_t hw[GAYLE_NUM_HWIFS], *hws[] = { NULL, NULL, NULL, NULL }; @@ -180,11 +179,7 @@ found: hws[i] = &hw[i]; } - host = ide_host_alloc(NULL, hws); - if (host) - ide_host_register(host, NULL, hws); - - return 0; + return ide_host_add(NULL, hws, NULL); } module_init(gayle_init); diff --git a/drivers/ide/legacy/ide-4drives.c b/drivers/ide/legacy/ide-4drives.c index 5935153..c76d55d 100644 --- a/drivers/ide/legacy/ide-4drives.c +++ b/drivers/ide/legacy/ide-4drives.c @@ -28,7 +28,6 @@ static const struct ide_port_info ide_4drives_port_info = { static int __init ide_4drives_init(void) { - struct ide_host *host; unsigned long base = 0x1f0, ctl = 0x3f6; hw_regs_t hw, *hws[] = { &hw, &hw, NULL, NULL }; @@ -54,11 +53,7 @@ static int __init ide_4drives_init(void) hw.irq = 14; hw.chipset = ide_4drives; - host = ide_host_alloc(&ide_4drives_port_info, hws); - if (host) - ide_host_register(host, &ide_4drives_port_info, hws); - - return 0; + return ide_host_add(&ide_4drives_port_info, hws, NULL); } module_init(ide_4drives_init); diff --git a/drivers/ide/legacy/ide-cs.c b/drivers/ide/legacy/ide-cs.c index 1a4b9e6..21bfac1 100644 --- a/drivers/ide/legacy/ide-cs.c +++ b/drivers/ide/legacy/ide-cs.c @@ -162,7 +162,7 @@ static struct ide_host *idecs_register(unsigned long io, unsigned long ctl, { struct ide_host *host; ide_hwif_t *hwif; - int i; + int i, rc; hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; if (!request_region(io, 8, DRV_NAME)) { @@ -184,12 +184,10 @@ static struct ide_host *idecs_register(unsigned long io, unsigned long ctl, hw.chipset = ide_pci; hw.dev = &handle->dev; - host = ide_host_alloc(&idecs_port_info, hws); - if (host == NULL) + rc = ide_host_add(&idecs_port_info, hws, &host); + if (rc) goto out_release; - ide_host_register(host, &idecs_port_info, hws); - hwif = host->ports[0]; if (hwif->present) diff --git a/drivers/ide/legacy/ide_platform.c b/drivers/ide/legacy/ide_platform.c index 58a942c..051b4ab 100644 --- a/drivers/ide/legacy/ide_platform.c +++ b/drivers/ide/legacy/ide_platform.c @@ -99,13 +99,9 @@ static int __devinit plat_ide_probe(struct platform_device *pdev) if (mmio) d.host_flags |= IDE_HFLAG_MMIO; - host = ide_host_alloc(&d, hws); - if (host == NULL) { - ret = -ENODEV; + ret = ide_host_add(&d, hws, &host); + if (ret) goto out; - } - - ide_host_register(host, &d, hws); platform_set_drvdata(pdev, host); diff --git a/drivers/ide/legacy/macide.c b/drivers/ide/legacy/macide.c index b49cf8c..a0bb167 100644 --- a/drivers/ide/legacy/macide.c +++ b/drivers/ide/legacy/macide.c @@ -92,7 +92,6 @@ static const char *mac_ide_name[] = static int __init macide_init(void) { ide_ack_intr_t *ack_intr; - struct ide_host *host; unsigned long base; int irq; hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; @@ -125,11 +124,7 @@ static int __init macide_init(void) macide_setup_ports(&hw, base, irq, ack_intr); - host = ide_host_alloc(NULL, hws); - if (host) - ide_host_register(host, NULL, hws); - - return 0; + return ide_host_add(NULL, hws, NULL); } module_init(macide_init); diff --git a/drivers/ide/legacy/q40ide.c b/drivers/ide/legacy/q40ide.c index 8fb4438..4abd8fc 100644 --- a/drivers/ide/legacy/q40ide.c +++ b/drivers/ide/legacy/q40ide.c @@ -131,7 +131,6 @@ static const char *q40_ide_names[Q40IDE_NUM_HWIFS]={ static int __init q40ide_init(void) { - struct ide_host *host; int i; hw_regs_t hw[Q40IDE_NUM_HWIFS], *hws[] = { NULL, NULL, NULL, NULL }; @@ -160,11 +159,7 @@ static int __init q40ide_init(void) hws[i] = &hw[i]; } - host = ide_host_alloc(&q40ide_port_info, hws); - if (host) - ide_host_register(host, &q40ide_port_info, hws); - - return 0; + return ide_host_add(&q40ide_port_info, hws, NULL); } module_init(q40ide_init); |