From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Kurt Borja <kuurtb@gmail.com>
Cc: Dell.Client.Kernel@dell.com, Hans de Goede <hdegoede@redhat.com>,
LKML <linux-kernel@vger.kernel.org>,
mario.limonciello@amd.com, platform-driver-x86@vger.kernel.org,
w_armin@gmx.de
Subject: Re: [RFC PATCH 16/21] alienware-wmi: Make running control state part of platdata
Date: Thu, 5 Dec 2024 16:06:23 +0200 (EET) [thread overview]
Message-ID: <c0af93e4-f2a6-bf2e-787d-7a360286ac8a@linux.intel.com> (raw)
In-Reply-To: <foiw2np7nj2qefgdw7t43zuz5kujdgnsllutjqjdoq7i5tkrdy@zfu2pk43crzx>
[-- Attachment #1: Type: text/plain, Size: 4270 bytes --]
On Thu, 5 Dec 2024, Kurt Borja wrote:
> On Thu, Dec 05, 2024 at 01:32:46PM +0200, Ilpo Järvinen wrote:
> > On Wed, 4 Dec 2024, Kurt Borja wrote:
> >
> > > Both WMI devices have a different "RUNNING" control state code. Make the
> > > WMI drivers decide which code to use, and refactor sysfs methods
> > > accordingly.
> > >
> > > Signed-off-by: Kurt Borja <kuurtb@gmail.com>
> > > ---
> > > drivers/platform/x86/dell/alienware-wmi.c | 9 ++++++---
> > > 1 file changed, 6 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/drivers/platform/x86/dell/alienware-wmi.c b/drivers/platform/x86/dell/alienware-wmi.c
> > > index 25e0139ed78c..fa21a50d66bd 100644
> > > --- a/drivers/platform/x86/dell/alienware-wmi.c
> > > +++ b/drivers/platform/x86/dell/alienware-wmi.c
> > > @@ -431,6 +431,7 @@ struct alienfx_platdata {
> > > bool hdmi_mux;
> > > bool amplifier;
> > > bool deepslp;
> > > + u8 running_code;
> > > };
> > >
> > > static u8 interface;
> > > @@ -576,18 +577,18 @@ static ssize_t lighting_control_state_store(struct device *dev,
> > > const char *buf, size_t count)
> > > {
> > > struct alienfx_priv *priv;
> > > + struct alienfx_platdata *pdata;
> > > u8 val;
> > >
> > > priv = dev_get_drvdata(dev);
> > > + pdata = dev_get_platdata(dev);
> > >
> > > if (strcmp(buf, "booting\n") == 0)
> > > val = LEGACY_BOOTING;
> > > else if (strcmp(buf, "suspend\n") == 0)
> > > val = LEGACY_SUSPEND;
> > > - else if (interface == LEGACY)
> > > - val = LEGACY_RUNNING;
> > > else
> > > - val = WMAX_RUNNING;
> > > + val = pdata->running_code;
> > >
> > > priv->lighting_control_state = val;
> > > pr_debug("alienware-wmi: updated control state to %d\n",
> > > @@ -1249,6 +1250,7 @@ static int legacy_wmi_probe(struct wmi_device *wdev, const void *context)
> > > .hdmi_mux = quirks->hdmi_mux,
> > > .amplifier = quirks->amplifier,
> > > .deepslp = quirks->deepslp,
> > > + .running_code = LEGACY_RUNNING,
> > > };
> > >
> > > if (quirks->num_zones > 0)
> > > @@ -1333,6 +1335,7 @@ static int wmax_wmi_probe(struct wmi_device *wdev, const void *context)
> > > .hdmi_mux = quirks->hdmi_mux,
> > > .amplifier = quirks->amplifier,
> > > .deepslp = quirks->deepslp,
> > > + .running_code = WMAX_RUNNING,
> > > };
> > >
> > > if (quirks->thermal)
> > >
> >
> > I've not taken extensive look at interdependent changes in the series but
> > while reviewing patch 20/21 I noticed that alienfx_probe() changed there
> > from:
> >
> > - if (interface == WMAX)
> > - priv->lighting_control_state = WMAX_RUNNING;
> > - else if (interface == LEGACY)
> > - priv->lighting_control_state = LEGACY_RUNNING;
> >
> > to:
> >
> > + priv->lighting_control_state = pdata->running_code;
>
> This was a workaround. I forgot to add this change in this patch. Also I'll
> move this earlier in the series.
>
> >
> > Somehow, it felt odd and then looking this patch 16, it felt even odder.
>
> The reason behind this is that I don't want AlienFX related methods
> depending on global variables like `interface` so I can split the file
> cleanly.
Just to make sure we don't talk past each other, I didn't mean the code
itself felt odd, just the patch it was changed in. So if your plan was to
have it in this patch to begin with but you noticed the problem while
doing the other change and put it "temporarily" there and forgot to move
it into correct place, no oddity problem then. :-)
> > Perhaps there's a good reason my review that didn't go deep enough failed
> > to uncover but please check if this is an indication that something is a
> > miss in the series.
> >
>
> Thank you so much for commenting on the series!
>
> Also, what do you think about the general approach? I was a bit unsure
> about the whole "platdata" stuff, as not many drivers use it in this
> subsystem.
I'm sorry but I've not come across it much so I'm not sure if my opinion
is that valuable.
What I can say for sure though is that the wide-spread use of global-level
variables in pdx86 drivers is definitely not setting a good example.
--
i.
next prev parent reply other threads:[~2024-12-05 14:06 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-05 0:27 [RFC PATCH 00/21] alienware-wmi driver rework Kurt Borja
2024-12-05 0:38 ` [RFC PATCH 01/21] alienware-wmi: Modify parse_rgb() signature Kurt Borja
2024-12-05 0:38 ` [RFC PATCH 02/21] alienware-wmi: Move Lighting Control State Kurt Borja
2024-12-05 0:39 ` [RFC PATCH 03/21] alienware-wmi: Remove unnecessary check at module exit Kurt Borja
2024-12-05 0:39 ` [RFC PATCH 04/21] alienware-wmi: Improve sysfs groups creation Kurt Borja
2024-12-05 0:40 ` [RFC PATCH 05/21] alienware-wmi: Refactor rgb-zones sysfs group creation Kurt Borja
2024-12-05 10:17 ` Ilpo Järvinen
2024-12-05 12:48 ` Kurt Borja
2024-12-05 13:18 ` Ilpo Järvinen
2024-12-05 13:34 ` Kurt Borja
2024-12-05 0:40 ` [RFC PATCH 06/21] alienware-wmi: Add state container and alienfx_probe() Kurt Borja
2024-12-05 0:40 ` [RFC PATCH 07/21] alienware-wmi: Migrate to state container pattern Kurt Borja
2024-12-05 0:41 ` [RFC PATCH 08/21] alienware-wmi: Add WMI Drivers Kurt Borja
2024-12-05 0:41 ` [RFC PATCH 09/21] alienware-wmi: Initialize WMI drivers Kurt Borja
2024-12-05 0:42 ` [RFC PATCH 10/21] alienware-wmi: Add alienfx OPs to platdata Kurt Borja
2024-12-05 11:05 ` Ilpo Järvinen
2024-12-05 12:50 ` Kurt Borja
2024-12-05 0:43 ` [RFC PATCH 11/21] alienware-wmi: Refactor LED control methods Kurt Borja
2024-12-05 0:43 ` [RFC PATCH 12/21] alienware-wmi: Refactor hdmi, amplifier, deepslp Kurt Borja
2024-12-05 0:44 ` [RFC PATCH 13/21] alienware-wmi: Add a state container for AWCC Kurt Borja
2024-12-05 0:44 ` [RFC PATCH 14/21] alienware-wmi: Migrate thermal methods to wmidev Kurt Borja
2024-12-05 0:44 ` [RFC PATCH 15/21] alienware-wmi: Refactor sysfs visibility methods Kurt Borja
2024-12-05 0:45 ` [RFC PATCH 16/21] alienware-wmi: Make running control state part of platdata Kurt Borja
2024-12-05 11:32 ` Ilpo Järvinen
2024-12-05 13:10 ` Kurt Borja
2024-12-05 14:06 ` Ilpo Järvinen [this message]
2024-12-07 2:10 ` Kurt Borja
2024-12-05 0:46 ` [RFC PATCH 17/21] alienware-wmi: Drop thermal methods dependency on quirks Kurt Borja
2024-12-05 11:14 ` Ilpo Järvinen
2024-12-05 12:56 ` Kurt Borja
2024-12-05 0:46 ` [RFC PATCH 18/21] platform-x86: Add header file for alienware-wmi Kurt Borja
2024-12-05 0:47 ` [RFC PATCH 19/21] platform-x86: Rename alienare-wmi Kurt Borja
2024-12-05 11:16 ` Ilpo Järvinen
2024-12-05 12:57 ` Kurt Borja
2024-12-05 0:47 ` [RFC PATCH 20/21] platform-x86: Split the alienware-wmi module Kurt Borja
2024-12-05 0:48 ` [RFC PATCH 21/21] platform-x86: Add config entries to alienware-wmi Kurt Borja
2024-12-06 23:26 ` [RFC PATCH 00/21] alienware-wmi driver rework Armin Wolf
2024-12-07 1:59 ` Kurt Borja
2024-12-07 3:20 ` Armin Wolf
2024-12-07 3:47 ` Kurt Borja
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=c0af93e4-f2a6-bf2e-787d-7a360286ac8a@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=Dell.Client.Kernel@dell.com \
--cc=hdegoede@redhat.com \
--cc=kuurtb@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mario.limonciello@amd.com \
--cc=platform-driver-x86@vger.kernel.org \
--cc=w_armin@gmx.de \
/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