public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: "Chunfeng Yun (云春峰)" <Chunfeng.Yun@mediatek.com>
To: "vkoul@kernel.org" <vkoul@kernel.org>
Cc: "linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
	"linux-mediatek@lists.infradead.org"
	<linux-mediatek@lists.infradead.org>,
	"linux-phy@lists.infradead.org" <linux-phy@lists.infradead.org>,
	"angelogioacchino.delregno@collabora.com"
	<angelogioacchino.delregno@collabora.com>,
	"Eddie Hung (洪正鑫)" <Eddie.Hung@mediatek.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v9 1/2] phy: core: add debugfs files
Date: Fri, 7 Apr 2023 05:30:56 +0000	[thread overview]
Message-ID: <81084a539ef4de55b9cd8bba9cfe41e4d73740ec.camel@mediatek.com> (raw)
In-Reply-To: <ZCrrhZzj98WdWkd3@matsya>

On Mon, 2023-04-03 at 20:36 +0530, Vinod Koul wrote:
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
> 
> 
> On 16-03-23, 15:14, Chunfeng Yun wrote:
> > Add a debugfs root for phy class, and create a debugfs directory
> > under
> > the root when create phy, then phy drivers can add debugfs files.
> > 
> > Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> > ---
> > v9: create a 'phy' debugfs root, add a debugfs entry in struct phy
> > suggested by Vinod;
> > 
> > No v8 sent out;
> > 
> > v2~v7: no changes
> > ---
> >  drivers/phy/phy-core.c  | 14 ++++++++++++++
> >  include/linux/phy/phy.h |  2 ++
> >  2 files changed, 16 insertions(+)
> > 
> > diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
> > index 9951efc03eaa..05715352881e 100644
> > --- a/drivers/phy/phy-core.c
> > +++ b/drivers/phy/phy-core.c
> > @@ -11,6 +11,7 @@
> >  #include <linux/export.h>
> >  #include <linux/module.h>
> >  #include <linux/err.h>
> > +#include <linux/debugfs.h>
> >  #include <linux/device.h>
> >  #include <linux/slab.h>
> >  #include <linux/of.h>
> > @@ -20,6 +21,7 @@
> >  #include <linux/regulator/consumer.h>
> > 
> >  static struct class *phy_class;
> > +static struct dentry *phy_debugfs_root;
> >  static DEFINE_MUTEX(phy_provider_mutex);
> >  static LIST_HEAD(phy_provider_list);
> >  static LIST_HEAD(phys);
> > @@ -996,6 +998,8 @@ struct phy *phy_create(struct device *dev,
> > struct device_node *node,
> >               pm_runtime_no_callbacks(&phy->dev);
> >       }
> > 
> > +     phy->debugfs = debugfs_create_dir(dev_name(&phy->dev),
> > phy_debugfs_root);
> > +
> >       return phy;
> > 
> >  put_dev:
> > @@ -1226,6 +1230,7 @@ static void phy_release(struct device *dev)
> > 
> >       phy = to_phy(dev);
> >       dev_vdbg(dev, "releasing '%s'\n", dev_name(dev));
> > +     debugfs_remove_recursive(phy->debugfs);
> >       regulator_put(phy->pwr);
> >       ida_simple_remove(&phy_ida, phy->id);
> >       kfree(phy);
> > @@ -1242,6 +1247,15 @@ static int __init phy_core_init(void)
> > 
> >       phy_class->dev_release = phy_release;
> > 
> > +     phy_debugfs_root = debugfs_create_dir("phy", NULL);
> > +
> >       return 0;
> >  }
> >  device_initcall(phy_core_init);
> > +
> > +static void __exit phy_core_exit(void)
> > +{
> > +     debugfs_remove_recursive(phy_debugfs_root);
> 
> This should be moved to phy_release() we want the debugfs to be
> cleaned
> first
phy_release() will remove its debugfs files, here it is the debugfs
root of phy core.
> 
> > +     class_destroy(phy_class);
> 
> hmmm we are missing this already, that might be an issue!
> 
> > +}
> > +module_exit(phy_core_exit);
> > diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h
> > index 3a570bc59fc7..f6d607ef0e80 100644
> > --- a/include/linux/phy/phy.h
> > +++ b/include/linux/phy/phy.h
> > @@ -148,6 +148,7 @@ struct phy_attrs {
> >   * @power_count: used to protect when the PHY is used by multiple
> > consumers
> >   * @attrs: used to specify PHY specific attributes
> >   * @pwr: power regulator associated with the phy
> > + * @debugfs: debugfs directory
> >   */
> >  struct phy {
> >       struct device           dev;
> > @@ -158,6 +159,7 @@ struct phy {
> >       int                     power_count;
> >       struct phy_attrs        attrs;
> >       struct regulator        *pwr;
> > +     struct dentry           *debugfs;
> >  };
> > 
> >  /**
> > --
> > 2.18.0
> 
> --
> ~Vinod
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2023-04-07  5:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-16  7:14 [PATCH v9 1/2] phy: core: add debugfs files Chunfeng Yun
2023-03-16  7:14 ` [PATCH v9 2/2] phy: mediatek: tphy: " Chunfeng Yun
2023-04-03 15:06 ` [PATCH v9 1/2] phy: core: " Vinod Koul
2023-04-07  5:30   ` Chunfeng Yun (云春峰) [this message]
2023-04-07  5:33   ` Chunfeng Yun (云春峰)

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=81084a539ef4de55b9cd8bba9cfe41e4d73740ec.camel@mediatek.com \
    --to=chunfeng.yun@mediatek.com \
    --cc=Eddie.Hung@mediatek.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=vkoul@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