Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932550AbbHDJYG (ORCPT ); Tue, 4 Aug 2015 05:24:06 -0400 Received: from mail-wi0-f176.google.com ([209.85.212.176]:33404 "EHLO mail-wi0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932442AbbHDJYD (ORCPT ); Tue, 4 Aug 2015 05:24:03 -0400 Message-ID: <55C084AF.7060606@linaro.org> Date: Tue, 04 Aug 2015 11:23:59 +0200 From: Daniel Lezcano User-Agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Govindraj Raja , linux-kernel@vger.kernel.org, linux-mips@linux-mips.org, devicetree@vger.kernel.org CC: Thomas Gleixner , Andrew Bresticker , James Hartley , Damien Horsley , James Hogan , Ezequiel Garcia , Ezequiel Garcia Subject: Re: [PATCH v4 1/7] clocksource: mips-gic: Enable the clock before using it References: <1438005618-27003-1-git-send-email-govindraj.raja@imgtec.com> <1438005618-27003-2-git-send-email-govindraj.raja@imgtec.com> In-Reply-To: <1438005618-27003-2-git-send-email-govindraj.raja@imgtec.com> 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: 1792 Lines: 52 On 07/27/2015 04:00 PM, Govindraj Raja wrote: > From: Ezequiel Garcia > > For the clock to be used (e.g. get its rate through clk_get_rate) > it should be prepared and enabled first. > > Also, while the clock is enabled the driver must hold a reference to it, > so let's remove the call to clk_put. > > Reviewed-by: Andrew Bresticker > Signed-off-by: Ezequiel Garcia Acked-by: Daniel Lezcano > --- > drivers/clocksource/mips-gic-timer.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/drivers/clocksource/mips-gic-timer.c b/drivers/clocksource/mips-gic-timer.c > index b81ed1a..913585d 100644 > --- a/drivers/clocksource/mips-gic-timer.c > +++ b/drivers/clocksource/mips-gic-timer.c > @@ -158,8 +158,13 @@ static void __init gic_clocksource_of_init(struct device_node *node) > > clk = of_clk_get(node, 0); > if (!IS_ERR(clk)) { > + if (clk_prepare_enable(clk) < 0) { > + pr_err("GIC failed to enable clock\n"); > + clk_put(clk); > + return; > + } > + > gic_frequency = clk_get_rate(clk); > - clk_put(clk); > } else if (of_property_read_u32(node, "clock-frequency", > &gic_frequency)) { > pr_err("GIC frequency not specified.\n"); > -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/