linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexandru Ardelean <aardelean@deviqon.com>
To: Mark Brown <broonie@kernel.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	lgirdwood@gmail.com, Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Guenter Roeck <linux@roeck-us.net>
Subject: Re: [RFC PATCH] regulator: devres: disable regulator on release if refcount is 1
Date: Tue, 29 Jun 2021 10:55:49 +0300	[thread overview]
Message-ID: <CAASAkoY=pgTE6nVKeoSDVsSEBU2zgckRuE-m4G+7L9-_Q2yUnw@mail.gmail.com> (raw)
In-Reply-To: <20210628145307.GC4492@sirena.org.uk>

On Mon, 28 Jun 2021 at 17:53, Mark Brown <broonie@kernel.org> wrote:
>
> On Fri, Jun 25, 2021 at 03:53:07PM +0300, Alexandru Ardelean wrote:
>
> > This means that the last 'regulator_disable()' (on driver remove) becomes
> > optional.
> > If there are any unbalanced regulator_enable()/regulator_disable() calls,
> > the 'enable_count' won't be touched and 'regulator_put()' will print a
> > warning.
>
> This doesn't seem like it's going to make reviewing and debugging
> reference counting issues any easier, it seems even more of a concern
> than a devm version TBH.  It's also not clear why if we were doing this
> we'd restrict it to a single reference.

Yeah, it doesn't make much difference if the refcount is 1 or higher.
For any refcount higher than 1, it's a serious unbalance of reg enable
+ disable.
And I agree that this may complicate reviews, as this would be one
extra subtlety [in the regulator framework] to account for.

Will send an RFC v2 with the short-hand.
I'm not trying to force anything with this, but looking at all the
repetitiveness of the devm_add_action_or_reset() hook to disable
simple regulators, I thought I'd [also] propose a variant or another.

  reply	other threads:[~2021-06-29  7:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-25 12:53 Alexandru Ardelean
2021-06-28 14:53 ` Mark Brown
2021-06-29  7:55   ` Alexandru Ardelean [this message]
2021-06-30 12:49 ` [RFC PATCH v2] regulator: devres: add devm_regulator_enable() as short-hand Alexandru Ardelean

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='CAASAkoY=pgTE6nVKeoSDVsSEBU2zgckRuE-m4G+7L9-_Q2yUnw@mail.gmail.com' \
    --to=aardelean@deviqon.com \
    --cc=broonie@kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --subject='Re: [RFC PATCH] regulator: devres: disable regulator on release if refcount is 1' \
    /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).