From patchwork Wed Jun 29 11:46:50 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 928262 X-Patchwork-Delegate: tony@atomide.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p5TBkxXr003129 for ; Wed, 29 Jun 2011 11:47:01 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755374Ab1F2LrA (ORCPT ); Wed, 29 Jun 2011 07:47:00 -0400 Received: from na3sys009aog105.obsmtp.com ([74.125.149.75]:45049 "EHLO na3sys009aog105.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754734Ab1F2LrA (ORCPT ); Wed, 29 Jun 2011 07:47:00 -0400 Received: from mail-bw0-f51.google.com ([209.85.214.51]) (using TLSv1) by na3sys009aob105.postini.com ([74.125.148.12]) with SMTP ID DSNKTgsQs0W6POEEPEoYmNDrWlqF44/szbv8@postini.com; Wed, 29 Jun 2011 04:46:59 PDT Received: by mail-bw0-f51.google.com with SMTP id 18so1258390bwa.10 for ; Wed, 29 Jun 2011 04:46:59 -0700 (PDT) Received: by 10.204.41.16 with SMTP id m16mr665011bke.151.1309348018673; Wed, 29 Jun 2011 04:46:58 -0700 (PDT) Received: from localhost (cs181221225.pp.htv.fi [82.181.221.225]) by mx.google.com with ESMTPS id k5sm1090955bka.5.2011.06.29.04.46.56 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 29 Jun 2011 04:46:57 -0700 (PDT) From: Felipe Balbi To: Tony Lindgren Cc: Linux OMAP Mailing List , Felipe Balbi Subject: [PATCH 1/2] cbus: retu: use sparse IRQ numbering Date: Wed, 29 Jun 2011 14:46:50 +0300 Message-Id: <1309348011-23141-2-git-send-email-balbi@ti.com> X-Mailer: git-send-email 1.7.6 In-Reply-To: <1309348011-23141-1-git-send-email-balbi@ti.com> References: <1309348011-23141-1-git-send-email-balbi@ti.com> Organization: Texas Instruments\n Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Wed, 29 Jun 2011 11:47:01 +0000 (UTC) there's no need to pass a bunch of IRQ bases down to drivers, we can use irq_alloc_descs() for that and put the sparse IRQ numbering scheme to work for us. Signed-off-by: Felipe Balbi --- drivers/cbus/retu.c | 25 ++++++++++++++++--------- 1 files changed, 16 insertions(+), 9 deletions(-) diff --git a/drivers/cbus/retu.c b/drivers/cbus/retu.c index 708b811..b58c6e5 100644 --- a/drivers/cbus/retu.c +++ b/drivers/cbus/retu.c @@ -441,9 +441,15 @@ static int __init retu_probe(struct platform_device *pdev) platform_set_drvdata(pdev, retu); + ret = irq_alloc_descs(-1, 0, MAX_RETU_IRQ_HANDLERS, 0); + if (ret < 0) { + dev_err(&pdev->dev, "failed to allocate IRQ descs\n"); + goto err1; + } + retu->irq = platform_get_irq(pdev, 0); - retu->irq_base = pdata->irq_base; - retu->irq_end = pdata->irq_end; + retu->irq_base = ret; + retu->irq_end = ret + MAX_RETU_IRQ_HANDLERS; retu->devid = pdata->devid; retu->dev = &pdev->dev; the_retu = retu; @@ -467,7 +473,7 @@ static int __init retu_probe(struct platform_device *pdev) "retu", retu); if (ret < 0) { dev_err(&pdev->dev, "Unable to register IRQ handler\n"); - goto err1; + goto err2; } irq_set_irq_wake(retu->irq, 1); @@ -478,16 +484,19 @@ static int __init retu_probe(struct platform_device *pdev) ret = retu_allocate_children(&pdev->dev, retu->irq_base); if (ret < 0) { dev_err(&pdev->dev, "Unable to allocate Retu children\n"); - goto err2; + goto err3; } return 0; -err2: +err3: pm_power_off = NULL; - __retu_write_reg(retu, RETU_REG_IMR, 0xffff); free_irq(retu->irq, retu); +err2: + retu_irq_exit(retu); + irq_free_descs(retu->irq_base, MAX_RETU_IRQ_HANDLERS); + err1: kfree(retu); the_retu = NULL; @@ -503,11 +512,9 @@ static int __exit retu_remove(struct platform_device *pdev) pm_power_off = NULL; the_retu = NULL; - /* Mask all RETU interrupts */ - __retu_write_reg(retu, RETU_REG_IMR, 0xffff); - free_irq(retu->irq, retu); retu_irq_exit(retu); + irq_free_descs(retu->irq_base, MAX_RETU_IRQ_HANDLERS); kfree(retu); return 0;