linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] regulator: Ensure unique regulator debugfs directory names
@ 2014-10-17 15:17 Guenter Roeck
  2014-11-17 21:00 ` Guenter Roeck
  2015-03-27 23:14 ` Mark Brown
  0 siblings, 2 replies; 6+ messages in thread
From: Guenter Roeck @ 2014-10-17 15:17 UTC (permalink / raw)
  To: Mark Brown; +Cc: Liam Girdwood, linux-kernel, Guenter Roeck, Alan Tull

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@opensource.altera.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
 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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] regulator: Ensure unique regulator debugfs directory names
  2014-10-17 15:17 [PATCH] regulator: Ensure unique regulator debugfs directory names Guenter Roeck
@ 2014-11-17 21:00 ` Guenter Roeck
  2014-11-17 23:26   ` Mark Brown
  2015-03-27 23:14 ` Mark Brown
  1 sibling, 1 reply; 6+ messages in thread
From: Guenter Roeck @ 2014-11-17 21:00 UTC (permalink / raw)
  To: Mark Brown; +Cc: Liam Girdwood, linux-kernel, Alan Tull

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@opensource.altera.com>
> Signed-off-by: Guenter Roeck <linux@roeck-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
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] regulator: Ensure unique regulator debugfs directory names
  2014-11-17 21:00 ` Guenter Roeck
@ 2014-11-17 23:26   ` Mark Brown
  2014-11-18  4:18     ` Guenter Roeck
  0 siblings, 1 reply; 6+ messages in thread
From: Mark Brown @ 2014-11-17 23:26 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: Liam Girdwood, linux-kernel, Alan Tull

[-- Attachment #1: Type: text/plain, Size: 745 bytes --]

On Mon, Nov 17, 2014 at 01:00:09PM -0800, Guenter Roeck wrote:
> On Fri, Oct 17, 2014 at 08:17:03AM -0700, Guenter Roeck wrote:

> > 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.

> Hi Mark,
> 
> did you have time to look into this patch ?

Please don't send contentless, quoted pings.  One of two things will be
true: either your patch got lost in which case a quoted copy is of no
use in getting the patch applied or the patch is buried under other mail
in which case you are at best adding to the email volume and at worst
your mail will never be seen as it's threaded in with the original send.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] regulator: Ensure unique regulator debugfs directory names
  2014-11-17 23:26   ` Mark Brown
@ 2014-11-18  4:18     ` Guenter Roeck
  2014-11-18 10:04       ` Mark Brown
  0 siblings, 1 reply; 6+ messages in thread
From: Guenter Roeck @ 2014-11-18  4:18 UTC (permalink / raw)
  To: Mark Brown; +Cc: Liam Girdwood, linux-kernel, Alan Tull

On 11/17/2014 03:26 PM, Mark Brown wrote:
> On Mon, Nov 17, 2014 at 01:00:09PM -0800, Guenter Roeck wrote:
>> On Fri, Oct 17, 2014 at 08:17:03AM -0700, Guenter Roeck wrote:
>
>>> 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.
>
>> Hi Mark,
>>
>> did you have time to look into this patch ?
>
> Please don't send contentless, quoted pings.  One of two things will be
> true: either your patch got lost in which case a quoted copy is of no
> use in getting the patch applied or the patch is buried under other mail
> in which case you are at best adding to the email volume and at worst
> your mail will never be seen as it's threaded in with the original send.
>

Hi Mark,

Sorry, I have no idea how you expect me (and others) to handle situations
like this, much less with this patch. Please keep in mind that this is
a per-maintainer process, and each maintainer handles things differently.
Individual maintainers may expect me to send a ping like I did, or to
resend the patch, or they may not reply because they dislike the patch
and they don't want to be bothered with a discussion. Some even go
ballistic if they get an e-mail with more than 80 columns of text.

Negotiating a minefield sometimes seems easier than submitting kernel
patches :-(.

I can't even find out by browsing the regulator mailing list since it
appears that there is no such list.

Guenter


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] regulator: Ensure unique regulator debugfs directory names
  2014-11-18  4:18     ` Guenter Roeck
@ 2014-11-18 10:04       ` Mark Brown
  0 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2014-11-18 10:04 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: Liam Girdwood, linux-kernel, Alan Tull

[-- Attachment #1: Type: text/plain, Size: 952 bytes --]

On Mon, Nov 17, 2014 at 08:18:44PM -0800, Guenter Roeck wrote:

> Sorry, I have no idea how you expect me (and others) to handle situations
> like this, much less with this patch. Please keep in mind that this is
> a per-maintainer process, and each maintainer handles things differently.
> Individual maintainers may expect me to send a ping like I did, or to
> resend the patch, or they may not reply because they dislike the patch

The default process is to resend the patch; I'm sure there are some
people who won't like that for some reason but it's reasonably rare.

> and they don't want to be bothered with a discussion. Some even go
> ballistic if they get an e-mail with more than 80 columns of text.

That's going to annoy essentially everyone, some people will be more
vocal than others but it's just a pretty basic thin.

> I can't even find out by browsing the regulator mailing list since it
> appears that there is no such list.

lkml.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] regulator: Ensure unique regulator debugfs directory names
  2014-10-17 15:17 [PATCH] regulator: Ensure unique regulator debugfs directory names Guenter Roeck
  2014-11-17 21:00 ` Guenter Roeck
@ 2015-03-27 23:14 ` Mark Brown
  1 sibling, 0 replies; 6+ messages in thread
From: Mark Brown @ 2015-03-27 23:14 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: Liam Girdwood, linux-kernel, Alan Tull

[-- Attachment #1: Type: text/plain, Size: 489 bytes --]

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.

Applied, thanks.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-03-28  2:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-17 15:17 [PATCH] regulator: Ensure unique regulator debugfs directory names Guenter Roeck
2014-11-17 21:00 ` Guenter Roeck
2014-11-17 23:26   ` Mark Brown
2014-11-18  4:18     ` Guenter Roeck
2014-11-18 10:04       ` Mark Brown
2015-03-27 23:14 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).