mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yen-Chi Huang <jesse.huang@portwell.com.tw>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: Hans de Goede <hdegoede@redhat.com>,
	jdelvare@suse.com, linux@roeck-us.net, wim@linux-watchdog.org,
	LKML <linux-kernel@vger.kernel.org>,
	platform-driver-x86@vger.kernel.org, linux-hwmon@vger.kernel.org,
	linux-watchdog@vger.kernel.org, jay.chen@canonical.com
Subject: Re: [PATCH v2 2/2] platform/x86: portwell-ec: Add hwmon support for voltage and temperature
Date: Thu, 24 Jul 2025 16:34:50 +0800	[thread overview]
Message-ID: <e5acefed-dc7d-490d-a795-230fdf3b312f@portwell.com.tw> (raw)
In-Reply-To: <41ed7342-a465-16ff-8283-29f0faa64d02@linux.intel.com>

Hi Ilpo,

Thanks for the thorough review, and sorry for the basic issues.

On 7/21/2025 9:56 PM, Ilpo Jarvinen wrote:
> On Tue, 15 Jul 2025, Yen-Chi Huang wrote:
> 
>> +static const struct pwec_data pwec_board_data_nano = {
>> +	.hwmon_in_data = pwec_nano_hwmon_in,
>> +	.hwmon_in_num = ARRAY_SIZE(pwec_nano_hwmon_in),
>> +	.hwmon_temp_data = pwec_nano_hwmon_temp,
>> +	.hwmon_temp_num = ARRAY_SIZE(pwec_nano_hwmon_temp),
>> +	.hwmon_info = pwec_nano_hwmon_info
> 
> Please add comma to any that is not a real terminator so that a future 
> changes won't need to add the comma if more fields get added.

Will fix in patch v3.

>>  static const struct dmi_system_id pwec_dmi_table[] = {
>>  	{
>>  		.ident = "NANO-6064 series",
>>  		.matches = {
>>  			DMI_MATCH(DMI_BOARD_NAME, "NANO-6064"),
>>  		},
>> +		.driver_data = (void *)&pwec_board_data_nano,
> 
> Casting a pointer to void * is not required.

`pwec_board_data_nano` is declared `const`, so dropping the cast produces:

	warning: initialization discards 'const' qualifier from pointer target type

Hence the explicit `(void *)` cast is needed to avoid the warning while
keeping the data read-only.

>> +		old_msb = pwec_read(lsb_reg+1);
> 
> Please add spaces around + as per the coding style guidance.
> 
>> +		lsb = pwec_read(lsb_reg);
>> +		msb = pwec_read(lsb_reg+1);
> 
> Ditto.

Will fix in patch v3.

>> +	switch (type) {
>> +	case hwmon_temp:
>> +		if (channel < d->hwmon_temp_num)
>> +			return 0444;
>> +		break;
> 
> I'd suggest you change these to:
> 
> 		return channel < d->hwmon_temp_num ? 0444 : 0;
> 
>> +	case hwmon_in:
>> +		if (channel < d->hwmon_in_num)
>> +			return 0444;
>> +		break;
>> +	default:
>> +		break;
> 
> ...and this to direct return 0; to simplify the code flow.

Will update as suggested in patch v3.

>> +	switch (type) {
>> +	case hwmon_temp:
>> +		if (channel < data->hwmon_temp_num) {
>> +			*val = pwec_read(data->hwmon_temp_data[channel].lsb_reg) * 1000;
> 
> There might have been some problem in preparing this series as literal 
> 1000 is still there despite your cover letter suggesting it was changed?
> 
> Please check the other expected changes as well, on a glance they seemed 
> to be in place but it has been a while since I've looked on this patch.

Will replace the literal with `MILLIDEGREE_PER_DEGREE` from
`<linux/units.h>` and double-check all other expected changes in v3.

Best regards,
Yen-Chi Huang

  reply	other threads:[~2025-07-24  8:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-14 10:52 [PATCH v2 0/2] platform/x86: portwell-ec: Add watchdog suspend/resume and hwmon Yen-Chi Huang
2025-07-15  3:51 ` [PATCH v2 1/2] platform/x86: portwell-ec: Add suspend/resume support for watchdog jesse huang
2025-07-15  3:56 ` [PATCH v2 2/2] platform/x86: portwell-ec: Add hwmon support for voltage and temperature Yen-Chi Huang
2025-07-21 13:56   ` Ilpo Järvinen
2025-07-24  8:34     ` Yen-Chi Huang [this message]
2025-07-14 10:56 jesse huang

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=e5acefed-dc7d-490d-a795-230fdf3b312f@portwell.com.tw \
    --to=jesse.huang@portwell.com.tw \
    --cc=hdegoede@redhat.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=jay.chen@canonical.com \
    --cc=jdelvare@suse.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=wim@linux-watchdog.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

all inboxes | Powered by JetHome®