From: Sylwester Nawrocki <s.nawrocki@samsung.com>
To: Russell King - ARM Linux <linux@arm.linux.org.uk>
Cc: linux-arm-kernel@lists.infradead.org, mturquette@linaro.org,
jiada_wang@mentor.com, robherring2@gmail.com,
grant.likely@linaro.org, broonie@kernel.org, vapier@gentoo.org,
ralf@linux-mips.org, kyungmin.park@samsung.com,
shawn.guo@linaro.org, sebastian.hesselbarth@gmail.com,
LW@KARO-electronics.de, t.figa@samsung.com,
g.liakhovetski@gmx.de, laurent.pinchart@ideasonboard.com,
linux-kernel@vger.kernel.org,
uclinux-dist-devel@blackfin.uclinux.org,
linux-mips@linux-mips.org, linux-sh@vger.kernel.org
Subject: Re: [PATCH v2 1/4] clk: add common __clk_get(), __clk_put() implementations
Date: Fri, 23 Aug 2013 16:41:29 +0200 [thread overview]
Message-ID: <52177499.4020703@samsung.com> (raw)
In-Reply-To: <20130820203034.GC17845@n2100.arm.linux.org.uk>
On 08/20/2013 10:30 PM, Russell King - ARM Linux wrote:
> On Tue, Aug 20, 2013 at 07:34:20PM +0200, Sylwester Nawrocki wrote:
>> +int __clk_get(struct clk *clk)
>> +{
>> + if (WARN_ON((!clk)))
>> + return 0;
>
> This changes the behaviour of clk_get()
My bad, will remove that.
>> +
>> + if (!try_module_get(clk->owner))
>> + return 0;
>
> If you want this to be safe against NULL pointers, just do this:
>
> if (clk && !try_module_get(clk->owner))
> return 0;
Ok, that should work too.
>> +
>> + return 1;
>> +}
>> +EXPORT_SYMBOL(__clk_get);
>> +
>> +void __clk_put(struct clk *clk)
>> +{
>> + if (!clk || IS_ERR(clk))
>> + return;
>> +
>> + module_put(clk->owner);
>
> Calling clk_put() with an error-pointer should be a Bad Thing and something
> that shouldn't be encouraged, so trapping it is probably unwise. So, just
> do here:
>
> if (clk)
> module_put(clk->owner);
>
> If we do have some callers of this with ERR pointers, then we could add:
>
> if (WARN_ON_ONCE(IS_ERR(clk)))
> return;
>
> and remove it after a full kernel cycle or so.
I wouldn't be surprised to see some callers with ERR pointers, since
clk_put() has been mostly a no op. I'm inclined to leave such a check
temporarily, let's see if it catches any issues.
Thanks for review of the other patches.
WARNING: multiple messages have this Message-ID (diff)
From: Sylwester Nawrocki <s.nawrocki@samsung.com>
To: linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 1/4] clk: add common __clk_get(), __clk_put() implementations
Date: Fri, 23 Aug 2013 14:41:29 +0000 [thread overview]
Message-ID: <52177499.4020703@samsung.com> (raw)
In-Reply-To: <20130820203034.GC17845@n2100.arm.linux.org.uk>
On 08/20/2013 10:30 PM, Russell King - ARM Linux wrote:
> On Tue, Aug 20, 2013 at 07:34:20PM +0200, Sylwester Nawrocki wrote:
>> +int __clk_get(struct clk *clk)
>> +{
>> + if (WARN_ON((!clk)))
>> + return 0;
>
> This changes the behaviour of clk_get()
My bad, will remove that.
>> +
>> + if (!try_module_get(clk->owner))
>> + return 0;
>
> If you want this to be safe against NULL pointers, just do this:
>
> if (clk && !try_module_get(clk->owner))
> return 0;
Ok, that should work too.
>> +
>> + return 1;
>> +}
>> +EXPORT_SYMBOL(__clk_get);
>> +
>> +void __clk_put(struct clk *clk)
>> +{
>> + if (!clk || IS_ERR(clk))
>> + return;
>> +
>> + module_put(clk->owner);
>
> Calling clk_put() with an error-pointer should be a Bad Thing and something
> that shouldn't be encouraged, so trapping it is probably unwise. So, just
> do here:
>
> if (clk)
> module_put(clk->owner);
>
> If we do have some callers of this with ERR pointers, then we could add:
>
> if (WARN_ON_ONCE(IS_ERR(clk)))
> return;
>
> and remove it after a full kernel cycle or so.
I wouldn't be surprised to see some callers with ERR pointers, since
clk_put() has been mostly a no op. I'm inclined to leave such a check
temporarily, let's see if it catches any issues.
Thanks for review of the other patches.
WARNING: multiple messages have this Message-ID (diff)
From: s.nawrocki@samsung.com (Sylwester Nawrocki)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 1/4] clk: add common __clk_get(), __clk_put() implementations
Date: Fri, 23 Aug 2013 16:41:29 +0200 [thread overview]
Message-ID: <52177499.4020703@samsung.com> (raw)
In-Reply-To: <20130820203034.GC17845@n2100.arm.linux.org.uk>
On 08/20/2013 10:30 PM, Russell King - ARM Linux wrote:
> On Tue, Aug 20, 2013 at 07:34:20PM +0200, Sylwester Nawrocki wrote:
>> +int __clk_get(struct clk *clk)
>> +{
>> + if (WARN_ON((!clk)))
>> + return 0;
>
> This changes the behaviour of clk_get()
My bad, will remove that.
>> +
>> + if (!try_module_get(clk->owner))
>> + return 0;
>
> If you want this to be safe against NULL pointers, just do this:
>
> if (clk && !try_module_get(clk->owner))
> return 0;
Ok, that should work too.
>> +
>> + return 1;
>> +}
>> +EXPORT_SYMBOL(__clk_get);
>> +
>> +void __clk_put(struct clk *clk)
>> +{
>> + if (!clk || IS_ERR(clk))
>> + return;
>> +
>> + module_put(clk->owner);
>
> Calling clk_put() with an error-pointer should be a Bad Thing and something
> that shouldn't be encouraged, so trapping it is probably unwise. So, just
> do here:
>
> if (clk)
> module_put(clk->owner);
>
> If we do have some callers of this with ERR pointers, then we could add:
>
> if (WARN_ON_ONCE(IS_ERR(clk)))
> return;
>
> and remove it after a full kernel cycle or so.
I wouldn't be surprised to see some callers with ERR pointers, since
clk_put() has been mostly a no op. I'm inclined to leave such a check
temporarily, let's see if it catches any issues.
Thanks for review of the other patches.
WARNING: multiple messages have this Message-ID (diff)
From: Sylwester Nawrocki <s.nawrocki@samsung.com>
To: Russell King - ARM Linux <linux@arm.linux.org.uk>
Cc: linux-arm-kernel@lists.infradead.org, mturquette@linaro.org,
jiada_wang@mentor.com, robherring2@gmail.com,
grant.likely@linaro.org, broonie@kernel.org, vapier@gentoo.org,
ralf@linux-mips.org, kyungmin.park@samsung.com,
shawn.guo@linaro.org, sebastian.hesselbarth@gmail.com,
LW@KARO-electronics.de, t.figa@samsung.com,
g.liakhovetski@gmx.de, laurent.pinchart@ideasonboard.com,
linux-kernel@vger.kernel.org,
uclinux-dist-devel@blackfin.uclinux.org,
linux-mips@linux-mips.org, linux-sh@vger.kernel.org
Subject: Re: [PATCH v2 1/4] clk: add common __clk_get(), __clk_put() implementations
Date: Fri, 23 Aug 2013 16:41:29 +0200 [thread overview]
Message-ID: <52177499.4020703@samsung.com> (raw)
In-Reply-To: <20130820203034.GC17845@n2100.arm.linux.org.uk>
On 08/20/2013 10:30 PM, Russell King - ARM Linux wrote:
> On Tue, Aug 20, 2013 at 07:34:20PM +0200, Sylwester Nawrocki wrote:
>> +int __clk_get(struct clk *clk)
>> +{
>> + if (WARN_ON((!clk)))
>> + return 0;
>
> This changes the behaviour of clk_get()
My bad, will remove that.
>> +
>> + if (!try_module_get(clk->owner))
>> + return 0;
>
> If you want this to be safe against NULL pointers, just do this:
>
> if (clk && !try_module_get(clk->owner))
> return 0;
Ok, that should work too.
>> +
>> + return 1;
>> +}
>> +EXPORT_SYMBOL(__clk_get);
>> +
>> +void __clk_put(struct clk *clk)
>> +{
>> + if (!clk || IS_ERR(clk))
>> + return;
>> +
>> + module_put(clk->owner);
>
> Calling clk_put() with an error-pointer should be a Bad Thing and something
> that shouldn't be encouraged, so trapping it is probably unwise. So, just
> do here:
>
> if (clk)
> module_put(clk->owner);
>
> If we do have some callers of this with ERR pointers, then we could add:
>
> if (WARN_ON_ONCE(IS_ERR(clk)))
> return;
>
> and remove it after a full kernel cycle or so.
I wouldn't be surprised to see some callers with ERR pointers, since
clk_put() has been mostly a no op. I'm inclined to leave such a check
temporarily, let's see if it catches any issues.
Thanks for review of the other patches.
next prev parent reply other threads:[~2013-08-23 14:41 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-20 17:34 [PATCH v2 0/4] clk: clock deregistration support Sylwester Nawrocki
2013-08-20 17:34 ` Sylwester Nawrocki
2013-08-20 17:34 ` Sylwester Nawrocki
2013-08-20 17:34 ` [PATCH v2 1/4] clk: add common __clk_get(), __clk_put() implementations Sylwester Nawrocki
2013-08-20 17:34 ` Sylwester Nawrocki
2013-08-20 17:34 ` Sylwester Nawrocki
2013-08-20 20:30 ` Russell King - ARM Linux
2013-08-20 20:30 ` Russell King - ARM Linux
2013-08-20 20:30 ` Russell King - ARM Linux
2013-08-23 14:41 ` Sylwester Nawrocki [this message]
2013-08-23 14:41 ` Sylwester Nawrocki
2013-08-23 14:41 ` Sylwester Nawrocki
2013-08-23 14:41 ` Sylwester Nawrocki
2013-08-20 17:34 ` [PATCH v2 2/4] clk: implement clk_unregister Sylwester Nawrocki
2013-08-20 17:34 ` Sylwester Nawrocki
2013-08-20 17:34 ` Sylwester Nawrocki
2013-08-23 21:58 ` Mike Turquette
2013-08-23 21:58 ` Mike Turquette
2013-08-23 21:58 ` Mike Turquette
2013-08-23 21:58 ` Mike Turquette
2013-08-23 23:00 ` Sylwester Nawrocki
2013-08-23 23:00 ` Sylwester Nawrocki
2013-08-23 23:00 ` Sylwester Nawrocki
2013-08-20 17:34 ` [PATCH v2 3/4] clk: Provide not locked variant of of_clk_get_from_provider() Sylwester Nawrocki
2013-08-20 17:34 ` Sylwester Nawrocki
2013-08-20 17:34 ` Sylwester Nawrocki
2013-08-20 21:51 ` Russell King - ARM Linux
2013-08-20 21:51 ` Russell King - ARM Linux
2013-08-20 21:51 ` Russell King - ARM Linux
2013-08-20 17:34 ` [PATCH v2 4/4] clkdev: Fix race condition in clock lookup from device tree Sylwester Nawrocki
2013-08-20 17:34 ` Sylwester Nawrocki
2013-08-20 17:34 ` Sylwester Nawrocki
2013-08-20 21:52 ` Russell King - ARM Linux
2013-08-20 21:52 ` Russell King - ARM Linux
2013-08-20 21:52 ` Russell King - ARM Linux
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=52177499.4020703@samsung.com \
--to=s.nawrocki@samsung.com \
--cc=LW@KARO-electronics.de \
--cc=broonie@kernel.org \
--cc=g.liakhovetski@gmx.de \
--cc=grant.likely@linaro.org \
--cc=jiada_wang@mentor.com \
--cc=kyungmin.park@samsung.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=linux-sh@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=mturquette@linaro.org \
--cc=ralf@linux-mips.org \
--cc=robherring2@gmail.com \
--cc=sebastian.hesselbarth@gmail.com \
--cc=shawn.guo@linaro.org \
--cc=t.figa@samsung.com \
--cc=uclinux-dist-devel@blackfin.uclinux.org \
--cc=vapier@gentoo.org \
/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.