IDE (& PowerMac): Let an hwif have a real parent
PATCH 1/1 IDE (& PowerMac): Let an hwif have a real parent
Hi Linus & Bart !
This patch allows an IDE hwif to be set a "parent" field so it can really descend from any struct device, typically the macio_device I use on pmac, and not only a PCI device or the legacy stuff.
This should work fine as long as hwif->gendev.parent doesn't contain junk, but so far, it seems it really only contains NULL unless specifically set by the host driver.
Without that, the pmac driver will not appear in it's proper location in the device tree, which is a real problem for power management as it won't be ordered properly with it's hosting asic (and mediabay if any), thus breaking suspend/resume.
Please apply,
Ben.
# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
# ChangeSet 1.1138 -> 1.1139
# drivers/ide/ide-probe.c 1.56 -> 1.57
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/08/10 [email protected] 1.1139
# Allow an ide controller to have a parent that isn't the pci_dev nor the legacy stuff
# --------------------------------------------
#
drivers/ide/ide-probe.c +2 -0
@@ -650,10 +650,12 @@strlcpy (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->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); }
Signature · 1 line
Benjamin Herrenschmidt <[email protected]>
Quoted 6 lines · Benjamin Herrenschmidt
Hi Linus & Bart !
This patch allows an IDE hwif to be set a "parent" field so it can really descend from any struct device, typically the
macio_deviceI use on pmac, and not only a PCI device or the legacy stuff.
Quoted 8 lines
This should work fine as long as
hwif->gendev.parentdoesn't contain junk, but so far, it seems it really only contains NULL unless specifically set by the host driver.Without that, the pmac driver will not appear in it's proper location in the device tree, which is a real problem for power management as it won't be ordered properly with it's hosting asic (and mediabay if any), thus breaking suspend/resume.
Looks good.
Quoted 2 lines
Please apply,
Ben.
Can you fix intendation, or I should do it?
Quoted 4 lines
drivers/ide/ide-probe.c +0
-0@@ -650,10 +650,12 @@strlcpy (hwif->gendev.bus_id,hwif->name,BUS_ID_SIZE );
drivers/ide/ide-probe.c line 660
Quoted 10 lines
drivers/ide/ide-probe.c +2
-0snprintf (hwif->gendev.name,DEVICE_NAME_SIZE ,"IDE Controller" ); hwif->gendev.driver_data = hwif; +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); }
--bartlomiej
Quoted 7 lines
Looks good.
Quoted 2 lines
Please apply,
Ben.Can you fix intendation, or I should do it?
Hrm... I don't know how I fucked it up, probably when merging between my trees. Here's the fixed version:
drivers/ide/ide-probe.c +7 -4
@@ -650,10 +650,13 @@strlcpy (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 +/* Would like to do = &device_legacy */ + hwif->gendev.parent =NULL ; + }device_register (&hwif->gendev); }