Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1569224
| From | Guenter Roeck <linux@roeck-us.net> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] clk: add more managed APIs |
| Date | 2017-01-29 17:10 +0100 |
| Message-ID | <t50dc-JO-29@gated-at.bofh.it> (permalink) |
| References | <t4Geu-52W-13@gated-at.bofh.it> <t4GHw-5sv-9@gated-at.bofh.it> <t4Hkd-5Gv-3@gated-at.bofh.it> <t4J2G-6LR-11@gated-at.bofh.it> <t4KUN-7Wl-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On 01/28/2017 03:39 PM, Russell King - ARM Linux wrote: > 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. > I tend to agree, after looking into its existing use. Do we have agreement on the other two ? I would like to see those in the next release so we can start using them. Thanks, Guenter
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] clk: add more managed APIs Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-01-28 19:50 +0100
Re: [PATCH] clk: add more managed APIs Russell King - ARM Linux <linux@armlinux.org.uk> - 2017-01-28 20:20 +0100
Re: [PATCH] clk: add more managed APIs Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-01-28 21:00 +0100
Re: [PATCH] clk: add more managed APIs Guenter Roeck <linux@roeck-us.net> - 2017-01-28 22:50 +0100
Re: [PATCH] clk: add more managed APIs Russell King - ARM Linux <linux@armlinux.org.uk> - 2017-01-29 00:50 +0100
Re: [PATCH] clk: add more managed APIs Guenter Roeck <linux@roeck-us.net> - 2017-01-29 17:10 +0100
[PATCH v2] clk: add more managed APIs Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-01-29 19:10 +0100
Re: [PATCH v2] clk: add more managed APIs Guenter Roeck <linux@roeck-us.net> - 2017-01-29 20:20 +0100
csiph-web