From patchwork Mon Aug 13 15:38:54 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ludovic Desroches X-Patchwork-Id: 1313881 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 1D74BDF223 for ; Mon, 13 Aug 2012 15:42:32 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1T0wk2-0007so-Cr; Mon, 13 Aug 2012 15:39:42 +0000 Received: from eusmtp01.atmel.com ([212.144.249.242]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1T0wjn-0007q1-V5 for linux-arm-kernel@lists.infradead.org; Mon, 13 Aug 2012 15:39:28 +0000 Received: from HNOCHT01.corp.atmel.com (10.161.30.161) by eusmtp01.atmel.com (10.161.101.30) with Microsoft SMTP Server (TLS) id 14.2.247.3; Mon, 13 Aug 2012 17:40:50 +0200 Received: from ibiza.rfo.atmel.com (10.159.245.197) by HNOCHT01.corp.atmel.com (10.161.30.160) with Microsoft SMTP Server (TLS) id 14.2.247.3; Mon, 13 Aug 2012 17:39:24 +0200 From: To: Subject: [PATCH] ARM: at91: fix drivers broken because of sparse irq support Date: Mon, 13 Aug 2012 17:38:54 +0200 Message-ID: <1344872334-1532-2-git-send-email-ludovic.desroches@atmel.com> X-Mailer: git-send-email 1.7.11.3 In-Reply-To: <1344872334-1532-1-git-send-email-ludovic.desroches@atmel.com> References: <1344872334-1532-1-git-send-email-ludovic.desroches@atmel.com> MIME-Version: 1.0 X-Originating-IP: [10.159.245.197] X-Spam-Note: CRM114 invocation failed X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: plagnioj@jcrosoft.com, manabian@gmail.com, nicolas.ferre@atmel.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Ludovic Desroches Some drivers directly use AT91_ID_SYS as virq so they are broken because of the NR_IRQS_LEGACY virq offset introduced with sparse irq support. Signed-off-by: Ludovic Desroches Cc: stable@vger.kernel.org Tested-by: Joachim Eastwood --- arch/arm/mach-at91/at91rm9200_time.c | 2 +- drivers/rtc/rtc-at91sam9.c | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/arch/arm/mach-at91/at91rm9200_time.c b/arch/arm/mach-at91/at91rm9200_time.c index 104ca40..aaa443b 100644 --- a/arch/arm/mach-at91/at91rm9200_time.c +++ b/arch/arm/mach-at91/at91rm9200_time.c @@ -197,7 +197,7 @@ void __init at91rm9200_timer_init(void) at91_st_read(AT91_ST_SR); /* Make IRQs happen for the system timer */ - setup_irq(AT91_ID_SYS, &at91rm9200_timer_irq); + setup_irq(NR_IRQS_LEGACY + AT91_ID_SYS, &at91rm9200_timer_irq); /* The 32KiHz "Slow Clock" (tick every 30517.58 nanoseconds) is used * directly for the clocksource and all clockevents, after adjusting diff --git a/drivers/rtc/rtc-at91sam9.c b/drivers/rtc/rtc-at91sam9.c index 8318689..2969047 100644 --- a/drivers/rtc/rtc-at91sam9.c +++ b/drivers/rtc/rtc-at91sam9.c @@ -345,11 +345,12 @@ static int __devinit at91_rtc_probe(struct platform_device *pdev) } /* register irq handler after we know what name we'll use */ - ret = request_irq(AT91_ID_SYS, at91_rtc_interrupt, + ret = request_irq(NR_IRQS_LEGACY + AT91_ID_SYS, at91_rtc_interrupt, IRQF_SHARED, dev_name(&rtc->rtcdev->dev), rtc); if (ret) { - dev_dbg(&pdev->dev, "can't share IRQ %d?\n", AT91_ID_SYS); + dev_dbg(&pdev->dev, "can't share IRQ %d?\n", + NR_IRQS_LEGACY + AT91_ID_SYS); rtc_device_unregister(rtc->rtcdev); goto fail_register; } @@ -386,7 +387,7 @@ static int __devexit at91_rtc_remove(struct platform_device *pdev) /* disable all interrupts */ rtt_writel(rtc, MR, mr & ~(AT91_RTT_ALMIEN | AT91_RTT_RTTINCIEN)); - free_irq(AT91_ID_SYS, rtc); + free_irq(NR_IRQS_LEGACY + AT91_ID_SYS, rtc); rtc_device_unregister(rtc->rtcdev); @@ -423,7 +424,7 @@ static int at91_rtc_suspend(struct platform_device *pdev, rtc->imr = mr & (AT91_RTT_ALMIEN | AT91_RTT_RTTINCIEN); if (rtc->imr) { if (device_may_wakeup(&pdev->dev) && (mr & AT91_RTT_ALMIEN)) { - enable_irq_wake(AT91_ID_SYS); + enable_irq_wake(NR_IRQS_LEGACY + AT91_ID_SYS); /* don't let RTTINC cause wakeups */ if (mr & AT91_RTT_RTTINCIEN) rtt_writel(rtc, MR, mr & ~AT91_RTT_RTTINCIEN); @@ -441,7 +442,7 @@ static int at91_rtc_resume(struct platform_device *pdev) if (rtc->imr) { if (device_may_wakeup(&pdev->dev)) - disable_irq_wake(AT91_ID_SYS); + disable_irq_wake(NR_IRQS_LEGACY + AT91_ID_SYS); mr = rtt_readl(rtc, MR); rtt_writel(rtc, MR, mr | rtc->imr); }