All of lore.kernel.org
 help / color / mirror / Atom feed
From: Raag Jadav <raag.jadav@intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Zijun Hu <quic_zijuhu@quicinc.com>,
	Bartosz Golaszewski <bartosz.golaszewski@linaro.org>,
	linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Danilo Krummrich <dakr@kernel.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	Bartosz Golaszewski <brgl@bgdev.pl>
Subject: Re: [PATCH v1 3/4] devres: Add devm_remove_action_optional() helper
Date: Thu, 20 Feb 2025 17:51:42 +0200	[thread overview]
Message-ID: <Z7dPjp4t0MrhulSt@black.fi.intel.com> (raw)
In-Reply-To: <Z7dM6B-SFQ5Q77zy@smile.fi.intel.com>

On Thu, Feb 20, 2025 at 05:40:24PM +0200, Andy Shevchenko wrote:
> On Thu, Feb 20, 2025 at 05:30:07PM +0200, Raag Jadav wrote:
> > On Thu, Feb 20, 2025 at 03:44:59PM +0200, Andy Shevchenko wrote:
> 
> ...
> 
> > > +/* Same as devm_remove_action(), but doesn't WARN() if action wasn't added before */
> > > +static inline
> > > +void devm_remove_action_optional(struct device *dev, void (*action)(void *), void *data)
> > > +{
> > > +	int ret;
> > > +
> > > +	ret = devm_remove_action_nowarn(dev, action, data);
> > > +	if (ret == -ENOENT)
> > > +		return;
> > > +
> > > +	WARN_ON(ret);
> > > +}
> > 
> > Trying to wrap my head around this one, can't the user simply do
> > 
> > 	if (devm_is_action_added())
> > 		devm_remove_action/_nowarn();
> 
> Hmm... Actually it sounds like a good point. I will check
> (and I like the idea of dropping this patch).

And perhaps

s/devm_is_action_added/devm_action_is_added

But whichever you think _is best_ ;)

Raag

  reply	other threads:[~2025-02-20 15:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-20 13:44 [PATCH v1 0/4] gpiolib: finish conversion to devm_*_action*() APIs Andy Shevchenko
2025-02-20 13:44 ` [PATCH v1 1/4] devres: Move devm_*_action*() APIs to devres.h Andy Shevchenko
2025-02-20 15:23   ` Raag Jadav
2025-02-20 13:44 ` [PATCH v1 2/4] devres: Add devm_is_action_added() helper Andy Shevchenko
2025-02-20 15:25   ` Raag Jadav
2025-02-20 13:44 ` [PATCH v1 3/4] devres: Add devm_remove_action_optional() helper Andy Shevchenko
2025-02-20 15:30   ` Raag Jadav
2025-02-20 15:40     ` Andy Shevchenko
2025-02-20 15:51       ` Raag Jadav [this message]
2025-02-20 16:02         ` Andy Shevchenko
2025-02-20 13:45 ` [PATCH v1 4/4] gpiolib: devres: Finish the conversion to use devm_add_action() Andy Shevchenko
2025-02-20 16:23 ` [PATCH v1 0/4] gpiolib: finish conversion to devm_*_action*() APIs Andy Shevchenko

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=Z7dPjp4t0MrhulSt@black.fi.intel.com \
    --to=raag.jadav@intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=bartosz.golaszewski@linaro.org \
    --cc=brgl@bgdev.pl \
    --cc=dakr@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=quic_zijuhu@quicinc.com \
    --cc=rafael@kernel.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.