public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: "Luke D. Jones" <luke@ljones.dev>
Cc: platform-driver-x86@vger.kernel.org,
	Hans de Goede <hdegoede@redhat.com>,
	 LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] platform/x86: asus-wmi: store a min default for ppt options
Date: Wed, 20 Mar 2024 15:13:12 +0200 (EET)	[thread overview]
Message-ID: <ebe48668-dfca-775c-880e-dfa333b7e562@linux.intel.com> (raw)
In-Reply-To: <20240310233722.30884-1-luke@ljones.dev>

On Mon, 11 Mar 2024, Luke D. Jones wrote:

> Laptops with any of the ppt or nv tunables default to the minimum setting
> on boot so we can safely assume a stored value is correct.
> 
> This patch adds storing of those values in the local struct, and enables
> reading of those values back.
> 
> Secondary to the above it renames some internal variables to be more
> consistent (which makes code grepping show all related parts)
> 
> Signed-off-by: Luke D. Jones <luke@ljones.dev>
> ---
>  drivers/platform/x86/asus-wmi.c | 141 +++++++++++++++++++++++++-------
>  1 file changed, 111 insertions(+), 30 deletions(-)
> 
> diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
> index e4341abb71e0..482e23b55e1e 100644
> --- a/drivers/platform/x86/asus-wmi.c
> +++ b/drivers/platform/x86/asus-wmi.c
> @@ -272,12 +272,19 @@ struct asus_wmi {
>  
>  	/* Tunables provided by ASUS for gaming laptops */
>  	bool ppt_pl2_sppt_available;
> +	u32 ppt_pl2_sppt;
>  	bool ppt_pl1_spl_available;
> +	u32 ppt_pl1_spl;
>  	bool ppt_apu_sppt_available;
> -	bool ppt_plat_sppt_available;
> +	u32 ppt_apu_sppt;
> +	bool ppt_platform_sppt_available;
> +	u32 ppt_platform_sppt;
>  	bool ppt_fppt_available;
> -	bool nv_dyn_boost_available;
> -	bool nv_temp_tgt_available;
> +	u32 ppt_fppt;
> +	bool nv_dynamic_boost_available;
> +	u32 nv_dynamic_boost;
> +	bool nv_temp_target_available;
> +	u32 nv_temp_target;
>  
>  	bool kbd_rgb_mode_available;
>  	u32 kbd_rgb_dev;

Can you check with pahole if this structure is now full of 31-bit holes?

The benefit of keeping bool & u32 doesn't seem that big to begin with 
(in visual sense because of the 1 char variation in column).

> @@ -999,11 +1006,10 @@ static ssize_t ppt_pl2_sppt_store(struct device *dev,
>  				    struct device_attribute *attr,
>  				    const char *buf, size_t count)
>  {
> +	struct asus_wmi *asus = dev_get_drvdata(dev);
>  	int result, err;
>  	u32 value;
>  
> -	struct asus_wmi *asus = dev_get_drvdata(dev);
> -

Please put this into own patch, it's entirely unrelated (but still useful 
change!).

>  	result = kstrtou32(buf, 10, &value);
>  	if (result)
>  		return result;
> @@ -1022,22 +1028,31 @@ static ssize_t ppt_pl2_sppt_store(struct device *dev,
>  		return -EIO;
>  	}
>  
> +	asus->ppt_pl2_sppt = value;
>  	sysfs_notify(&asus->platform_device->dev.kobj, NULL, "ppt_pl2_sppt");
>  
>  	return count;
>  }
> -static DEVICE_ATTR_WO(ppt_pl2_sppt);
> +
> +static ssize_t ppt_pl2_sppt_show(struct device *dev,
> +				       struct device_attribute *attr,
> +				       char *buf)

Alignment is not correct?

> +{
> +	struct asus_wmi *asus = dev_get_drvdata(dev);
> +
> +	return sysfs_emit(buf, "%d\n", asus->ppt_pl2_sppt);
> +}
> +static DEVICE_ATTR_RW(ppt_pl2_sppt);
>  
>  /* Tunable: PPT, Intel=PL1, AMD=SPL ******************************************/
>  static ssize_t ppt_pl1_spl_store(struct device *dev,
>  				    struct device_attribute *attr,
>  				    const char *buf, size_t count)
>  {
> +	struct asus_wmi *asus = dev_get_drvdata(dev);
>  	int result, err;
>  	u32 value;
>  
> -	struct asus_wmi *asus = dev_get_drvdata(dev);
> -

Unrelated, put to the same move patch as the other change please. I won't 
mark all thse from this point on but please do them all.

-- 
 i.


  reply	other threads:[~2024-03-20 13:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-10 23:37 [PATCH] platform/x86: asus-wmi: store a min default for ppt options Luke D. Jones
2024-03-20 13:13 ` Ilpo Järvinen [this message]
2024-03-20 20:11   ` Luke Jones
2024-03-21 11:23     ` Ilpo Järvinen

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=ebe48668-dfca-775c-880e-dfa333b7e562@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=hdegoede@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luke@ljones.dev \
    --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