Linux Hardware Monitor development
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Tzung-Bi Shih <tzungbi@kernel.org>
Cc: Hardware Monitoring <linux-hwmon@vger.kernel.org>
Subject: Re: [PATCH v2 2/6] hwmon: (max6697) Drop platform data support
Date: Wed, 24 Jul 2024 07:25:31 -0700	[thread overview]
Message-ID: <5ffd1dae-cff3-4837-a178-540b5507ea64@roeck-us.net> (raw)
In-Reply-To: <ZqD7mNVlulOfeCYW@tzungbi-laptop>

On 7/24/24 06:03, Tzung-Bi Shih wrote:
> On Tue, Jul 23, 2024 at 08:44:43AM -0700, Guenter Roeck wrote:
>> +	if (data->type != max6581) {
>> +		if (of_property_read_bool(node, "resistance-cancellation") &&
>> +		    chip->valid_conf & MAX6697_CONF_RESISTANCE) {
>> +			confreg |= MAX6697_CONF_RESISTANCE;
>> +			factor = 1;
>> +		}
>> +	} else {
>> +		if (of_property_read_u32(node, "resistance-cancellation", &vals[0])) {
>> +			if (of_property_read_bool(node, "resistance-cancellation"))
>> +				vals[0] = 0xfe;
>> +			else
>> +				vals[0] = 0;
>> +		}
>> +
>> +		factor = hweight8(vals[0] & 0xfe);
> 
> It doesn't AND with 0xfe originally.
> 

Yes, but the original code uses the value in
	factor += hweight8(pdata->resistance_cancellation >> 1);
	ret = i2c_smbus_write_byte_data(client, MAX6581_REG_RESISTANCE,
                                         pdata->resistance_cancellation >> 1);
which is effectively the same. I can't just use
	factor = hweight8(vals[0] >> 1);
because, unlike resistance_cancellation, val[] is an u32 array which would
not auto-mask the upper bits.

Thanks,
Guenter


  reply	other threads:[~2024-07-24 14:25 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-23 15:44 [PATCH v2 0/6] hwmon: (max6697) Cleanup, use regmap and with_info API Guenter Roeck
2024-07-23 15:44 ` [PATCH v2 1/6] hwmon: (max6697) Reorder include files Guenter Roeck
2024-07-24 13:01   ` Tzung-Bi Shih
2024-07-23 15:44 ` [PATCH v2 2/6] hwmon: (max6697) Drop platform data support Guenter Roeck
2024-07-24 13:03   ` Tzung-Bi Shih
2024-07-24 14:25     ` Guenter Roeck [this message]
2024-07-24 15:41       ` Tzung-Bi Shih
2024-07-24 17:40         ` Guenter Roeck
2024-07-25  0:54           ` Tzung-Bi Shih
2024-07-25  5:52             ` Guenter Roeck
2024-07-23 15:44 ` [PATCH v2 3/6] hwmon: (max6697) Use bit operations where possible Guenter Roeck
2024-07-24 13:02   ` Tzung-Bi Shih
2024-07-23 15:44 ` [PATCH v2 4/6] hwmon: (max6697) Convert to use regmap Guenter Roeck
2024-07-23 15:44 ` [PATCH v2 5/6] hwmon: (max6697) Convert to with_info hwmon API Guenter Roeck
2024-07-23 15:44 ` [PATCH v2 6/6] hwmon: (max6697) Add support for tempX_min and tempX_min_alarm Guenter Roeck

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=5ffd1dae-cff3-4837-a178-540b5507ea64@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=tzungbi@kernel.org \
    /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