diff mbox

rtc: lpc32xx: remove irq > NR_IRQS check from probe()

Message ID 1449036628-20539-1-git-send-email-vz@mleia.com
State Accepted
Headers show

Commit Message

Vladimir Zapolskiy Dec. 2, 2015, 6:10 a.m. UTC
If the driver is used on an ARM platform with SPARSE_IRQ defined,
semantics of NR_IRQS is different (minimal value of virtual irqs)
and by default it is set to 16, see arch/arm/include/asm/irq.h.

This value may be less than the actual number of virtual irqs, which
may break the driver initialization. The check removal allows to use
the driver on such a platform, and, if irq controller driver works
correctly, the check is not needed on legacy platforms.

Fixes a runtime problem:

  rtc-lpc32xx 40024000.rtc: Can't get interrupt resource

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
---
 drivers/rtc/rtc-lpc32xx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Alexandre Belloni Dec. 13, 2015, 1:54 p.m. UTC | #1
On 02/12/2015 at 08:10:28 +0200, Vladimir Zapolskiy wrote :
> If the driver is used on an ARM platform with SPARSE_IRQ defined,
> semantics of NR_IRQS is different (minimal value of virtual irqs)
> and by default it is set to 16, see arch/arm/include/asm/irq.h.
> 
> This value may be less than the actual number of virtual irqs, which
> may break the driver initialization. The check removal allows to use
> the driver on such a platform, and, if irq controller driver works
> correctly, the check is not needed on legacy platforms.
> 
> Fixes a runtime problem:
> 
>   rtc-lpc32xx 40024000.rtc: Can't get interrupt resource
> 
> Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
> ---
>  drivers/rtc/rtc-lpc32xx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
Applied, thanks.
diff mbox

Patch

diff --git a/drivers/rtc/rtc-lpc32xx.c b/drivers/rtc/rtc-lpc32xx.c
index f923f73..887871c 100644
--- a/drivers/rtc/rtc-lpc32xx.c
+++ b/drivers/rtc/rtc-lpc32xx.c
@@ -205,7 +205,7 @@  static int lpc32xx_rtc_probe(struct platform_device *pdev)
 	u32 tmp;
 
 	rtcirq = platform_get_irq(pdev, 0);
-	if (rtcirq < 0 || rtcirq >= NR_IRQS) {
+	if (rtcirq < 0) {
 		dev_warn(&pdev->dev, "Can't get interrupt resource\n");
 		rtcirq = -1;
 	}