All of lore.kernel.org
 help / color / mirror / Atom feed
* [rtc-linux] [PATCH] rtc: lpc32xx: remove irq > NR_IRQS check from probe()
@ 2015-12-02  6:10 Vladimir Zapolskiy
  2015-12-13 13:54 ` [rtc-linux] " Alexandre Belloni
  0 siblings, 1 reply; 2+ messages in thread
From: Vladimir Zapolskiy @ 2015-12-02  6:10 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni; +Cc: rtc-linux

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

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;
 	}
-- 
2.1.4

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [rtc-linux] Re: [PATCH] rtc: lpc32xx: remove irq > NR_IRQS check from probe()
  2015-12-02  6:10 [rtc-linux] [PATCH] rtc: lpc32xx: remove irq > NR_IRQS check from probe() Vladimir Zapolskiy
@ 2015-12-13 13:54 ` Alexandre Belloni
  0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Belloni @ 2015-12-13 13:54 UTC (permalink / raw)
  To: Vladimir Zapolskiy; +Cc: Alessandro Zummo, rtc-linux

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.

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-12-13 13:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-02  6:10 [rtc-linux] [PATCH] rtc: lpc32xx: remove irq > NR_IRQS check from probe() Vladimir Zapolskiy
2015-12-13 13:54 ` [rtc-linux] " Alexandre Belloni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.