aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-07-24 16:53:14 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-07-24 16:53:14 -0400
commit6cdf6eb357c2681596b7b1672b92396ba82333d4 (patch)
treea6194373c64616ecb3d1af2c9247a32f50543f97 /drivers/ide
parent8c2eece50a368c7986bae0b3e52739558dd71b51 (diff)
ide: add ->dev and ->host_priv fields to struct ide_host
* Add 'struct device *dev[2]' and 'void *host_priv' fields to struct ide_host. * Set ->dev[] in ide_host_alloc_all()/ide_setup_pci_device[s](). * Pass 'void *priv' argument to ide_setup_pci_device[s]() and use it to set ->host_priv. * Set PCI dev's ->driver_data to point to the struct ide_host instance if PCI host driver wants to use ->host_priv. * Rename ide_setup_pci_device[s]() to ide_pci_init_{one,two}(). Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide')
-rw-r--r--drivers/ide/ide-probe.c3
-rw-r--r--drivers/ide/pci/aec62xx.c2
-rw-r--r--drivers/ide/pci/alim15x3.c2
-rw-r--r--drivers/ide/pci/amd74xx.c2
-rw-r--r--drivers/ide/pci/atiixp.c2
-rw-r--r--drivers/ide/pci/cmd64x.c2
-rw-r--r--drivers/ide/pci/cs5530.c2
-rw-r--r--drivers/ide/pci/cs5535.c2
-rw-r--r--drivers/ide/pci/cy82c693.c2
-rw-r--r--drivers/ide/pci/generic.c2
-rw-r--r--drivers/ide/pci/hpt34x.c2
-rw-r--r--drivers/ide/pci/hpt366.c4
-rw-r--r--drivers/ide/pci/it8213.c2
-rw-r--r--drivers/ide/pci/it821x.c2
-rw-r--r--drivers/ide/pci/jmicron.c2
-rw-r--r--drivers/ide/pci/ns87415.c2
-rw-r--r--drivers/ide/pci/opti621.c2
-rw-r--r--drivers/ide/pci/pdc202xx_new.c4
-rw-r--r--drivers/ide/pci/pdc202xx_old.c2
-rw-r--r--drivers/ide/pci/piix.c2
-rw-r--r--drivers/ide/pci/rz1000.c2
-rw-r--r--drivers/ide/pci/sc1200.c2
-rw-r--r--drivers/ide/pci/serverworks.c2
-rw-r--r--drivers/ide/pci/siimage.c2
-rw-r--r--drivers/ide/pci/sis5513.c2
-rw-r--r--drivers/ide/pci/sl82c105.c2
-rw-r--r--drivers/ide/pci/slc90e66.c2
-rw-r--r--drivers/ide/pci/tc86c001.c2
-rw-r--r--drivers/ide/pci/triflex.c2
-rw-r--r--drivers/ide/pci/trm290.c2
-rw-r--r--drivers/ide/pci/via82cxxx.c2
-rw-r--r--drivers/ide/setup-pci.c52
32 files changed, 80 insertions, 39 deletions
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index 4aa76c453755..890c15b1b3ae 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -1604,6 +1604,9 @@ struct ide_host *ide_host_alloc_all(const struct ide_port_info *d,
1604 return NULL; 1604 return NULL;
1605 } 1605 }
1606 1606
1607 if (hws[0])
1608 host->dev[0] = hws[0]->dev;
1609
1607 return host; 1610 return host;
1608} 1611}
1609EXPORT_SYMBOL_GPL(ide_host_alloc_all); 1612EXPORT_SYMBOL_GPL(ide_host_alloc_all);
diff --git a/drivers/ide/pci/aec62xx.c b/drivers/ide/pci/aec62xx.c
index fbc43e121e6b..7a5d246fe9b1 100644
--- a/drivers/ide/pci/aec62xx.c
+++ b/drivers/ide/pci/aec62xx.c
@@ -273,7 +273,7 @@ static int __devinit aec62xx_init_one(struct pci_dev *dev, const struct pci_devi
273 } 273 }
274 } 274 }
275 275
276 err = ide_setup_pci_device(dev, &d); 276 err = ide_pci_init_one(dev, &d, NULL);
277 if (err) 277 if (err)
278 pci_disable_device(dev); 278 pci_disable_device(dev);
279 279
diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c
index 5ef7817ac64f..7f96e7ca3864 100644
--- a/drivers/ide/pci/alim15x3.c
+++ b/drivers/ide/pci/alim15x3.c
@@ -565,7 +565,7 @@ static int __devinit alim15x3_init_one(struct pci_dev *dev, const struct pci_dev
565 if (idx == 0) 565 if (idx == 0)
566 d.host_flags |= IDE_HFLAG_CLEAR_SIMPLEX; 566 d.host_flags |= IDE_HFLAG_CLEAR_SIMPLEX;
567 567
568 return ide_setup_pci_device(dev, &d); 568 return ide_pci_init_one(dev, &d, NULL);
569} 569}
570 570
571 571
diff --git a/drivers/ide/pci/amd74xx.c b/drivers/ide/pci/amd74xx.c
index ef7d971031ee..b6a475313c7c 100644
--- a/drivers/ide/pci/amd74xx.c
+++ b/drivers/ide/pci/amd74xx.c
@@ -302,7 +302,7 @@ static int __devinit amd74xx_probe(struct pci_dev *dev, const struct pci_device_
302 d.name, pci_name(dev), dev->revision, 302 d.name, pci_name(dev), dev->revision,
303 amd_dma[fls(d.udma_mask) - 1]); 303 amd_dma[fls(d.udma_mask) - 1]);
304 304
305 return ide_setup_pci_device(dev, &d); 305 return ide_pci_init_one(dev, &d, NULL);
306} 306}
307 307
308static const struct pci_device_id amd74xx_pci_tbl[] = { 308static const struct pci_device_id amd74xx_pci_tbl[] = {
diff --git a/drivers/ide/pci/atiixp.c b/drivers/ide/pci/atiixp.c
index 8b637181681a..b483a68b39f6 100644
--- a/drivers/ide/pci/atiixp.c
+++ b/drivers/ide/pci/atiixp.c
@@ -167,7 +167,7 @@ static const struct ide_port_info atiixp_pci_info[] __devinitdata = {
167 167
168static int __devinit atiixp_init_one(struct pci_dev *dev, const struct pci_device_id *id) 168static int __devinit atiixp_init_one(struct pci_dev *dev, const struct pci_device_id *id)
169{ 169{
170 return ide_setup_pci_device(dev, &atiixp_pci_info[id->driver_data]); 170 return ide_pci_init_one(dev, &atiixp_pci_info[id->driver_data], NULL);
171} 171}
172 172
173static const struct pci_device_id atiixp_pci_tbl[] = { 173static const struct pci_device_id atiixp_pci_tbl[] = {
diff --git a/drivers/ide/pci/cmd64x.c b/drivers/ide/pci/cmd64x.c
index ce58bfcdb3c6..fc0333c9a4e5 100644
--- a/drivers/ide/pci/cmd64x.c
+++ b/drivers/ide/pci/cmd64x.c
@@ -507,7 +507,7 @@ static int __devinit cmd64x_init_one(struct pci_dev *dev, const struct pci_devic
507 } 507 }
508 } 508 }
509 509
510 return ide_setup_pci_device(dev, &d); 510 return ide_pci_init_one(dev, &d, NULL);
511} 511}
512 512
513static const struct pci_device_id cmd64x_pci_tbl[] = { 513static const struct pci_device_id cmd64x_pci_tbl[] = {
diff --git a/drivers/ide/pci/cs5530.c b/drivers/ide/pci/cs5530.c
index f5534c1ff349..ba82bad8bf4e 100644
--- a/drivers/ide/pci/cs5530.c
+++ b/drivers/ide/pci/cs5530.c
@@ -256,7 +256,7 @@ static const struct ide_port_info cs5530_chipset __devinitdata = {
256 256
257static int __devinit cs5530_init_one(struct pci_dev *dev, const struct pci_device_id *id) 257static int __devinit cs5530_init_one(struct pci_dev *dev, const struct pci_device_id *id)
258{ 258{
259 return ide_setup_pci_device(dev, &cs5530_chipset); 259 return ide_pci_init_one(dev, &cs5530_chipset, NULL);
260} 260}
261 261
262static const struct pci_device_id cs5530_pci_tbl[] = { 262static const struct pci_device_id cs5530_pci_tbl[] = {
diff --git a/drivers/ide/pci/cs5535.c b/drivers/ide/pci/cs5535.c
index 5404fe4f701d..2161f43ca1b8 100644
--- a/drivers/ide/pci/cs5535.c
+++ b/drivers/ide/pci/cs5535.c
@@ -180,7 +180,7 @@ static const struct ide_port_info cs5535_chipset __devinitdata = {
180static int __devinit cs5535_init_one(struct pci_dev *dev, 180static int __devinit cs5535_init_one(struct pci_dev *dev,
181 const struct pci_device_id *id) 181 const struct pci_device_id *id)
182{ 182{
183 return ide_setup_pci_device(dev, &cs5535_chipset); 183 return ide_pci_init_one(dev, &cs5535_chipset, NULL);
184} 184}
185 185
186static const struct pci_device_id cs5535_pci_tbl[] = { 186static const struct pci_device_id cs5535_pci_tbl[] = {
diff --git a/drivers/ide/pci/cy82c693.c b/drivers/ide/pci/cy82c693.c
index e14ad5530fa4..abd27ed7c30c 100644
--- a/drivers/ide/pci/cy82c693.c
+++ b/drivers/ide/pci/cy82c693.c
@@ -419,7 +419,7 @@ static int __devinit cy82c693_init_one(struct pci_dev *dev, const struct pci_dev
419 if ((dev->class >> 8) == PCI_CLASS_STORAGE_IDE && 419 if ((dev->class >> 8) == PCI_CLASS_STORAGE_IDE &&
420 PCI_FUNC(dev->devfn) == 1) { 420 PCI_FUNC(dev->devfn) == 1) {
421 dev2 = pci_get_slot(dev->bus, dev->devfn + 1); 421 dev2 = pci_get_slot(dev->bus, dev->devfn + 1);
422 ret = ide_setup_pci_devices(dev, dev2, &cy82c693_chipset); 422 ret = ide_pci_init_two(dev, dev2, &cy82c693_chipset, NULL);
423 /* We leak pci refs here but thats ok - we can't be unloaded */ 423 /* We leak pci refs here but thats ok - we can't be unloaded */
424 } 424 }
425 return ret; 425 return ret;
diff --git a/drivers/ide/pci/generic.c b/drivers/ide/pci/generic.c
index 041720e22762..dd0caea5e4f3 100644
--- a/drivers/ide/pci/generic.c
+++ b/drivers/ide/pci/generic.c
@@ -139,7 +139,7 @@ static int __devinit generic_init_one(struct pci_dev *dev, const struct pci_devi
139 goto out; 139 goto out;
140 } 140 }
141 } 141 }
142 ret = ide_setup_pci_device(dev, d); 142 ret = ide_pci_init_one(dev, d, NULL);
143out: 143out:
144 return ret; 144 return ret;
145} 145}
diff --git a/drivers/ide/pci/hpt34x.c b/drivers/ide/pci/hpt34x.c
index 9e1d1c4741da..3d70c5150ac6 100644
--- a/drivers/ide/pci/hpt34x.c
+++ b/drivers/ide/pci/hpt34x.c
@@ -156,7 +156,7 @@ static int __devinit hpt34x_init_one(struct pci_dev *dev, const struct pci_devic
156 156
157 d = &hpt34x_chipsets[(pcicmd & PCI_COMMAND_MEMORY) ? 1 : 0]; 157 d = &hpt34x_chipsets[(pcicmd & PCI_COMMAND_MEMORY) ? 1 : 0];
158 158
159 return ide_setup_pci_device(dev, d); 159 return ide_pci_init_one(dev, d, NULL);
160} 160}
161 161
162static const struct pci_device_id hpt34x_pci_tbl[] = { 162static const struct pci_device_id hpt34x_pci_tbl[] = {
diff --git a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c
index 1f1135ce7cd6..b23b7a278005 100644
--- a/drivers/ide/pci/hpt366.c
+++ b/drivers/ide/pci/hpt366.c
@@ -1608,13 +1608,13 @@ static int __devinit hpt366_init_one(struct pci_dev *dev, const struct pci_devic
1608 d.host_flags &= ~IDE_HFLAG_NON_BOOTABLE; 1608 d.host_flags &= ~IDE_HFLAG_NON_BOOTABLE;
1609 } 1609 }
1610 1610
1611 ret = ide_setup_pci_devices(dev, dev2, &d); 1611 ret = ide_pci_init_two(dev, dev2, &d, NULL);
1612 if (ret < 0) 1612 if (ret < 0)
1613 pci_dev_put(dev2); 1613 pci_dev_put(dev2);
1614 return ret; 1614 return ret;
1615 } 1615 }
1616 1616
1617 return ide_setup_pci_device(dev, &d); 1617 return ide_pci_init_one(dev, &d, NULL);
1618} 1618}
1619 1619
1620static const struct pci_device_id hpt366_pci_tbl[] __devinitconst = { 1620static const struct pci_device_id hpt366_pci_tbl[] __devinitconst = {
diff --git a/drivers/ide/pci/it8213.c b/drivers/ide/pci/it8213.c
index 2b71bdf74e73..18219fa9ef01 100644
--- a/drivers/ide/pci/it8213.c
+++ b/drivers/ide/pci/it8213.c
@@ -184,7 +184,7 @@ static const struct ide_port_info it8213_chipsets[] __devinitdata = {
184 184
185static int __devinit it8213_init_one(struct pci_dev *dev, const struct pci_device_id *id) 185static int __devinit it8213_init_one(struct pci_dev *dev, const struct pci_device_id *id)
186{ 186{
187 return ide_setup_pci_device(dev, &it8213_chipsets[id->driver_data]); 187 return ide_pci_init_one(dev, &it8213_chipsets[id->driver_data], NULL);
188} 188}
189 189
190static const struct pci_device_id it8213_pci_tbl[] = { 190static const struct pci_device_id it8213_pci_tbl[] = {
diff --git a/drivers/ide/pci/it821x.c b/drivers/ide/pci/it821x.c
index cbf647202994..40186f9e56aa 100644
--- a/drivers/ide/pci/it821x.c
+++ b/drivers/ide/pci/it821x.c
@@ -664,7 +664,7 @@ static int __devinit it821x_init_one(struct pci_dev *dev, const struct pci_devic
664 664
665 pci_set_drvdata(dev, itdevs); 665 pci_set_drvdata(dev, itdevs);
666 666
667 return ide_setup_pci_device(dev, &it821x_chipsets[id->driver_data]); 667 return ide_pci_init_one(dev, &it821x_chipsets[id->driver_data], NULL);
668} 668}
669 669
670static const struct pci_device_id it821x_pci_tbl[] = { 670static const struct pci_device_id it821x_pci_tbl[] = {
diff --git a/drivers/ide/pci/jmicron.c b/drivers/ide/pci/jmicron.c
index 96ef7394f283..a7e3c14f7b07 100644
--- a/drivers/ide/pci/jmicron.c
+++ b/drivers/ide/pci/jmicron.c
@@ -121,7 +121,7 @@ static const struct ide_port_info jmicron_chipset __devinitdata = {
121 121
122static int __devinit jmicron_init_one(struct pci_dev *dev, const struct pci_device_id *id) 122static int __devinit jmicron_init_one(struct pci_dev *dev, const struct pci_device_id *id)
123{ 123{
124 return ide_setup_pci_device(dev, &jmicron_chipset); 124 return ide_pci_init_one(dev, &jmicron_chipset, NULL);
125} 125}
126 126
127/* All JMB PATA controllers have and will continue to have the same 127/* All JMB PATA controllers have and will continue to have the same
diff --git a/drivers/ide/pci/ns87415.c b/drivers/ide/pci/ns87415.c
index 5cd2b32ff0ef..a45c33c0c792 100644
--- a/drivers/ide/pci/ns87415.c
+++ b/drivers/ide/pci/ns87415.c
@@ -324,7 +324,7 @@ static int __devinit ns87415_init_one(struct pci_dev *dev, const struct pci_devi
324 d.tp_ops = &superio_tp_ops; 324 d.tp_ops = &superio_tp_ops;
325 } 325 }
326#endif 326#endif
327 return ide_setup_pci_device(dev, &d); 327 return ide_pci_init_one(dev, &d, NULL);
328} 328}
329 329
330static const struct pci_device_id ns87415_pci_tbl[] = { 330static const struct pci_device_id ns87415_pci_tbl[] = {
diff --git a/drivers/ide/pci/opti621.c b/drivers/ide/pci/opti621.c
index 725c80508d90..edb9132ffbe4 100644
--- a/drivers/ide/pci/opti621.c
+++ b/drivers/ide/pci/opti621.c
@@ -209,7 +209,7 @@ static const struct ide_port_info opti621_chipset __devinitdata = {
209 209
210static int __devinit opti621_init_one(struct pci_dev *dev, const struct pci_device_id *id) 210static int __devinit opti621_init_one(struct pci_dev *dev, const struct pci_device_id *id)
211{ 211{
212 return ide_setup_pci_device(dev, &opti621_chipset); 212 return ide_pci_init_one(dev, &opti621_chipset, NULL);
213} 213}
214 214
215static const struct pci_device_id opti621_pci_tbl[] = { 215static const struct pci_device_id opti621_pci_tbl[] = {
diff --git a/drivers/ide/pci/pdc202xx_new.c b/drivers/ide/pci/pdc202xx_new.c
index 070df8ab3b21..71a420feb981 100644
--- a/drivers/ide/pci/pdc202xx_new.c
+++ b/drivers/ide/pci/pdc202xx_new.c
@@ -524,7 +524,7 @@ static int __devinit pdc202new_init_one(struct pci_dev *dev, const struct pci_de
524 dev2 = pdc20270_get_dev2(dev); 524 dev2 = pdc20270_get_dev2(dev);
525 525
526 if (dev2) { 526 if (dev2) {
527 int ret = ide_setup_pci_devices(dev, dev2, d); 527 int ret = ide_pci_init_two(dev, dev2, d, NULL);
528 if (ret < 0) 528 if (ret < 0)
529 pci_dev_put(dev2); 529 pci_dev_put(dev2);
530 return ret; 530 return ret;
@@ -540,7 +540,7 @@ static int __devinit pdc202new_init_one(struct pci_dev *dev, const struct pci_de
540 return -ENODEV; 540 return -ENODEV;
541 } 541 }
542 542
543 return ide_setup_pci_device(dev, d); 543 return ide_pci_init_one(dev, d, NULL);
544} 544}
545 545
546static const struct pci_device_id pdc202new_pci_tbl[] = { 546static const struct pci_device_id pdc202new_pci_tbl[] = {
diff --git a/drivers/ide/pci/pdc202xx_old.c b/drivers/ide/pci/pdc202xx_old.c
index e54dc653b8c4..eba1d60a73a0 100644
--- a/drivers/ide/pci/pdc202xx_old.c
+++ b/drivers/ide/pci/pdc202xx_old.c
@@ -412,7 +412,7 @@ static int __devinit pdc202xx_init_one(struct pci_dev *dev, const struct pci_dev
412 } 412 }
413 } 413 }
414 414
415 return ide_setup_pci_device(dev, d); 415 return ide_pci_init_one(dev, d, NULL);
416} 416}
417 417
418static const struct pci_device_id pdc202xx_pci_tbl[] = { 418static const struct pci_device_id pdc202xx_pci_tbl[] = {
diff --git a/drivers/ide/pci/piix.c b/drivers/ide/pci/piix.c
index 0ce41b4dddaf..359f65ddcbf9 100644
--- a/drivers/ide/pci/piix.c
+++ b/drivers/ide/pci/piix.c
@@ -394,7 +394,7 @@ static const struct ide_port_info piix_pci_info[] __devinitdata = {
394 394
395static int __devinit piix_init_one(struct pci_dev *dev, const struct pci_device_id *id) 395static int __devinit piix_init_one(struct pci_dev *dev, const struct pci_device_id *id)
396{ 396{
397 return ide_setup_pci_device(dev, &piix_pci_info[id->driver_data]); 397 return ide_pci_init_one(dev, &piix_pci_info[id->driver_data], NULL);
398} 398}
399 399
400/** 400/**
diff --git a/drivers/ide/pci/rz1000.c b/drivers/ide/pci/rz1000.c
index 532154adba29..860ffdeca095 100644
--- a/drivers/ide/pci/rz1000.c
+++ b/drivers/ide/pci/rz1000.c
@@ -48,7 +48,7 @@ static const struct ide_port_info rz1000_chipset __devinitdata = {
48 48
49static int __devinit rz1000_init_one(struct pci_dev *dev, const struct pci_device_id *id) 49static int __devinit rz1000_init_one(struct pci_dev *dev, const struct pci_device_id *id)
50{ 50{
51 return ide_setup_pci_device(dev, &rz1000_chipset); 51 return ide_pci_init_one(dev, &rz1000_chipset, NULL);
52} 52}
53 53
54static const struct pci_device_id rz1000_pci_tbl[] = { 54static const struct pci_device_id rz1000_pci_tbl[] = {
diff --git a/drivers/ide/pci/sc1200.c b/drivers/ide/pci/sc1200.c
index 14c787b5d95f..8fd9cc2119d6 100644
--- a/drivers/ide/pci/sc1200.c
+++ b/drivers/ide/pci/sc1200.c
@@ -317,7 +317,7 @@ static const struct ide_port_info sc1200_chipset __devinitdata = {
317 317
318static int __devinit sc1200_init_one(struct pci_dev *dev, const struct pci_device_id *id) 318static int __devinit sc1200_init_one(struct pci_dev *dev, const struct pci_device_id *id)
319{ 319{
320 return ide_setup_pci_device(dev, &sc1200_chipset); 320 return ide_pci_init_one(dev, &sc1200_chipset, NULL);
321} 321}
322 322
323static const struct pci_device_id sc1200_pci_tbl[] = { 323static const struct pci_device_id sc1200_pci_tbl[] = {
diff --git a/drivers/ide/pci/serverworks.c b/drivers/ide/pci/serverworks.c
index 127ccb45e261..34abdfc8d567 100644
--- a/drivers/ide/pci/serverworks.c
+++ b/drivers/ide/pci/serverworks.c
@@ -422,7 +422,7 @@ static int __devinit svwks_init_one(struct pci_dev *dev, const struct pci_device
422 d.host_flags &= ~IDE_HFLAG_SINGLE; 422 d.host_flags &= ~IDE_HFLAG_SINGLE;
423 } 423 }
424 424
425 return ide_setup_pci_device(dev, &d); 425 return ide_pci_init_one(dev, &d, NULL);
426} 426}
427 427
428static const struct pci_device_id svwks_pci_tbl[] = { 428static const struct pci_device_id svwks_pci_tbl[] = {
diff --git a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c
index 5965a35d94ae..48124133601a 100644
--- a/drivers/ide/pci/siimage.c
+++ b/drivers/ide/pci/siimage.c
@@ -795,7 +795,7 @@ static int __devinit siimage_init_one(struct pci_dev *dev,
795 d.host_flags |= IDE_HFLAG_NO_ATAPI_DMA; 795 d.host_flags |= IDE_HFLAG_NO_ATAPI_DMA;
796 } 796 }
797 797
798 return ide_setup_pci_device(dev, &d); 798 return ide_pci_init_one(dev, &d, NULL);
799} 799}
800 800
801static const struct pci_device_id siimage_pci_tbl[] = { 801static const struct pci_device_id siimage_pci_tbl[] = {
diff --git a/drivers/ide/pci/sis5513.c b/drivers/ide/pci/sis5513.c
index 2389945ca95d..a2330c4ac75b 100644
--- a/drivers/ide/pci/sis5513.c
+++ b/drivers/ide/pci/sis5513.c
@@ -583,7 +583,7 @@ static int __devinit sis5513_init_one(struct pci_dev *dev, const struct pci_devi
583 583
584 d.udma_mask = udma_rates[chipset_family]; 584 d.udma_mask = udma_rates[chipset_family];
585 585
586 return ide_setup_pci_device(dev, &d); 586 return ide_pci_init_one(dev, &d, NULL);
587} 587}
588 588
589static const struct pci_device_id sis5513_pci_tbl[] = { 589static const struct pci_device_id sis5513_pci_tbl[] = {
diff --git a/drivers/ide/pci/sl82c105.c b/drivers/ide/pci/sl82c105.c
index f82a6502c1b7..be22f8125d71 100644
--- a/drivers/ide/pci/sl82c105.c
+++ b/drivers/ide/pci/sl82c105.c
@@ -335,7 +335,7 @@ static int __devinit sl82c105_init_one(struct pci_dev *dev, const struct pci_dev
335 d.host_flags &= ~IDE_HFLAG_SERIALIZE_DMA; 335 d.host_flags &= ~IDE_HFLAG_SERIALIZE_DMA;
336 } 336 }
337 337
338 return ide_setup_pci_device(dev, &d); 338 return ide_pci_init_one(dev, &d, NULL);
339} 339}
340 340
341static const struct pci_device_id sl82c105_pci_tbl[] = { 341static const struct pci_device_id sl82c105_pci_tbl[] = {
diff --git a/drivers/ide/pci/slc90e66.c b/drivers/ide/pci/slc90e66.c
index dae6e2c94d86..2fc2f2cf2206 100644
--- a/drivers/ide/pci/slc90e66.c
+++ b/drivers/ide/pci/slc90e66.c
@@ -144,7 +144,7 @@ static const struct ide_port_info slc90e66_chipset __devinitdata = {
144 144
145static int __devinit slc90e66_init_one(struct pci_dev *dev, const struct pci_device_id *id) 145static int __devinit slc90e66_init_one(struct pci_dev *dev, const struct pci_device_id *id)
146{ 146{
147 return ide_setup_pci_device(dev, &slc90e66_chipset); 147 return ide_pci_init_one(dev, &slc90e66_chipset, NULL);
148} 148}
149 149
150static const struct pci_device_id slc90e66_pci_tbl[] = { 150static const struct pci_device_id slc90e66_pci_tbl[] = {
diff --git a/drivers/ide/pci/tc86c001.c b/drivers/ide/pci/tc86c001.c
index 477e19790102..e16e79d21772 100644
--- a/drivers/ide/pci/tc86c001.c
+++ b/drivers/ide/pci/tc86c001.c
@@ -215,7 +215,7 @@ static const struct ide_port_info tc86c001_chipset __devinitdata = {
215static int __devinit tc86c001_init_one(struct pci_dev *dev, 215static int __devinit tc86c001_init_one(struct pci_dev *dev,
216 const struct pci_device_id *id) 216 const struct pci_device_id *id)
217{ 217{
218 return ide_setup_pci_device(dev, &tc86c001_chipset); 218 return ide_pci_init_one(dev, &tc86c001_chipset, NULL);
219} 219}
220 220
221static const struct pci_device_id tc86c001_pci_tbl[] = { 221static const struct pci_device_id tc86c001_pci_tbl[] = {
diff --git a/drivers/ide/pci/triflex.c b/drivers/ide/pci/triflex.c
index db65a558d4ec..60dcb645d1b0 100644
--- a/drivers/ide/pci/triflex.c
+++ b/drivers/ide/pci/triflex.c
@@ -104,7 +104,7 @@ static const struct ide_port_info triflex_device __devinitdata = {
104static int __devinit triflex_init_one(struct pci_dev *dev, 104static int __devinit triflex_init_one(struct pci_dev *dev,
105 const struct pci_device_id *id) 105 const struct pci_device_id *id)
106{ 106{
107 return ide_setup_pci_device(dev, &triflex_device); 107 return ide_pci_init_one(dev, &triflex_device, NULL);
108} 108}
109 109
110static const struct pci_device_id triflex_pci_tbl[] = { 110static const struct pci_device_id triflex_pci_tbl[] = {
diff --git a/drivers/ide/pci/trm290.c b/drivers/ide/pci/trm290.c
index a8a3138682ef..d8127b51a542 100644
--- a/drivers/ide/pci/trm290.c
+++ b/drivers/ide/pci/trm290.c
@@ -340,7 +340,7 @@ static const struct ide_port_info trm290_chipset __devinitdata = {
340 340
341static int __devinit trm290_init_one(struct pci_dev *dev, const struct pci_device_id *id) 341static int __devinit trm290_init_one(struct pci_dev *dev, const struct pci_device_id *id)
342{ 342{
343 return ide_setup_pci_device(dev, &trm290_chipset); 343 return ide_pci_init_one(dev, &trm290_chipset, NULL);
344} 344}
345 345
346static const struct pci_device_id trm290_pci_tbl[] = { 346static const struct pci_device_id trm290_pci_tbl[] = {
diff --git a/drivers/ide/pci/via82cxxx.c b/drivers/ide/pci/via82cxxx.c
index 09dc4803ef9d..2f22abfe003b 100644
--- a/drivers/ide/pci/via82cxxx.c
+++ b/drivers/ide/pci/via82cxxx.c
@@ -466,7 +466,7 @@ static int __devinit via_init_one(struct pci_dev *dev, const struct pci_device_i
466 466
467 d.udma_mask = via_config->udma_mask; 467 d.udma_mask = via_config->udma_mask;
468 468
469 return ide_setup_pci_device(dev, &d); 469 return ide_pci_init_one(dev, &d, NULL);
470} 470}
471 471
472static const struct pci_device_id via_pci_tbl[] = { 472static const struct pci_device_id via_pci_tbl[] = {
diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c
index b85de71fdc88..ca17bf8896df 100644
--- a/drivers/ide/setup-pci.c
+++ b/drivers/ide/setup-pci.c
@@ -525,8 +525,10 @@ out:
525 return ret; 525 return ret;
526} 526}
527 527
528int ide_setup_pci_device(struct pci_dev *dev, const struct ide_port_info *d) 528int ide_pci_init_one(struct pci_dev *dev, const struct ide_port_info *d,
529 void *priv)
529{ 530{
531 struct ide_host *host;
530 hw_regs_t hw[4], *hws[] = { NULL, NULL, NULL, NULL }; 532 hw_regs_t hw[4], *hws[] = { NULL, NULL, NULL, NULL };
531 int ret; 533 int ret;
532 534
@@ -536,6 +538,19 @@ int ide_setup_pci_device(struct pci_dev *dev, const struct ide_port_info *d)
536 538
537 ide_pci_setup_ports(dev, d, 0, &hw[0], &hws[0]); 539 ide_pci_setup_ports(dev, d, 0, &hw[0], &hws[0]);
538 540
541 host = ide_host_alloc(d, hws);
542 if (host == NULL) {
543 ret = -ENOMEM;
544 goto out;
545 }
546
547 host->dev[0] = &dev->dev;
548
549 host->host_priv = priv;
550
551 if (priv)
552 pci_set_drvdata(dev, host);
553
539 ret = do_ide_setup_pci_device(dev, d, 1); 554 ret = do_ide_setup_pci_device(dev, d, 1);
540 if (ret < 0) 555 if (ret < 0)
541 goto out; 556 goto out;
@@ -543,16 +558,19 @@ int ide_setup_pci_device(struct pci_dev *dev, const struct ide_port_info *d)
543 /* fixup IRQ */ 558 /* fixup IRQ */
544 hw[1].irq = hw[0].irq = ret; 559 hw[1].irq = hw[0].irq = ret;
545 560
546 ret = ide_host_add(d, hws, NULL); 561 ret = ide_host_register(host, d, hws);
562 if (ret)
563 ide_host_free(host);
547out: 564out:
548 return ret; 565 return ret;
549} 566}
550EXPORT_SYMBOL_GPL(ide_setup_pci_device); 567EXPORT_SYMBOL_GPL(ide_pci_init_one);
551 568
552int ide_setup_pci_devices(struct pci_dev *dev1, struct pci_dev *dev2, 569int ide_pci_init_two(struct pci_dev *dev1, struct pci_dev *dev2,
553 const struct ide_port_info *d) 570 const struct ide_port_info *d, void *priv)
554{ 571{
555 struct pci_dev *pdev[] = { dev1, dev2 }; 572 struct pci_dev *pdev[] = { dev1, dev2 };
573 struct ide_host *host;
556 int ret, i; 574 int ret, i;
557 hw_regs_t hw[4], *hws[] = { NULL, NULL, NULL, NULL }; 575 hw_regs_t hw[4], *hws[] = { NULL, NULL, NULL, NULL };
558 576
@@ -562,7 +580,25 @@ int ide_setup_pci_devices(struct pci_dev *dev1, struct pci_dev *dev2,
562 goto out; 580 goto out;
563 581
564 ide_pci_setup_ports(pdev[i], d, 0, &hw[i*2], &hws[i*2]); 582 ide_pci_setup_ports(pdev[i], d, 0, &hw[i*2], &hws[i*2]);
583 }
565 584
585 host = ide_host_alloc(d, hws);
586 if (host == NULL) {
587 ret = -ENOMEM;
588 goto out;
589 }
590
591 host->dev[0] = &dev1->dev;
592 host->dev[1] = &dev2->dev;
593
594 host->host_priv = priv;
595
596 if (priv) {
597 pci_set_drvdata(pdev[0], host);
598 pci_set_drvdata(pdev[1], host);
599 }
600
601 for (i = 0; i < 2; i++) {
566 ret = do_ide_setup_pci_device(pdev[i], d, !i); 602 ret = do_ide_setup_pci_device(pdev[i], d, !i);
567 603
568 /* 604 /*
@@ -576,8 +612,10 @@ int ide_setup_pci_devices(struct pci_dev *dev1, struct pci_dev *dev2,
576 hw[i*2 + 1].irq = hw[i*2].irq = ret; 612 hw[i*2 + 1].irq = hw[i*2].irq = ret;
577 } 613 }
578 614
579 ret = ide_host_add(d, hws, NULL); 615 ret = ide_host_register(host, d, hws);
616 if (ret)
617 ide_host_free(host);
580out: 618out:
581 return ret; 619 return ret;
582} 620}
583EXPORT_SYMBOL_GPL(ide_setup_pci_devices); 621EXPORT_SYMBOL_GPL(ide_pci_init_two);