From patchwork Fri May 23 10:31:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 30746 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f198.google.com (mail-ve0-f198.google.com [209.85.128.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8D44E20AEA for ; Fri, 23 May 2014 10:43:51 +0000 (UTC) Received: by mail-ve0-f198.google.com with SMTP id sa20sf17148032veb.5 for ; Fri, 23 May 2014 03:43:51 -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=Zm/Klnuz4quk7uA00s0K1WWwPaFZ59hheFxNXqoFeOM=; b=YSgug1nFriAyDKf8PYYZXU5SLbwP1p68D3Q7+LDB54hSHepoy89ylrOPYcqDE5a8iD tZ/cvH5uOPhcg31/BpjHBMZgGDqOWZ7PqV2kZcnhOzunSULBEpyy92GhGQ7dJCKRD+HO QEMe4uQelHqzP1JS1Y9VHX4WuFD7jCRkP1aM5m7jnYBqOQ+7s/EFLPBjIuMqfRzPBu55 dnyXreztM3ogwKVwZAwzcvQ+1i6A/JUxRe/Mh4+CkDLfLO8J3HlOKLBj3XV0yyHfhesQ L5JSJtLciAQ61V2poVq2cGI3JxnV4toN45sW+/hUzq1/PQIWyY9XgT2myXmuUq0LcMpH FO2g== X-Gm-Message-State: ALoCoQm3FIYg2tKIuzdSGdedY3IBQoReg2vBeaVWPCHs0QdVoYg3JtCMNkoXdZ5smFQH/4Kcb/VF X-Received: by 10.236.99.7 with SMTP id w7mr1607300yhf.4.1400841831385; Fri, 23 May 2014 03:43:51 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.81.115 with SMTP id e106ls1698696qgd.65.gmail; Fri, 23 May 2014 03:43:51 -0700 (PDT) X-Received: by 10.58.161.101 with SMTP id xr5mr639571veb.36.1400841831288; Fri, 23 May 2014 03:43:51 -0700 (PDT) Received: from mail-vc0-f179.google.com (mail-vc0-f179.google.com [209.85.220.179]) by mx.google.com with ESMTPS id jb1si1396683vec.42.2014.05.23.03.43.51 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 23 May 2014 03:43:51 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.179 as permitted sender) client-ip=209.85.220.179; Received: by mail-vc0-f179.google.com with SMTP id im17so5990097vcb.38 for ; Fri, 23 May 2014 03:43:51 -0700 (PDT) X-Received: by 10.220.195.196 with SMTP id ed4mr141942vcb.42.1400841831215; Fri, 23 May 2014 03:43:51 -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 ib8csp20484vcb; Fri, 23 May 2014 03:43:50 -0700 (PDT) X-Received: by 10.224.7.6 with SMTP id b6mr4987072qab.45.1400841830829; Fri, 23 May 2014 03:43:50 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id i10si2973744qgd.66.2014.05.23.03.43.50 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 May 2014 03:43:50 -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 1Wnmv2-00023r-LN; Fri, 23 May 2014 10:41:44 +0000 Received: from mail-wi0-f175.google.com ([209.85.212.175]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Wnmm3-0001M8-TN for linux-arm-kernel@lists.infradead.org; Fri, 23 May 2014 10:32:28 +0000 Received: by mail-wi0-f175.google.com with SMTP id f8so604210wiw.8 for ; Fri, 23 May 2014 03:32:05 -0700 (PDT) X-Received: by 10.180.228.42 with SMTP id sf10mr2462808wic.48.1400841125774; Fri, 23 May 2014 03:32:05 -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.04 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 23 May 2014 03:32:05 -0700 (PDT) From: Daniel Lezcano To: tglx@linutronix.de, mingo@kernel.org Subject: [PATCH 24/71] clocksource: sh_tmu: Split channel setup to separate function Date: Fri, 23 May 2014 12:31:04 +0200 Message-Id: <1400841111-6683-24-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_033228_132326_20F03493 X-CRM114-Status: GOOD ( 14.79 ) 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 [209.85.212.175 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.220.179 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 Move the channel setup code from sh_tmu_setup to a new sh_tmu_setup_channel function and call it from sh_tmu_setup. Signed-off-by: Laurent Pinchart --- drivers/clocksource/sh_tmu.c | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/drivers/clocksource/sh_tmu.c b/drivers/clocksource/sh_tmu.c index 7013790..4779c97 100644 --- a/drivers/clocksource/sh_tmu.c +++ b/drivers/clocksource/sh_tmu.c @@ -436,6 +436,28 @@ static int sh_tmu_register(struct sh_tmu_channel *ch, char *name, return 0; } +static int sh_tmu_channel_setup(struct sh_tmu_channel *ch, + struct sh_tmu_device *tmu) +{ + struct sh_timer_config *cfg = tmu->pdev->dev.platform_data; + + memset(ch, 0, sizeof(*ch)); + ch->tmu = tmu; + + ch->irq = platform_get_irq(tmu->pdev, 0); + if (ch->irq < 0) { + dev_err(&tmu->pdev->dev, "failed to get irq\n"); + return ch->irq; + } + + ch->cs_enabled = false; + ch->enable_count = 0; + + return sh_tmu_register(ch, (char *)dev_name(&tmu->pdev->dev), + cfg->clockevent_rating, + cfg->clocksource_rating); +} + static int sh_tmu_setup(struct sh_tmu_device *tmu, struct platform_device *pdev) { struct sh_timer_config *cfg = pdev->dev.platform_data; @@ -459,12 +481,6 @@ static int sh_tmu_setup(struct sh_tmu_device *tmu, struct platform_device *pdev) goto err0; } - tmu->channel.irq = platform_get_irq(tmu->pdev, 0); - if (tmu->channel.irq < 0) { - dev_err(&tmu->pdev->dev, "failed to get irq\n"); - goto err0; - } - /* map memory, let mapbase point to our channel */ tmu->mapbase = ioremap_nocache(res->start, resource_size(res)); if (tmu->mapbase == NULL) { @@ -484,13 +500,7 @@ static int sh_tmu_setup(struct sh_tmu_device *tmu, struct platform_device *pdev) if (ret < 0) goto err2; - tmu->channel.cs_enabled = false; - tmu->channel.enable_count = 0; - tmu->channel.tmu = tmu; - - ret = sh_tmu_register(&tmu->channel, (char *)dev_name(&tmu->pdev->dev), - cfg->clockevent_rating, - cfg->clocksource_rating); + ret = sh_tmu_channel_setup(&tmu->channel, tmu); if (ret < 0) goto err3;