[PATCH 2/2] net: smsc911x: get IRQ flags from chip if not present in IORESOURCE_IRQ

Javier Martinez Canillas javier.martinez at collabora.co.uk
Sat Apr 13 04:05:43 EST 2013


When defining an IRQ trigger type and level flags from a Device Tree
a call to of_irq_to_resource() is made to parse the "interrupts"
property cells and return a struct resource.

But the flags are not saved on this struct resource which means that
drivers that try to obtain this information from an IORESOURCE_IRQ
will not be able to get it.

So, is more safe to fallback and query this information from the irq
chip directly if it was not found on the struct resource.

Signed-off-by: Javier Martinez Canillas <javier.martinez at collabora.co.uk>
---
 drivers/net/ethernet/smsc/smsc911x.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c
index da5cc9a..3d535b3 100644
--- a/drivers/net/ethernet/smsc/smsc911x.c
+++ b/drivers/net/ethernet/smsc/smsc911x.c
@@ -2390,6 +2390,10 @@ static int smsc911x_drv_probe(struct platform_device *pdev)
 	pdata = netdev_priv(dev);
 	dev->irq = irq_res->start;
 	irq_flags = irq_res->flags & IRQF_TRIGGER_MASK;
+
+	if (!irq_flags)
+		irq_flags = irq_get_trigger_type(dev->irq);
+
 	pdata->ioaddr = ioremap_nocache(res->start, res_size);
 
 	pdata->dev = dev;
-- 
1.7.7.6



More information about the devicetree-discuss mailing list