Commit 6cdf6eb3 authored by Bartlomiej Zolnierkiewicz's avatar Bartlomiej Zolnierkiewicz
Browse files

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: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
parent 8c2eece5
......@@ -1604,6 +1604,9 @@ struct ide_host *ide_host_alloc_all(const struct ide_port_info *d,
return NULL;
}
if (hws[0])
host->dev[0] = hws[0]->dev;
return host;
}
EXPORT_SYMBOL_GPL(ide_host_alloc_all);
......
......@@ -273,7 +273,7 @@ static int __devinit aec62xx_init_one(struct pci_dev *dev, const struct pci_devi
}
}
err = ide_setup_pci_device(dev, &d);
err = ide_pci_init_one(dev, &d, NULL);
if (err)
pci_disable_device(dev);
......
......@@ -565,7 +565,7 @@ static int __devinit alim15x3_init_one(struct pci_dev *dev, const struct pci_dev
if (idx == 0)
d.host_flags |= IDE_HFLAG_CLEAR_SIMPLEX;
return ide_setup_pci_device(dev, &d);
return ide_pci_init_one(dev, &d, NULL);
}
......
......@@ -302,7 +302,7 @@ static int __devinit amd74xx_probe(struct pci_dev *dev, const struct pci_device_
d.name, pci_name(dev), dev->revision,
amd_dma[fls(d.udma_mask) - 1]);
return ide_setup_pci_device(dev, &d);
return ide_pci_init_one(dev, &d, NULL);
}
static const struct pci_device_id amd74xx_pci_tbl[] = {
......
......@@ -167,7 +167,7 @@ static const struct ide_port_info atiixp_pci_info[] __devinitdata = {
static int __devinit atiixp_init_one(struct pci_dev *dev, const struct pci_device_id *id)
{
return ide_setup_pci_device(dev, &atiixp_pci_info[id->driver_data]);
return ide_pci_init_one(dev, &atiixp_pci_info[id->driver_data], NULL);
}
static const struct pci_device_id atiixp_pci_tbl[] = {
......
......@@ -507,7 +507,7 @@ static int __devinit cmd64x_init_one(struct pci_dev *dev, const struct pci_devic
}
}
return ide_setup_pci_device(dev, &d);
return ide_pci_init_one(dev, &d, NULL);
}
static const struct pci_device_id cmd64x_pci_tbl[] = {
......
......@@ -256,7 +256,7 @@ static const struct ide_port_info cs5530_chipset __devinitdata = {
static int __devinit cs5530_init_one(struct pci_dev *dev, const struct pci_device_id *id)
{
return ide_setup_pci_device(dev, &cs5530_chipset);
return ide_pci_init_one(dev, &cs5530_chipset, NULL);
}
static const struct pci_device_id cs5530_pci_tbl[] = {
......
......@@ -180,7 +180,7 @@ static const struct ide_port_info cs5535_chipset __devinitdata = {
static int __devinit cs5535_init_one(struct pci_dev *dev,
const struct pci_device_id *id)
{
return ide_setup_pci_device(dev, &cs5535_chipset);
return ide_pci_init_one(dev, &cs5535_chipset, NULL);
}
static const struct pci_device_id cs5535_pci_tbl[] = {
......
......@@ -419,7 +419,7 @@ static int __devinit cy82c693_init_one(struct pci_dev *dev, const struct pci_dev
if ((dev->class >> 8) == PCI_CLASS_STORAGE_IDE &&
PCI_FUNC(dev->devfn) == 1) {
dev2 = pci_get_slot(dev->bus, dev->devfn + 1);
ret = ide_setup_pci_devices(dev, dev2, &cy82c693_chipset);
ret = ide_pci_init_two(dev, dev2, &cy82c693_chipset, NULL);
/* We leak pci refs here but thats ok - we can't be unloaded */
}
return ret;
......
......@@ -139,7 +139,7 @@ static int __devinit generic_init_one(struct pci_dev *dev, const struct pci_devi
goto out;
}
}
ret = ide_setup_pci_device(dev, d);
ret = ide_pci_init_one(dev, d, NULL);
out:
return ret;
}
......
......@@ -156,7 +156,7 @@ static int __devinit hpt34x_init_one(struct pci_dev *dev, const struct pci_devic
d = &hpt34x_chipsets[(pcicmd & PCI_COMMAND_MEMORY) ? 1 : 0];
return ide_setup_pci_device(dev, d);
return ide_pci_init_one(dev, d, NULL);
}
static const struct pci_device_id hpt34x_pci_tbl[] = {
......
......@@ -1608,13 +1608,13 @@ static int __devinit hpt366_init_one(struct pci_dev *dev, const struct pci_devic
d.host_flags &= ~IDE_HFLAG_NON_BOOTABLE;
}
ret = ide_setup_pci_devices(dev, dev2, &d);
ret = ide_pci_init_two(dev, dev2, &d, NULL);
if (ret < 0)
pci_dev_put(dev2);
return ret;
}
return ide_setup_pci_device(dev, &d);
return ide_pci_init_one(dev, &d, NULL);
}
static const struct pci_device_id hpt366_pci_tbl[] __devinitconst = {
......
......@@ -184,7 +184,7 @@ static const struct ide_port_info it8213_chipsets[] __devinitdata = {
static int __devinit it8213_init_one(struct pci_dev *dev, const struct pci_device_id *id)
{
return ide_setup_pci_device(dev, &it8213_chipsets[id->driver_data]);
return ide_pci_init_one(dev, &it8213_chipsets[id->driver_data], NULL);
}
static const struct pci_device_id it8213_pci_tbl[] = {
......
......@@ -664,7 +664,7 @@ static int __devinit it821x_init_one(struct pci_dev *dev, const struct pci_devic
pci_set_drvdata(dev, itdevs);
return ide_setup_pci_device(dev, &it821x_chipsets[id->driver_data]);
return ide_pci_init_one(dev, &it821x_chipsets[id->driver_data], NULL);
}
static const struct pci_device_id it821x_pci_tbl[] = {
......
......@@ -121,7 +121,7 @@ static const struct ide_port_info jmicron_chipset __devinitdata = {
static int __devinit jmicron_init_one(struct pci_dev *dev, const struct pci_device_id *id)
{
return ide_setup_pci_device(dev, &jmicron_chipset);
return ide_pci_init_one(dev, &jmicron_chipset, NULL);
}
/* All JMB PATA controllers have and will continue to have the same
......
......@@ -324,7 +324,7 @@ static int __devinit ns87415_init_one(struct pci_dev *dev, const struct pci_devi
d.tp_ops = &superio_tp_ops;
}
#endif
return ide_setup_pci_device(dev, &d);
return ide_pci_init_one(dev, &d, NULL);
}
static const struct pci_device_id ns87415_pci_tbl[] = {
......
......@@ -209,7 +209,7 @@ static const struct ide_port_info opti621_chipset __devinitdata = {
static int __devinit opti621_init_one(struct pci_dev *dev, const struct pci_device_id *id)
{
return ide_setup_pci_device(dev, &opti621_chipset);
return ide_pci_init_one(dev, &opti621_chipset, NULL);
}
static const struct pci_device_id opti621_pci_tbl[] = {
......
......@@ -524,7 +524,7 @@ static int __devinit pdc202new_init_one(struct pci_dev *dev, const struct pci_de
dev2 = pdc20270_get_dev2(dev);
if (dev2) {
int ret = ide_setup_pci_devices(dev, dev2, d);
int ret = ide_pci_init_two(dev, dev2, d, NULL);
if (ret < 0)
pci_dev_put(dev2);
return ret;
......@@ -540,7 +540,7 @@ static int __devinit pdc202new_init_one(struct pci_dev *dev, const struct pci_de
return -ENODEV;
}
return ide_setup_pci_device(dev, d);
return ide_pci_init_one(dev, d, NULL);
}
static const struct pci_device_id pdc202new_pci_tbl[] = {
......
......@@ -412,7 +412,7 @@ static int __devinit pdc202xx_init_one(struct pci_dev *dev, const struct pci_dev
}
}
return ide_setup_pci_device(dev, d);
return ide_pci_init_one(dev, d, NULL);
}
static const struct pci_device_id pdc202xx_pci_tbl[] = {
......
......@@ -394,7 +394,7 @@ static const struct ide_port_info piix_pci_info[] __devinitdata = {
static int __devinit piix_init_one(struct pci_dev *dev, const struct pci_device_id *id)
{
return ide_setup_pci_device(dev, &piix_pci_info[id->driver_data]);
return ide_pci_init_one(dev, &piix_pci_info[id->driver_data], NULL);
}
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment