[PATCH] Let ide interfaces choose a parent device

Benjamin Herrenschmidt (benh@kernel.crashing.org)
24 Apr 2003 15:22:51 +0200


Hi !

Right now, the parent struct device of IDE interfaces is forced to be
either the pci_dev or some not-yet implemented legacy node. This is
wrong as non-PCI ide interfaces may well hang off different bus types.
For PowerMac, for example, I'm defining a bus type for Apple's "MacIO"
ASIC and ide/ppc/pmac.c will hang off a device on that bus.

The following patch will let the HWIF fill the parent pointer and only
put it's "default" stuff in there if it's NULL.

--- 1.40/drivers/ide/ide-probe.c Fri Apr 18 17:58:55 2003
+++ edited/drivers/ide/ide-probe.c Thu Apr 24 15:15:15 2003
@@ -696,10 +696,12 @@
strncpy(hwif->gendev.bus_id,hwif->name,BUS_ID_SIZE);
snprintf(hwif->gendev.name,DEVICE_NAME_SIZE,"IDE Controller");
hwif->gendev.driver_data = hwif;
- if (hwif->pci_dev)
- hwif->gendev.parent = &hwif->pci_dev->dev;
- else
- hwif->gendev.parent = NULL; /* Would like to do = &device_legacy */
+ if (hwif->gendev.parent == NULL) {
+ if (hwif->pci_dev)
+ hwif->gendev.parent = &hwif->pci_dev->dev;
+ else
+ hwif->gendev.parent = NULL; /* Would like to do = &device_legacy */
+ }
device_register(&hwif->gendev);

if (hwif->mmio == 2)

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/