devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* pata_of_platform.c cannot build on sparc
@ 2011-12-21 22:38 David Miller
  2011-12-21 23:23 ` [PATCH] pata_of_platform: remove direct dependency on OF_IRQ Rob Herring
  2011-12-21 23:25 ` pata_of_platform.c cannot build on sparc Rob Herring
  0 siblings, 2 replies; 8+ messages in thread
From: David Miller @ 2011-12-21 22:38 UTC (permalink / raw)
  To: pawel.moll
  Cc: jgarzik, linux-ide, grant.likely, rob.herring, devicetree-discuss


It depends upon CONFIG_OF_IRQ which not all CONFIG_OF platforms support,
in particular sparc does not support CONFIG_OF_PLATFORM because it
precomputes all IRQs at boot time when it scans the device tree so all
of the CONFIG_OF_IRQ infrastructure to probe and resolve IRQs at driver
probe time is wrong and completely unnecessary.

Add the proper dependencies so that pata_of_platform.c doesn't get
built on sparc.

CONFIG_OF_IRQ was severely misdesigned, it should just NOP out on
platforms where the architecture has the final IRQ values already like
sparc does.  But that's not how it was implemented at all, and now
we're starting to have all of these drivers get hard dependencies on
this mechanism and it's datastructures, and the resulting sparc build
failures from time to time.

Jeff, please push something like the following to Linus so that
sparc's allmodconfig builds again.  Thanks.

--------------------
pata_of_platform: Add missing CONFIG_OF_IRQ dependency.

Signed-off-by: David S. Miller <davem@davemloft.net>

diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index 6bdedd7..cf047c4 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -820,7 +820,7 @@ config PATA_PLATFORM
 
 config PATA_OF_PLATFORM
 	tristate "OpenFirmware platform device PATA support"
-	depends on PATA_PLATFORM && OF
+	depends on PATA_PLATFORM && OF && OF_IRQ
 	help
 	  This option enables support for generic directly connected ATA
 	  devices commonly found on embedded systems with OpenFirmware

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

* [PATCH] pata_of_platform: remove direct dependency on OF_IRQ
  2011-12-21 22:38 pata_of_platform.c cannot build on sparc David Miller
@ 2011-12-21 23:23 ` Rob Herring
  2011-12-21 23:25 ` pata_of_platform.c cannot build on sparc Rob Herring
  1 sibling, 0 replies; 8+ messages in thread
From: Rob Herring @ 2011-12-21 23:23 UTC (permalink / raw)
  To: pawel.moll, David Miller; +Cc: Rob Herring, linux-ide, devicetree-discuss

From: Rob Herring <rob.herring@calxeda.com>

CONFIG_OF_IRQ is not available on some platforms and using of_irq_*
breaks the build. Since resources are already populated in the platform
device, get the irq from there instead.

Reported-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Rob Herring <rob.herring@calxeda.com>
---
 drivers/ata/pata_of_platform.c |   15 ++++++---------
 1 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/ata/pata_of_platform.c b/drivers/ata/pata_of_platform.c
index 2a472c5..ece899d 100644
--- a/drivers/ata/pata_of_platform.c
+++ b/drivers/ata/pata_of_platform.c
@@ -12,8 +12,7 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/of_address.h>
-#include <linux/of_irq.h>
-#include <linux/of_platform.h>
+#include <linux/platform_device.h>
 #include <linux/ata_platform.h>
 
 static int __devinit pata_of_platform_probe(struct platform_device *ofdev)
@@ -22,7 +21,7 @@ static int __devinit pata_of_platform_probe(struct platform_device *ofdev)
 	struct device_node *dn = ofdev->dev.of_node;
 	struct resource io_res;
 	struct resource ctl_res;
-	struct resource irq_res;
+	struct resource *irq_res;
 	unsigned int reg_shift = 0;
 	int pio_mode = 0;
 	int pio_mask;
@@ -51,11 +50,9 @@ static int __devinit pata_of_platform_probe(struct platform_device *ofdev)
 		}
 	}
 
-	ret = of_irq_to_resource(dn, 0, &irq_res);
-	if (!ret)
-		irq_res.start = irq_res.end = 0;
-	else
-		irq_res.flags = 0;
+	irq_res = platform_get_resource(ofdev, IORESOURCE_IRQ, 0);
+	if (irq_res)
+		irq_res->flags = 0;
 
 	prop = of_get_property(dn, "reg-shift", NULL);
 	if (prop)
@@ -75,7 +72,7 @@ static int __devinit pata_of_platform_probe(struct platform_device *ofdev)
 	pio_mask = 1 << pio_mode;
 	pio_mask |= (1 << pio_mode) - 1;
 
-	return __pata_platform_probe(&ofdev->dev, &io_res, &ctl_res, &irq_res,
+	return __pata_platform_probe(&ofdev->dev, &io_res, &ctl_res, irq_res,
 				     reg_shift, pio_mask);
 }
 
-- 
1.7.5.4


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

* Re: pata_of_platform.c cannot build on sparc
  2011-12-21 22:38 pata_of_platform.c cannot build on sparc David Miller
  2011-12-21 23:23 ` [PATCH] pata_of_platform: remove direct dependency on OF_IRQ Rob Herring
@ 2011-12-21 23:25 ` Rob Herring
  2011-12-22  0:14   ` David Miller
  1 sibling, 1 reply; 8+ messages in thread
From: Rob Herring @ 2011-12-21 23:25 UTC (permalink / raw)
  To: David Miller
  Cc: pawel.moll, linux-ide, devicetree-discuss, jgarzik, rob.herring

On 12/21/2011 04:38 PM, David Miller wrote:
> 
> It depends upon CONFIG_OF_IRQ which not all CONFIG_OF platforms support,
> in particular sparc does not support CONFIG_OF_PLATFORM because it
> precomputes all IRQs at boot time when it scans the device tree so all
> of the CONFIG_OF_IRQ infrastructure to probe and resolve IRQs at driver
> probe time is wrong and completely unnecessary.
> 
> Add the proper dependencies so that pata_of_platform.c doesn't get
> built on sparc.
> 
> CONFIG_OF_IRQ was severely misdesigned, it should just NOP out on
> platforms where the architecture has the final IRQ values already like
> sparc does.  But that's not how it was implemented at all, and now
> we're starting to have all of these drivers get hard dependencies on
> this mechanism and it's datastructures, and the resulting sparc build
> failures from time to time.
> 
> Jeff, please push something like the following to Linus so that
> sparc's allmodconfig builds again.  Thanks.
> 

Really, drivers should no longer use of_irq_to_resource (or
of_address_to_resource for that matter). The resources are setup by the
core OF code. The patch I sent does this.

Rob

> --------------------
> pata_of_platform: Add missing CONFIG_OF_IRQ dependency.
> 
> Signed-off-by: David S. Miller <davem@davemloft.net>
> 
> diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
> index 6bdedd7..cf047c4 100644
> --- a/drivers/ata/Kconfig
> +++ b/drivers/ata/Kconfig
> @@ -820,7 +820,7 @@ config PATA_PLATFORM
>  
>  config PATA_OF_PLATFORM
>  	tristate "OpenFirmware platform device PATA support"
> -	depends on PATA_PLATFORM && OF
> +	depends on PATA_PLATFORM && OF && OF_IRQ
>  	help
>  	  This option enables support for generic directly connected ATA
>  	  devices commonly found on embedded systems with OpenFirmware
> _______________________________________________
> devicetree-discuss mailing list
> devicetree-discuss@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/devicetree-discuss


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

* Re: pata_of_platform.c cannot build on sparc
  2011-12-21 23:25 ` pata_of_platform.c cannot build on sparc Rob Herring
@ 2011-12-22  0:14   ` David Miller
  2011-12-22  1:40     ` Jeff Garzik
  0 siblings, 1 reply; 8+ messages in thread
From: David Miller @ 2011-12-22  0:14 UTC (permalink / raw)
  To: robherring2
  Cc: pawel.moll, linux-ide, devicetree-discuss, jgarzik, rob.herring

From: Rob Herring <robherring2@gmail.com>
Date: Wed, 21 Dec 2011 17:25:15 -0600

> On 12/21/2011 04:38 PM, David Miller wrote:
>> 
>> It depends upon CONFIG_OF_IRQ which not all CONFIG_OF platforms support,
>> in particular sparc does not support CONFIG_OF_PLATFORM because it
>> precomputes all IRQs at boot time when it scans the device tree so all
>> of the CONFIG_OF_IRQ infrastructure to probe and resolve IRQs at driver
>> probe time is wrong and completely unnecessary.
>> 
>> Add the proper dependencies so that pata_of_platform.c doesn't get
>> built on sparc.
>> 
>> CONFIG_OF_IRQ was severely misdesigned, it should just NOP out on
>> platforms where the architecture has the final IRQ values already like
>> sparc does.  But that's not how it was implemented at all, and now
>> we're starting to have all of these drivers get hard dependencies on
>> this mechanism and it's datastructures, and the resulting sparc build
>> failures from time to time.
>> 
>> Jeff, please push something like the following to Linus so that
>> sparc's allmodconfig builds again.  Thanks.
>> 
> 
> Really, drivers should no longer use of_irq_to_resource (or
> of_address_to_resource for that matter). The resources are setup by the
> core OF code. The patch I sent does this.

Thanks for taking care of this.

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

* Re: pata_of_platform.c cannot build on sparc
  2011-12-22  0:14   ` David Miller
@ 2011-12-22  1:40     ` Jeff Garzik
  2011-12-22 13:38       ` Rob Herring
  0 siblings, 1 reply; 8+ messages in thread
From: Jeff Garzik @ 2011-12-22  1:40 UTC (permalink / raw)
  To: David Miller
  Cc: robherring2, pawel.moll, linux-ide, devicetree-discuss, jgarzik,
	rob.herring

On 12/21/2011 07:14 PM, David Miller wrote:
> From: Rob Herring<robherring2@gmail.com>
> Date: Wed, 21 Dec 2011 17:25:15 -0600
>
>> On 12/21/2011 04:38 PM, David Miller wrote:
>>>
>>> It depends upon CONFIG_OF_IRQ which not all CONFIG_OF platforms support,
>>> in particular sparc does not support CONFIG_OF_PLATFORM because it
>>> precomputes all IRQs at boot time when it scans the device tree so all
>>> of the CONFIG_OF_IRQ infrastructure to probe and resolve IRQs at driver
>>> probe time is wrong and completely unnecessary.
>>>
>>> Add the proper dependencies so that pata_of_platform.c doesn't get
>>> built on sparc.
>>>
>>> CONFIG_OF_IRQ was severely misdesigned, it should just NOP out on
>>> platforms where the architecture has the final IRQ values already like
>>> sparc does.  But that's not how it was implemented at all, and now
>>> we're starting to have all of these drivers get hard dependencies on
>>> this mechanism and it's datastructures, and the resulting sparc build
>>> failures from time to time.
>>>
>>> Jeff, please push something like the following to Linus so that
>>> sparc's allmodconfig builds again.  Thanks.
>>>
>>
>> Really, drivers should no longer use of_irq_to_resource (or
>> of_address_to_resource for that matter). The resources are setup by the
>> core OF code. The patch I sent does this.
>
> Thanks for taking care of this.

Being so late in 3.2-rc, it would be preferred to apply&push David's 
patch for 3.2, and then get Rob's into libata-dev#upstream (linux-next).

That OK?

	Jeff





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

* Re: pata_of_platform.c cannot build on sparc
  2011-12-22  1:40     ` Jeff Garzik
@ 2011-12-22 13:38       ` Rob Herring
  2011-12-22 20:00         ` Sergei Shtylyov
  0 siblings, 1 reply; 8+ messages in thread
From: Rob Herring @ 2011-12-22 13:38 UTC (permalink / raw)
  To: Jeff Garzik
  Cc: David Miller, pawel.moll, linux-ide, devicetree-discuss, jgarzik

On 12/21/2011 07:40 PM, Jeff Garzik wrote:
> On 12/21/2011 07:14 PM, David Miller wrote:
>> From: Rob Herring<robherring2@gmail.com>
>> Date: Wed, 21 Dec 2011 17:25:15 -0600
>>
>>> On 12/21/2011 04:38 PM, David Miller wrote:
>>>>
>>>> It depends upon CONFIG_OF_IRQ which not all CONFIG_OF platforms
>>>> support,
>>>> in particular sparc does not support CONFIG_OF_PLATFORM because it
>>>> precomputes all IRQs at boot time when it scans the device tree so all
>>>> of the CONFIG_OF_IRQ infrastructure to probe and resolve IRQs at driver
>>>> probe time is wrong and completely unnecessary.
>>>>
>>>> Add the proper dependencies so that pata_of_platform.c doesn't get
>>>> built on sparc.
>>>>
>>>> CONFIG_OF_IRQ was severely misdesigned, it should just NOP out on
>>>> platforms where the architecture has the final IRQ values already like
>>>> sparc does.  But that's not how it was implemented at all, and now
>>>> we're starting to have all of these drivers get hard dependencies on
>>>> this mechanism and it's datastructures, and the resulting sparc build
>>>> failures from time to time.
>>>>
>>>> Jeff, please push something like the following to Linus so that
>>>> sparc's allmodconfig builds again.  Thanks.
>>>>
>>>
>>> Really, drivers should no longer use of_irq_to_resource (or
>>> of_address_to_resource for that matter). The resources are setup by the
>>> core OF code. The patch I sent does this.
>>
>> Thanks for taking care of this.
> 
> Being so late in 3.2-rc, it would be preferred to apply&push David's
> patch for 3.2, and then get Rob's into libata-dev#upstream (linux-next).
> 
> That OK?
> 

Fine by me.

Rob

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

* Re: pata_of_platform.c cannot build on sparc
  2011-12-22 20:00         ` Sergei Shtylyov
@ 2011-12-22 19:38           ` Jeff Garzik
  0 siblings, 0 replies; 8+ messages in thread
From: Jeff Garzik @ 2011-12-22 19:38 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: Rob Herring, David Miller, pawel.moll, linux-ide,
	devicetree-discuss, jgarzik

On 12/22/2011 03:00 PM, Sergei Shtylyov wrote:
> Hello.
>
> On 12/22/2011 04:38 PM, Rob Herring wrote:
>
>>>>>> It depends upon CONFIG_OF_IRQ which not all CONFIG_OF platforms
>>>>>> support,
>>>>>> in particular sparc does not support CONFIG_OF_PLATFORM because it
>>>>>> precomputes all IRQs at boot time when it scans the device tree so
>>>>>> all
>>>>>> of the CONFIG_OF_IRQ infrastructure to probe and resolve IRQs at
>>>>>> driver
>>>>>> probe time is wrong and completely unnecessary.
>
>>>>>> Add the proper dependencies so that pata_of_platform.c doesn't get
>>>>>> built on sparc.
>
>>>>>> CONFIG_OF_IRQ was severely misdesigned, it should just NOP out on
>>>>>> platforms where the architecture has the final IRQ values already
>>>>>> like
>>>>>> sparc does. But that's not how it was implemented at all, and now
>>>>>> we're starting to have all of these drivers get hard dependencies on
>>>>>> this mechanism and it's datastructures, and the resulting sparc build
>>>>>> failures from time to time.
>
>>>>>> Jeff, please push something like the following to Linus so that
>>>>>> sparc's allmodconfig builds again. Thanks.
>
>>>>> Really, drivers should no longer use of_irq_to_resource (or
>>>>> of_address_to_resource for that matter). The resources are setup by
>>>>> the
>>>>> core OF code. The patch I sent does this.
>
>>>> Thanks for taking care of this.
>
>>> Being so late in 3.2-rc, it would be preferred to apply&push David's
>>> patch for 3.2, and then get Rob's into libata-dev#upstream (linux-next).
>
>>> That OK?
>
>> Fine by me.
>
> But then it should be extended to undo David's patch, right? Or that
> patch just be reverted afterwards...

Correct.

	Jeff





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

* Re: pata_of_platform.c cannot build on sparc
  2011-12-22 13:38       ` Rob Herring
@ 2011-12-22 20:00         ` Sergei Shtylyov
  2011-12-22 19:38           ` Jeff Garzik
  0 siblings, 1 reply; 8+ messages in thread
From: Sergei Shtylyov @ 2011-12-22 20:00 UTC (permalink / raw)
  To: Rob Herring
  Cc: Jeff Garzik, David Miller, pawel.moll, linux-ide,
	devicetree-discuss, jgarzik

Hello.

On 12/22/2011 04:38 PM, Rob Herring wrote:

>>>>> It depends upon CONFIG_OF_IRQ which not all CONFIG_OF platforms
>>>>> support,
>>>>> in particular sparc does not support CONFIG_OF_PLATFORM because it
>>>>> precomputes all IRQs at boot time when it scans the device tree so all
>>>>> of the CONFIG_OF_IRQ infrastructure to probe and resolve IRQs at driver
>>>>> probe time is wrong and completely unnecessary.

>>>>> Add the proper dependencies so that pata_of_platform.c doesn't get
>>>>> built on sparc.

>>>>> CONFIG_OF_IRQ was severely misdesigned, it should just NOP out on
>>>>> platforms where the architecture has the final IRQ values already like
>>>>> sparc does.  But that's not how it was implemented at all, and now
>>>>> we're starting to have all of these drivers get hard dependencies on
>>>>> this mechanism and it's datastructures, and the resulting sparc build
>>>>> failures from time to time.

>>>>> Jeff, please push something like the following to Linus so that
>>>>> sparc's allmodconfig builds again.  Thanks.

>>>> Really, drivers should no longer use of_irq_to_resource (or
>>>> of_address_to_resource for that matter). The resources are setup by the
>>>> core OF code. The patch I sent does this.

>>> Thanks for taking care of this.

>> Being so late in 3.2-rc, it would be preferred to apply&push David's
>> patch for 3.2, and then get Rob's into libata-dev#upstream (linux-next).

>> That OK?

> Fine by me.

    But then it should be extended to undo David's patch, right? Or that patch 
just be reverted afterwards...

WBR, Sergei

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

end of thread, other threads:[~2011-12-22 20:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-21 22:38 pata_of_platform.c cannot build on sparc David Miller
2011-12-21 23:23 ` [PATCH] pata_of_platform: remove direct dependency on OF_IRQ Rob Herring
2011-12-21 23:25 ` pata_of_platform.c cannot build on sparc Rob Herring
2011-12-22  0:14   ` David Miller
2011-12-22  1:40     ` Jeff Garzik
2011-12-22 13:38       ` Rob Herring
2011-12-22 20:00         ` Sergei Shtylyov
2011-12-22 19:38           ` Jeff Garzik

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