From patchwork Fri May 23 10:31:23 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 30733 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yk0-f198.google.com (mail-yk0-f198.google.com [209.85.160.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 857A02066E for ; Fri, 23 May 2014 10:41:22 +0000 (UTC) Received: by mail-yk0-f198.google.com with SMTP id 9sf10595532ykp.9 for ; Fri, 23 May 2014 03:41:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=WPwIFHlvLm4hiGN3wVjS+S9+g4Qd/Ep4wqhzfiLhC8k=; b=HM+GB8C0x8qd2MX1C8QvVlkhDGUTghB81KffVhKHFYrCP5gpDUQzh9Xp8hM/65wGYN wus3mcOf8YoLuahjeqd1/xvoXDc+OauDXQW22bWpfUJMIe2KuFuyH1Q7y8v1PPmhTToL K54XdL0B5IL6PHJMf758fTKf8KEVpU1vTc5pL6CtDECRPjpedwD07kNQdvQELQovfavE oLrr/WklmWvVS1MyeRzktNYDvD3hOCnU15LD67RqCjd7ji8AwxAncAs5XDN/p9ZPO9yw O42jLvBgfuBfAV05epAOMWaeXLLk6uwlojko6g/wbx3IGM7DNGvM3tkhAl7Iv8q1FBnH o+3Q== X-Gm-Message-State: ALoCoQmSlnyIMb6+xRM77y9BZnvM8VcjWLKpfw7cmIEe31mMHwLmltO2mU9E1juk++O37BLgpKlx X-Received: by 10.58.245.132 with SMTP id xo4mr1246877vec.11.1400841682142; Fri, 23 May 2014 03:41:22 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.101.4 with SMTP id t4ls1715761qge.1.gmail; Fri, 23 May 2014 03:41:22 -0700 (PDT) X-Received: by 10.58.85.65 with SMTP id f1mr3571864vez.20.1400841682035; Fri, 23 May 2014 03:41:22 -0700 (PDT) Received: from mail-vc0-f176.google.com (mail-vc0-f176.google.com [209.85.220.176]) by mx.google.com with ESMTPS id l4si1392225vcg.46.2014.05.23.03.41.22 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 23 May 2014 03:41:22 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.176 as permitted sender) client-ip=209.85.220.176; Received: by mail-vc0-f176.google.com with SMTP id id10so2577325vcb.7 for ; Fri, 23 May 2014 03:41:22 -0700 (PDT) X-Received: by 10.220.69.72 with SMTP id y8mr3395053vci.21.1400841681961; Fri, 23 May 2014 03:41:21 -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 ib8csp20366vcb; Fri, 23 May 2014 03:41:21 -0700 (PDT) X-Received: by 10.66.243.225 with SMTP id xb1mr4707260pac.49.1400841681218; Fri, 23 May 2014 03:41:21 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id kn8si3299596pab.196.2014.05.23.03.41.20 for ; Fri, 23 May 2014 03:41:20 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752942AbaEWKcg (ORCPT + 27 others); Fri, 23 May 2014 06:32:36 -0400 Received: from mail-wi0-f179.google.com ([209.85.212.179]:62461 "EHLO mail-wi0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752824AbaEWKc3 (ORCPT ); Fri, 23 May 2014 06:32:29 -0400 Received: by mail-wi0-f179.google.com with SMTP id bs8so617393wib.12 for ; Fri, 23 May 2014 03:32:28 -0700 (PDT) X-Received: by 10.194.84.101 with SMTP id x5mr3381272wjy.52.1400841148863; Fri, 23 May 2014 03:32:28 -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.32.27 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 23 May 2014 03:32:28 -0700 (PDT) From: Daniel Lezcano To: tglx@linutronix.de, mingo@kernel.org Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 43/71] clocksource: sh_mtu2: Add index to struct sh_mtu2_channel Date: Fri, 23 May 2014 12:31:23 +0200 Message-Id: <1400841111-6683-43-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> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.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.220.176 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 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Laurent Pinchart Use the index as the timer start/stop bit and when printing messages to identify the channel. Signed-off-by: Laurent Pinchart Tested-by: Wolfram Sang --- drivers/clocksource/sh_mtu2.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/drivers/clocksource/sh_mtu2.c b/drivers/clocksource/sh_mtu2.c index 97714ce..61827c6 100644 --- a/drivers/clocksource/sh_mtu2.c +++ b/drivers/clocksource/sh_mtu2.c @@ -38,6 +38,7 @@ struct sh_mtu2_device; struct sh_mtu2_channel { struct sh_mtu2_device *mtu; + unsigned int index; void __iomem *base; int irq; @@ -110,7 +111,6 @@ static inline void sh_mtu2_write(struct sh_mtu2_channel *ch, int reg_nr, static void sh_mtu2_start_stop_ch(struct sh_mtu2_channel *ch, int start) { - struct sh_timer_config *cfg = ch->mtu->pdev->dev.platform_data; unsigned long flags, value; /* start stop register shared by multiple timer channels */ @@ -118,9 +118,9 @@ static void sh_mtu2_start_stop_ch(struct sh_mtu2_channel *ch, int start) value = sh_mtu2_read(ch, TSTR); if (start) - value |= 1 << cfg->timer_bit; + value |= 1 << ch->index; else - value &= ~(1 << cfg->timer_bit); + value &= ~(1 << ch->index); sh_mtu2_write(ch, TSTR, value); raw_spin_unlock_irqrestore(&sh_mtu2_lock, flags); @@ -138,7 +138,8 @@ static int sh_mtu2_enable(struct sh_mtu2_channel *ch) /* enable clock */ ret = clk_enable(ch->mtu->clk); if (ret) { - dev_err(&ch->mtu->pdev->dev, "cannot enable clock\n"); + dev_err(&ch->mtu->pdev->dev, "ch%u: cannot enable clock\n", + ch->index); return ret; } @@ -211,7 +212,7 @@ static void sh_mtu2_clock_event_mode(enum clock_event_mode mode, switch (mode) { case CLOCK_EVT_MODE_PERIODIC: dev_info(&ch->mtu->pdev->dev, - "used for periodic clock events\n"); + "ch%u: used for periodic clock events\n", ch->index); sh_mtu2_enable(ch); break; case CLOCK_EVT_MODE_UNUSED: @@ -250,15 +251,16 @@ static void sh_mtu2_register_clockevent(struct sh_mtu2_channel *ch, ced->suspend = sh_mtu2_clock_event_suspend; ced->resume = sh_mtu2_clock_event_resume; - dev_info(&ch->mtu->pdev->dev, "used for clock events\n"); + dev_info(&ch->mtu->pdev->dev, "ch%u: used for clock events\n", + ch->index); clockevents_register_device(ced); ret = request_irq(ch->irq, sh_mtu2_interrupt, IRQF_TIMER | IRQF_IRQPOLL | IRQF_NOBALANCING, dev_name(&ch->mtu->pdev->dev), ch); if (ret) { - dev_err(&ch->mtu->pdev->dev, "failed to request irq %d\n", - ch->irq); + dev_err(&ch->mtu->pdev->dev, "ch%u: failed to request irq %d\n", + ch->index, ch->irq); return; } } @@ -279,10 +281,12 @@ static int sh_mtu2_setup_channel(struct sh_mtu2_channel *ch, memset(ch, 0, sizeof(*ch)); ch->mtu = mtu; + ch->index = cfg->timer_bit; ch->irq = platform_get_irq(mtu->pdev, 0); if (ch->irq < 0) { - dev_err(&mtu->pdev->dev, "failed to get irq\n"); + dev_err(&mtu->pdev->dev, "ch%u: failed to get irq\n", + ch->index); return ch->irq; }