All of lore.kernel.org
 help / color / mirror / Atom feed
From: Saravana Kannan <skannan@codeaurora.org>
To: Russell King - ARM Linux <linux@arm.linux.org.uk>
Cc: "Turquette, Mike" <mturquette@ti.com>,
	andrew@lunn.ch, linaro-dev@lists.linaro.org,
	eric.miao@linaro.org, grant.likely@secretlab.ca,
	Colin Cross <ccross@google.com>,
	jeremy.kerr@canonical.com, sboyd@quicinc.com,
	magnus.damm@gmail.com, dsaxena@linaro.org,
	linux-arm-kernel@lists.infradead.org, arnd.bergmann@linaro.org,
	patches@linaro.org, Thomas Gleixner <tglx@linutronix.de>,
	linux-omap@vger.kernel.org, richard.zhao@linaro.org,
	shawn.guo@freescale.com, paul@pwsan.com,
	linus.walleij@stericsson.com,
	broonie@opensource.wolfsonmicro.com,
	linux-kernel@vger.kernel.org, amit.kucheria@linaro.org,
	skannan@quicinc.com
Subject: Re: [PATCH v4 3/6] clk: introduce the common clock framework
Date: Fri, 13 Jan 2012 20:18:34 -0800	[thread overview]
Message-ID: <4F11021A.8070407@codeaurora.org> (raw)
In-Reply-To: <20111217110433.GC14547@n2100.arm.linux.org.uk>

On 12/17/2011 03:04 AM, Russell King - ARM Linux wrote:
> On Fri, Dec 16, 2011 at 04:45:48PM -0800, Turquette, Mike wrote:
>> On Wed, Dec 14, 2011 at 5:18 AM, Thomas Gleixner<tglx@linutronix.de>  wrote:
>>> On Tue, 13 Dec 2011, Mike Turquette wrote:
>>>> +void __clk_unprepare(struct clk *clk)
>>>> +{
>>>> +     if (!clk)
>>>> +             return;
>>>> +
>>>> +     if (WARN_ON(clk->prepare_count == 0))
>>>> +             return;
>>>> +
>>>> +     if (--clk->prepare_count>  0)
>>>> +             return;
>>>> +
>>>> +     WARN_ON(clk->enable_count>  0);
>>>
>>> So this leaves the clock enable count set. I'm a bit wary about
>>> that. Shouldn't it either return (including bumping the prepare_count
>>> again) or call clk_disable() ?
>
> No it should not.
>
>> I've hit this in my port of OMAP.  It comes from this simple situation:
>>
>> driver 1 (adapted for clk_prepare/clk_unprepare):
>> clk_prepare(clk);
>> clk_enable(clk);
>>
>> ...
>>
>> driver2 (not adapted for clk_prepare/clk_unprepare):
>> clk_enable(clk);
>
> So this is basically buggy.  Look, it's quite simple.  Convert _all_
> your drivers to clk_prepare/clk_unprepare _before_ you start switching
> your platform to use these new functions.  You can do that _today_
> without exception.
>
> We must refuse to merge _any_ user which does this the old way - and
> we should have been doing this since my commit was merged into mainline
> to allow drivers to be converted.
>
> And stop trying to think of ways around this inside clk_prepare/
> clk_unprepare/clk_enable/clk_disable.  You can't do it.  Just fix _all_
> the drivers.  Now.  Before you start implementing clk_prepare/clk_unprepare.

I agree with Russell's suggestion. This is what I'm trying to do with 
the MSM platform. Not sure if I'm too optimistic, but as of today, I'm 
still optimistic I can push the MSM driver devs to get this done before 
we enable real prepare/unprepare support.

Thanks,
Saravana

-- 
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

WARNING: multiple messages have this Message-ID (diff)
From: skannan@codeaurora.org (Saravana Kannan)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v4 3/6] clk: introduce the common clock framework
Date: Fri, 13 Jan 2012 20:18:34 -0800	[thread overview]
Message-ID: <4F11021A.8070407@codeaurora.org> (raw)
In-Reply-To: <20111217110433.GC14547@n2100.arm.linux.org.uk>

On 12/17/2011 03:04 AM, Russell King - ARM Linux wrote:
> On Fri, Dec 16, 2011 at 04:45:48PM -0800, Turquette, Mike wrote:
>> On Wed, Dec 14, 2011 at 5:18 AM, Thomas Gleixner<tglx@linutronix.de>  wrote:
>>> On Tue, 13 Dec 2011, Mike Turquette wrote:
>>>> +void __clk_unprepare(struct clk *clk)
>>>> +{
>>>> +     if (!clk)
>>>> +             return;
>>>> +
>>>> +     if (WARN_ON(clk->prepare_count == 0))
>>>> +             return;
>>>> +
>>>> +     if (--clk->prepare_count>  0)
>>>> +             return;
>>>> +
>>>> +     WARN_ON(clk->enable_count>  0);
>>>
>>> So this leaves the clock enable count set. I'm a bit wary about
>>> that. Shouldn't it either return (including bumping the prepare_count
>>> again) or call clk_disable() ?
>
> No it should not.
>
>> I've hit this in my port of OMAP.  It comes from this simple situation:
>>
>> driver 1 (adapted for clk_prepare/clk_unprepare):
>> clk_prepare(clk);
>> clk_enable(clk);
>>
>> ...
>>
>> driver2 (not adapted for clk_prepare/clk_unprepare):
>> clk_enable(clk);
>
> So this is basically buggy.  Look, it's quite simple.  Convert _all_
> your drivers to clk_prepare/clk_unprepare _before_ you start switching
> your platform to use these new functions.  You can do that _today_
> without exception.
>
> We must refuse to merge _any_ user which does this the old way - and
> we should have been doing this since my commit was merged into mainline
> to allow drivers to be converted.
>
> And stop trying to think of ways around this inside clk_prepare/
> clk_unprepare/clk_enable/clk_disable.  You can't do it.  Just fix _all_
> the drivers.  Now.  Before you start implementing clk_prepare/clk_unprepare.

I agree with Russell's suggestion. This is what I'm trying to do with 
the MSM platform. Not sure if I'm too optimistic, but as of today, I'm 
still optimistic I can push the MSM driver devs to get this done before 
we enable real prepare/unprepare support.

Thanks,
Saravana

-- 
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

  reply	other threads:[~2012-01-14  4:18 UTC|newest]

Thread overview: 85+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-14  3:53 [PATCH v4 0/6] common clk framework Mike Turquette
2011-12-14  3:53 ` Mike Turquette
2011-12-14  3:53 ` Mike Turquette
     [not found] ` <1323834838-2206-1-git-send-email-mturquette-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2011-12-14  3:53   ` [PATCH v4 1/6] clk: Kconfig: add entry for HAVE_CLK_PREPARE Mike Turquette
2011-12-14  3:53     ` Mike Turquette
2011-12-14  3:53     ` Mike Turquette
2011-12-14  3:53   ` [PATCH v4 2/6] Documentation: common clk API Mike Turquette
2011-12-14  3:53     ` Mike Turquette
2011-12-14  3:53     ` Mike Turquette
2012-01-05 14:31     ` Amit Kucheria
2012-01-05 14:31       ` Amit Kucheria
2012-01-05 20:04       ` Turquette, Mike
2012-01-05 20:04         ` Turquette, Mike
2012-01-05 20:04         ` Turquette, Mike
2011-12-14  3:53   ` [PATCH v4 3/6] clk: introduce the common clock framework Mike Turquette
2011-12-14  3:53     ` Mike Turquette
2011-12-14  3:53     ` Mike Turquette
2011-12-14  4:52     ` Ryan Mallon
2011-12-14  4:52       ` Ryan Mallon
     [not found]       ` <4EE82B76.2000204-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2011-12-14 19:07         ` Turquette, Mike
2011-12-14 19:07           ` Turquette, Mike
2011-12-14 19:07           ` Turquette, Mike
2011-12-14  7:50     ` Richard Zhao
2011-12-14  7:50       ` Richard Zhao
2011-12-14  7:50       ` Richard Zhao
2011-12-14 13:18     ` Thomas Gleixner
2011-12-14 13:18       ` Thomas Gleixner
2011-12-17  0:45       ` Turquette, Mike
2011-12-17  0:45         ` Turquette, Mike
2011-12-17  0:45         ` Turquette, Mike
2011-12-17 11:04         ` Russell King - ARM Linux
2011-12-17 11:04           ` Russell King - ARM Linux
2011-12-17 11:04           ` Russell King - ARM Linux
2012-01-14  4:18           ` Saravana Kannan [this message]
2012-01-14  4:18             ` Saravana Kannan
     [not found]             ` <4F11021A.8070407-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2012-01-14  4:39               ` Turquette, Mike
2012-01-14  4:39                 ` Turquette, Mike
2012-01-14  4:39                 ` Turquette, Mike
2012-01-14  4:51                 ` Saravana Kannan
2012-01-14  4:51                   ` Saravana Kannan
     [not found]         ` <CAJOA=zO=gM2r4pCVo+orLqE9Q1SSw4h5nXsAHo-e_SHZAfvKDA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-01-04  2:15           ` Richard Zhao
2012-01-04  2:15             ` Richard Zhao
2012-01-04  2:15             ` Richard Zhao
2012-01-04 14:32             ` Rob Herring
2012-01-04 14:32               ` Rob Herring
     [not found]               ` <4F0462FF.1000308-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-01-05  1:01                 ` Turquette, Mike
2012-01-05  1:01                   ` Turquette, Mike
2012-01-05  1:01                   ` Turquette, Mike
2012-01-05  1:23                   ` Richard Zhao
2012-01-05  1:23                     ` Richard Zhao
2012-01-05  1:23                     ` Richard Zhao
2012-01-05  2:11                   ` Rob Herring
2012-01-05  2:11                     ` Rob Herring
2012-01-05  4:07                     ` Turquette, Mike
2012-01-05  4:07                       ` Turquette, Mike
2012-01-05  4:07                       ` Turquette, Mike
     [not found]                       ` <CAJOA=zPgwiOSoyZK1SpzZVZfTOmwruTR=WO+gRdVZrZVzNuPSA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-01-12 13:13                         ` Amit Kucheria
2012-01-12 13:13                           ` Amit Kucheria
2012-01-12 13:13                           ` Amit Kucheria
2012-01-13  0:04                       ` Saravana Kannan
2012-01-13  0:04                         ` Saravana Kannan
2012-01-13  0:48                         ` Rob Herring
2012-01-13  0:48                           ` Rob Herring
2012-01-13  1:19                           ` Saravana Kannan
2012-01-13  1:19                             ` Saravana Kannan
     [not found]                         ` <4F0F7507.3080501-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2012-01-13 14:53                           ` Shawn Guo
2012-01-13 14:53                             ` Shawn Guo
2012-01-13 14:53                             ` Shawn Guo
2011-12-14  3:53   ` [PATCH v4 4/6] clk: introduce rate change notifiers Mike Turquette
2011-12-14  3:53     ` Mike Turquette
2011-12-14  3:53     ` Mike Turquette
2011-12-14  3:53   ` [PATCH v4 5/6] clk: basic gateable and fixed-rate clks Mike Turquette
2011-12-14  3:53     ` Mike Turquette
2011-12-14  3:53     ` Mike Turquette
2011-12-14  5:15     ` Ryan Mallon
2011-12-14  5:15       ` Ryan Mallon
     [not found]       ` <4EE830D5.5070305-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2011-12-17  0:57         ` Turquette, Mike
2011-12-17  0:57           ` Turquette, Mike
2011-12-17  0:57           ` Turquette, Mike
2011-12-14  3:53   ` [PATCH v4 6/6] clk: export the clk tree topology to debugfs Mike Turquette
2011-12-14  3:53     ` Mike Turquette
2011-12-14  3:53     ` Mike Turquette
2011-12-14  4:02 ` [PATCH v4 0/6] common clk framework Turquette, Mike
2011-12-14  4:02   ` Turquette, Mike
2011-12-14  4:02   ` Turquette, Mike

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F11021A.8070407@codeaurora.org \
    --to=skannan@codeaurora.org \
    --cc=amit.kucheria@linaro.org \
    --cc=andrew@lunn.ch \
    --cc=arnd.bergmann@linaro.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=ccross@google.com \
    --cc=dsaxena@linaro.org \
    --cc=eric.miao@linaro.org \
    --cc=grant.likely@secretlab.ca \
    --cc=jeremy.kerr@canonical.com \
    --cc=linaro-dev@lists.linaro.org \
    --cc=linus.walleij@stericsson.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=magnus.damm@gmail.com \
    --cc=mturquette@ti.com \
    --cc=patches@linaro.org \
    --cc=paul@pwsan.com \
    --cc=richard.zhao@linaro.org \
    --cc=sboyd@quicinc.com \
    --cc=shawn.guo@freescale.com \
    --cc=skannan@quicinc.com \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.