Re: [RFC PATCH 17/21] alienware-wmi: Drop thermal methods dependency on quirks

From: Kurt Borja
Date: Thu Dec 05 2024 - 07:59:12 EST


On Thu, Dec 05, 2024 at 01:14:43PM +0200, Ilpo Järvinen wrote:
> On Wed, 4 Dec 2024, Kurt Borja wrote:
>
> > Make the `gmode` condition on AWCC WMI devices part of the device's
> > state container, and refactor "platform_profile" methods accordingly.
> >
> > Signed-off-by: Kurt Borja <kuurtb@xxxxxxxxx>
> > ---
> > drivers/platform/x86/dell/alienware-wmi.c | 13 +++++++------
> > 1 file changed, 7 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/platform/x86/dell/alienware-wmi.c b/drivers/platform/x86/dell/alienware-wmi.c
> > index fa21a50d66bd..7137995d5983 100644
> > --- a/drivers/platform/x86/dell/alienware-wmi.c
> > +++ b/drivers/platform/x86/dell/alienware-wmi.c
> > @@ -407,6 +407,7 @@ struct awcc_priv {
> > struct wmi_device *wdev;
> > struct platform_profile_handler pp_handler;
> > enum wmax_thermal_mode supported_thermal_profiles[PLATFORM_PROFILE_LAST];
> > + bool has_gmode;
> > };
> >
> > struct alienfx_priv {
> > @@ -1044,7 +1045,7 @@ static int thermal_profile_set(struct platform_profile_handler *pprof,
> >
> > priv = container_of(pprof, struct awcc_priv, pp_handler);
> >
> > - if (quirks->gmode) {
> > + if (priv->has_gmode) {
> > u32 gmode_status;
> > int ret;
> >
> > @@ -1070,7 +1071,7 @@ static int thermal_profile_set(struct platform_profile_handler *pprof,
> > priv->supported_thermal_profiles[profile]);
> > }
> >
> > -static int create_thermal_profile(struct wmi_device *wdev)
> > +static int create_thermal_profile(struct wmi_device *wdev, bool has_gmode)
> > {
> > struct awcc_priv *priv;
> > u32 out_data;
> > @@ -1115,7 +1116,8 @@ static int create_thermal_profile(struct wmi_device *wdev)
> > if (bitmap_empty(priv->pp_handler.choices, PLATFORM_PROFILE_LAST))
> > return -ENODEV;
> >
> > - if (quirks->gmode) {
> > + if (has_gmode) {
> > + priv->has_gmode = true;
> > priv->supported_thermal_profiles[PLATFORM_PROFILE_PERFORMANCE] =
> > WMAX_THERMAL_MODE_GMODE;
> >
> > @@ -1130,8 +1132,7 @@ static int create_thermal_profile(struct wmi_device *wdev)
> >
> > static void remove_thermal_profile(void)
> > {
> > - if (quirks->thermal)
> > - platform_profile_remove();
> > + platform_profile_remove();
>
> Did you intend to make this change in this patch?
>
> I'm unable to confirm why the if () could now be removed and how it is
> related to other parts of this patch.

This is indeed should not be part of this patch.

In patch 08/21 wmax_wmi_remove() checks for quirks->thermal before
calling remove_thermal_profile() so the this check is safe to drop.

>
> > }
> >
> > /*
> > @@ -1339,7 +1340,7 @@ static int wmax_wmi_probe(struct wmi_device *wdev, const void *context)
> > };
> >
> > if (quirks->thermal)
> > - ret = create_thermal_profile(wdev);
> > + ret = create_thermal_profile(wdev, quirks->gmode);
> > else if (quirks->num_zones > 0)
> > ret = alienfx_wmi_init(&pdata);
> >
> >
>
> --
> i.
>