From patchwork Mon Jan 22 10:39:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ladislav Michl X-Patchwork-Id: 10178257 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 984C2602B7 for ; Mon, 22 Jan 2018 10:52:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 938A8205F7 for ; Mon, 22 Jan 2018 10:52:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 87BFF21F61; Mon, 22 Jan 2018 10:52:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E374A205F7 for ; Mon, 22 Jan 2018 10:52:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ioMepW+EAVDNJYEgyQ7a70P7HQrikOj5LZxflSEdo74=; b=LgB8xAltrNW0DB uco5TPJKPKYK52dcp7M11qDHw61FUNwz+DYFMME64MZ+plAOz7NrXxyodc2EWowfAUNGBxCRszEnj PvN8uIY8XkaVeob1Q40LmrxfrlrwpuAe16ujwAW4uzrOXhogAYE+7xQZhqrvD3hg/o+hE31xj6xuI xvKzECqjdYYcMiVOgJaeFY14VE+NONQSG9H+UsjnU+Z4iTIScLPWpCajzH+/K1EzxHLMYdUv3ze2V BLZaor6MB/1lj4gbcB2gMPbUIIwqhwiC7s5+Lk6wTtK/Rp1Omy7s7DLtTEbPbAgVJh+FHWFQdOwIA kf1rnVBhXfRgyDFZ6PLg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1edZiF-0005SJ-8i; Mon, 22 Jan 2018 10:52:27 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1edZiB-0004l9-Uo for linux-arm-kernel@bombadil.infradead.org; Mon, 22 Jan 2018 10:52:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Sender:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=OpEN9qrGrwgb9FIy7cjCN7KN27dCJef/eWx7ed9eSP8=; b=lkpxmhcsI5jOnfyT/cNfpu8a0 n2jK82ZVzyLjZxAdw/YDCC1MiuhCdwMTl8CmxbUtyMqcRQXuko7PfPMHBNDWxWG136w+BEzwWOkoo BCwthP3YBUtiuIlIncqpX0OwVA6oJNysSVoNv+lhn+iwoghi8s4/Rf1d8o+UPfl/NHIBNE+txgR1y zCs6z+k8TDinaM9T6Q8/v4JKRCv7tZkRZrKn0fx+QW4Vdx7DKVnc2k/6FTl4k6sBa6DhCPBETQ4HV 6DMvLe9p9Z8ztEh2sSWmvarP/ud+3OVWohICu+OXHkKHfvLOkCYR6OHVnE5fGGzzxvNzek1hKRnk4 MVtAbBM0g==; Received: from eddie.linux-mips.org ([148.251.95.138] helo=cvs.linux-mips.org) by casper.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1edZW5-0000ur-0T for linux-arm-kernel@lists.infradead.org; Mon, 22 Jan 2018 10:39:56 +0000 Received: (from localhost user: 'ladis' uid#1021 fake: STDIN (ladis@eddie.linux-mips.org)) by eddie.linux-mips.org id S23990412AbeAVKjikTWqR (ORCPT ); Mon, 22 Jan 2018 11:39:38 +0100 Date: Mon, 22 Jan 2018 11:39:37 +0100 From: Ladislav Michl To: Claudiu Beznea Subject: Re: [PATCH 3/3] clocksource: timer-dm: Make unexported functions static Message-ID: <20180122103936.GB19401@lenoch> References: <20180117214629.GA11952@lenoch> <20180117214826.GD11952@lenoch> <755fca20-7544-1655-47c7-83b1a2669adc@microchip.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <755fca20-7544-1655-47c7-83b1a2669adc@microchip.com> User-Agent: Mutt/1.9.2 (2017-12-15) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180122_103953_060009_D6014002 X-CRM114-Status: GOOD ( 27.21 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-pwm@vger.kernel.org, grygorii.strashko@ti.com, aaro.koskinen@iki.fi, tony@atomide.com, Keerthy , daniel.lezcano@linaro.org, linux-kernel@vger.kernel.org, robh+dt@kernel.org, narmstrong@baylibre.com, thierry.reding@gmail.com, sebastian.reichel@collabora.co.uk, t-kristo@ti.com, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP On Mon, Jan 22, 2018 at 11:26:44AM +0200, Claudiu Beznea wrote: > On 17.01.2018 23:48, Ladislav Michl wrote: > > As dmtimer no longer exports functions, make those previously > > exported static. > > > > Signed-off-by: Ladislav Michl > > --- > > Note: only those functions assigned to timer ops are made static > > as some others will be needed later for event capture. > > > > drivers/clocksource/timer-dm.c | 218 ++++++++++++++++++++--------------------- > > include/clocksource/dmtimer.h | 24 ---- > > 2 files changed, 109 insertions(+), 133 deletions(-) > > > > diff --git a/drivers/clocksource/timer-dm.c b/drivers/clocksource/timer-dm.c > > index 324ec93d3dd2..8de9e543d129 100644 > > --- a/drivers/clocksource/timer-dm.c > > +++ b/drivers/clocksource/timer-dm.c > > @@ -163,6 +163,92 @@ static int omap_dm_timer_of_set_source(struct omap_dm_timer *timer) > > return ret; > > } > > > > +static int omap_dm_timer_set_source(struct omap_dm_timer *timer, int source) > > +{ > > + int ret; > > + char *parent_name = NULL; > Could be declared as const: const char *parent_name = NULL; > > > + struct clk *parent; > > + struct dmtimer_platform_data *pdata; > > + > > + if (unlikely(!timer)) > > + return -EINVAL; > > + > > + pdata = timer->pdev->dev.platform_data; > > + > > + if (source < 0 || source >= 3) > > + return -EINVAL; > > + > > + /* > > + * FIXME: Used for OMAP1 devices only because they do not currently > > + * use the clock framework to set the parent clock. To be removed > > + * once OMAP1 migrated to using clock framework for dmtimers > > + */ > > + if (pdata && pdata->set_timer_src) > > + return pdata->set_timer_src(timer->pdev, source); > > + > > + if (IS_ERR(timer->fclk)) > > + return -EINVAL; > Souldn't this check be done at the beginning of the function? Well, this patch only moves existing functions around, just to make it compile after declarations are removed from header file. Fixes should be sent separately as this is not the only problem with clocksource code :) Anyway, thank you for review, this one could be addressed by a following patch: diff --git a/drivers/clocksource/timer-dm.c b/drivers/clocksource/timer-dm.c index dbf2b1f6a941..02b3436db70e 100644 --- a/drivers/clocksource/timer-dm.c +++ b/drivers/clocksource/timer-dm.c @@ -166,17 +166,30 @@ static int omap_dm_timer_of_set_source(struct omap_dm_timer *timer) static int omap_dm_timer_set_source(struct omap_dm_timer *timer, int source) { int ret; - char *parent_name = NULL; + const char *parent_name; struct clk *parent; struct dmtimer_platform_data *pdata; - if (unlikely(!timer)) + if (unlikely(!timer) || IS_ERR(timer->fclk)) return -EINVAL; - pdata = timer->pdev->dev.platform_data; + switch (source) { + case OMAP_TIMER_SRC_SYS_CLK: + parent_name = "timer_sys_ck"; + break; - if (source < 0 || source >= 3) + case OMAP_TIMER_SRC_32_KHZ: + parent_name = "timer_32k_ck"; + break; + + case OMAP_TIMER_SRC_EXT_CLK: + parent_name = "timer_ext_ck"; + break; + default: return -EINVAL; + } + + pdata = timer->pdev->dev.platform_data; /* * FIXME: Used for OMAP1 devices only because they do not currently @@ -186,29 +199,12 @@ static int omap_dm_timer_set_source(struct omap_dm_timer *timer, int source) if (pdata && pdata->set_timer_src) return pdata->set_timer_src(timer->pdev, source); - if (IS_ERR(timer->fclk)) - return -EINVAL; - #if defined(CONFIG_COMMON_CLK) /* Check if the clock has configurable parents */ if (clk_hw_get_num_parents(__clk_get_hw(timer->fclk)) < 2) return 0; #endif - switch (source) { - case OMAP_TIMER_SRC_SYS_CLK: - parent_name = "timer_sys_ck"; - break; - - case OMAP_TIMER_SRC_32_KHZ: - parent_name = "timer_32k_ck"; - break; - - case OMAP_TIMER_SRC_EXT_CLK: - parent_name = "timer_ext_ck"; - break; - } - parent = clk_get(&timer->pdev->dev, parent_name); if (IS_ERR(parent)) { pr_err("%s: %s not found\n", __func__, parent_name);