[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJZ5v0hC7q59ZBNtLTqsZ3soszO9ect6bPpYGrYRPOKcWO_xpg@mail.gmail.com>
Date: Tue, 16 Feb 2021 15:33:19 +0100
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
"Rafael J. Wysocki" <rafael@...nel.org>
Subject: Re: [PATCH 1/2] driver core: component: remove dentry pointer in
"struct master"
On Tue, Feb 16, 2021 at 3:24 PM Greg Kroah-Hartman
<gregkh@...uxfoundation.org> wrote:
>
> There is no need to keep around a pointer to a dentry when all it is
> used for is to remove the debugfs file when tearing things down. As the
> name is simple, have debugfs look up the dentry when removing things,
> keeping the logic much simpler.
>
> Cc: "Rafael J. Wysocki" <rafael@...nel.org>
> Cc: linux-kernel@...r.kernel.org
> Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
> ---
> drivers/base/component.c | 9 +++------
> 1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/base/component.c b/drivers/base/component.c
> index dcfbe7251dc4..272ba42392f0 100644
> --- a/drivers/base/component.c
> +++ b/drivers/base/component.c
> @@ -65,7 +65,6 @@ struct master {
> const struct component_master_ops *ops;
> struct device *dev;
> struct component_match *match;
> - struct dentry *dentry;
> };
>
> struct component {
> @@ -125,15 +124,13 @@ core_initcall(component_debug_init);
>
> static void component_master_debugfs_add(struct master *m)
> {
> - m->dentry = debugfs_create_file(dev_name(m->dev), 0444,
> - component_debugfs_dir,
> - m, &component_devices_fops);
> + debugfs_create_file(dev_name(m->dev), 0444, component_debugfs_dir, m,
> + &component_devices_fops);
> }
>
> static void component_master_debugfs_del(struct master *m)
> {
> - debugfs_remove(m->dentry);
> - m->dentry = NULL;
> + debugfs_remove(debugfs_lookup(dev_name(m->dev), component_debugfs_dir));
> }
>
> #else
> --
> 2.30.1
>
Powered by blists - more mailing lists