mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alex Yeo <alexyeo362@gmail.com>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: platform-driver-x86@vger.kernel.org,
	Hans de Goede <hansg@kernel.org>,
	Kenneth Chan <kenneth.t.chan@gmail.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH v2] platform/x86: panasonic-laptop: Add platform_profile support
Date: Thu, 8 Oct 2026 03:07:22 +0800	[thread overview]
Message-ID: <5331a0a0-7080-4311-84c7-433d5bebbf19@gmail.com> (raw)
In-Reply-To: <de93474c-8d00-0382-bd46-e40f850f0bb9@linux.intel.com>

Thank you for taking the time to do a code review. I have made the 
specified changes for v3.

v3: 
https://lore.kernel.org/platform-driver-x86/20261007190446.38862-1-alexyeo362@gmail.com/

>> @@ -130,9 +134,12 @@
>>   #include <linux/kernel.h>
>>   #include <linux/module.h>
>>   #include <linux/platform_device.h>
>> +#include <linux/platform_profile.h>
>> +#include <linux/printk.h>
>>   #include <linux/seq_file.h>
>>   #include <linux/serio.h>
>>   #include <linux/slab.h>
>> +#include <linux/sysfs.h>
> 
> Thanks for the update.
> 
> I no longer recall if I suggested adding sysfs.h in the earlier review
> but I cannot now seem to locate anything that would be directly related to
> sysfs in this patch.
> 

Removed as no code uses that directly. Still builds with W=1 C=1.

>> +static int pcc_profile_platform_profile_probe(void *drvdata, unsigned long *choices)
>> +{
>> +	enum platform_profile_option pp_opt;
>> +	struct pcc_profile *pcc = drvdata;
>> +
>> +	for (pp_opt = 0; pp_opt < ARRAY_SIZE(pcc->quirks->platform_profiles); pp_opt++) {
>> +		const struct pcc_platform_profile *profile =
>> +			&pcc->quirks->platform_profiles[pp_opt];
>> +
>> +		if (profile->fan_mode != PCC_FAN_MODE_UNSET &&
>> +		    profile->tdp_mode != PCC_TDP_MODE_UNSET) {
>> +			set_bit(pp_opt, choices);
>> +		} else if (WARN_ON(profile->fan_mode != PCC_FAN_MODE_UNSET ||
>> +				   profile->tdp_mode != PCC_TDP_MODE_UNSET)) {
>> +			/* Both TDP and fan mode should be set */
>> +			return -EINVAL;
>> +		}
> 
> First check the error and return.
> 
> Then check double UNSET case and use continue.
> 
> Lastly, else is no longer needed for the set_bit() in the remaining cases.
> 

The code was refactored to fit that flow.
For the WARN_ON error check (first if statement), it follows the XOR 
pattern so != was used.

Thanks


      reply	other threads:[~2026-10-07 19:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-06  8:50 Alex Yeo
2026-10-06  9:49 ` Ilpo Järvinen
2026-10-07 19:07   ` Alex Yeo [this message]

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=5331a0a0-7080-4311-84c7-433d5bebbf19@gmail.com \
    --to=alexyeo362@gmail.com \
    --cc=hansg@kernel.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=kenneth.t.chan@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@vger.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

all inboxes | Powered by JetHome®