linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Kurt Borja" <kuurtb@gmail.com>
To: "David E. Box" <david.e.box@linux.intel.com>, <corbet@lwn.net>,
	<bhelgaas@google.com>, <hdegoede@redhat.com>,
	<ilpo.jarvinen@linux.intel.com>, <vkoul@kernel.org>,
	<yung-chuan.liao@linux.intel.com>,
	<pierre-louis.bossart@linux.dev>, <sanyog.r.kale@intel.com>,
	<gregkh@linuxfoundation.org>, <rafael@kernel.org>,
	<dakr@kernel.org>, <dan.j.williams@intel.com>,
	<andriy.shevchenko@linux.intel.com>
Cc: <linux-doc@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-pci@vger.kernel.org>,
	<platform-driver-x86@vger.kernel.org>,
	<Dell.Client.Kernel@dell.com>, <linux-sound@vger.kernel.org>
Subject: Re: [PATCH 6/7] platform/x86/dell: alienware-wmi: update sysfs visibility macros
Date: Wed, 23 Apr 2025 15:31:17 -0300	[thread overview]
Message-ID: <D9E8DY5E0CTO.2O6K5NWUGKA6Z@gmail.com> (raw)
In-Reply-To: <20250423175040.784680-7-david.e.box@linux.intel.com>

On Wed Apr 23, 2025 at 2:50 PM -03, David E. Box wrote:
> Replace deprecated visibility macros and align group naming with new API.
>
> In alienware-wmi-base.c, use NAMED_ATTRIBUTE_GROUP_COMBO_VISIBLE(rgb_zones)
> to define the rgb_zones attribute group concisely. To preserve the existing
> userspace ABI, rename zone_attr_visible and rgb_zones_attr_visible to
> zone_group_visible and rgb_zones_group_visible, respectively, to reflect the
> 'rgb_zones' group.
>
> In alienware-wmi-wmax.c, replace DEFINE_SIMPLE_SYSFS_GROUP_VISIBLE() with
> the renamed DEFINE_SYSFS_GROUP_VISIBILITY() macro for the hdmi, amplifier,
> and deepsleep attributes to match the updated API.
>
> While here, add missing sysfs.h include and sort headers alphabetically. No
> functional changes are intended.
>
> Signed-off-by: David E. Box <david.e.box@linux.intel.com>

Thanks! I like these new macros.

Reviewed-by: Kurt Borja <kuurtb@gmail.com>

Small comment bellow.

> ---
>  .../platform/x86/dell/alienware-wmi-base.c    | 23 ++++++++-----------
>  .../platform/x86/dell/alienware-wmi-wmax.c    |  7 +++---
>  2 files changed, 13 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/platform/x86/dell/alienware-wmi-base.c b/drivers/platform/x86/dell/alienware-wmi-base.c
> index 64562b92314f..ee41892e562c 100644
> --- a/drivers/platform/x86/dell/alienware-wmi-base.c
> +++ b/drivers/platform/x86/dell/alienware-wmi-base.c
> @@ -10,10 +10,11 @@
>  
>  #include <linux/acpi.h>
>  #include <linux/cleanup.h>
> -#include <linux/module.h>
> -#include <linux/platform_device.h>
>  #include <linux/dmi.h>
>  #include <linux/leds.h>
> +#include <linux/module.h>
> +#include <linux/platform_device.h>
> +#include <linux/sysfs.h>
>  #include "alienware-wmi.h"
>  
>  MODULE_AUTHOR("Mario Limonciello <mario.limonciello@outlook.com>");
> @@ -326,8 +327,8 @@ static ssize_t lighting_control_state_store(struct device *dev,
>  
>  static DEVICE_ATTR_RW(lighting_control_state);
>  
> -static umode_t zone_attr_visible(struct kobject *kobj,
> -				 struct attribute *attr, int n)
> +static umode_t rgb_zones_attr_visible(struct kobject *kobj,
> +				      struct attribute *attr, int n)
>  {
>  	if (n < alienfx->num_zones + 1)
>  		return attr->mode;
> @@ -335,13 +336,12 @@ static umode_t zone_attr_visible(struct kobject *kobj,
>  	return 0;
>  }
>  
> -static bool zone_group_visible(struct kobject *kobj)
> +static bool rgb_zones_group_visible(struct kobject *kobj)
>  {
>  	return alienfx->num_zones > 0;
>  }
> -DEFINE_SYSFS_GROUP_VISIBLE(zone);
>  
> -static struct attribute *zone_attrs[] = {
> +static struct attribute *rgb_zones_attrs[] = {
>  	&dev_attr_lighting_control_state.attr,
>  	&dev_attr_zone00.attr,
>  	&dev_attr_zone01.attr,
> @@ -349,12 +349,7 @@ static struct attribute *zone_attrs[] = {
>  	&dev_attr_zone03.attr,
>  	NULL
>  };
> -
> -static struct attribute_group zone_attribute_group = {
> -	.name = "rgb_zones",
> -	.is_visible = SYSFS_GROUP_VISIBLE(zone),
> -	.attrs = zone_attrs,
> -};
> +NAMED_ATTRIBUTE_GROUP_COMBO_VISIBLE(rgb_zones);
>  
>  /*
>   * LED Brightness (Global)
> @@ -410,7 +405,7 @@ static int alienfx_probe(struct platform_device *pdev)
>  }
>  
>  static const struct attribute_group *alienfx_groups[] = {
> -	&zone_attribute_group,
> +	&rgb_zones_group,
>  	WMAX_DEV_GROUPS
>  	NULL
>  };
> diff --git a/drivers/platform/x86/dell/alienware-wmi-wmax.c b/drivers/platform/x86/dell/alienware-wmi-wmax.c
> index 0c3be03385f8..559415849bcc 100644
> --- a/drivers/platform/x86/dell/alienware-wmi-wmax.c
> +++ b/drivers/platform/x86/dell/alienware-wmi-wmax.c
> @@ -13,6 +13,7 @@
>  #include <linux/dmi.h>
>  #include <linux/moduleparam.h>
>  #include <linux/platform_profile.h>
> +#include <linux/sysfs.h>

JFYI, this line conflicts with linux-next.

-- 
 ~ Kurt

>  #include <linux/wmi.h>
>  #include "alienware-wmi.h"
>  
> @@ -356,7 +357,7 @@ static bool hdmi_group_visible(struct kobject *kobj)
>  {
>  	return alienware_interface == WMAX && alienfx->hdmi_mux;
>  }
> -DEFINE_SIMPLE_SYSFS_GROUP_VISIBLE(hdmi);
> +DEFINE_SYSFS_GROUP_VISIBILITY(hdmi);
>  
>  static struct attribute *hdmi_attrs[] = {
>  	&dev_attr_cable.attr,
> @@ -404,7 +405,7 @@ static bool amplifier_group_visible(struct kobject *kobj)
>  {
>  	return alienware_interface == WMAX && alienfx->amplifier;
>  }
> -DEFINE_SIMPLE_SYSFS_GROUP_VISIBLE(amplifier);
> +DEFINE_SYSFS_GROUP_VISIBILITY(amplifier);
>  
>  static struct attribute *amplifier_attrs[] = {
>  	&dev_attr_status.attr,
> @@ -475,7 +476,7 @@ static bool deepsleep_group_visible(struct kobject *kobj)
>  {
>  	return alienware_interface == WMAX && alienfx->deepslp;
>  }
> -DEFINE_SIMPLE_SYSFS_GROUP_VISIBLE(deepsleep);
> +DEFINE_SYSFS_GROUP_VISIBILITY(deepsleep);
>  
>  static struct attribute *deepsleep_attrs[] = {
>  	&dev_attr_deepsleep.attr,


  reply	other threads:[~2025-04-23 18:31 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-23 17:50 [PATCH 0/7] sysfs: Introduce macros for attribute groups with visibility control David E. Box
2025-04-23 17:50 ` [PATCH 1/7] sysfs: Rename attribute group visibility macros David E. Box
2025-04-24  1:26   ` Dan Williams
2025-04-23 17:50 ` [PATCH 2/7] sysfs: Introduce macros to simplify creation of visible attribute groups David E. Box
2025-04-24  1:32   ` Dan Williams
2025-04-23 17:50 ` [PATCH 3/7] docs: sysfs.rst: document additional attribute group macros David E. Box
2025-04-24  1:34   ` Dan Williams
2025-04-23 17:50 ` [PATCH 4/7] pci: doe: Replace sysfs visibility macro David E. Box
2025-04-24  1:35   ` Dan Williams
2025-04-25 10:57   ` Ilpo Järvinen
2025-04-25 18:13     ` David E. Box
2025-04-26 13:06       ` Ilpo Järvinen
2025-04-23 17:50 ` [PATCH 5/7] soundwire: sysfs: Use ATTRIBUTE_GROUP_VISIBLE() David E. Box
2025-04-24  1:37   ` Dan Williams
2025-04-23 17:50 ` [PATCH 6/7] platform/x86/dell: alienware-wmi: update sysfs visibility macros David E. Box
2025-04-23 18:31   ` Kurt Borja [this message]
2025-04-24  3:01   ` Dan Williams
2025-04-23 17:50 ` [PATCH 7/7] sysfs: Remove transitional attribute group alias macros David E. Box
2025-04-24  3:02   ` Dan Williams

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=D9E8DY5E0CTO.2O6K5NWUGKA6Z@gmail.com \
    --to=kuurtb@gmail.com \
    --cc=Dell.Client.Kernel@dell.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=bhelgaas@google.com \
    --cc=corbet@lwn.net \
    --cc=dakr@kernel.org \
    --cc=dan.j.williams@intel.com \
    --cc=david.e.box@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hdegoede@redhat.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=pierre-louis.bossart@linux.dev \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=sanyog.r.kale@intel.com \
    --cc=vkoul@kernel.org \
    --cc=yung-chuan.liao@linux.intel.com \
    /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;
as well as URLs for NNTP newsgroup(s).