Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754073AbcC3SG5 (ORCPT ); Wed, 30 Mar 2016 14:06:57 -0400 Received: from mail-wm0-f54.google.com ([74.125.82.54]:33556 "EHLO mail-wm0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752737AbcC3SG4 (ORCPT ); Wed, 30 Mar 2016 14:06:56 -0400 Subject: Re: [PATCH] arm: at91: do not disable/enable clocks in a row To: Sebastian Andrzej Siewior , Nicolas Ferre References: <1459258007-24968-1-git-send-email-bigeasy@linutronix.de> Cc: Thomas Gleixner , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org From: Daniel Lezcano Message-ID: <56FC15BC.9010708@linaro.org> Date: Wed, 30 Mar 2016 20:06:52 +0200 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <1459258007-24968-1-git-send-email-bigeasy@linutronix.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2053 Lines: 64 On 03/29/2016 03:26 PM, Sebastian Andrzej Siewior wrote: > Currently the driver will disable the clock and enable it one line later > if it is switching from periodic mode into one shot. > This can be avoided and causes a needless warning on -RT. I don't see the connection between the description and the content of the patch. It can be avoided by not disabling the clock when going to periodic / oneshot. The function below suggest clk_enable() is called twice, is that the real issue ? > Tested-by: Alexandre Belloni > Acked-by: Alexandre Belloni > Signed-off-by: Sebastian Andrzej Siewior > --- > drivers/clocksource/tcb_clksrc.c | 33 +++++++++++++++++++++++++++++---- > 1 file changed, 29 insertions(+), 4 deletions(-) > > diff --git a/drivers/clocksource/tcb_clksrc.c b/drivers/clocksource/tcb_clksrc.c > index 4da2af9694a2..ed1ae4445e8d 100644 > --- a/drivers/clocksource/tcb_clksrc.c > +++ b/drivers/clocksource/tcb_clksrc.c > @@ -74,6 +74,7 @@ static struct clocksource clksrc = { > struct tc_clkevt_device { > struct clock_event_device clkevt; > struct clk *clk; > + bool clk_enabled; > void __iomem *regs; > }; > > @@ -91,6 +92,24 @@ static struct tc_clkevt_device *to_tc_clkevt(struct clock_event_device *clkevt) > */ > static u32 timer_clock; > > +static void tc_clk_disable(struct clock_event_device *d) > +{ > + struct tc_clkevt_device *tcd = to_tc_clkevt(d); > + > + clk_disable(tcd->clk); > + tcd->clk_enabled = false; > +} > + > +static void tc_clk_enable(struct clock_event_device *d) > +{ > + struct tc_clkevt_device *tcd = to_tc_clkevt(d); > + > + if (tcd->clk_enabled) > + return; > + clk_enable(tcd->clk); > + tcd->clk_enabled = true; > +} This function. -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog