linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3/6] ide: small ide_register_port() cleanup
@ 2008-11-12 21:16 Bartlomiej Zolnierkiewicz
  2009-01-18  1:23 ` Andreas Schwab
  0 siblings, 1 reply; 4+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-11-12 21:16 UTC (permalink / raw)
  To: linux-ide; +Cc: linux-kernel

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/ide/ide-probe.c |    9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

Index: b/drivers/ide/ide-probe.c
===================================================================
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -640,14 +640,9 @@ static int ide_register_port(ide_hwif_t 
 	/* register with global device tree */
 	dev_set_name(&hwif->gendev, hwif->name);
 	hwif->gendev.driver_data = hwif;
-	if (hwif->gendev.parent == NULL) {
-		if (hwif->dev)
-			hwif->gendev.parent = hwif->dev;
-		else
-			/* Would like to do = &device_legacy */
-			hwif->gendev.parent = NULL;
-	}
+	hwif->gendev.parent = hwif->dev;
 	hwif->gendev.release = hwif_release_dev;
+
 	ret = device_register(&hwif->gendev);
 	if (ret < 0) {
 		printk(KERN_WARNING "IDE: %s: device_register error: %d\n",

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

* Re: [PATCH 3/6] ide: small ide_register_port() cleanup
  2008-11-12 21:16 [PATCH 3/6] ide: small ide_register_port() cleanup Bartlomiej Zolnierkiewicz
@ 2009-01-18  1:23 ` Andreas Schwab
  2009-01-19 11:43   ` Bartlomiej Zolnierkiewicz
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Schwab @ 2009-01-18  1:23 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz; +Cc: linux-ide, linux-kernel

Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> writes:

> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> ---
>  drivers/ide/ide-probe.c |    9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)
>
> Index: b/drivers/ide/ide-probe.c
> ===================================================================
> --- a/drivers/ide/ide-probe.c
> +++ b/drivers/ide/ide-probe.c
> @@ -640,14 +640,9 @@ static int ide_register_port(ide_hwif_t 
>  	/* register with global device tree */
>  	dev_set_name(&hwif->gendev, hwif->name);
>  	hwif->gendev.driver_data = hwif;
> -	if (hwif->gendev.parent == NULL) {
> -		if (hwif->dev)
> -			hwif->gendev.parent = hwif->dev;
> -		else
> -			/* Would like to do = &device_legacy */
> -			hwif->gendev.parent = NULL;
> -	}
> +	hwif->gendev.parent = hwif->dev;

This breaks ide-pmac.  It overwrites the parent that
pmac_ide_macio_attach has set.

Signed-off-by: Andreas Schwab <schwab@suse.de>

diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index 312127e..0db1ed9 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -649,7 +649,8 @@ static int ide_register_port(ide_hwif_t *hwif)
 	/* register with global device tree */
 	dev_set_name(&hwif->gendev, hwif->name);
 	hwif->gendev.driver_data = hwif;
-	hwif->gendev.parent = hwif->dev;
+	if (hwif->gendev.parent == NULL)
+		hwif->gendev.parent = hwif->dev;
 	hwif->gendev.release = hwif_release_dev;
 
 	ret = device_register(&hwif->gendev);

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

* Re: [PATCH 3/6] ide: small ide_register_port() cleanup
  2009-01-18  1:23 ` Andreas Schwab
@ 2009-01-19 11:43   ` Bartlomiej Zolnierkiewicz
  2009-01-19 22:44     ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 4+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-01-19 11:43 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: linux-ide, linux-kernel, Benjamin Herrenschmidt

On Sunday 18 January 2009, Andreas Schwab wrote:
> Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> writes:
> 
> > Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> > ---
> >  drivers/ide/ide-probe.c |    9 ++-------
> >  1 file changed, 2 insertions(+), 7 deletions(-)
> >
> > Index: b/drivers/ide/ide-probe.c
> > ===================================================================
> > --- a/drivers/ide/ide-probe.c
> > +++ b/drivers/ide/ide-probe.c
> > @@ -640,14 +640,9 @@ static int ide_register_port(ide_hwif_t 
> >  	/* register with global device tree */
> >  	dev_set_name(&hwif->gendev, hwif->name);
> >  	hwif->gendev.driver_data = hwif;
> > -	if (hwif->gendev.parent == NULL) {
> > -		if (hwif->dev)
> > -			hwif->gendev.parent = hwif->dev;
> > -		else
> > -			/* Would like to do = &device_legacy */
> > -			hwif->gendev.parent = NULL;
> > -	}
> > +	hwif->gendev.parent = hwif->dev;
> 
> This breaks ide-pmac.  It overwrites the parent that
> pmac_ide_macio_attach has set.
> 
> Signed-off-by: Andreas Schwab <schwab@suse.de>
> 
> diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
> index 312127e..0db1ed9 100644
> --- a/drivers/ide/ide-probe.c
> +++ b/drivers/ide/ide-probe.c
> @@ -649,7 +649,8 @@ static int ide_register_port(ide_hwif_t *hwif)
>  	/* register with global device tree */
>  	dev_set_name(&hwif->gendev, hwif->name);
>  	hwif->gendev.driver_data = hwif;
> -	hwif->gendev.parent = hwif->dev;
> +	if (hwif->gendev.parent == NULL)
> +		hwif->gendev.parent = hwif->dev;
>  	hwif->gendev.release = hwif_release_dev;
>  
>  	ret = device_register(&hwif->gendev);

Applied, thanks for fixing it.

Since it is the second time this ->parent special case bited us in the *ss:

pmac_ide_macio_attach():
...
	hw.dev = &mdev->bus->pdev->dev;
	hw.parent = &mdev->ofdev.dev;
...

I again wonder what is the reason for having different struct device-s used
for DBDMA and for device tree on MACIO PMAC controllers.  Maybe there is no
real reason after all and we can use &mdev->ofdev.dev also for hwif->dev?

Thanks,
Bart

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

* Re: [PATCH 3/6] ide: small ide_register_port() cleanup
  2009-01-19 11:43   ` Bartlomiej Zolnierkiewicz
@ 2009-01-19 22:44     ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 4+ messages in thread
From: Benjamin Herrenschmidt @ 2009-01-19 22:44 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz; +Cc: Andreas Schwab, linux-ide, linux-kernel


> Since it is the second time this ->parent special case bited us in the *ss:
> 
> pmac_ide_macio_attach():
> ...
> 	hw.dev = &mdev->bus->pdev->dev;
> 	hw.parent = &mdev->ofdev.dev;
> ...
> 
> I again wonder what is the reason for having different struct device-s used
> for DBDMA and for device tree on MACIO PMAC controllers.  Maybe there is no
> real reason after all and we can use &mdev->ofdev.dev also for hwif->dev?

Historically, dma_map_* wasn't supported on the macio devs, had to use
the underlying pci dev.

In fact, it might even still be the case. I need to have a look at it
after LCA, though with our current DMA ops, it should be easy to fix.

Cheers,
Ben.



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

end of thread, other threads:[~2009-01-19 22:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-12 21:16 [PATCH 3/6] ide: small ide_register_port() cleanup Bartlomiej Zolnierkiewicz
2009-01-18  1:23 ` Andreas Schwab
2009-01-19 11:43   ` Bartlomiej Zolnierkiewicz
2009-01-19 22:44     ` Benjamin Herrenschmidt

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