From patchwork Fri May 23 10:31:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 30737 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f198.google.com (mail-qc0-f198.google.com [209.85.216.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D8B3B2066E for ; Fri, 23 May 2014 10:41:59 +0000 (UTC) Received: by mail-qc0-f198.google.com with SMTP id m20sf15119341qcx.1 for ; Fri, 23 May 2014 03:41:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :in-reply-to:references:cc:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:content-type:content-transfer-encoding; bh=U2jTABQj/9HAn+q8Gtumh7yBLaxy9oP4dLvxT50nZX8=; b=IuNAlwbJkz9kRwQ+3TPdnahrAleoV2NYB1LMENyrBvzh86rlAy3Z9Pow+qtqpw6XJe RqCnp2vrKMiPkq0z4YTyd6kEUGum47WAf/5tg+9GM2GI9YE5Ix23daDlxQP6q4rljLS2 mXFxyhpPhOklA2RIQi2yOX+SPstYm9akGAPR9be6QGuMNEiyz7i5CjdQ1KYdTH4VWKdb Yj8tfLqhpJ1k6jGkyQcRvP+rwLqZ0/5oQcAXmbGs1kX09wQnnZ2Yz9d13/kqVhpR3NT/ oNmI9ghIRtCUOeOnFA8vjF7YFz6+zE1dVIwdLP+l6U8LF7HmUzJQ8AUOH3xJk/5VQCOJ t4Qw== X-Gm-Message-State: ALoCoQneiVOhYzgO+tv+6tdEF1A8XRPETWv1istKEaTbrh7Caf62kdSnGc4nLPnKHcXYnbcglFpZ X-Received: by 10.236.127.35 with SMTP id c23mr1462418yhi.51.1400841719534; Fri, 23 May 2014 03:41:59 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.81.115 with SMTP id e106ls1698363qgd.65.gmail; Fri, 23 May 2014 03:41:59 -0700 (PDT) X-Received: by 10.58.46.231 with SMTP id y7mr3379628vem.5.1400841719404; Fri, 23 May 2014 03:41:59 -0700 (PDT) Received: from mail-ve0-f173.google.com (mail-ve0-f173.google.com [209.85.128.173]) by mx.google.com with ESMTPS id pi7si1402212veb.13.2014.05.23.03.41.59 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 23 May 2014 03:41:59 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.173 as permitted sender) client-ip=209.85.128.173; Received: by mail-ve0-f173.google.com with SMTP id pa12so6039009veb.18 for ; Fri, 23 May 2014 03:41:59 -0700 (PDT) X-Received: by 10.221.4.66 with SMTP id ob2mr3473873vcb.28.1400841719298; Fri, 23 May 2014 03:41:59 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp20405vcb; Fri, 23 May 2014 03:41:59 -0700 (PDT) X-Received: by 10.229.97.71 with SMTP id k7mr5317882qcn.4.1400841718938; Fri, 23 May 2014 03:41:58 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id d9si3031859qar.94.2014.05.23.03.41.58 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 May 2014 03:41:58 -0700 (PDT) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Wnmti-0000jH-5g; Fri, 23 May 2014 10:40:22 +0000 Received: from mail-wg0-f52.google.com ([74.125.82.52]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Wnmlw-0001Fx-Ef for linux-arm-kernel@lists.infradead.org; Fri, 23 May 2014 10:32:21 +0000 Received: by mail-wg0-f52.google.com with SMTP id l18so4576411wgh.11 for ; Fri, 23 May 2014 03:32:00 -0700 (PDT) X-Received: by 10.180.13.113 with SMTP id g17mr2462490wic.48.1400841120804; Fri, 23 May 2014 03:32:00 -0700 (PDT) Received: from localhost.localdomain (AToulouse-654-1-404-187.w82-125.abo.wanadoo.fr. [82.125.3.187]) by mx.google.com with ESMTPSA id s9sm2200908wix.13.2014.05.23.03.31.59 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 23 May 2014 03:32:00 -0700 (PDT) From: Daniel Lezcano To: tglx@linutronix.de, mingo@kernel.org Subject: [PATCH 20/71] clocksource: sh_cmt: Request IRQ for clock event device only Date: Fri, 23 May 2014 12:31:00 +0200 Message-Id: <1400841111-6683-20-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1400841111-6683-1-git-send-email-daniel.lezcano@linaro.org> References: <537F214C.8000700@linaro.org> <1400841111-6683-1-git-send-email-daniel.lezcano@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140523_033220_704196_8FFD0A75 X-CRM114-Status: GOOD ( 16.60 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.3.2 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [74.125.82.52 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: daniel.lezcano@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.173 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Laurent Pinchart Clock sources don't need an IRQ, request the IRQ only for channels used as clock event devices. Signed-off-by: Laurent Pinchart --- drivers/clocksource/sh_cmt.c | 51 ++++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c index 9f215e7..bc8d025 100644 --- a/drivers/clocksource/sh_cmt.c +++ b/drivers/clocksource/sh_cmt.c @@ -785,10 +785,28 @@ static void sh_cmt_clock_event_resume(struct clock_event_device *ced) pm_genpd_syscore_poweron(&ch->cmt->pdev->dev); } -static void sh_cmt_register_clockevent(struct sh_cmt_channel *ch, - const char *name) +static int sh_cmt_register_clockevent(struct sh_cmt_channel *ch, + const char *name) { struct clock_event_device *ced = &ch->ced; + int irq; + int ret; + + irq = platform_get_irq(ch->cmt->pdev, ch->cmt->legacy ? 0 : ch->index); + if (irq < 0) { + dev_err(&ch->cmt->pdev->dev, "ch%u: failed to get irq\n", + ch->index); + return irq; + } + + ret = request_irq(irq, sh_cmt_interrupt, + IRQF_TIMER | IRQF_IRQPOLL | IRQF_NOBALANCING, + dev_name(&ch->cmt->pdev->dev), ch); + if (ret) { + dev_err(&ch->cmt->pdev->dev, "ch%u: failed to request irq %d\n", + ch->index, irq); + return ret; + } ced->name = name; ced->features = CLOCK_EVT_FEAT_PERIODIC; @@ -803,14 +821,20 @@ static void sh_cmt_register_clockevent(struct sh_cmt_channel *ch, dev_info(&ch->cmt->pdev->dev, "ch%u: used for clock events\n", ch->index); clockevents_register_device(ced); + + return 0; } static int sh_cmt_register(struct sh_cmt_channel *ch, const char *name, bool clockevent, bool clocksource) { + int ret; + if (clockevent) { ch->cmt->has_clockevent = true; - sh_cmt_register_clockevent(ch, name); + ret = sh_cmt_register_clockevent(ch, name); + if (ret < 0) + return ret; } if (clocksource) { @@ -825,7 +849,6 @@ static int sh_cmt_setup_channel(struct sh_cmt_channel *ch, unsigned int index, unsigned int hwidx, bool clockevent, bool clocksource, struct sh_cmt_device *cmt) { - int irq; int ret; /* Skip unused channels. */ @@ -869,17 +892,6 @@ static int sh_cmt_setup_channel(struct sh_cmt_channel *ch, unsigned int index, } } - if (cmt->legacy) - irq = platform_get_irq(cmt->pdev, 0); - else - irq = platform_get_irq(cmt->pdev, ch->index); - - if (irq < 0) { - dev_err(&cmt->pdev->dev, "ch%u: failed to get irq\n", - ch->index); - return irq; - } - if (cmt->info->width == (sizeof(ch->max_match_value) * 8)) ch->max_match_value = ~0; else @@ -904,15 +916,6 @@ static int sh_cmt_setup_channel(struct sh_cmt_channel *ch, unsigned int index, } ch->cs_enabled = false; - ret = request_irq(irq, sh_cmt_interrupt, - IRQF_TIMER | IRQF_IRQPOLL | IRQF_NOBALANCING, - dev_name(&cmt->pdev->dev), ch); - if (ret) { - dev_err(&cmt->pdev->dev, "ch%u: failed to request irq %d\n", - ch->index, irq); - return ret; - } - return 0; }