diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-07-23 13:55:57 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-07-23 13:55:57 -0400 |
commit | 6f904d015262dfa43eb1cecc00b0998b4c3543f2 (patch) | |
tree | d12a5818072d04525db6eb2d74668ba03bdead2d /drivers/ide/ide-pnp.c | |
parent | 48c3c1072651922ed153bcf0a33ea82cf20df390 (diff) |
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/ide-pnp.c')
-rw-r--r-- | drivers/ide/ide-pnp.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/ide/ide-pnp.c b/drivers/ide/ide-pnp.c index 4458ca61897a..bac9b392b689 100644 --- a/drivers/ide/ide-pnp.c +++ b/drivers/ide/ide-pnp.c | |||
@@ -31,6 +31,7 @@ static int idepnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id) | |||
31 | { | 31 | { |
32 | struct ide_host *host; | 32 | struct ide_host *host; |
33 | unsigned long base, ctl; | 33 | unsigned long base, ctl; |
34 | int rc; | ||
34 | hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; | 35 | hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; |
35 | 36 | ||
36 | printk(KERN_INFO DRV_NAME ": generic PnP IDE interface\n"); | 37 | printk(KERN_INFO DRV_NAME ": generic PnP IDE interface\n"); |
@@ -59,19 +60,18 @@ static int idepnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id) | |||
59 | hw.irq = pnp_irq(dev, 0); | 60 | hw.irq = pnp_irq(dev, 0); |
60 | hw.chipset = ide_generic; | 61 | hw.chipset = ide_generic; |
61 | 62 | ||
62 | host = ide_host_alloc(NULL, hws); | 63 | rc = ide_host_add(NULL, hws, &host); |
63 | if (host) { | 64 | if (rc) |
64 | pnp_set_drvdata(dev, host); | 65 | goto out; |
65 | 66 | ||
66 | ide_host_register(host, NULL, hws); | 67 | pnp_set_drvdata(dev, host); |
67 | |||
68 | return 0; | ||
69 | } | ||
70 | 68 | ||
69 | return 0; | ||
70 | out: | ||
71 | release_region(ctl, 1); | 71 | release_region(ctl, 1); |
72 | release_region(base, 8); | 72 | release_region(base, 8); |
73 | 73 | ||
74 | return -1; | 74 | return rc; |
75 | } | 75 | } |
76 | 76 | ||
77 | static void idepnp_remove(struct pnp_dev *dev) | 77 | static void idepnp_remove(struct pnp_dev *dev) |