[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20141117210009.GA28122@roeck-us.net>
Date: Mon, 17 Nov 2014 13:00:09 -0800
From: Guenter Roeck <linux@...ck-us.net>
To: Mark Brown <broonie@...nel.org>
Cc: Liam Girdwood <lgirdwood@...il.com>, linux-kernel@...r.kernel.org,
Alan Tull <atull@...nsource.altera.com>
Subject: Re: [PATCH] regulator: Ensure unique regulator debugfs directory
names
On Fri, Oct 17, 2014 at 08:17:03AM -0700, Guenter Roeck wrote:
> If multiple regulator devices of the same type exist in a system,
> the regulator driver assigns generic names for the regulators it
> provides, and debugfs is enabled, the regulator subsystem attempts
> to create multiple entries with the same name in the regulator debugfs
> directory. This fails for all but the first regulator, resulting in
> multiple "Failed to create debugfs directory" log entries.
>
> To avoid the problem, prepend the debugfs directory name for a regulator
> with its parent device name if available, but only if no explicit
> regulator name was provided.
>
> Cc: Alan Tull <atull@...nsource.altera.com>
> Signed-off-by: Guenter Roeck <linux@...ck-us.net>
Hi Mark,
did you have time to look into this patch ?
Thanks,
Guenter
> ---
> drivers/regulator/core.c | 13 ++++++++++++-
> 1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
> index cd87c0c..92f7a53 100644
> --- a/drivers/regulator/core.c
> +++ b/drivers/regulator/core.c
> @@ -3538,7 +3538,18 @@ static int add_regulator_attributes(struct regulator_dev *rdev)
>
> static void rdev_init_debugfs(struct regulator_dev *rdev)
> {
> - rdev->debugfs = debugfs_create_dir(rdev_get_name(rdev), debugfs_root);
> + struct device *parent = rdev->dev.parent;
> + const char *rname = rdev_get_name(rdev);
> + char name[NAME_MAX];
> +
> + /* Avoid duplicate debugfs directory names */
> + if (parent && rname == rdev->desc->name) {
> + snprintf(name, sizeof(name), "%s-%s", dev_name(parent),
> + rname);
> + rname = name;
> + }
> +
> + rdev->debugfs = debugfs_create_dir(rname, debugfs_root);
> if (!rdev->debugfs) {
> rdev_warn(rdev, "Failed to create debugfs directory\n");
> return;
> --
> 1.9.1
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists