From: "Marek Behún" <kabel@kernel.org>
To: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: Gregory CLEMENT <gregory.clement@bootlin.com>,
Arnd Bergmann <arnd@arndb.de>,
soc@kernel.org, Hans de Goede <hdegoede@redhat.com>,
Matti Vaittinen <mazziesaccount@gmail.com>,
Dan Carpenter <dan.carpenter@linaro.org>,
Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
arm@kernel.org
Subject: Re: [PATCH v6 08/11] devm-helpers: Add resource managed version of debugfs directory create function
Date: Tue, 23 Apr 2024 18:43:46 +0200 [thread overview]
Message-ID: <20240423184346.37eb0915@thinkpad> (raw)
In-Reply-To: <Zifi0Iw8iVNvhptE@smile.fi.intel.com>
On Tue, 23 Apr 2024 19:33:20 +0300
Andy Shevchenko <andriy.shevchenko@intel.com> wrote:
> On Tue, Apr 23, 2024 at 06:20:14PM +0200, Marek Behún wrote:
> > On Tue, 23 Apr 2024 19:02:21 +0300
> > Andy Shevchenko <andriy.shevchenko@intel.com> wrote:
> > > On Thu, Apr 18, 2024 at 02:11:13PM +0200, Marek Behún wrote:
>
> ...
>
> > > > +static inline struct dentry *
> > > > +devm_debugfs_create_dir(struct device *dev, const char *name,
> > > > + struct dentry *parent)
> > > > +{
> > > > + struct dentry *dentry;
> > > > + int err;
> > >
> > > > + dentry = debugfs_create_dir(name, parent);
> > > > + if (IS_ERR(dentry))
> > > > + return dentry;
> > >
> > > Why do we care?
> > >
> > > > + err = devm_add_action_or_reset(dev, devm_debugfs_dir_recursive_drop,
> > > > + dentry);
> > > > + if (err < 0)
> > > > + return ERR_PTR(err);
> > > > +
> > > > + return dentry;
> > > > +}
> > >
> > > static inline struct dentry *
> > > devm_debugfs_create_dir(struct device *dev, const char *name, struct dentry *parent)
> > > {
> > > struct dentry *dentry;
> > > int err;
> > >
> > > dentry = debugfs_create_dir(name, parent);
> > >
> > > err = devm_add_action_or_reset(dev, devm_debugfs_dir_recursive_drop, dentry);
> > > if (err)
> > > return ERR_PTR(err);
> >
> > But if the dir creation fails, there is no need to allocate devm
> > destructor...
>
> Yes, but why do we care about that?
> debugfs is designed the way that we should ignore errors from it.
>
> This discussion let me think, that probably the best solution is to add a field
> to struct device_driver to handle this.
>
> debugfs will appear only when device is completely instantiated, removed before
> anything, and a lot of other benefits (see the story behind dev_groups as a
> reference).
>
Okay, this seems way beyond the scope of what I am trying to do here.
Since Matti is also not entirely content with these additions to the
devm-helpers.h header and you suggested to use gpiod_to_irq(), I shall
drop these changes from the next version and just use
devm_add_action_or_reset() in the driver directly.
Marek
next prev parent reply other threads:[~2024-04-23 16:43 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-18 12:11 [PATCH v6 00/11] Turris Omnia MCU driver Marek Behún
2024-04-18 12:11 ` [PATCH v6 01/11] dt-bindings: arm: add cznic,turris-omnia-mcu binding Marek Behún
2024-04-18 15:43 ` Conor Dooley
2024-04-19 8:23 ` Marek Behún
2024-04-19 11:14 ` Marek Behún
2024-04-19 13:52 ` Conor Dooley
2024-04-18 12:11 ` [PATCH v6 02/11] platform: cznic: Add preliminary support for Turris Omnia MCU Marek Behún
2024-04-18 12:11 ` [PATCH v6 03/11] platform: cznic: turris-omnia-mcu: Add support for MCU connected GPIOs Marek Behún
2024-04-18 12:11 ` [PATCH v6 04/11] platform: cznic: turris-omnia-mcu: Add support for poweroff and wakeup Marek Behún
2024-04-18 12:11 ` [PATCH v6 05/11] platform: cznic: turris-omnia-mcu: Add support for MCU watchdog Marek Behún
2024-04-18 13:26 ` Guenter Roeck
2024-04-18 14:15 ` Marek Behún
2024-04-18 12:11 ` [PATCH v6 06/11] devm-helpers: Add resource managed version of irq_create_mapping() Marek Behún
2024-04-23 12:32 ` Matti Vaittinen
2024-04-23 12:46 ` Andy Shevchenko
2024-04-23 14:21 ` Marek Behún
2024-04-23 15:14 ` Marek Behún
2024-04-23 15:56 ` Andy Shevchenko
2024-04-18 12:11 ` [PATCH v6 07/11] platform: cznic: turris-omnia-mcu: Add support for MCU provided TRNG Marek Behún
2024-04-23 15:58 ` Andy Shevchenko
2024-04-23 16:32 ` Marek Behún
2024-04-23 16:43 ` Andy Shevchenko
2024-04-23 16:57 ` Marek Behún
2024-04-23 17:25 ` Andy Shevchenko
2024-04-24 16:55 ` Marek Behún
2024-04-18 12:11 ` [PATCH v6 08/11] devm-helpers: Add resource managed version of debugfs directory create function Marek Behún
2024-04-23 12:33 ` Matti Vaittinen
2024-04-23 16:02 ` Andy Shevchenko
2024-04-23 16:20 ` Marek Behún
2024-04-23 16:33 ` Andy Shevchenko
2024-04-23 16:43 ` Marek Behún [this message]
2024-04-23 16:21 ` Dan Carpenter
2024-04-18 12:11 ` [PATCH v6 09/11] platform: cznic: turris-omnia-mcu: Add support for digital message signing via debugfs Marek Behún
2024-04-18 12:11 ` [PATCH v6 10/11] ARM: dts: turris-omnia: Add MCU system-controller node Marek Behún
2024-04-18 12:11 ` [PATCH v6 11/11] ARM: dts: turris-omnia: Add GPIO key node for front button Marek Behún
2024-04-23 16:05 ` [PATCH v6 00/11] Turris Omnia MCU driver 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=20240423184346.37eb0915@thinkpad \
--to=kabel@kernel.org \
--cc=andriy.shevchenko@intel.com \
--cc=arm@kernel.org \
--cc=arnd@arndb.de \
--cc=christophe.jaillet@wanadoo.fr \
--cc=dan.carpenter@linaro.org \
--cc=gregory.clement@bootlin.com \
--cc=hdegoede@redhat.com \
--cc=mazziesaccount@gmail.com \
--cc=soc@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 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).