public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Kurt Borja <kuurtb@gmail.com>
Cc: platform-driver-x86@vger.kernel.org, Armin Wolf <W_Armin@gmx.de>,
	 Mario Limonciello <mario.limonciello@amd.com>,
	 Hans de Goede <hdegoede@redhat.com>,
	Dell.Client.Kernel@dell.com,  LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v7 00/14] platform/x86: alienware-wmi driver rework
Date: Mon, 3 Feb 2025 16:09:59 +0200 (EET)	[thread overview]
Message-ID: <a2086a6b-6e2a-faab-6dd1-d13d3bceccfa@linux.intel.com> (raw)
In-Reply-To: <D7IV1P2LAXRV.21V72EQZ7RMFZ@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3441 bytes --]

On Mon, 3 Feb 2025, Kurt Borja wrote:

> On Mon Feb 3, 2025 at 7:55 AM -05, Ilpo Järvinen wrote:
> > On Mon, 3 Feb 2025, Kurt Borja wrote:
> >
> >> On Mon Feb 3, 2025 at 4:20 AM -05, Ilpo Järvinen wrote:
> >> > On Mon, 3 Feb 2025, Kurt Borja wrote:
> >> >
> >> >> Hi!
> >> >>
> >> >> I bring some last minute modifications.
> >> >> 
> >> >> I found commit
> >> >> 
> >> >> 	8d8fc146dd7a ("nvmem: core: switch to use device_add_groups()")
> >> >> 
> >> >> which states that it's unnecesary to call device_remove_groups() when
> >> >> the device is removed, so I dropped it to simplify things.
> >> >
> >> > Hi Kurt,
> >> 
> >> Hi Ilpo,
> >> 
> >> >
> >> >> I also found commit
> >> >> 
> >> >> 	957961b6dcc8 ("hwmon: (oxp-sensors) Move tt_toggle attribute to dev_groups")
> >> >> 
> >> >> which states that no driver should add sysfs groups while probing the
> >> >> device as it races with userspace, so I re-added PROBE_FORCE_SYNCHRONOUS
> >> >> to the platform driver, so groups are added only after the device has
> >> >> finished probing.
> >> >>
> >> >> I'm not 100% sure that the second commit message applies here, but it is
> >> >> revd-by Greg K-H so I added it just in case.
> >> >
> >> > Which is why .dev_groups should be used as it is able to avoid those 
> >> > races on driver core level.
> >> 
> >> In previous discussions with Armin we agreed it made more sense to move
> >> WMAX-only groups from alienware-wmi-base.c to alienware-wmi-wmax.c when
> >> splitting.
> >> 
> >> I have no problem in moving them back to .dev_groups though.
> >> 
> >> >
> >> > Why you call device_add_groups() at all? Can't you just insert it into 
> >> > .dev_groups member in alienware_wmax_wmi_driver?
> >> 
> >> I'd love to do this as it would simplify things a LOT, but some
> >> user-space tools might expect this attributes to be exposed by the
> >> "fake" platform device located at
> >> 
> >> /sys/devices/platform/alienware-wmi
> >> 
> >> If it were not for this, I would expose every attribute in the WMI
> >> device.
> >
> > Ah, sorry, I didn't pay attention where they were added to. I vaguely 
> > recall that discussion.
> >
> > But still, you could make the groups available through .h and just add 
> > them directly into alienfx_groups (with an #ifdef/#else in .h), or is 
> > there again something I don't see?
> 
> What do you think about something like:
> 
> alienware-wmi.h
> ---------------
> 
> #if IS_ENABLED(CONFIG_ALIENWARE_WMI_WMAX)
> #define WMAX_ONLY_GROUP(name)		(wmax_##name)
> 
> extern const struct attribute_group wmax_hdmi_attribute_group;
> ...
> #else
> #define WMAX_ONLY_GROUP(name)		NULL
> #endif
> 
> alienware-wmi-base.c
> --------------------
> ...
> static const struct attribute_group *alienfx_groups[] = {
> 	&zone_attribute_group,
> 	WMAX_ONLY_GROUP(hdmi_attribute_group),
> 	WMAX_ONLY_GROUP(amplifier_attribute_group),
> 	WMAX_ONLY_GROUP(deepsleep_attribute_group),

IMHO, just define WMAX_GROUPS in the header and use it here.

Similar to e.g. ARCH_PCI_DEV_GROUPS in drivers/pci/pci-sysfs.c.

> 	NULL
> ...
> 
> };
> 
> >
> > Obviously, .is_visible functions need to be extended slightly to filter 
> > out by interface but that should be relatively easy too. Also, the group 
> > variable names should be properly prefixed when making them cross file 
> > boundary like that.
> 

-- 
 i.

  reply	other threads:[~2025-02-03 14:10 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-03  6:20 [PATCH v7 00/14] platform/x86: alienware-wmi driver rework Kurt Borja
2025-02-03  6:20 ` [PATCH v7 01/14] platform/x86: alienware-wmi: Add a state container for LED control feature Kurt Borja
2025-02-03  6:20 ` [PATCH v7 02/14] platform/x86: alienware-wmi: Add WMI Drivers Kurt Borja
2025-02-03  6:20 ` [PATCH v7 03/14] platform/x86: alienware-wmi: Add a state container for thermal control methods Kurt Borja
2025-02-03  6:20 ` [PATCH v7 04/14] platform/x86: alienware-wmi: Refactor LED " Kurt Borja
2025-02-03  6:20 ` [PATCH v7 05/14] platform/x86: alienware-wmi: Refactor hdmi, amplifier, deepslp methods Kurt Borja
2025-02-03  6:20 ` [PATCH v7 06/14] platform/x86: alienware-wmi: Refactor thermal control methods Kurt Borja
2025-02-03  6:20 ` [PATCH v7 07/14] platform/x86: alienware-wmi: Split DMI table Kurt Borja
2025-02-03  6:20 ` [PATCH v7 08/14] MAINTAINERS: Update ALIENWARE WMI DRIVER entry Kurt Borja
2025-02-03  6:20 ` [PATCH v7 09/14] platform/x86: Rename alienware-wmi.c Kurt Borja
2025-02-03  6:20 ` [PATCH v7 10/14] platform/x86: Add alienware-wmi.h Kurt Borja
2025-02-03  6:20 ` [PATCH v7 11/14] platform/x86: Split the alienware-wmi driver Kurt Borja
2025-02-03  6:20 ` [PATCH v7 12/14] platform/x86: dell: Modify Makefile alignment Kurt Borja
2025-02-03  6:20 ` [PATCH v7 13/14] platform/x86: Update alienware-wmi config entries Kurt Borja
2025-02-03  6:20 ` [PATCH v7 14/14] platform/x86: alienware-wmi: Update header and module information Kurt Borja
2025-02-03  9:20 ` [PATCH v7 00/14] platform/x86: alienware-wmi driver rework Ilpo Järvinen
2025-02-03 12:06   ` Kurt Borja
2025-02-03 12:55     ` Ilpo Järvinen
2025-02-03 13:55       ` Kurt Borja
2025-02-03 14:09         ` Ilpo Järvinen [this message]
2025-02-03 15:28           ` Kurt Borja
2025-02-03 15:34 ` Armin Wolf
2025-02-03 16:15   ` 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=a2086a6b-6e2a-faab-6dd1-d13d3bceccfa@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=Dell.Client.Kernel@dell.com \
    --cc=W_Armin@gmx.de \
    --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 \
    /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