All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] IDE (& PowerMac): Let an hwif have a real parent
@ 2003-08-10 14:12 Benjamin Herrenschmidt
  2003-08-10 14:33 ` Bartlomiej Zolnierkiewicz
  0 siblings, 1 reply; 3+ messages in thread
From: Benjamin Herrenschmidt @ 2003-08-10 14:12 UTC (permalink / raw)
  To: Linus Torvalds, Bartlomiej Zolnierkiewicz; +Cc: linux-kernel mailing list

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	benh@kernel.crashing.org	1.1139
# Allow an ide controller to have a parent that isn't the pci_dev nor
the legacy stuff
# --------------------------------------------
#
diff -Nru a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
--- a/drivers/ide/ide-probe.c	Sun Aug 10 16:07:40 2003
+++ b/drivers/ide/ide-probe.c	Sun Aug 10 16:07:40 2003
@@ -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);
 }
 

-- 
Benjamin Herrenschmidt <benh@kernel.crashing.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] IDE (& PowerMac): Let an hwif have a real parent
  2003-08-10 14:12 [PATCH] IDE (& PowerMac): Let an hwif have a real parent Benjamin Herrenschmidt
@ 2003-08-10 14:33 ` Bartlomiej Zolnierkiewicz
  2003-08-10 20:31   ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 3+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2003-08-10 14:33 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linux-kernel


On 10 Aug 2003, Benjamin Herrenschmidt wrote:

> 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.

Looks good.

> Please apply,
> Ben.

Can you fix intendation, or I should do it?

> --- a/drivers/ide/ide-probe.c	Sun Aug 10 16:07:40 2003
> +++ b/drivers/ide/ide-probe.c	Sun Aug 10 16:07:40 2003
> @@ -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);
>  }

--bartlomiej


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] IDE (& PowerMac): Let an hwif have a real parent
  2003-08-10 14:33 ` Bartlomiej Zolnierkiewicz
@ 2003-08-10 20:31   ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 3+ messages in thread
From: Benjamin Herrenschmidt @ 2003-08-10 20:31 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz, Linus Torvalds; +Cc: linux-kernel mailing list


> Looks good.
> 
> > 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:

diff -urN linux-2.5/drivers/ide/ide-probe.c linux-2.5-benh-merge/drivers/ide/ide-probe.c
--- linux-2.5/drivers/ide/ide-probe.c	2003-08-09 11:05:27.000000000 +0200
+++ linux-2.5-benh-merge/drivers/ide/ide-probe.c	2003-08-10 22:30:14.000000000 +0200
@@ -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);
 }
 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-08-10 20:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-08-10 14:12 [PATCH] IDE (& PowerMac): Let an hwif have a real parent Benjamin Herrenschmidt
2003-08-10 14:33 ` Bartlomiej Zolnierkiewicz
2003-08-10 20:31   ` Benjamin Herrenschmidt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.