Re: [PATCH V4 RESEND net-next 1/7] net: hibmcge: Add debugfs supported in this module

From: Greg Kroah-Hartman
Date: Fri Dec 06 2024 - 01:23:15 EST


On Thu, Dec 05, 2024 at 05:50:06PM -0800, Jakub Kicinski wrote:
> On Tue, 3 Dec 2024 23:01:25 +0800 Jijie Shao wrote:
> > +static void hbg_debugfs_uninit(void *data)
> > +{
> > + debugfs_remove_recursive((struct dentry *)data);
> > +}
> > +
> > +void hbg_debugfs_init(struct hbg_priv *priv)
> > +{
> > + const char *name = pci_name(priv->pdev);
> > + struct device *dev = &priv->pdev->dev;
> > + struct dentry *root;
> > + u32 i;
> > +
> > + root = debugfs_create_dir(name, hbg_dbgfs_root);
> > +
> > + for (i = 0; i < ARRAY_SIZE(hbg_dbg_infos); i++)
> > + debugfs_create_devm_seqfile(dev, hbg_dbg_infos[i].name,
> > + root, hbg_dbg_infos[i].read);
> > +
> > + /* Ignore the failure because debugfs is not a key feature. */
> > + devm_add_action_or_reset(dev, hbg_debugfs_uninit, root);
>
> There is nothing specific to this driver in the devm action,
> also no need to create all files as devm if you remove recursive..
>
> Hi Greg, are you okay with adding debugfs_create_devm_dir() ?

Seems like overkill, but if you can find multiple users of it, sure,
that would be fine to add.

thanks,

greg k-h