From patchwork Fri May 23 10:31:20 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 30745 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ig0-f200.google.com (mail-ig0-f200.google.com [209.85.213.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 32F2E2066E for ; Fri, 23 May 2014 10:43:51 +0000 (UTC) Received: by mail-ig0-f200.google.com with SMTP id uy17sf1691534igb.11 for ; Fri, 23 May 2014 03:43:50 -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=5WmVTq0xFJykuZyS7oJhvsh5/ZnbPr1cXIvBS/ULfDY=; b=RIXAU3pUl47Jx4DP4F4Nia0HXOn6DSz7JaOqUrr52kUzOqpidZIOx4e2D4MvtdE+F3 n7n/ovvtcrQ0k6j8mudZQ5ZT9yjY87tRE84RDXXoFWhgTm4lnkpM/JN1bjUvO82YCnWN BEpO58gtIQcbgRjjIGQeNJQuj7YbH0V+FFy4H4JJEqljcs12A1ha2YFfLVimVKOwT607 4YxGmsvOYXSZZtLid+/U0VfskTXxxsBkq9Qcp+V3CmmVCwufts1KElSJQT0McBHeK5Jw 5cbh1IcAS5ZibbShUfE/mtAi1wTGQAxj6iKWcCeoXXi4Nx0/SFjm2KAVdKJTAZUzpyKs 37gQ== X-Gm-Message-State: ALoCoQnzx69QSC4kZ/Buqa1iujdU9cETzPryQC2tzHfMOdq8vW094VK2vN5EzdRbeq9ODXAVhnHG X-Received: by 10.182.51.228 with SMTP id n4mr1845133obo.28.1400841830620; Fri, 23 May 2014 03:43:50 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.101.247 with SMTP id u110ls1744391qge.79.gmail; Fri, 23 May 2014 03:43:50 -0700 (PDT) X-Received: by 10.58.161.168 with SMTP id xt8mr3359577veb.25.1400841830492; Fri, 23 May 2014 03:43:50 -0700 (PDT) Received: from mail-vc0-f175.google.com (mail-vc0-f175.google.com [209.85.220.175]) by mx.google.com with ESMTPS id xw5si1403850vcb.11.2014.05.23.03.43.50 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 23 May 2014 03:43:50 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.175 as permitted sender) client-ip=209.85.220.175; Received: by mail-vc0-f175.google.com with SMTP id id10so2605828vcb.20 for ; Fri, 23 May 2014 03:43:50 -0700 (PDT) X-Received: by 10.220.69.72 with SMTP id y8mr3404144vci.21.1400841830385; Fri, 23 May 2014 03:43:50 -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 ib8csp20482vcb; Fri, 23 May 2014 03:43:49 -0700 (PDT) X-Received: by 10.68.229.68 with SMTP id so4mr4750207pbc.110.1400841829577; Fri, 23 May 2014 03:43:49 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id xg6si3395644pab.9.2014.05.23.03.43.49 for ; Fri, 23 May 2014 03:43:49 -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 S1753528AbaEWKmh (ORCPT + 27 others); Fri, 23 May 2014 06:42:37 -0400 Received: from mail-wg0-f45.google.com ([74.125.82.45]:57320 "EHLO mail-wg0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751917AbaEWKc0 (ORCPT ); Fri, 23 May 2014 06:32:26 -0400 Received: by mail-wg0-f45.google.com with SMTP id m15so4689550wgh.16 for ; Fri, 23 May 2014 03:32:25 -0700 (PDT) X-Received: by 10.194.243.104 with SMTP id wx8mr3339568wjc.32.1400841145077; Fri, 23 May 2014 03:32:25 -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.23 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 23 May 2014 03:32:24 -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 40/71] clocksource: sh_mtu2: Split channel setup to separate function Date: Fri, 23 May 2014 12:31:20 +0200 Message-Id: <1400841111-6683-40-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.175 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 Move the channel setup code from sh_mtu2_setup to a new sh_mtu2_setup_channel function and call it from sh_mtu2_setup. Signed-off-by: Laurent Pinchart Tested-by: Wolfram Sang --- drivers/clocksource/sh_mtu2.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/drivers/clocksource/sh_mtu2.c b/drivers/clocksource/sh_mtu2.c index 256621c..8fd7059 100644 --- a/drivers/clocksource/sh_mtu2.c +++ b/drivers/clocksource/sh_mtu2.c @@ -273,6 +273,24 @@ static int sh_mtu2_register(struct sh_mtu2_channel *ch, char *name, return 0; } +static int sh_mtu2_setup_channel(struct sh_mtu2_channel *ch, + struct sh_mtu2_device *mtu) +{ + struct sh_timer_config *cfg = mtu->pdev->dev.platform_data; + + memset(ch, 0, sizeof(*ch)); + ch->mtu = mtu; + + ch->irq = platform_get_irq(mtu->pdev, 0); + if (ch->irq < 0) { + dev_err(&mtu->pdev->dev, "failed to get irq\n"); + return ch->irq; + } + + return sh_mtu2_register(ch, (char *)dev_name(&mtu->pdev->dev), + cfg->clockevent_rating); +} + static int sh_mtu2_setup(struct sh_mtu2_device *mtu, struct platform_device *pdev) { @@ -297,12 +315,6 @@ static int sh_mtu2_setup(struct sh_mtu2_device *mtu, goto err0; } - mtu->channel.irq = platform_get_irq(mtu->pdev, 0); - if (mtu->channel.irq < 0) { - dev_err(&mtu->pdev->dev, "failed to get irq\n"); - goto err0; - } - /* map memory, let mapbase point to our channel */ mtu->mapbase = ioremap_nocache(res->start, resource_size(res)); if (mtu->mapbase == NULL) { @@ -322,10 +334,7 @@ static int sh_mtu2_setup(struct sh_mtu2_device *mtu, if (ret < 0) goto err2; - mtu->channel.mtu = mtu; - - ret = sh_mtu2_register(&mtu->channel, (char *)dev_name(&mtu->pdev->dev), - cfg->clockevent_rating); + ret = sh_mtu2_setup_channel(&mtu->channel, mtu); if (ret < 0) goto err3;