diff options
author | Kamlakant Patel <kamlakant.patel@broadcom.com> | 2015-05-04 05:09:49 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-05-04 15:10:41 -0400 |
commit | 965b2aa78fbcb831acf4f669f494da201f4bcace (patch) | |
tree | 8b0a1b1a851551711af32842b4b606b7fccde0ca /drivers/net/ethernet | |
parent | d66bf7dd27573ee5ea90484899ee952c19ccb194 (diff) |
net/smsc911x: fix irq resource allocation failure
When smsc911x uses GPIO as the interrupt controller, and if both are
loaded as modules, we get following error:
"smsc911x: Could not allocate irq resource"
This issue is because of smsc911x using platform_get_resource to get
device tree based irq resource.
commit "9ec36ca (of/irq: do irq resolution in platform_get_irq)" and
commit "7085a7 (drivers: platform: parse IRQ flags from resources)" add
support in platform_get_irq to resolve irq and irq_flags respectively
for both modern device tree and legacy static platform data platforms.
Modify smsc911x driver to use platform_get_irq to pick up irq resource
correctly and use irq_get_trigger_type to get the IRQ trigger flags.
Signed-off-by: Kamlakant Patel <kamlakant.patel@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet')
-rw-r--r-- | drivers/net/ethernet/smsc/smsc911x.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c index 41047c9143d0..959aeeade0c9 100644 --- a/drivers/net/ethernet/smsc/smsc911x.c +++ b/drivers/net/ethernet/smsc/smsc911x.c | |||
@@ -2418,9 +2418,9 @@ static int smsc911x_drv_probe(struct platform_device *pdev) | |||
2418 | struct net_device *dev; | 2418 | struct net_device *dev; |
2419 | struct smsc911x_data *pdata; | 2419 | struct smsc911x_data *pdata; |
2420 | struct smsc911x_platform_config *config = dev_get_platdata(&pdev->dev); | 2420 | struct smsc911x_platform_config *config = dev_get_platdata(&pdev->dev); |
2421 | struct resource *res, *irq_res; | 2421 | struct resource *res; |
2422 | unsigned int intcfg = 0; | 2422 | unsigned int intcfg = 0; |
2423 | int res_size, irq_flags; | 2423 | int res_size, irq, irq_flags; |
2424 | int retval; | 2424 | int retval; |
2425 | 2425 | ||
2426 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, | 2426 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, |
@@ -2434,8 +2434,8 @@ static int smsc911x_drv_probe(struct platform_device *pdev) | |||
2434 | } | 2434 | } |
2435 | res_size = resource_size(res); | 2435 | res_size = resource_size(res); |
2436 | 2436 | ||
2437 | irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); | 2437 | irq = platform_get_irq(pdev, 0); |
2438 | if (!irq_res) { | 2438 | if (irq <= 0) { |
2439 | pr_warn("Could not allocate irq resource\n"); | 2439 | pr_warn("Could not allocate irq resource\n"); |
2440 | retval = -ENODEV; | 2440 | retval = -ENODEV; |
2441 | goto out_0; | 2441 | goto out_0; |
@@ -2455,8 +2455,8 @@ static int smsc911x_drv_probe(struct platform_device *pdev) | |||
2455 | SET_NETDEV_DEV(dev, &pdev->dev); | 2455 | SET_NETDEV_DEV(dev, &pdev->dev); |
2456 | 2456 | ||
2457 | pdata = netdev_priv(dev); | 2457 | pdata = netdev_priv(dev); |
2458 | dev->irq = irq_res->start; | 2458 | dev->irq = irq; |
2459 | irq_flags = irq_res->flags & IRQF_TRIGGER_MASK; | 2459 | irq_flags = irq_get_trigger_type(irq); |
2460 | pdata->ioaddr = ioremap_nocache(res->start, res_size); | 2460 | pdata->ioaddr = ioremap_nocache(res->start, res_size); |
2461 | 2461 | ||
2462 | pdata->dev = dev; | 2462 | pdata->dev = dev; |