linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Russell King - ARM Linux <linux@armlinux.org.uk>
To: Guenter Roeck <linux@roeck-us.net>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@codeaurora.org>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	Andy Shevchenko <andy.shevchenko@gmail.com>,
	linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] clk: add more managed APIs
Date: Sat, 28 Jan 2017 23:39:11 +0000	[thread overview]
Message-ID: <20170128233911.GO27312@n2100.armlinux.org.uk> (raw)
In-Reply-To: <64ed0890-14f6-42ff-66b1-60f7b3d7d02f@roeck-us.net>

On Sat, Jan 28, 2017 at 01:44:35PM -0800, Guenter Roeck wrote:
> On 01/28/2017 11:22 AM, Dmitry Torokhov wrote:
> >Guenter, I know you are a coccinelle wizard, can you cook a script that
> >can find current users of clk_enable() in probe paths? Then we can make
> >informed decision on devm_clk_enable.
> >
> 
> Questionable use:
> 	drivers/input/keyboard/st-keyscan.c

clk_enable() without preceding clk_prepare() - buggy.

> 
> clk_enable() in probe, clk_disable() in remove:
> 	drivers/i2c/busses/i2c-tegra.c

Could be converted to use clk_prepare_enable() or clk_prepare()
depending on i2c_dev->is_multimaster_mode in the initialisation
path (and their devm_* equivalents.)

> 	drivers/media/platform/exynos4-is/fimc-core.c
> 	drivers/media/platform/exynos4-is/mipi-csis.c

Looks like it does a sequence of:

	devm_clk_get()
	clk_prepare()
	clk_set_rate()
	clk_enable()

which seems a little wrong - clk_set_rate() should be before
clk_prepare() if you care about not having the clock output.  Remember
that clk_prepare() _may_ result in the clock output being enabled.  So
these two look buggy, and when fixed could use devm_clk_prepare_enable().

> 	drivers/thermal/spear_thermal.c

clk_enable() without a preceding clk_prepare().  Buggy driver.

> 	drivers/usb/musb/am35x.c

Ditto.

> 	drivers/usb/musb/davinci.c

Ditto.

> Not that many. A quick browse suggests that clk_enable()/clk_disable()
> is more commonly used to temporarily enable the clock while needed.

So out of all those, there's probably only _one_ which is legit - the
rest are all technically buggy.

Given that, I'd say there's real reason _not_ to provide devm_clk_enable()
to persuade people to use the correct interfaces in the probe path.

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.

  reply	other threads:[~2017-01-28 23:40 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-28 18:40 Dmitry Torokhov
2017-01-28 19:03 ` Russell King - ARM Linux
2017-01-28 19:22   ` Dmitry Torokhov
2017-01-28 21:44     ` Guenter Roeck
2017-01-28 23:39       ` Russell King - ARM Linux [this message]
2017-01-29 16:00         ` Guenter Roeck
2017-01-29 18:07         ` [PATCH v2] " Dmitry Torokhov
2017-01-29 18:31           ` Guenter Roeck
2017-01-30 18:55           ` Stephen Boyd
2017-01-30 19:22             ` Guenter Roeck
2017-01-30 21:42               ` Russell King - ARM Linux
2017-01-30 21:58                 ` Dmitry Torokhov
2017-01-30 22:25                   ` Russell King - ARM Linux
2017-01-30 22:51                 ` Guenter Roeck
2017-01-31  8:43                   ` Geert Uytterhoeven
2017-01-31  0:59               ` Dmitry Torokhov
2017-01-31 17:20                 ` Guenter Roeck
2017-01-31 18:26                   ` Dmitry Torokhov
2017-01-31 19:34                     ` Guenter Roeck
2017-01-31  0:57             ` [PATCH v3] " Dmitry Torokhov
2017-02-07  3:51               ` Dmitry Torokhov
2017-02-14 19:44                 ` Stephen Boyd
2017-02-14 19:55                   ` Dmitry Torokhov
2017-02-14 20:31                     ` Guenter Roeck
2017-02-14 20:01                   ` 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=20170128233911.GO27312@n2100.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=andy.shevchenko@gmail.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=mturquette@baylibre.com \
    --cc=sboyd@codeaurora.org \
    --cc=viresh.kumar@linaro.org \
    --subject='Re: [PATCH] clk: add more managed APIs' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).