From: "David E. Box" <david.e.box@linux.intel.com>
To: corbet@lwn.net, bhelgaas@google.com, kuurtb@gmail.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,
david.e.box@linux.intel.com, 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: [PATCH 5/7] soundwire: sysfs: Use ATTRIBUTE_GROUP_VISIBLE()
Date: Wed, 23 Apr 2025 10:50:35 -0700 [thread overview]
Message-ID: <20250423175040.784680-6-david.e.box@linux.intel.com> (raw)
In-Reply-To: <20250423175040.784680-1-david.e.box@linux.intel.com>
Replace the manual definition of the dp0 attribute group with the newly
introduced ATTRIBUTE_GROUP_VISIBLE() macro, simplifying the code and
improving maintainability.
Consolidate the definition of dp0_attrs and move the attribute array above
the macro so that they are visibly tied together. While here, also remove
the unneeded trailing comma after NULL at the end of all attribute arrays.
No functional changes are intended.
Signed-off-by: David E. Box <david.e.box@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/soundwire/sysfs_slave.c | 32 +++++++++++++-------------------
1 file changed, 13 insertions(+), 19 deletions(-)
diff --git a/drivers/soundwire/sysfs_slave.c b/drivers/soundwire/sysfs_slave.c
index c5c22d1708ec..400f2a17f140 100644
--- a/drivers/soundwire/sysfs_slave.c
+++ b/drivers/soundwire/sysfs_slave.c
@@ -103,7 +103,7 @@ static DEVICE_ATTR_RO(modalias);
static struct attribute *slave_attrs[] = {
&dev_attr_modalias.attr,
- NULL,
+ NULL
};
static const struct attribute_group slave_attr_group = {
@@ -126,7 +126,7 @@ static struct attribute *slave_dev_attrs[] = {
&dev_attr_master_count.attr,
&dev_attr_source_ports.attr,
&dev_attr_sink_ports.attr,
- NULL,
+ NULL
};
static const struct attribute_group sdw_slave_dev_attr_group = {
@@ -170,16 +170,6 @@ static ssize_t words_show(struct device *dev,
}
static DEVICE_ATTR_RO(words);
-static struct attribute *dp0_attrs[] = {
- &dev_attr_max_word.attr,
- &dev_attr_min_word.attr,
- &dev_attr_words.attr,
- &dev_attr_BRA_flow_controlled.attr,
- &dev_attr_simple_ch_prep_sm.attr,
- &dev_attr_imp_def_interrupts.attr,
- NULL,
-};
-
static umode_t dp0_attr_visible(struct kobject *kobj, struct attribute *attr,
int n)
{
@@ -198,19 +188,23 @@ static bool dp0_group_visible(struct kobject *kobj)
return true;
return false;
}
-DEFINE_SYSFS_GROUP_VISIBLE(dp0);
-static const struct attribute_group dp0_group = {
- .attrs = dp0_attrs,
- .is_visible = SYSFS_GROUP_VISIBLE(dp0),
- .name = "dp0",
+static struct attribute *dp0_attrs[] = {
+ &dev_attr_max_word.attr,
+ &dev_attr_min_word.attr,
+ &dev_attr_words.attr,
+ &dev_attr_BRA_flow_controlled.attr,
+ &dev_attr_simple_ch_prep_sm.attr,
+ &dev_attr_imp_def_interrupts.attr,
+ NULL
};
+NAMED_ATTRIBUTE_GROUP_COMBO_VISIBLE(dp0);
const struct attribute_group *sdw_attr_groups[] = {
&slave_attr_group,
&sdw_slave_dev_attr_group,
&dp0_group,
- NULL,
+ NULL
};
/*
@@ -249,7 +243,7 @@ static DEVICE_ATTR_RO(device_number);
static struct attribute *slave_status_attrs[] = {
&dev_attr_status.attr,
&dev_attr_device_number.attr,
- NULL,
+ NULL
};
/*
--
2.43.0
next prev parent reply other threads:[~2025-04-23 17:50 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 ` David E. Box [this message]
2025-04-24 1:37 ` [PATCH 5/7] soundwire: sysfs: Use ATTRIBUTE_GROUP_VISIBLE() 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
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=20250423175040.784680-6-david.e.box@linux.intel.com \
--to=david.e.box@linux.intel.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=gregkh@linuxfoundation.org \
--cc=hdegoede@redhat.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=kuurtb@gmail.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).