From: Guenter Roeck <firstname.lastname@example.org> To: Dmitry Torokhov <email@example.com> Cc: Stephen Boyd <firstname.lastname@example.org>, Russell King - ARM Linux <email@example.com>, Michael Turquette <firstname.lastname@example.org>, Viresh Kumar <email@example.com>, Andy Shevchenko <firstname.lastname@example.org>, email@example.com, lkml <firstname.lastname@example.org> Subject: Re: [PATCH v3] clk: add more managed APIs Date: Tue, 14 Feb 2017 12:31:33 -0800 [thread overview] Message-ID: <20170214203133.GA3726@roeck-us.net> (raw) In-Reply-To: <CAKdAkRSWCWrweNyDAJ4Xkc4igmRSexjKvEG57eg+3QnPc7mbRQ@mail.gmail.com> On Tue, Feb 14, 2017 at 11:55:20AM -0800, Dmitry Torokhov wrote: > On Tue, Feb 14, 2017 at 11:44 AM, Stephen Boyd <email@example.com> wrote: > > On 02/06, Dmitry Torokhov wrote: > >> On Mon, Jan 30, 2017 at 04:57:13PM -0800, Dmitry Torokhov wrote: > >> > When converting a driver to managed resources it is desirable to be able to > >> > manage all resources in the same fashion. This change allows managing clock > >> > prepared and enabled state in the same way we manage many other resources. > >> > > >> > This adds the following managed APIs: > >> > > >> > - devm_clk_prepare()/devm_clk_unprepare(); > >> > - devm_clk_prepare_enable()/devm_clk_disable_unprepare(). > >> > > >> > Reviewed-by: Guenter Roeck <firstname.lastname@example.org> > >> > Signed-off-by: Dmitry Torokhov <email@example.com> > >> > >> It would be awesome if we could get it into 4.11... > > > > I'd prefer we didn't do this. Instead, make clk_put() drop any > > prepare or enables that were done via that clk pointer. Mike > > started to do this before, but we have some code that assumes > > it can do: > > > > clk = clk_get(...) > > clk_prepare_enable(clk) > > clk_put(clk) > > > > and have the clk stay on. Those would need to be changed. > > That means we'd need to audit entire code base ;( > > > > > We would also need Russell's approval to update the clk_put() > > documentation to describe this change in behavior. > > > >  http://firstname.lastname@example.org > > > > Note that devm* APIs do not preclude from changing clk_put() behavior > down the road and it is extremely easy to go and > s/devm_clk_prepare_enable/clk_prepare_enable/ once cleanup is > automatic. > > Having devm now will help make driver code better (because right now > we either need to add wrappers so devm_add_action_or_reset() can be > used, or continue mixing devm* and goto cleanups, which are often > wrong). > Absolutely agree. The combination of clk_prepare_enable() in probe and clk_disable_unprepare() in remove is used all over the place. Sure, we _can_ use devm_add_action_or_reset() for all those cases, and I do have a coccinelle script doing just that. While I'll have to accept going forward with that approach if needed, I have to admit that I completely fail to miss the point why that would be a good idea. Thanks, Guenter
next prev parent reply other threads:[~2017-02-14 20:31 UTC|newest] Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top 2017-01-28 18:40 [PATCH] " 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 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 [this message] 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=20170214203133.GA3726@roeck-us.net \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --subject='Re: [PATCH v3] 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).