[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <73f56b53-f02c-49ca-bfc5-67eb51e852b6@redhat.com>
Date: Thu, 7 Nov 2024 10:52:04 +0100
From: Hans de Goede <hdegoede@...hat.com>
To: Armin Wolf <W_Armin@....de>, corentin.chary@...il.com, luke@...nes.dev,
mohamed.ghanmi@...com.tn
Cc: srinivas.pandruvada@...ux.intel.com, ilpo.jarvinen@...ux.intel.com,
Michael@...ronix.com, casey.g.bowman@...el.com,
platform-driver-x86@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/2] platform/x86: asus-wmi: Use
platform_profile_cycle()
Hi,
On 7-Nov-24 1:38 AM, Armin Wolf wrote:
> Replace throttle_thermal_policy_switch_next() with
> platform_profile_cycle() to reduce code duplication and avoid a
> potential race condition with the platform profile handler.
>
> Suggested-by: Hans de Goede <hdegoede@...hat.com>
> Signed-off-by: Armin Wolf <W_Armin@....de>
Thanks, patch looks good to me:
Reviewed-by: Hans de Goede <hdegoede@...hat.com>
Regards,
Hans
> ---
> drivers/platform/x86/asus-wmi.c | 24 +-----------------------
> 1 file changed, 1 insertion(+), 23 deletions(-)
>
> diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
> index ce60835d0303..ba8b6d028f9f 100644
> --- a/drivers/platform/x86/asus-wmi.c
> +++ b/drivers/platform/x86/asus-wmi.c
> @@ -3755,28 +3755,6 @@ static int throttle_thermal_policy_set_default(struct asus_wmi *asus)
> return throttle_thermal_policy_write(asus);
> }
>
> -static int throttle_thermal_policy_switch_next(struct asus_wmi *asus)
> -{
> - u8 new_mode = asus->throttle_thermal_policy_mode + 1;
> - int err;
> -
> - if (new_mode > PLATFORM_PROFILE_MAX)
> - new_mode = ASUS_THROTTLE_THERMAL_POLICY_DEFAULT;
> -
> - asus->throttle_thermal_policy_mode = new_mode;
> - err = throttle_thermal_policy_write(asus);
> - if (err)
> - return err;
> -
> - /*
> - * Ensure that platform_profile updates userspace with the change to ensure
> - * that platform_profile and throttle_thermal_policy_mode are in sync.
> - */
> - platform_profile_notify();
> -
> - return 0;
> -}
> -
> static ssize_t throttle_thermal_policy_show(struct device *dev,
> struct device_attribute *attr, char *buf)
> {
> @@ -4301,7 +4279,7 @@ static void asus_wmi_handle_event_code(int code, struct asus_wmi *asus)
> if (asus->fan_boost_mode_available)
> fan_boost_mode_switch_next(asus);
> if (asus->throttle_thermal_policy_dev)
> - throttle_thermal_policy_switch_next(asus);
> + platform_profile_cycle();
> return;
>
> }
> --
> 2.39.5
>
Powered by blists - more mailing lists