From: atull <atull@opensource.altera.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: jdelvare@suse.de, lm-sensors@lm-sensors.org, lgirdwood@gmail.com,
broonie@kernel.org, robh+dt@kernel.org, pawel.moll@arm.com,
mark.rutland@arm.com, ijc+devicetree@hellion.org.uk,
galak@codeaurora.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, delicious.quinoa@gmail.com,
dinguyen@opensource.altera.com, yvanderv@opensource.altera.com
Subject: Re: [PATCH v6 3/4] pmbus: add regulator support
Date: Fri, 17 Oct 2014 09:48:39 -0500 [thread overview]
Message-ID: <alpine.DEB.2.02.1410170944240.13511@atx-linux-37> (raw)
In-Reply-To: <20141016202045.GA23966@roeck-us.net>
On Thu, 16 Oct 2014, Guenter Roeck wrote:
> On Thu, Oct 16, 2014 at 01:40:23PM -0500, atull wrote:
> > On Thu, 16 Oct 2014, Guenter Roeck wrote:
> >
> > > On Wed, Oct 15, 2014 at 01:55:09PM -0500, atull@opensource.altera.com wrote:
> > > > From: Alan Tull <atull@opensource.altera.com>
> > > >
> > > > Add support for simple on/off control of each channel.
> > > >
> > > > To add regulator support, the pmbus part driver needs to add
> > > > regulator_desc information and number of regulators to its
> > > > pmbus_driver_info struct.
> > > >
> > > > regulator_desc can be declared using default macro for a
> > > > regulator (PMBUS_REGULATOR) that is in pmbus.h
> > > >
> > > > The regulator_init_data can be initialized from either
> > > > platform data or the device tree.
> > > >
> > > > Signed-off-by: Alan Tull <atull@opensource.altera.com>
> > > > Reviewed-by: Mark Brown <broonie@kernel.org>
> > > > Cc: Guenter Roeck <linux@roeck-us.net>
> > >
> > > Hi Alan,
> > >
> > > I am still seeing lots of the following:
> > >
> > > vout0: Failed to create debugfs directory
> > > vout1: Failed to create debugfs directory
> > > vout2: Failed to create debugfs directory
> > > vout3: Failed to create debugfs directory
> > > vout4: Failed to create debugfs directory
> > > vout5: Failed to create debugfs directory
> > > vout6: Failed to create debugfs directory
> > > vout7: Failed to create debugfs directory
> > >
> > > I thought there was a problem in the regulator core, but after looking
> > > into it concluded that the regulator core _should_ prepend the names
> > > with the device name when creating the debugfs entries, unless no device
> > > name is specified. So something must be missing. We'll need to sort
> > > this out before I can accept the code.
> > >
> > > Thanks,
> > > Guenter
> > >
> >
> > Hi Guenter,
> >
> > OK, I will look into it.
> >
>
> Can you try the following patch ? It may not be perfect, but it does
> the job for me.
>
> Mark, would that patch be acceptable ?
>
> Thanks,
> Guenter
> ---
> From: Guenter Roeck <linux@roeck-us.net>
> Date: Thu, 16 Oct 2014 13:08:35 -0700
> Subject: [PATCH] regulator: Ensure unique regulator debugfs directory names
>
> 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
>
Hi Guenter,
I tried it out on a board with two ltc2978's. It looked really good to
me. It solves the debugfs issue without affecting the DT.
root@socfpga_cyclone5:~# ls /sys/kernel/debug/regulator/
0-005c-vout0 0-005c-vout6 0-005e-vout7
0-005c-vout1 0-005c-vout7 FPGA-1.1V
0-005c-vout2 0-005e-vout1 FPGA-1.5V
0-005c-vout3 0-005e-vout3 FPGA-2.5V
0-005c-vout4 0-005e-vout5
reg-dummy-regulator-dummy
0-005c-vout5 0-005e-vout6 supply_map
Alan
next prev parent reply other threads:[~2014-10-17 14:48 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-15 18:55 [PATCH v6 0/4] pmbus: ltc2978: add regulator support atull
[not found] ` <1413399310-19277-1-git-send-email-atull-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org>
2014-10-15 18:55 ` [PATCH v6 1/4] hwmon: ltc2978: device tree bindings documentation atull-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx
2014-10-16 19:46 ` Guenter Roeck
2014-10-15 18:55 ` [PATCH v6 2/4] pmbus: core: add helpers for byte write and read modify write atull
2014-10-15 18:55 ` [PATCH v6 3/4] pmbus: add regulator support atull
2014-10-16 18:35 ` Guenter Roeck
[not found] ` <20141016183501.GA21253-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
2014-10-16 18:40 ` atull
2014-10-16 19:18 ` Guenter Roeck
2014-10-16 20:20 ` Guenter Roeck
2014-10-17 14:48 ` atull [this message]
2014-10-17 15:02 ` Guenter Roeck
2014-10-15 18:55 ` [PATCH v6 4/4] pmbus: ltc2978: " atull
2014-10-16 21:24 ` [PATCH v6 0/4] " Guenter Roeck
2014-10-17 14:54 ` atull
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=alpine.DEB.2.02.1410170944240.13511@atx-linux-37 \
--to=atull@opensource.altera.com \
--cc=broonie@kernel.org \
--cc=delicious.quinoa@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=dinguyen@opensource.altera.com \
--cc=galak@codeaurora.org \
--cc=ijc+devicetree@hellion.org.uk \
--cc=jdelvare@suse.de \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=lm-sensors@lm-sensors.org \
--cc=mark.rutland@arm.com \
--cc=pawel.moll@arm.com \
--cc=robh+dt@kernel.org \
--cc=yvanderv@opensource.altera.com \
/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