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 | 48c3c1072651922ed153bcf0a33ea82cf20df390 (patch) | |
tree | 92ad23e3869e70731eca99394c08a3bf06b8753e /drivers/ide/pci/delkin_cb.c | |
parent | 374e042c3e767ac2e5a40b78529220e0b3de793c (diff) |
ide: add struct ide_host (take 3)
* Add struct ide_host which keeps pointers to host's ports.
* Add ide_host_alloc[_all]() and ide_host_remove() helpers.
* Pass 'struct ide_host *host' instead of 'u8 *idx' to
ide_device_add[_all]() and rename it to ide_host_register[_all]().
* Convert host drivers and core code to use struct ide_host.
* Remove no longer needed ide_find_port().
* Make ide_find_port_slot() static.
* Unexport ide_unregister().
v2:
* Add missing 'struct ide_host *host' to macide.c.
v3:
* Fix build problem in pmac.c (s/ide_alloc_host/ide_host_alloc/)
(Noticed by Stephen Rothwell).
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/pci/delkin_cb.c')
-rw-r--r-- | drivers/ide/pci/delkin_cb.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/drivers/ide/pci/delkin_cb.c b/drivers/ide/pci/delkin_cb.c index 33fe15db408a..5eb9d9325184 100644 --- a/drivers/ide/pci/delkin_cb.c +++ b/drivers/ide/pci/delkin_cb.c | |||
@@ -56,11 +56,10 @@ static const struct ide_port_info delkin_cb_port_info = { | |||
56 | static int __devinit | 56 | static int __devinit |
57 | delkin_cb_probe (struct pci_dev *dev, const struct pci_device_id *id) | 57 | delkin_cb_probe (struct pci_dev *dev, const struct pci_device_id *id) |
58 | { | 58 | { |
59 | struct ide_host *host; | ||
59 | unsigned long base; | 60 | unsigned long base; |
60 | ide_hwif_t *hwif = NULL; | ||
61 | int i, rc; | 61 | int i, rc; |
62 | hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; | 62 | hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; |
63 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | ||
64 | 63 | ||
65 | rc = pci_enable_device(dev); | 64 | rc = pci_enable_device(dev); |
66 | if (rc) { | 65 | if (rc) { |
@@ -87,17 +86,13 @@ delkin_cb_probe (struct pci_dev *dev, const struct pci_device_id *id) | |||
87 | hw.dev = &dev->dev; | 86 | hw.dev = &dev->dev; |
88 | hw.chipset = ide_pci; /* this enables IRQ sharing */ | 87 | hw.chipset = ide_pci; /* this enables IRQ sharing */ |
89 | 88 | ||
90 | hwif = ide_find_port(); | 89 | host = ide_host_alloc(&delkin_cb_port_info, hws); |
91 | if (hwif == NULL) | 90 | if (host == NULL) |
92 | goto out_disable; | 91 | goto out_disable; |
93 | 92 | ||
94 | i = hwif->index; | 93 | ide_host_register(host, &delkin_cb_port_info, hws); |
95 | 94 | ||
96 | idx[0] = i; | 95 | pci_set_drvdata(dev, host); |
97 | |||
98 | ide_device_add(idx, &delkin_cb_port_info, hws); | ||
99 | |||
100 | pci_set_drvdata(dev, hwif); | ||
101 | 96 | ||
102 | return 0; | 97 | return 0; |
103 | 98 | ||
@@ -110,9 +105,9 @@ out_disable: | |||
110 | static void | 105 | static void |
111 | delkin_cb_remove (struct pci_dev *dev) | 106 | delkin_cb_remove (struct pci_dev *dev) |
112 | { | 107 | { |
113 | ide_hwif_t *hwif = pci_get_drvdata(dev); | 108 | struct ide_host *host = pci_get_drvdata(dev); |
114 | 109 | ||
115 | ide_unregister(hwif); | 110 | ide_host_remove(host); |
116 | 111 | ||
117 | pci_release_regions(dev); | 112 | pci_release_regions(dev); |
118 | pci_disable_device(dev); | 113 | pci_disable_device(dev); |