Skip to contentSkip to conversation

pata_of_platform.c cannot build on sparc

PATCH New David Miller 4 participants 8 messages Dec 21, 2011 – Dec 22, 2011 libata

lore
Share & tools
lore
#0 lore raw

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.

drivers/ata/Kconfig +1 -1
index 6bdedd7..cf047c4 100644
@@ -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
#1 lore raw

PATCH 1/1 pata_of_platform: remove direct dependency on OF_IRQ

From: Rob Herring <[email protected]>

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.

---
 drivers/ata/pata_of_platform.c |   15 ++++++---------
 1 files changed, 6 insertions(+), 9 deletions(-)
drivers/ata/pata_of_platform.c +6 -9
index 2a472c5..ece899d 100644
@@ -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);
 }
 
Signature · 1 line
1.7.5.4
#2 lore raw
In reply to David Miller
Quoted 17 lines · David Miller

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.

Quoted 3 lines

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

Quoted 22 lines

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

drivers/ata/Kconfig +1 -1
index 6bdedd7..cf047c4 100644
@@ -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
[email protected]
https://lists.ozlabs.org/listinfo/devicetree-discuss

#3 lore raw

From: Rob Herring <[email protected]>
Date: Wed, 21 Dec 2011 17:25:15 -0600

Quoted 18 lines · David Miller
Quoted 17 lines

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.

Quoted 7 lines
Quoted 3 lines

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.

#4 lore raw
Quoted 25 lines · David Miller

From: Rob Herring<[email protected]>
Date: Wed, 21 Dec 2011 17:25:15 -0600

Quoted 22 lines · David Miller
Quoted 20 lines

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.

Quoted 5 lines
Quoted 3 lines

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

#5 lore raw
Quoted 31 lines · Jeff Garzik
Quoted 30 lines · David Miller

From: Rob Herring<[email protected]>
Date: Wed, 21 Dec 2011 17:25:15 -0600

Quoted 26 lines · David Miller
Quoted 18 lines

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.

Quoted 3 lines

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.

Quoted 7 lines
Quoted 1 line

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

#6 lore raw

Hello.

Quoted 24 lines · Rob Herring
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
Quoted 17 lines

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.

Quoted 2 lines

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.

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

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

#7 lore raw
Quoted 37 lines · Sergei Shtylyov

Hello.

Quoted 32 lines · Rob Herring
Quoted 32 lines
Quoted 23 lines
Quoted 22 lines
Quoted 22 lines

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.

Quoted 6 lines
Quoted 4 lines

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

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

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