[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z7dPjp4t0MrhulSt@black.fi.intel.com>
Date: Thu, 20 Feb 2025 17:51:42 +0200
From: Raag Jadav <raag.jadav@...el.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Zijun Hu <quic_zijuhu@...cinc.com>,
Bartosz Golaszewski <bartosz.golaszewski@...aro.org>,
linux-kernel@...r.kernel.org, linux-gpio@...r.kernel.org,
"Rafael J. Wysocki" <rafael@...nel.org>,
Danilo Krummrich <dakr@...nel.org>,
Linus Walleij <linus.walleij@...aro.org>,
Bartosz Golaszewski <brgl@...ev.pl>
Subject: Re: [PATCH v1 3/4] devres: Add devm_remove_action_optional() helper
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
Powered by blists - more mailing lists