[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <65d7918b358a5_1ee3129432@dwillia2-mobl3.amr.corp.intel.com.notmuch>
Date: Thu, 22 Feb 2024 10:25:15 -0800
From: Dan Williams <dan.j.williams@...el.com>
To: Dan Williams <dan.j.williams@...el.com>, Dave Jiang
<dave.jiang@...el.com>, Marek Behún <kabel@...nel.org>,
<linux-kernel@...r.kernel.org>, Hans de Goede <hdegoede@...hat.com>, "Matti
Vaittinen" <mazziesaccount@...il.com>
CC: Horia Geantă <horia.geanta@....com>, Pankaj Gupta
<pankaj.gupta@....com>, Gaurav Jain <gaurav.jain@....com>, Herbert Xu
<herbert@...dor.apana.org.au>, "David S. Miller" <davem@...emloft.net>,
Davidlohr Bueso <dave@...olabs.net>, Jonathan Cameron
<jonathan.cameron@...wei.com>, Alison Schofield <alison.schofield@...el.com>,
Vishal Verma <vishal.l.verma@...el.com>, Ira Weiny <ira.weiny@...el.com>, Dan
Williams <dan.j.williams@...el.com>, Bamvor Jian Zhang <bamv2005@...il.com>,
Linus Walleij <linus.walleij@...aro.org>, "Bartosz Golaszewski"
<brgl@...ev.pl>, Douglas Anderson <dianders@...omium.org>, Andrzej Hajda
<andrzej.hajda@...el.com>, Neil Armstrong <neil.armstrong@...aro.org>, Robert
Foss <rfoss@...nel.org>, "Laurent Pinchart"
<Laurent.pinchart@...asonboard.com>, Jonas Karlman <jonas@...boo.se>, Jernej
Skrabec <jernej.skrabec@...il.com>, "Maarten Lankhorst"
<maarten.lankhorst@...ux.intel.com>, Maxime Ripard <mripard@...nel.org>,
Thomas Zimmermann <tzimmermann@...e.de>, David Airlie <airlied@...il.com>,
Daniel Vetter <daniel@...ll.ch>, James Seo <james@...iv.tech>, Jean Delvare
<jdelvare@...e.com>, Guenter Roeck <linux@...ck-us.net>,
<linux-crypto@...r.kernel.org>, <linux-cxl@...r.kernel.org>,
<linux-gpio@...r.kernel.org>, <dri-devel@...ts.freedesktop.org>,
<linux-hwmon@...r.kernel.org>
Subject: Re: [PATCH 2/2] devm-helpers: Add resource managed version of
debugfs directory create function
Dan Williams wrote:
> Dave Jiang wrote:
> >
> >
> > On 2/22/24 7:58 AM, Marek Behún wrote:
> > > A few drivers register a devm action to remove a debugfs directory,
> > > implementing a one-liner function that calls debufs_remove_recursive().
> > > Help drivers avoid this repeated implementations by adding managed
> > > version of debugfs directory create function.
> > >
> > > Use the new function devm_debugfs_create_dir() in the following
> > > drivers:
> > > drivers/crypto/caam/ctrl.c
> > > drivers/gpu/drm/bridge/ti-sn65dsi86.c
> > > drivers/hwmon/hp-wmi-sensors.c
> > > drivers/hwmon/mr75203.c
> > > drivers/hwmon/pmbus/pmbus_core.c
> > >
> > > Also use the action function devm_debugfs_dir_recursive_drop() in
> > > drivers
> > > drivers/cxl/mem.c
> > > drivers/gpio/gpio-mockup.c
> > >
> > > Signed-off-by: Marek Behún <kabel@...nel.org>
> > > ---
> > > drivers/crypto/caam/ctrl.c | 16 +++------
> > > drivers/cxl/mem.c | 9 ++---
> > > drivers/gpio/gpio-mockup.c | 11 ++----
> > > drivers/gpu/drm/bridge/ti-sn65dsi86.c | 13 ++------
> > > drivers/hwmon/hp-wmi-sensors.c | 15 ++-------
> > > drivers/hwmon/mr75203.c | 15 +++------
> > > drivers/hwmon/pmbus/pmbus_core.c | 16 +++------
> > > include/linux/devm-helpers.h | 48 +++++++++++++++++++++++++++
> > > 8 files changed, 72 insertions(+), 71 deletions(-)
> > >
[..]
> > diff --git a/drivers/cxl/cxlmem.h b/drivers/cxl/cxlmem.h
> > index 5303d6942b88..b6f13ba87927 100644
> > --- a/drivers/cxl/cxlmem.h
> > +++ b/drivers/cxl/cxlmem.h
> > @@ -859,6 +859,5 @@ struct cxl_hdm {
> > };
> >
> > struct seq_file;
> > -struct dentry *cxl_debugfs_create_dir(const char *dir);
> > void cxl_dpa_debug(struct seq_file *file, struct cxl_dev_state *cxlds);
> > #endif /* __CXL_MEM_H__ */
> > diff --git a/drivers/cxl/mem.c b/drivers/cxl/mem.c
> > index c5c9d8e0d88d..494abe7a54c5 100644
> > --- a/drivers/cxl/mem.c
> > +++ b/drivers/cxl/mem.c
> > @@ -4,6 +4,7 @@
> > #include <linux/device.h>
> > #include <linux/module.h>
> > #include <linux/pci.h>
> > +#include <linux/devm-helpers.h>
> >
> > #include "cxlmem.h"
> > #include "cxlpci.h"
> > @@ -30,11 +31,6 @@ static void enable_suspend(void *data)
> > cxl_mem_active_dec();
> > }
> >
> > -static void remove_debugfs(void *dentry)
> > -{
> > - debugfs_remove_recursive(dentry);
> > -}
> > -
> > static int cxl_mem_dpa_show(struct seq_file *file, void *data)
> > {
> > struct device *dev = file->private;
> > @@ -128,7 +124,10 @@ static int cxl_mem_probe(struct device *dev)
> > if (work_pending(&cxlmd->detach_work))
> > return -EBUSY;
> >
> > - dentry = cxl_debugfs_create_dir(dev_name(dev));
> > + dentry = devm_debugfs_create_dir(dev, dev_name(dev), NULL);
> > + if (IS_ERR(dentry))
> > + return PTR_ERR(dentry);
> > +
>
> No that loses the "cxl" prefix.
So, to be clear, I do see the benefit of removing the
devm_add_action_or_reset() call altogether, but that work is a bit
deeper and should not be tied with all these other cleanups. So I think
from the CXL perspective, please drop these CXL changes out of this
patch. Follow up with a standalone patch, or leave it to drivers/cxl/
folks to create that deeper cleanup.
Powered by blists - more mailing lists