From patchwork Fri May 23 10:30:50 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 30717 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ig0-f198.google.com (mail-ig0-f198.google.com [209.85.213.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3D62020369 for ; Fri, 23 May 2014 10:36:39 +0000 (UTC) Received: by mail-ig0-f198.google.com with SMTP id uq10sf1663029igb.9 for ; Fri, 23 May 2014 03:36:38 -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=8N9Qd/Eh0k/Um/UIN26OAhg5hsmEF2bRgJoSJQ/sBGk=; b=DMYayCLPbAYAAc/mCPPkJgElDbiXrGcygXJ3Dr80sQWbrjqUpEAmM3xZ7dSc7YsuRg 9T5y385vlR7d15aiS+kU8Bre8+C59om/wr1rsAlEfwYGGZ6+SKupdzw32J2IUF7LxrnK fD81ejuDkXYKbA6E+gQwr/UJTIJ7g3hIq69nVu5phvKLFxbwpFy1H3iOvFpIlbNt1OPx GgUio4HHVs9Wh01EPaygV2Ve/cpB7vlswRS9H09ZQUim4XTiyxFNABdvK3SgqOPgn5f+ HWb3lFR8y2u+v6AYKp7lWKT7IclidW7OONSPqNoqFCqQfBz8f6yL7XmgWQZY+3LBIIAQ 3mnA== X-Gm-Message-State: ALoCoQnNK2IWE/ybltc/c6NPcp0JHFRKcnY33CBTk5hlfOfbcFOrH6qVnwKCv1aWZLLa6abKD2zT X-Received: by 10.50.18.20 with SMTP id s20mr1199318igd.3.1400841398494; Fri, 23 May 2014 03:36:38 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.30.165 with SMTP id d34ls1635769qgd.25.gmail; Fri, 23 May 2014 03:36:38 -0700 (PDT) X-Received: by 10.220.81.194 with SMTP id y2mr3360691vck.29.1400841398395; Fri, 23 May 2014 03:36:38 -0700 (PDT) Received: from mail-ve0-f174.google.com (mail-ve0-f174.google.com [209.85.128.174]) by mx.google.com with ESMTPS id z1si1392649vet.30.2014.05.23.03.36.38 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 23 May 2014 03:36:38 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.174 as permitted sender) client-ip=209.85.128.174; Received: by mail-ve0-f174.google.com with SMTP id jw12so5934055veb.5 for ; Fri, 23 May 2014 03:36:38 -0700 (PDT) X-Received: by 10.220.139.198 with SMTP id f6mr110488vcu.47.1400841398280; Fri, 23 May 2014 03:36:38 -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 ib8csp20091vcb; Fri, 23 May 2014 03:36:38 -0700 (PDT) X-Received: by 10.140.88.112 with SMTP id s103mr4518902qgd.113.1400841397935; Fri, 23 May 2014 03:36:37 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id p10si2955459qci.12.2014.05.23.03.36.37 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 May 2014 03:36:37 -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 1WnmoD-0002qk-9k; Fri, 23 May 2014 10:34:41 +0000 Received: from mail-we0-f173.google.com ([74.125.82.173]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Wnmln-0001Da-1P for linux-arm-kernel@lists.infradead.org; Fri, 23 May 2014 10:32:11 +0000 Received: by mail-we0-f173.google.com with SMTP id u57so4681072wes.18 for ; Fri, 23 May 2014 03:31:48 -0700 (PDT) X-Received: by 10.180.19.201 with SMTP id h9mr2415136wie.17.1400841108483; Fri, 23 May 2014 03:31:48 -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.47 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 23 May 2014 03:31:47 -0700 (PDT) From: Daniel Lezcano To: tglx@linutronix.de, mingo@kernel.org Subject: [PATCH 10/71] clocksource: sh_cmt: Allocate channels dynamically Date: Fri, 23 May 2014 12:30:50 +0200 Message-Id: <1400841111-6683-10-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_033211_235304_3B60D5DE X-CRM114-Status: GOOD ( 13.77 ) 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.173 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.174 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 This prepares the driver for multi-channel support. Signed-off-by: Laurent Pinchart --- drivers/clocksource/sh_cmt.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c index 0779bf1..f94db32 100644 --- a/drivers/clocksource/sh_cmt.c +++ b/drivers/clocksource/sh_cmt.c @@ -62,7 +62,8 @@ struct sh_cmt_device { void __iomem *mapbase; struct clk *clk; - struct sh_cmt_channel channel; + struct sh_cmt_channel *channels; + unsigned int num_channels; unsigned long width; /* 16 or 32 bit version of hardware block */ unsigned long overflow_bit; @@ -822,7 +823,15 @@ static int sh_cmt_setup(struct sh_cmt_device *cmt, struct platform_device *pdev) cmt->clear_bits = ~0xc000; } - ret = sh_cmt_setup_channel(&cmt->channel, cfg->timer_bit, cmt); + cmt->channels = kzalloc(sizeof(*cmt->channels), GFP_KERNEL); + if (cmt->channels == NULL) { + ret = -ENOMEM; + goto err4; + } + + cmt->num_channels = 1; + + ret = sh_cmt_setup_channel(&cmt->channels[0], cfg->timer_bit, cmt); if (ret < 0) goto err4; @@ -830,6 +839,7 @@ static int sh_cmt_setup(struct sh_cmt_device *cmt, struct platform_device *pdev) return 0; err4: + kfree(cmt->channels); clk_unprepare(cmt->clk); err3: clk_put(cmt->clk);