Linux Hardware Monitor development
 help / color / mirror / Atom feed
From: Tzung-Bi Shih <tzungbi@kernel.org>
To: Guenter Roeck <linux@roeck-us.net>
Cc: Hardware Monitoring <linux-hwmon@vger.kernel.org>
Subject: Re: [PATCH 4/6] hwmon: (lm95234) Convert to with_info hwmon API
Date: Fri, 19 Jul 2024 00:40:24 +0800	[thread overview]
Message-ID: <ZplFeHMIKjHPiwTc@tzungbi-laptop> (raw)
In-Reply-To: <20240718033935.205185-5-linux@roeck-us.net>

On Wed, Jul 17, 2024 at 08:39:33PM -0700, Guenter Roeck wrote:
> +static int lm95234_temp_write(struct device *dev, u32 attr, int channel, long val)
>  {
[...]
> +	case hwmon_temp_max:
> +		val = clamp_val(val, 0, channel ? 255000 : 127000);

Perhaps I am misunderstanding, but this looks weird to me.  By applying
the patch, the maximum values are:

static SENSOR_DEVICE_ATTR_RW(temp1_max, tcrit1, 0); -> 127000
static SENSOR_DEVICE_ATTR_RW(temp2_max, tcrit2, 0); -> 255000
static SENSOR_DEVICE_ATTR_RW(temp3_max, tcrit2, 1); -> 255000
static SENSOR_DEVICE_ATTR_RW(temp4_max, tcrit1, 3); -> 255000
static SENSOR_DEVICE_ATTR_RW(temp5_max, tcrit1, 4); -> 255000


However, it was originally:

static ssize_t tcrit1_store(struct device *dev, struct device_attribute *attr,
	        const char *buf, size_t count)
{
[...]
    val = DIV_ROUND_CLOSEST(clamp_val(val, 0, 255000), 1000);

static ssize_t tcrit2_store(struct device *dev, struct device_attribute *attr,
	        const char *buf, size_t count)
{
[...]
    val = DIV_ROUND_CLOSEST(clamp_val(val, 0, (index ? 255 : 127) * 1000),
		    1000);

static SENSOR_DEVICE_ATTR_RW(temp1_max, tcrit1, 0); -> 255000
static SENSOR_DEVICE_ATTR_RW(temp2_max, tcrit2, 0); -> 127000
static SENSOR_DEVICE_ATTR_RW(temp3_max, tcrit2, 1); -> 255000
static SENSOR_DEVICE_ATTR_RW(temp4_max, tcrit1, 3); -> 255000
static SENSOR_DEVICE_ATTR_RW(temp5_max, tcrit1, 4); -> 255000

> +		val = DIV_ROUND_CLOSEST(val, 1000);
> +		return regmap_write(regmap, lm95234_crit_reg(channel), val);

  reply	other threads:[~2024-07-18 16:40 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-18  3:39 [PATCH 0/6] hwmon: (lm9534) Various improvements Guenter Roeck
2024-07-18  3:39 ` [PATCH 1/6] hwmon: (lm95234) Reorder include files to be in alphabetic order Guenter Roeck
2024-07-18 16:39   ` Tzung-Bi Shih
2024-07-18  3:39 ` [PATCH 2/6] hwmon: (lm95234) Use find_closest to find matching update interval Guenter Roeck
2024-07-18 16:39   ` Tzung-Bi Shih
2024-07-18 17:48     ` Guenter Roeck
2024-07-18 17:53       ` Guenter Roeck
2024-07-19  0:52         ` Tzung-Bi Shih
2024-07-18  3:39 ` [PATCH 3/6] hwmon: (lm95234) Convert to use regmap Guenter Roeck
2024-07-18 16:40   ` Tzung-Bi Shih
2024-07-18  3:39 ` [PATCH 4/6] hwmon: (lm95234) Convert to with_info hwmon API Guenter Roeck
2024-07-18 16:40   ` Tzung-Bi Shih [this message]
2024-07-18 17:47     ` Guenter Roeck
2024-07-19  0:52       ` Tzung-Bi Shih
2024-07-19  1:55         ` Guenter Roeck
2024-07-18  3:39 ` [PATCH 5/6] hwmon: (lm95234) Add support for tempX_enable attribute Guenter Roeck
2024-07-18 16:40   ` Tzung-Bi Shih
2024-07-18  3:39 ` [PATCH 6/6] hwmon: (lm95234) Use multi-byte regmap operations Guenter Roeck
2024-07-18 16:40   ` Tzung-Bi Shih

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=ZplFeHMIKjHPiwTc@tzungbi-laptop \
    --to=tzungbi@kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox