* [PATCH] Let ide interfaces choose a parent device
@ 2003-04-24 13:22 Benjamin Herrenschmidt
2003-04-24 15:14 ` Bartlomiej Zolnierkiewicz
0 siblings, 1 reply; 2+ messages in thread
From: Benjamin Herrenschmidt @ 2003-04-24 13:22 UTC (permalink / raw)
To: Bartlomiej Zolnierkiewicz, Linus Torvalds
Cc: Alan Cox, linux-kernel mailing list
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)
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Let ide interfaces choose a parent device
2003-04-24 13:22 [PATCH] Let ide interfaces choose a parent device Benjamin Herrenschmidt
@ 2003-04-24 15:14 ` Bartlomiej Zolnierkiewicz
0 siblings, 0 replies; 2+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2003-04-24 15:14 UTC (permalink / raw)
To: Benjamin Herrenschmidt
Cc: Linus Torvalds, Alan Cox, linux-kernel mailing list
On 24 Apr 2003, Benjamin Herrenschmidt wrote:
> 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.
It seems PCI HWIFs are already doing this in ide_pci_setup_ports().
For me patch is okay.
--
Bartlomiej
> --- 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)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-04-24 15:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-24 13:22 [PATCH] Let ide interfaces choose a parent device Benjamin Herrenschmidt
2003-04-24 15:14 ` Bartlomiej Zolnierkiewicz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).