Skip to contentSkip to conversation

sparc: Add sparc support for platform_get_resource()

PATCH Superseded Andreas Larsson 1 participant 2 messages Oct 18, 2012 Driver core

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sparc: Add sparc support for platform_get_resource()

This adds sparc support for platform_get_irq that in the normal case use platform_get_resource() to get an irq. This standard approach fails for sparc as there are no resources of type IORESOURCE_IRQ for irqs for sparc.

Cross platform drivers can then use this standard platform function and work on sparc instead of having to have a special case for sparc.

---
 drivers/base/platform.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
drivers/base/platform.c +6 -0
index ddeca14..a17199a 100644
@@ -82,9 +82,15 @@ EXPORT_SYMBOL_GPL(platform_get_resource);
  */
 int platform_get_irq(struct platform_device *dev, unsigned int num)
 {
+#ifdef CONFIG_SPARC
+	if (!dev || num >= dev->archdata.num_irqs)
+		return -ENXIO;
+	return dev->archdata.irqs[num];
+#else
 	struct resource *r = platform_get_resource(dev, IORESOURCE_IRQ, num);
 
 	return r ? r->start : -ENXIO;
+#endif
 }
 EXPORT_SYMBOL_GPL(platform_get_irq);
 
Signature · 1 line
1.7.0.4
#1 lore raw
Quoted 3 lines · Andreas Larsson

This adds sparc support for platform_get_irq that in the normal case use platform_get_resource() to get an irq. This standard approach fails for sparc as there are no resources of type IORESOURCE_IRQ for irqs for sparc.

Sorry, subject line incorrect. New version sent.

Cheers,
Andreas