lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20220905223052.GA3695291@roeck-us.net>
Date:   Mon, 5 Sep 2022 15:30:52 -0700
From:   Guenter Roeck <linux@...ck-us.net>
To:     Alexandru Gagniuc <mr.nuke.me@...il.com>
Cc:     linux-hwmon@...r.kernel.org, robert.marko@...tura.hr,
        luka.perkov@...tura.hr, jdelvare@...e.com, dev@...ehler.at,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/3] hwmon: (tps23861) create unique debugfs directory
 per device

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@...il.com>

For my reference:

Reviewed-by: Guenter Roeck <linux@...ck-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;
>  }

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ