All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Benoit Cousson <bcousson@baylibre.com>,
	Patrick Titiano <ptitiano@baylibre.com>,
	LM Sensors <lm-sensors@lm-sensors.org>,
	Jean Delvare <jdelvare@suse.de>
Subject: Re: [lm-sensors] [PATCH v2 2/5] hwmon: ina2xx: make shunt resistance configurable at run-time
Date: Sun, 30 Nov 2014 20:01:21 +0000	[thread overview]
Message-ID: <547B7791.8030108@roeck-us.net> (raw)
In-Reply-To: <1417082350-23470-3-git-send-email-bgolaszewski@baylibre.com>

On 11/27/2014 01:59 AM, Bartosz Golaszewski wrote:
> The shunt resistance can only be set via platform_data or device tree. This
> isn't suitable for devices in which the shunt resistance can change/isn't
> known at boot-time.
>
> Add a sysfs attribute that allows to read and set the shunt resistance.
>
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> ---
>   drivers/hwmon/ina2xx.c | 62 +++++++++++++++++++++++++++++++++++++++++++++-----
>   1 file changed, 56 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/hwmon/ina2xx.c b/drivers/hwmon/ina2xx.c
> index 0a6b60f..341da67 100644
> --- a/drivers/hwmon/ina2xx.c
> +++ b/drivers/hwmon/ina2xx.c
> @@ -51,6 +51,8 @@
>   #define INA226_ALERT_LIMIT		0x07
>   #define INA226_DIE_ID			0xFF
>
> +/* shunt resistor sysfs attribute index */
> +#define INA2XX_RSHUNT			0x8
>
After reading the datasheet again ... those defines were meant
to reflect registers, not to create 'dummy' index values for software.
Please rearrange your code to not require such constructs; it is just
confusing for others (including me).

Guenter


_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

WARNING: multiple messages have this Message-ID (diff)
From: Guenter Roeck <linux@roeck-us.net>
To: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Benoit Cousson <bcousson@baylibre.com>,
	Patrick Titiano <ptitiano@baylibre.com>,
	LM Sensors <lm-sensors@lm-sensors.org>,
	Jean Delvare <jdelvare@suse.de>
Subject: Re: [PATCH v2 2/5] hwmon: ina2xx: make shunt resistance configurable at run-time
Date: Sun, 30 Nov 2014 12:01:21 -0800	[thread overview]
Message-ID: <547B7791.8030108@roeck-us.net> (raw)
In-Reply-To: <1417082350-23470-3-git-send-email-bgolaszewski@baylibre.com>

On 11/27/2014 01:59 AM, Bartosz Golaszewski wrote:
> The shunt resistance can only be set via platform_data or device tree. This
> isn't suitable for devices in which the shunt resistance can change/isn't
> known at boot-time.
>
> Add a sysfs attribute that allows to read and set the shunt resistance.
>
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> ---
>   drivers/hwmon/ina2xx.c | 62 +++++++++++++++++++++++++++++++++++++++++++++-----
>   1 file changed, 56 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/hwmon/ina2xx.c b/drivers/hwmon/ina2xx.c
> index 0a6b60f..341da67 100644
> --- a/drivers/hwmon/ina2xx.c
> +++ b/drivers/hwmon/ina2xx.c
> @@ -51,6 +51,8 @@
>   #define INA226_ALERT_LIMIT		0x07
>   #define INA226_DIE_ID			0xFF
>
> +/* shunt resistor sysfs attribute index */
> +#define INA2XX_RSHUNT			0x8
>
After reading the datasheet again ... those defines were meant
to reflect registers, not to create 'dummy' index values for software.
Please rearrange your code to not require such constructs; it is just
confusing for others (including me).

Guenter


  parent reply	other threads:[~2014-11-30 20:01 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-27  9:59 [lm-sensors] [PATCH v2 0/5] hwmon: ina2xx: fixes & extensions Bartosz Golaszewski
2014-11-27  9:59 ` Bartosz Golaszewski
2014-11-27  9:59 ` [lm-sensors] [PATCH v2 1/5] hwmon: ina2xx: bail-out from ina2xx_probe() in case of configuration err Bartosz Golaszewski
2014-11-27  9:59   ` [PATCH v2 1/5] hwmon: ina2xx: bail-out from ina2xx_probe() in case of configuration errors Bartosz Golaszewski
2014-11-30 19:44   ` [lm-sensors] [PATCH v2 1/5] hwmon: ina2xx: bail-out from ina2xx_probe() in case of configuration Guenter Roeck
2014-11-30 19:44     ` [PATCH v2 1/5] hwmon: ina2xx: bail-out from ina2xx_probe() in case of configuration errors Guenter Roeck
2014-11-27  9:59 ` [lm-sensors] [PATCH v2 2/5] hwmon: ina2xx: make shunt resistance configurable at run-time Bartosz Golaszewski
2014-11-27  9:59   ` Bartosz Golaszewski
2014-11-30 19:44   ` [lm-sensors] " Guenter Roeck
2014-11-30 19:44     ` Guenter Roeck
2014-11-30 20:01   ` Guenter Roeck [this message]
2014-11-30 20:01     ` Guenter Roeck
2014-11-27  9:59 ` [lm-sensors] [PATCH v2 3/5] hwmon: ina2xx: allow to change the averaging rate " Bartosz Golaszewski
2014-11-27  9:59   ` Bartosz Golaszewski
2014-11-30 19:59   ` [lm-sensors] " Guenter Roeck
2014-11-30 19:59     ` Guenter Roeck
2014-11-27  9:59 ` [lm-sensors] [PATCH v2 4/5] hwmon: ina2xx: change hex constants to lower-case Bartosz Golaszewski
2014-11-27  9:59   ` Bartosz Golaszewski
2014-11-30 20:05   ` [lm-sensors] " Guenter Roeck
2014-11-30 20:05     ` Guenter Roeck
2014-11-27  9:59 ` [lm-sensors] [PATCH v2 5/5] hwmon: ina2xx: documentation update for new sysfs attributes Bartosz Golaszewski
2014-11-27  9:59   ` Bartosz Golaszewski

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=547B7791.8030108@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=bcousson@baylibre.com \
    --cc=bgolaszewski@baylibre.com \
    --cc=jdelvare@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lm-sensors@lm-sensors.org \
    --cc=ptitiano@baylibre.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 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.