All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Adamski, Krzysztof (Nokia - PL/Wroclaw)"  <krzysztof.adamski@nokia.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: Jean Delvare <jdelvare@suse.com>,
	"linux-hwmon@vger.kernel.org" <linux-hwmon@vger.kernel.org>,
	"Sverdlin,
	Alexander (Nokia - DE/Ulm)" <alexander.sverdlin@nokia.com>
Subject: Re: [PATCH 1/3] pmbus: support for custom sysfs attributes
Date: Thu, 11 Apr 2019 07:53:53 +0000	[thread overview]
Message-ID: <20190411075340.GB28466@localhost.localdomain> (raw)
In-Reply-To: <b3f0de78-e3bc-5c73-e732-9fa62c3404cf@roeck-us.net>

On Wed, Apr 10, 2019 at 05:35:21PM -0700, Guenter Roeck wrote:
>On 4/10/19 3:38 PM, Adamski, Krzysztof (Nokia - PL/Wroclaw) wrote:
>>This patch makes it possible to pass custom struct attribute_group array
>>via the pmbus_driver_info struct so that those can be added to the
>>attribute groups passed to hwmon_device_register_with_groups().
>>
>>This makes it possible to register custom sysfs attributes by PMBUS
>>drivers similar to how you can do this with most other busses/classes.
>>
>>Signed-off-by: Krzysztof Adamski <krzysztof.adamski@nokia.com>
>>---
>>  drivers/hwmon/pmbus/pmbus.h      |  3 +++
>>  drivers/hwmon/pmbus/pmbus_core.c | 13 ++++++++++++-
>>  2 files changed, 15 insertions(+), 1 deletion(-)
>>
>>diff --git a/drivers/hwmon/pmbus/pmbus.h b/drivers/hwmon/pmbus/pmbus.h
>>index 1d24397d36ec..fb267ec11623 100644
>>--- a/drivers/hwmon/pmbus/pmbus.h
>>+++ b/drivers/hwmon/pmbus/pmbus.h
>>@@ -417,6 +417,9 @@ struct pmbus_driver_info {
>>  	/* Regulator functionality, if supported by this chip driver. */
>>  	int num_regulators;
>>  	const struct regulator_desc *reg_desc;
>>+
>>+	/* custom attributes */
>>+	const struct attribute_group **groups;
>
>I can understand the need and desire for one additional group. More than one
>is highly questionable. Please explain why you think that more than one extra
>attribute would ever be needed. It does add substantial complexity, so
>there should be a good reason.

The only situation I could come up is if the driver would want to group
attributes in different directories by setting different name for each
of them. One other reason I choose to use this approach is that this
seems to be standard way for passing this information on other
layers/frameworks.  For example, this is the same "format" you would
pass this kind of data when creating a class, a bus, a driver or when
you use any of the *_register_with_groups().

This approach is simply more generic with (to my opinion) low cost of
implementation. But if we don't want to support that, I'm fine to change
this to single custom group.

Krzysztof

  reply	other threads:[~2019-04-11  7:53 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-10 22:38 [PATCH 0/3] pmbus: extend configurability via sysfs Adamski, Krzysztof (Nokia - PL/Wroclaw)
2019-04-10 22:38 ` [PATCH 1/3] pmbus: support for custom sysfs attributes Adamski, Krzysztof (Nokia - PL/Wroclaw)
2019-04-11  0:35   ` Guenter Roeck
2019-04-11  7:53     ` Adamski, Krzysztof (Nokia - PL/Wroclaw) [this message]
2019-04-11 13:19       ` Guenter Roeck
2019-04-10 22:39 ` [PATCH 2/3] lm25066: export sysfs attribute for SAMPLES_FOR_AVG Adamski, Krzysztof (Nokia - PL/Wroclaw)
2019-04-11  0:55   ` Guenter Roeck
2019-04-11  4:24     ` Nicolin Chen
2019-04-11  8:09       ` Adamski, Krzysztof (Nokia - PL/Wroclaw)
2019-04-11 13:07         ` Guenter Roeck
2019-04-11 14:12           ` Adamski, Krzysztof (Nokia - PL/Wroclaw)
2019-04-10 22:39 ` [PATCH 3/3] pmbus: export coefficients via sysfs Adamski, Krzysztof (Nokia - PL/Wroclaw)
2019-04-11  0:30   ` Guenter Roeck
2019-04-11  7:45     ` Adamski, Krzysztof (Nokia - PL/Wroclaw)
2019-04-11 13:39       ` Guenter Roeck
2019-04-11 14:09         ` Adamski, Krzysztof (Nokia - PL/Wroclaw)

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=20190411075340.GB28466@localhost.localdomain \
    --to=krzysztof.adamski@nokia.com \
    --cc=alexander.sverdlin@nokia.com \
    --cc=jdelvare@suse.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux@roeck-us.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.