Received: by 10.223.176.46 with SMTP id f43csp2744176wra; Mon, 22 Jan 2018 02:40:57 -0800 (PST) X-Google-Smtp-Source: AH8x225haYJMzo+iKz4dXnhb3aTcwWaSY5AAfifOyMikKVvqHBSj5IofUeCnu+AjM9Dfc/lCthEB X-Received: by 10.99.97.87 with SMTP id v84mr7039867pgb.342.1516617657036; Mon, 22 Jan 2018 02:40:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516617657; cv=none; d=google.com; s=arc-20160816; b=teKw/lIxP/0U8O9zJekOBP4HWkvKpTn5d9MbNSubGQlyQucv9UUtk/q27VCGNxnZgv ZeEvRhkdDkHJpsHvQSbPgWl6aFUQMeLvHo9hnubzTAJECBtRjZ0wsckalYC8y9oSZIBH sf7UiytG+8/FwjOGB6b8+sb4nBNUUtkUN+vXJKatOJ5Pvhlbugd5wm2IO46ahJIxIgji QBiSyUO9jceFcoEGf84ouE1JHGbDZCLqP6j4lxz04TUTLSMXDQbCzCbxElwG8IwhWJ1F N1AtvHTk9Xi1iKJcjCaSajw90tVxLVkVU5A9MBeEQbY3k48GeRHZYJuLd/GeoXx9jn3Y GGNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=OpEN9qrGrwgb9FIy7cjCN7KN27dCJef/eWx7ed9eSP8=; b=L4P08Y7EioWwoQxeRXvM1O14USMP3KuIFfdGSJwhDa/8qFOtn3Q9E4Zs7Gganj30ZE ViCZST73COceI1KKbfiRUAyUiqhaJXSlIt08zloG5/Wp4CCGNwLzdcmeA1UT7eh+EYEC QinNlcj3D6V7MNb6glC+xJcDk5RYYUN/LhUiEImNxwn7SVb5IqJRbFOkmfHbxQ+A3nAw Foxy0Sm9Ncm4yWsR8R6OBi9McOgDyTw77RbnXtX9zVswYqyVxAqb/OZ2b6jhIhpfaygP OVkTof+R89nZM2c1egrN7Te/D1S5Q38Qb1TNRmfp8IXmUWKDKe8Cqiyu9JLYNZ9SDkOP b+5A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a66si13837485pgc.276.2018.01.22.02.40.43; Mon, 22 Jan 2018 02:40:57 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751417AbeAVKjn (ORCPT + 99 others); Mon, 22 Jan 2018 05:39:43 -0500 Received: from eddie.linux-mips.org ([148.251.95.138]:56072 "EHLO cvs.linux-mips.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751205AbeAVKjk (ORCPT ); Mon, 22 Jan 2018 05:39:40 -0500 Received: (from localhost user: 'ladis' uid#1021 fake: STDIN (ladis@eddie.linux-mips.org)) by eddie.linux-mips.org id S23990412AbeAVKjikTWqR (ORCPT + 2 others); Mon, 22 Jan 2018 11:39:38 +0100 Date: Mon, 22 Jan 2018 11:39:37 +0100 From: Ladislav Michl To: Claudiu Beznea Cc: linux-omap@vger.kernel.org, linux-pwm@vger.kernel.org, Keerthy , daniel.lezcano@linaro.org, thierry.reding@gmail.com, tony@atomide.com, aaro.koskinen@iki.fi, narmstrong@baylibre.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, sebastian.reichel@collabora.co.uk, robh+dt@kernel.org, t-kristo@ti.com, grygorii.strashko@ti.com 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-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <755fca20-7544-1655-47c7-83b1a2669adc@microchip.com> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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);