aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-05-17 13:12:24 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-05-17 13:12:24 -0400
commitdca3983059a4481e4ae97bbf0ac4b4c21429e1a5 (patch)
treeee15aed0673b5474bdadc93e3054f361bf2e839b /drivers
parent29e52cf793ded6bece50de50e738596f94f07d9f (diff)
ide: pass number of ports to ide_host_{alloc,add}() (v2)
Pass number of ports to ide_host_{alloc,add}() and then update all users accordingly. v2: - drop no longer needed NULL initializers in buddha.c, cmd640.c and gayle.c (noticed by Sergei) There should be no functional changes caused by this patch. Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ide/at91_ide.c5
-rw-r--r--drivers/ide/au1xxx-ide.c4
-rw-r--r--drivers/ide/buddha.c4
-rw-r--r--drivers/ide/cmd640.c5
-rw-r--r--drivers/ide/cs5520.c4
-rw-r--r--drivers/ide/delkin_cb.c4
-rw-r--r--drivers/ide/falconide.c4
-rw-r--r--drivers/ide/gayle.c4
-rw-r--r--drivers/ide/icside.c8
-rw-r--r--drivers/ide/ide-4drives.c4
-rw-r--r--drivers/ide/ide-cs.c4
-rw-r--r--drivers/ide/ide-generic.c4
-rw-r--r--drivers/ide/ide-h8300.c4
-rw-r--r--drivers/ide/ide-legacy.c4
-rw-r--r--drivers/ide/ide-pnp.c4
-rw-r--r--drivers/ide/ide-probe.c9
-rw-r--r--drivers/ide/ide_platform.c4
-rw-r--r--drivers/ide/macide.c4
-rw-r--r--drivers/ide/palm_bk3710.c4
-rw-r--r--drivers/ide/pmac.c4
-rw-r--r--drivers/ide/q40ide.c4
-rw-r--r--drivers/ide/rapide.c4
-rw-r--r--drivers/ide/scc_pata.c4
-rw-r--r--drivers/ide/setup-pci.c6
-rw-r--r--drivers/ide/sgiioc4.c4
-rw-r--r--drivers/ide/tx4938ide.c5
-rw-r--r--drivers/ide/tx4939ide.c5
27 files changed, 61 insertions, 62 deletions
diff --git a/drivers/ide/at91_ide.c b/drivers/ide/at91_ide.c
index 8d39cc9bdf92..11fe1ffdff76 100644
--- a/drivers/ide/at91_ide.c
+++ b/drivers/ide/at91_ide.c
@@ -247,8 +247,7 @@ irqreturn_t at91_irq_handler(int irq, void *dev_id)
247static int __init at91_ide_probe(struct platform_device *pdev) 247static int __init at91_ide_probe(struct platform_device *pdev)
248{ 248{
249 int ret; 249 int ret;
250 hw_regs_t hw; 250 hw_regs_t hw, *hws[] = { &hw };
251 hw_regs_t *hws[] = { &hw, NULL, NULL, NULL };
252 struct ide_host *host; 251 struct ide_host *host;
253 struct resource *res; 252 struct resource *res;
254 unsigned long tf_base = 0, ctl_base = 0; 253 unsigned long tf_base = 0, ctl_base = 0;
@@ -307,7 +306,7 @@ static int __init at91_ide_probe(struct platform_device *pdev)
307 hw.irq = board->irq_pin; 306 hw.irq = board->irq_pin;
308 hw.dev = &pdev->dev; 307 hw.dev = &pdev->dev;
309 308
310 host = ide_host_alloc(&at91_ide_port_info, hws); 309 host = ide_host_alloc(&at91_ide_port_info, hws, 1);
311 if (!host) { 310 if (!host) {
312 perr("failed to allocate ide host\n"); 311 perr("failed to allocate ide host\n");
313 return -ENOMEM; 312 return -ENOMEM;
diff --git a/drivers/ide/au1xxx-ide.c b/drivers/ide/au1xxx-ide.c
index 9b31f830e2f5..32f5be686018 100644
--- a/drivers/ide/au1xxx-ide.c
+++ b/drivers/ide/au1xxx-ide.c
@@ -508,7 +508,7 @@ static int au_ide_probe(struct platform_device *dev)
508 struct resource *res; 508 struct resource *res;
509 struct ide_host *host; 509 struct ide_host *host;
510 int ret = 0; 510 int ret = 0;
511 hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; 511 hw_regs_t hw, *hws[] = { &hw };
512 512
513#if defined(CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA) 513#if defined(CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA)
514 char *mode = "MWDMA2"; 514 char *mode = "MWDMA2";
@@ -550,7 +550,7 @@ static int au_ide_probe(struct platform_device *dev)
550 hw.irq = ahwif->irq; 550 hw.irq = ahwif->irq;
551 hw.dev = &dev->dev; 551 hw.dev = &dev->dev;
552 552
553 ret = ide_host_add(&au1xxx_port_info, hws, &host); 553 ret = ide_host_add(&au1xxx_port_info, hws, 1, &host);
554 if (ret) 554 if (ret)
555 goto out; 555 goto out;
556 556
diff --git a/drivers/ide/buddha.c b/drivers/ide/buddha.c
index 9aa2cd9be310..0450652cdabb 100644
--- a/drivers/ide/buddha.c
+++ b/drivers/ide/buddha.c
@@ -160,7 +160,7 @@ static int __init buddha_init(void)
160 160
161 while ((z = zorro_find_device(ZORRO_WILDCARD, z))) { 161 while ((z = zorro_find_device(ZORRO_WILDCARD, z))) {
162 unsigned long board; 162 unsigned long board;
163 hw_regs_t hw[MAX_NUM_HWIFS], *hws[] = { NULL, NULL, NULL, NULL }; 163 hw_regs_t hw[MAX_NUM_HWIFS], *hws[MAX_NUM_HWIFS];
164 164
165 if (z->id == ZORRO_PROD_INDIVIDUAL_COMPUTERS_BUDDHA) { 165 if (z->id == ZORRO_PROD_INDIVIDUAL_COMPUTERS_BUDDHA) {
166 buddha_num_hwifs = BUDDHA_NUM_HWIFS; 166 buddha_num_hwifs = BUDDHA_NUM_HWIFS;
@@ -224,7 +224,7 @@ fail_base2:
224 hws[i] = &hw[i]; 224 hws[i] = &hw[i];
225 } 225 }
226 226
227 ide_host_add(&buddha_port_info, hws, NULL); 227 ide_host_add(&buddha_port_info, hws, i, NULL);
228 } 228 }
229 229
230 return 0; 230 return 0;
diff --git a/drivers/ide/cmd640.c b/drivers/ide/cmd640.c
index e862a2503ab0..edb3a7a35c80 100644
--- a/drivers/ide/cmd640.c
+++ b/drivers/ide/cmd640.c
@@ -708,7 +708,7 @@ static int __init cmd640x_init(void)
708 int second_port_cmd640 = 0, rc; 708 int second_port_cmd640 = 0, rc;
709 const char *bus_type, *port2; 709 const char *bus_type, *port2;
710 u8 b, cfr; 710 u8 b, cfr;
711 hw_regs_t hw[2], *hws[] = { NULL, NULL, NULL, NULL }; 711 hw_regs_t hw[2], *hws[2];
712 712
713 if (cmd640_vlb && probe_for_cmd640_vlb()) { 713 if (cmd640_vlb && probe_for_cmd640_vlb()) {
714 bus_type = "VLB"; 714 bus_type = "VLB";
@@ -822,7 +822,8 @@ static int __init cmd640x_init(void)
822 cmd640_dump_regs(); 822 cmd640_dump_regs();
823#endif 823#endif
824 824
825 return ide_host_add(&cmd640_port_info, hws, NULL); 825 return ide_host_add(&cmd640_port_info, hws, second_port_cmd640 ? 2 : 1,
826 NULL);
826} 827}
827 828
828module_param_named(probe_vlb, cmd640_vlb, bool, 0); 829module_param_named(probe_vlb, cmd640_vlb, bool, 0);
diff --git a/drivers/ide/cs5520.c b/drivers/ide/cs5520.c
index 87987a7d36c9..a9023d7843f2 100644
--- a/drivers/ide/cs5520.c
+++ b/drivers/ide/cs5520.c
@@ -110,7 +110,7 @@ static const struct ide_port_info cyrix_chipset __devinitdata = {
110static int __devinit cs5520_init_one(struct pci_dev *dev, const struct pci_device_id *id) 110static int __devinit cs5520_init_one(struct pci_dev *dev, const struct pci_device_id *id)
111{ 111{
112 const struct ide_port_info *d = &cyrix_chipset; 112 const struct ide_port_info *d = &cyrix_chipset;
113 hw_regs_t hw[4], *hws[] = { NULL, NULL, NULL, NULL }; 113 hw_regs_t hw[2], *hws[] = { NULL, NULL };
114 114
115 ide_setup_pci_noise(dev, d); 115 ide_setup_pci_noise(dev, d);
116 116
@@ -136,7 +136,7 @@ static int __devinit cs5520_init_one(struct pci_dev *dev, const struct pci_devic
136 ide_pci_setup_ports(dev, d, &hw[0], &hws[0]); 136 ide_pci_setup_ports(dev, d, &hw[0], &hws[0]);
137 hw[0].irq = 14; 137 hw[0].irq = 14;
138 138
139 return ide_host_add(d, hws, NULL); 139 return ide_host_add(d, hws, 2, NULL);
140} 140}
141 141
142static const struct pci_device_id cs5520_pci_tbl[] = { 142static const struct pci_device_id cs5520_pci_tbl[] = {
diff --git a/drivers/ide/delkin_cb.c b/drivers/ide/delkin_cb.c
index a0de834a81c3..d4a76f22ed15 100644
--- a/drivers/ide/delkin_cb.c
+++ b/drivers/ide/delkin_cb.c
@@ -77,7 +77,7 @@ delkin_cb_probe (struct pci_dev *dev, const struct pci_device_id *id)
77 struct ide_host *host; 77 struct ide_host *host;
78 unsigned long base; 78 unsigned long base;
79 int rc; 79 int rc;
80 hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; 80 hw_regs_t hw, *hws[] = { &hw };
81 81
82 rc = pci_enable_device(dev); 82 rc = pci_enable_device(dev);
83 if (rc) { 83 if (rc) {
@@ -99,7 +99,7 @@ delkin_cb_probe (struct pci_dev *dev, const struct pci_device_id *id)
99 hw.irq = dev->irq; 99 hw.irq = dev->irq;
100 hw.dev = &dev->dev; 100 hw.dev = &dev->dev;
101 101
102 rc = ide_host_add(&delkin_cb_port_info, hws, &host); 102 rc = ide_host_add(&delkin_cb_port_info, hws, 1, &host);
103 if (rc) 103 if (rc)
104 goto out_disable; 104 goto out_disable;
105 105
diff --git a/drivers/ide/falconide.c b/drivers/ide/falconide.c
index 770cfa67bdc8..adb5b0cf7626 100644
--- a/drivers/ide/falconide.c
+++ b/drivers/ide/falconide.c
@@ -138,7 +138,7 @@ static void __init falconide_setup_ports(hw_regs_t *hw)
138static int __init falconide_init(void) 138static int __init falconide_init(void)
139{ 139{
140 struct ide_host *host; 140 struct ide_host *host;
141 hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; 141 hw_regs_t hw, *hws[] = { &hw };
142 int rc; 142 int rc;
143 143
144 if (!MACH_IS_ATARI || !ATARIHW_PRESENT(IDE)) 144 if (!MACH_IS_ATARI || !ATARIHW_PRESENT(IDE))
@@ -153,7 +153,7 @@ static int __init falconide_init(void)
153 153
154 falconide_setup_ports(&hw); 154 falconide_setup_ports(&hw);
155 155
156 host = ide_host_alloc(&falconide_port_info, hws); 156 host = ide_host_alloc(&falconide_port_info, hws, 1);
157 if (host == NULL) { 157 if (host == NULL) {
158 rc = -ENOMEM; 158 rc = -ENOMEM;
159 goto err; 159 goto err;
diff --git a/drivers/ide/gayle.c b/drivers/ide/gayle.c
index 71db2f9c3361..253ff34afd8f 100644
--- a/drivers/ide/gayle.c
+++ b/drivers/ide/gayle.c
@@ -125,7 +125,7 @@ static int __init gayle_init(void)
125 unsigned long base, ctrlport, irqport; 125 unsigned long base, ctrlport, irqport;
126 ide_ack_intr_t *ack_intr; 126 ide_ack_intr_t *ack_intr;
127 int a4000, i, rc; 127 int a4000, i, rc;
128 hw_regs_t hw[GAYLE_NUM_HWIFS], *hws[] = { NULL, NULL, NULL, NULL }; 128 hw_regs_t hw[GAYLE_NUM_HWIFS], *hws[GAYLE_NUM_HWIFS];
129 129
130 if (!MACH_IS_AMIGA) 130 if (!MACH_IS_AMIGA)
131 return -ENODEV; 131 return -ENODEV;
@@ -170,7 +170,7 @@ found:
170 hws[i] = &hw[i]; 170 hws[i] = &hw[i];
171 } 171 }
172 172
173 rc = ide_host_add(&gayle_port_info, hws, NULL); 173 rc = ide_host_add(&gayle_port_info, hws, i, NULL);
174 if (rc) 174 if (rc)
175 release_mem_region(res_start, res_n); 175 release_mem_region(res_start, res_n);
176 176
diff --git a/drivers/ide/icside.c b/drivers/ide/icside.c
index 6352a44ed179..6223b80beb35 100644
--- a/drivers/ide/icside.c
+++ b/drivers/ide/icside.c
@@ -410,7 +410,7 @@ icside_register_v5(struct icside_state *state, struct expansion_card *ec)
410{ 410{
411 void __iomem *base; 411 void __iomem *base;
412 struct ide_host *host; 412 struct ide_host *host;
413 hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; 413 hw_regs_t hw, *hws[] = { &hw };
414 int ret; 414 int ret;
415 415
416 base = ecardm_iomap(ec, ECARD_RES_MEMC, 0, 0); 416 base = ecardm_iomap(ec, ECARD_RES_MEMC, 0, 0);
@@ -431,7 +431,7 @@ icside_register_v5(struct icside_state *state, struct expansion_card *ec)
431 431
432 icside_setup_ports(&hw, base, &icside_cardinfo_v5, ec); 432 icside_setup_ports(&hw, base, &icside_cardinfo_v5, ec);
433 433
434 host = ide_host_alloc(&icside_v5_port_info, hws); 434 host = ide_host_alloc(&icside_v5_port_info, hws, 1);
435 if (host == NULL) 435 if (host == NULL)
436 return -ENODEV; 436 return -ENODEV;
437 437
@@ -467,7 +467,7 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec)
467 struct ide_host *host; 467 struct ide_host *host;
468 unsigned int sel = 0; 468 unsigned int sel = 0;
469 int ret; 469 int ret;
470 hw_regs_t hw[2], *hws[] = { &hw[0], &hw[1], NULL, NULL }; 470 hw_regs_t hw[2], *hws[] = { &hw[0], &hw[1] };
471 struct ide_port_info d = icside_v6_port_info; 471 struct ide_port_info d = icside_v6_port_info;
472 472
473 ioc_base = ecardm_iomap(ec, ECARD_RES_IOCFAST, 0, 0); 473 ioc_base = ecardm_iomap(ec, ECARD_RES_IOCFAST, 0, 0);
@@ -507,7 +507,7 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec)
507 icside_setup_ports(&hw[0], easi_base, &icside_cardinfo_v6_1, ec); 507 icside_setup_ports(&hw[0], easi_base, &icside_cardinfo_v6_1, ec);
508 icside_setup_ports(&hw[1], easi_base, &icside_cardinfo_v6_2, ec); 508 icside_setup_ports(&hw[1], easi_base, &icside_cardinfo_v6_2, ec);
509 509
510 host = ide_host_alloc(&d, hws); 510 host = ide_host_alloc(&d, hws, 2);
511 if (host == NULL) 511 if (host == NULL)
512 return -ENODEV; 512 return -ENODEV;
513 513
diff --git a/drivers/ide/ide-4drives.c b/drivers/ide/ide-4drives.c
index 617ca7a5ec8a..189b8bd9957e 100644
--- a/drivers/ide/ide-4drives.c
+++ b/drivers/ide/ide-4drives.c
@@ -31,7 +31,7 @@ static const struct ide_port_info ide_4drives_port_info = {
31static int __init ide_4drives_init(void) 31static int __init ide_4drives_init(void)
32{ 32{
33 unsigned long base = 0x1f0, ctl = 0x3f6; 33 unsigned long base = 0x1f0, ctl = 0x3f6;
34 hw_regs_t hw, *hws[] = { &hw, &hw, NULL, NULL }; 34 hw_regs_t hw, *hws[] = { &hw, &hw };
35 35
36 if (probe_4drives == 0) 36 if (probe_4drives == 0)
37 return -ENODEV; 37 return -ENODEV;
@@ -54,7 +54,7 @@ static int __init ide_4drives_init(void)
54 ide_std_init_ports(&hw, base, ctl); 54 ide_std_init_ports(&hw, base, ctl);
55 hw.irq = 14; 55 hw.irq = 14;
56 56
57 return ide_host_add(&ide_4drives_port_info, hws, NULL); 57 return ide_host_add(&ide_4drives_port_info, hws, 2, NULL);
58} 58}
59 59
60module_init(ide_4drives_init); 60module_init(ide_4drives_init);
diff --git a/drivers/ide/ide-cs.c b/drivers/ide/ide-cs.c
index 43d09dcae28c..63309ad04cb2 100644
--- a/drivers/ide/ide-cs.c
+++ b/drivers/ide/ide-cs.c
@@ -164,7 +164,7 @@ static struct ide_host *idecs_register(unsigned long io, unsigned long ctl,
164 struct ide_host *host; 164 struct ide_host *host;
165 ide_hwif_t *hwif; 165 ide_hwif_t *hwif;
166 int i, rc; 166 int i, rc;
167 hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; 167 hw_regs_t hw, *hws[] = { &hw };
168 168
169 if (!request_region(io, 8, DRV_NAME)) { 169 if (!request_region(io, 8, DRV_NAME)) {
170 printk(KERN_ERR "%s: I/O resource 0x%lX-0x%lX not free.\n", 170 printk(KERN_ERR "%s: I/O resource 0x%lX-0x%lX not free.\n",
@@ -184,7 +184,7 @@ static struct ide_host *idecs_register(unsigned long io, unsigned long ctl,
184 hw.irq = irq; 184 hw.irq = irq;
185 hw.dev = &handle->dev; 185 hw.dev = &handle->dev;
186 186
187 rc = ide_host_add(&idecs_port_info, hws, &host); 187 rc = ide_host_add(&idecs_port_info, hws, 1, &host);
188 if (rc) 188 if (rc)
189 goto out_release; 189 goto out_release;
190 190
diff --git a/drivers/ide/ide-generic.c b/drivers/ide/ide-generic.c
index 0427759d0187..0d40848540d4 100644
--- a/drivers/ide/ide-generic.c
+++ b/drivers/ide/ide-generic.c
@@ -86,7 +86,7 @@ static void ide_generic_check_pci_legacy_iobases(int *primary, int *secondary)
86 86
87static int __init ide_generic_init(void) 87static int __init ide_generic_init(void)
88{ 88{
89 hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; 89 hw_regs_t hw, *hws[] = { &hw };
90 unsigned long io_addr; 90 unsigned long io_addr;
91 int i, rc = 0, primary = 0, secondary = 0; 91 int i, rc = 0, primary = 0, secondary = 0;
92 92
@@ -133,7 +133,7 @@ static int __init ide_generic_init(void)
133#else 133#else
134 hw.irq = legacy_irqs[i]; 134 hw.irq = legacy_irqs[i];
135#endif 135#endif
136 rc = ide_host_add(&ide_generic_port_info, hws, NULL); 136 rc = ide_host_add(&ide_generic_port_info, hws, 1, NULL);
137 if (rc) { 137 if (rc) {
138 release_region(io_addr + 0x206, 1); 138 release_region(io_addr + 0x206, 1);
139 release_region(io_addr, 8); 139 release_region(io_addr, 8);
diff --git a/drivers/ide/ide-h8300.c b/drivers/ide/ide-h8300.c
index 40eff6c9759c..0b5fabe2806d 100644
--- a/drivers/ide/ide-h8300.c
+++ b/drivers/ide/ide-h8300.c
@@ -83,7 +83,7 @@ static const struct ide_port_info h8300_port_info = {
83 83
84static int __init h8300_ide_init(void) 84static int __init h8300_ide_init(void)
85{ 85{
86 hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; 86 hw_regs_t hw, *hws[] = { &hw };
87 87
88 printk(KERN_INFO DRV_NAME ": H8/300 generic IDE interface\n"); 88 printk(KERN_INFO DRV_NAME ": H8/300 generic IDE interface\n");
89 89
@@ -96,7 +96,7 @@ static int __init h8300_ide_init(void)
96 96
97 hw_setup(&hw); 97 hw_setup(&hw);
98 98
99 return ide_host_add(&h8300_port_info, hws, NULL); 99 return ide_host_add(&h8300_port_info, hws, 1, NULL);
100 100
101out_busy: 101out_busy:
102 printk(KERN_ERR "ide-h8300: IDE I/F resource already used.\n"); 102 printk(KERN_ERR "ide-h8300: IDE I/F resource already used.\n");
diff --git a/drivers/ide/ide-legacy.c b/drivers/ide/ide-legacy.c
index 0c5b29c56cbe..98389e539909 100644
--- a/drivers/ide/ide-legacy.c
+++ b/drivers/ide/ide-legacy.c
@@ -40,7 +40,7 @@ static void ide_legacy_init_one(hw_regs_t **hws, hw_regs_t *hw,
40 40
41int ide_legacy_device_add(const struct ide_port_info *d, unsigned long config) 41int ide_legacy_device_add(const struct ide_port_info *d, unsigned long config)
42{ 42{
43 hw_regs_t hw[2], *hws[] = { NULL, NULL, NULL, NULL }; 43 hw_regs_t hw[2], *hws[] = { NULL, NULL };
44 44
45 memset(&hw, 0, sizeof(hw)); 45 memset(&hw, 0, sizeof(hw));
46 46
@@ -52,6 +52,6 @@ int ide_legacy_device_add(const struct ide_port_info *d, unsigned long config)
52 (d->host_flags & IDE_HFLAG_SINGLE)) 52 (d->host_flags & IDE_HFLAG_SINGLE))
53 return -ENOENT; 53 return -ENOENT;
54 54
55 return ide_host_add(d, hws, NULL); 55 return ide_host_add(d, hws, 2, NULL);
56} 56}
57EXPORT_SYMBOL_GPL(ide_legacy_device_add); 57EXPORT_SYMBOL_GPL(ide_legacy_device_add);
diff --git a/drivers/ide/ide-pnp.c b/drivers/ide/ide-pnp.c
index 47043fda2398..6bca0f05ee90 100644
--- a/drivers/ide/ide-pnp.c
+++ b/drivers/ide/ide-pnp.c
@@ -37,7 +37,7 @@ static int idepnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id)
37 struct ide_host *host; 37 struct ide_host *host;
38 unsigned long base, ctl; 38 unsigned long base, ctl;
39 int rc; 39 int rc;
40 hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; 40 hw_regs_t hw, *hws[] = { &hw };
41 41
42 printk(KERN_INFO DRV_NAME ": generic PnP IDE interface\n"); 42 printk(KERN_INFO DRV_NAME ": generic PnP IDE interface\n");
43 43
@@ -64,7 +64,7 @@ static int idepnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id)
64 ide_std_init_ports(&hw, base, ctl); 64 ide_std_init_ports(&hw, base, ctl);
65 hw.irq = pnp_irq(dev, 0); 65 hw.irq = pnp_irq(dev, 0);
66 66
67 rc = ide_host_add(&ide_pnp_port_info, hws, &host); 67 rc = ide_host_add(&ide_pnp_port_info, hws, 1, &host);
68 if (rc) 68 if (rc)
69 goto out; 69 goto out;
70 70
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index f17ba1932ad6..6c7451a6e609 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -1261,7 +1261,8 @@ out_nomem:
1261 return -ENOMEM; 1261 return -ENOMEM;
1262} 1262}
1263 1263
1264struct ide_host *ide_host_alloc(const struct ide_port_info *d, hw_regs_t **hws) 1264struct ide_host *ide_host_alloc(const struct ide_port_info *d, hw_regs_t **hws,
1265 unsigned int n_ports)
1265{ 1266{
1266 struct ide_host *host; 1267 struct ide_host *host;
1267 struct device *dev = hws[0] ? hws[0]->dev : NULL; 1268 struct device *dev = hws[0] ? hws[0]->dev : NULL;
@@ -1272,7 +1273,7 @@ struct ide_host *ide_host_alloc(const struct ide_port_info *d, hw_regs_t **hws)
1272 if (host == NULL) 1273 if (host == NULL)
1273 return NULL; 1274 return NULL;
1274 1275
1275 for (i = 0; i < MAX_HOST_PORTS; i++) { 1276 for (i = 0; i < n_ports; i++) {
1276 ide_hwif_t *hwif; 1277 ide_hwif_t *hwif;
1277 int idx; 1278 int idx;
1278 1279
@@ -1443,12 +1444,12 @@ int ide_host_register(struct ide_host *host, const struct ide_port_info *d,
1443EXPORT_SYMBOL_GPL(ide_host_register); 1444EXPORT_SYMBOL_GPL(ide_host_register);
1444 1445
1445int ide_host_add(const struct ide_port_info *d, hw_regs_t **hws, 1446int ide_host_add(const struct ide_port_info *d, hw_regs_t **hws,
1446 struct ide_host **hostp) 1447 unsigned int n_ports, struct ide_host **hostp)
1447{ 1448{
1448 struct ide_host *host; 1449 struct ide_host *host;
1449 int rc; 1450 int rc;
1450 1451
1451 host = ide_host_alloc(d, hws); 1452 host = ide_host_alloc(d, hws, n_ports);
1452 if (host == NULL) 1453 if (host == NULL)
1453 return -ENOMEM; 1454 return -ENOMEM;
1454 1455
diff --git a/drivers/ide/ide_platform.c b/drivers/ide/ide_platform.c
index 813653362a26..47413c2b5f8e 100644
--- a/drivers/ide/ide_platform.c
+++ b/drivers/ide/ide_platform.c
@@ -54,7 +54,7 @@ static int __devinit plat_ide_probe(struct platform_device *pdev)
54 struct pata_platform_info *pdata; 54 struct pata_platform_info *pdata;
55 struct ide_host *host; 55 struct ide_host *host;
56 int ret = 0, mmio = 0; 56 int ret = 0, mmio = 0;
57 hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; 57 hw_regs_t hw, *hws[] = { &hw };
58 struct ide_port_info d = platform_ide_port_info; 58 struct ide_port_info d = platform_ide_port_info;
59 59
60 pdata = pdev->dev.platform_data; 60 pdata = pdev->dev.platform_data;
@@ -98,7 +98,7 @@ static int __devinit plat_ide_probe(struct platform_device *pdev)
98 if (mmio) 98 if (mmio)
99 d.host_flags |= IDE_HFLAG_MMIO; 99 d.host_flags |= IDE_HFLAG_MMIO;
100 100
101 ret = ide_host_add(&d, hws, &host); 101 ret = ide_host_add(&d, hws, 1, &host);
102 if (ret) 102 if (ret)
103 goto out; 103 goto out;
104 104
diff --git a/drivers/ide/macide.c b/drivers/ide/macide.c
index 3af9e96da617..31aa27818604 100644
--- a/drivers/ide/macide.c
+++ b/drivers/ide/macide.c
@@ -96,7 +96,7 @@ static int __init macide_init(void)
96 ide_ack_intr_t *ack_intr; 96 ide_ack_intr_t *ack_intr;
97 unsigned long base; 97 unsigned long base;
98 int irq; 98 int irq;
99 hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; 99 hw_regs_t hw, *hws[] = { &hw };
100 100
101 if (!MACH_IS_MAC) 101 if (!MACH_IS_MAC)
102 return -ENODEV; 102 return -ENODEV;
@@ -126,7 +126,7 @@ static int __init macide_init(void)
126 126
127 macide_setup_ports(&hw, base, irq, ack_intr); 127 macide_setup_ports(&hw, base, irq, ack_intr);
128 128
129 return ide_host_add(&macide_port_info, hws, NULL); 129 return ide_host_add(&macide_port_info, hws, 1, NULL);
130} 130}
131 131
132module_init(macide_init); 132module_init(macide_init);
diff --git a/drivers/ide/palm_bk3710.c b/drivers/ide/palm_bk3710.c
index a455c25f43cc..4507a6d801bc 100644
--- a/drivers/ide/palm_bk3710.c
+++ b/drivers/ide/palm_bk3710.c
@@ -316,7 +316,7 @@ static int __init palm_bk3710_probe(struct platform_device *pdev)
316 void __iomem *base; 316 void __iomem *base;
317 unsigned long rate, mem_size; 317 unsigned long rate, mem_size;
318 int i, rc; 318 int i, rc;
319 hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; 319 hw_regs_t hw, *hws[] = { &hw };
320 320
321 clk = clk_get(&pdev->dev, "IDECLK"); 321 clk = clk_get(&pdev->dev, "IDECLK");
322 if (IS_ERR(clk)) 322 if (IS_ERR(clk))
@@ -369,7 +369,7 @@ static int __init palm_bk3710_probe(struct platform_device *pdev)
369 ATA_UDMA5; 369 ATA_UDMA5;
370 370
371 /* Register the IDE interface with Linux */ 371 /* Register the IDE interface with Linux */
372 rc = ide_host_add(&palm_bk3710_port_info, hws, NULL); 372 rc = ide_host_add(&palm_bk3710_port_info, hws, 1, NULL);
373 if (rc) 373 if (rc)
374 goto out; 374 goto out;
375 375
diff --git a/drivers/ide/pmac.c b/drivers/ide/pmac.c
index f76e4e6b408f..f4f806476e0a 100644
--- a/drivers/ide/pmac.c
+++ b/drivers/ide/pmac.c
@@ -1029,7 +1029,7 @@ static int __devinit pmac_ide_setup_device(pmac_ide_hwif_t *pmif, hw_regs_t *hw)
1029 const int *bidp; 1029 const int *bidp;
1030 struct ide_host *host; 1030 struct ide_host *host;
1031 ide_hwif_t *hwif; 1031 ide_hwif_t *hwif;
1032 hw_regs_t *hws[] = { hw, NULL, NULL, NULL }; 1032 hw_regs_t *hws[] = { hw };
1033 struct ide_port_info d = pmac_port_info; 1033 struct ide_port_info d = pmac_port_info;
1034 int rc; 1034 int rc;
1035 1035
@@ -1077,7 +1077,7 @@ static int __devinit pmac_ide_setup_device(pmac_ide_hwif_t *pmif, hw_regs_t *hw)
1077 /* Make sure we have sane timings */ 1077 /* Make sure we have sane timings */
1078 sanitize_timings(pmif); 1078 sanitize_timings(pmif);
1079 1079
1080 host = ide_host_alloc(&d, hws); 1080 host = ide_host_alloc(&d, hws, 1);
1081 if (host == NULL) 1081 if (host == NULL)
1082 return -ENOMEM; 1082 return -ENOMEM;
1083 hwif = host->ports[0]; 1083 hwif = host->ports[0];
diff --git a/drivers/ide/q40ide.c b/drivers/ide/q40ide.c
index 7488d4ff3d7c..e46229fe5ea3 100644
--- a/drivers/ide/q40ide.c
+++ b/drivers/ide/q40ide.c
@@ -135,7 +135,7 @@ static const char *q40_ide_names[Q40IDE_NUM_HWIFS]={
135static int __init q40ide_init(void) 135static int __init q40ide_init(void)
136{ 136{
137 int i; 137 int i;
138 hw_regs_t hw[Q40IDE_NUM_HWIFS], *hws[] = { NULL, NULL, NULL, NULL }; 138 hw_regs_t hw[Q40IDE_NUM_HWIFS], *hws[] = { NULL, NULL };
139 139
140 if (!MACH_IS_Q40) 140 if (!MACH_IS_Q40)
141 return -ENODEV; 141 return -ENODEV;
@@ -162,7 +162,7 @@ static int __init q40ide_init(void)
162 hws[i] = &hw[i]; 162 hws[i] = &hw[i];
163 } 163 }
164 164
165 return ide_host_add(&q40ide_port_info, hws, NULL); 165 return ide_host_add(&q40ide_port_info, hws, Q40IDE_NUM_HWIFS, NULL);
166} 166}
167 167
168module_init(q40ide_init); 168module_init(q40ide_init);
diff --git a/drivers/ide/rapide.c b/drivers/ide/rapide.c
index bd4d7a8a666c..c4da3dd39f5c 100644
--- a/drivers/ide/rapide.c
+++ b/drivers/ide/rapide.c
@@ -36,7 +36,7 @@ rapide_probe(struct expansion_card *ec, const struct ecard_id *id)
36 void __iomem *base; 36 void __iomem *base;
37 struct ide_host *host; 37 struct ide_host *host;
38 int ret; 38 int ret;
39 hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; 39 hw_regs_t hw, *hws[] = { &hw };
40 40
41 ret = ecard_request_resources(ec); 41 ret = ecard_request_resources(ec);
42 if (ret) 42 if (ret)
@@ -52,7 +52,7 @@ rapide_probe(struct expansion_card *ec, const struct ecard_id *id)
52 rapide_setup_ports(&hw, base, base + 0x818, 1 << 6, ec->irq); 52 rapide_setup_ports(&hw, base, base + 0x818, 1 << 6, ec->irq);
53 hw.dev = &ec->dev; 53 hw.dev = &ec->dev;
54 54
55 ret = ide_host_add(&rapide_port_info, hws, &host); 55 ret = ide_host_add(&rapide_port_info, hws, 1, &host);
56 if (ret) 56 if (ret)
57 goto release; 57 goto release;
58 58
diff --git a/drivers/ide/scc_pata.c b/drivers/ide/scc_pata.c
index 9e3aef317332..9415f8c8a41d 100644
--- a/drivers/ide/scc_pata.c
+++ b/drivers/ide/scc_pata.c
@@ -559,7 +559,7 @@ static int scc_ide_setup_pci_device(struct pci_dev *dev,
559{ 559{
560 struct scc_ports *ports = pci_get_drvdata(dev); 560 struct scc_ports *ports = pci_get_drvdata(dev);
561 struct ide_host *host; 561 struct ide_host *host;
562 hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; 562 hw_regs_t hw, *hws[] = { &hw };
563 int i, rc; 563 int i, rc;
564 564
565 memset(&hw, 0, sizeof(hw)); 565 memset(&hw, 0, sizeof(hw));
@@ -568,7 +568,7 @@ static int scc_ide_setup_pci_device(struct pci_dev *dev,
568 hw.irq = dev->irq; 568 hw.irq = dev->irq;
569 hw.dev = &dev->dev; 569 hw.dev = &dev->dev;
570 570
571 rc = ide_host_add(d, hws, &host); 571 rc = ide_host_add(d, hws, 1, &host);
572 if (rc) 572 if (rc)
573 return rc; 573 return rc;
574 574
diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c
index 82519ddc9108..d78f4c994517 100644
--- a/drivers/ide/setup-pci.c
+++ b/drivers/ide/setup-pci.c
@@ -538,7 +538,7 @@ int ide_pci_init_one(struct pci_dev *dev, const struct ide_port_info *d,
538 void *priv) 538 void *priv)
539{ 539{
540 struct ide_host *host; 540 struct ide_host *host;
541 hw_regs_t hw[4], *hws[] = { NULL, NULL, NULL, NULL }; 541 hw_regs_t hw[2], *hws[] = { NULL, NULL };
542 int ret; 542 int ret;
543 543
544 ret = ide_setup_pci_controller(dev, d, 1); 544 ret = ide_setup_pci_controller(dev, d, 1);
@@ -547,7 +547,7 @@ int ide_pci_init_one(struct pci_dev *dev, const struct ide_port_info *d,
547 547
548 ide_pci_setup_ports(dev, d, &hw[0], &hws[0]); 548 ide_pci_setup_ports(dev, d, &hw[0], &hws[0]);
549 549
550 host = ide_host_alloc(d, hws); 550 host = ide_host_alloc(d, hws, 2);
551 if (host == NULL) { 551 if (host == NULL) {
552 ret = -ENOMEM; 552 ret = -ENOMEM;
553 goto out; 553 goto out;
@@ -596,7 +596,7 @@ int ide_pci_init_two(struct pci_dev *dev1, struct pci_dev *dev2,
596 ide_pci_setup_ports(pdev[i], d, &hw[i*2], &hws[i*2]); 596 ide_pci_setup_ports(pdev[i], d, &hw[i*2], &hws[i*2]);
597 } 597 }
598 598
599 host = ide_host_alloc(d, hws); 599 host = ide_host_alloc(d, hws, 4);
600 if (host == NULL) { 600 if (host == NULL) {
601 ret = -ENOMEM; 601 ret = -ENOMEM;
602 goto out; 602 goto out;
diff --git a/drivers/ide/sgiioc4.c b/drivers/ide/sgiioc4.c
index 676d41c7add5..3f8ee357ffb3 100644
--- a/drivers/ide/sgiioc4.c
+++ b/drivers/ide/sgiioc4.c
@@ -546,7 +546,7 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev)
546 unsigned long cmd_base, irqport; 546 unsigned long cmd_base, irqport;
547 unsigned long bar0, cmd_phys_base, ctl; 547 unsigned long bar0, cmd_phys_base, ctl;
548 void __iomem *virt_base; 548 void __iomem *virt_base;
549 hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; 549 hw_regs_t hw, *hws[] = { &hw };
550 int rc; 550 int rc;
551 551
552 /* Get the CmdBlk and CtrlBlk Base Registers */ 552 /* Get the CmdBlk and CtrlBlk Base Registers */
@@ -580,7 +580,7 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev)
580 /* Initializing chipset IRQ Registers */ 580 /* Initializing chipset IRQ Registers */
581 writel(0x03, (void __iomem *)(irqport + IOC4_INTR_SET * 4)); 581 writel(0x03, (void __iomem *)(irqport + IOC4_INTR_SET * 4));
582 582
583 rc = ide_host_add(&sgiioc4_port_info, hws, NULL); 583 rc = ide_host_add(&sgiioc4_port_info, hws, 1, NULL);
584 if (!rc) 584 if (!rc)
585 return 0; 585 return 0;
586 586
diff --git a/drivers/ide/tx4938ide.c b/drivers/ide/tx4938ide.c
index e33d764e2945..16adc18499fa 100644
--- a/drivers/ide/tx4938ide.c
+++ b/drivers/ide/tx4938ide.c
@@ -130,8 +130,7 @@ static const struct ide_port_info tx4938ide_port_info __initdata = {
130 130
131static int __init tx4938ide_probe(struct platform_device *pdev) 131static int __init tx4938ide_probe(struct platform_device *pdev)
132{ 132{
133 hw_regs_t hw; 133 hw_regs_t hw, *hws[] = { &hw };
134 hw_regs_t *hws[] = { &hw, NULL, NULL, NULL };
135 struct ide_host *host; 134 struct ide_host *host;
136 struct resource *res; 135 struct resource *res;
137 struct tx4938ide_platform_info *pdata = pdev->dev.platform_data; 136 struct tx4938ide_platform_info *pdata = pdev->dev.platform_data;
@@ -183,7 +182,7 @@ static int __init tx4938ide_probe(struct platform_device *pdev)
183 tx4938ide_tune_ebusc(pdata->ebus_ch, pdata->gbus_clock, 0); 182 tx4938ide_tune_ebusc(pdata->ebus_ch, pdata->gbus_clock, 0);
184 else 183 else
185 d.port_ops = NULL; 184 d.port_ops = NULL;
186 ret = ide_host_add(&d, hws, &host); 185 ret = ide_host_add(&d, hws, 1, &host);
187 if (!ret) 186 if (!ret)
188 platform_set_drvdata(pdev, host); 187 platform_set_drvdata(pdev, host);
189 return ret; 188 return ret;
diff --git a/drivers/ide/tx4939ide.c b/drivers/ide/tx4939ide.c
index 564422d23976..fa57920d003a 100644
--- a/drivers/ide/tx4939ide.c
+++ b/drivers/ide/tx4939ide.c
@@ -537,8 +537,7 @@ static const struct ide_port_info tx4939ide_port_info __initdata = {
537 537
538static int __init tx4939ide_probe(struct platform_device *pdev) 538static int __init tx4939ide_probe(struct platform_device *pdev)
539{ 539{
540 hw_regs_t hw; 540 hw_regs_t hw, *hws[] = { &hw };
541 hw_regs_t *hws[] = { &hw, NULL, NULL, NULL };
542 struct ide_host *host; 541 struct ide_host *host;
543 struct resource *res; 542 struct resource *res;
544 int irq, ret; 543 int irq, ret;
@@ -581,7 +580,7 @@ static int __init tx4939ide_probe(struct platform_device *pdev)
581 hw.dev = &pdev->dev; 580 hw.dev = &pdev->dev;
582 581
583 pr_info("TX4939 IDE interface (base %#lx, irq %d)\n", mapbase, irq); 582 pr_info("TX4939 IDE interface (base %#lx, irq %d)\n", mapbase, irq);
584 host = ide_host_alloc(&tx4939ide_port_info, hws); 583 host = ide_host_alloc(&tx4939ide_port_info, hws, 1);
585 if (!host) 584 if (!host)
586 return -ENOMEM; 585 return -ENOMEM;
587 /* use extra_base for base address of the all registers */ 586 /* use extra_base for base address of the all registers */