From: Guenter Roeck <linux@roeck-us.net>
To: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Cc: linux-hwmon@vger.kernel.org, robert.marko@sartura.hr,
luka.perkov@sartura.hr, jdelvare@suse.com, dev@aboehler.at,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] hwmon: (tps23861) create unique debugfs directory per device
Date: Mon, 5 Sep 2022 15:30:52 -0700 [thread overview]
Message-ID: <20220905223052.GA3695291@roeck-us.net> (raw)
In-Reply-To: <20220905142806.110598-3-mr.nuke.me@gmail.com>
On Mon, Sep 05, 2022 at 09:28:06AM -0500, Alexandru Gagniuc wrote:
> On systems with more than one tps23861, creating the debugfs directory
> for additional devices fails with
>
> debugfs: Directory 'tps23861' with parent '/' already present!
>
> To resolve this, include the hwmon device name in the directory name.
> Since the name is unique, this guarantees that the debugfs directory
> is unique.
>
> Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
For my reference:
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> ---
> drivers/hwmon/tps23861.c | 14 +++++++++++---
> 1 file changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/hwmon/tps23861.c b/drivers/hwmon/tps23861.c
> index 0dbd12060b50..3e9df72702c0 100644
> --- a/drivers/hwmon/tps23861.c
> +++ b/drivers/hwmon/tps23861.c
> @@ -503,9 +503,17 @@ static int tps23861_port_status_show(struct seq_file *s, void *data)
>
> DEFINE_SHOW_ATTRIBUTE(tps23861_port_status);
>
> -static void tps23861_init_debugfs(struct tps23861_data *data)
> +static void tps23861_init_debugfs(struct tps23861_data *data,
> + struct device *hwmon_dev)
> {
> - data->debugfs_dir = debugfs_create_dir(data->client->name, NULL);
> + const char *debugfs_name;
> +
> + debugfs_name = devm_kasprintf(&data->client->dev, GFP_KERNEL, "%s-%s",
> + data->client->name, dev_name(hwmon_dev));
> + if (!debugfs_name)
> + return;
> +
> + data->debugfs_dir = debugfs_create_dir(debugfs_name, NULL);
>
> debugfs_create_file("port_status",
> 0400,
> @@ -554,7 +562,7 @@ static int tps23861_probe(struct i2c_client *client)
> if (IS_ERR(hwmon_dev))
> return PTR_ERR(hwmon_dev);
>
> - tps23861_init_debugfs(data);
> + tps23861_init_debugfs(data, hwmon_dev);
>
> return 0;
> }
next prev parent reply other threads:[~2022-09-05 22:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-05 14:28 [PATCH 1/3] hwmon: (tps23861) fix byte order in resistance register Alexandru Gagniuc
2022-09-05 14:28 ` [PATCH 2/3] hwmon: (tps23861) reduce count of i2c transactions for port_status Alexandru Gagniuc
2022-09-05 22:29 ` Guenter Roeck
2022-09-05 14:28 ` [PATCH 3/3] hwmon: (tps23861) create unique debugfs directory per device Alexandru Gagniuc
2022-09-05 22:30 ` Guenter Roeck [this message]
2022-09-05 22:10 ` [PATCH 1/3] hwmon: (tps23861) fix byte order in resistance register Guenter Roeck
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=20220905223052.GA3695291@roeck-us.net \
--to=linux@roeck-us.net \
--cc=dev@aboehler.at \
--cc=jdelvare@suse.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luka.perkov@sartura.hr \
--cc=mr.nuke.me@gmail.com \
--cc=robert.marko@sartura.hr \
/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