lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250423175040.784680-6-david.e.box@linux.intel.com>
Date: Wed, 23 Apr 2025 10:50:35 -0700
From: "David E. Box" <david.e.box@...ux.intel.com>
To: corbet@....net,
	bhelgaas@...gle.com,
	kuurtb@...il.com,
	hdegoede@...hat.com,
	ilpo.jarvinen@...ux.intel.com,
	vkoul@...nel.org,
	yung-chuan.liao@...ux.intel.com,
	pierre-louis.bossart@...ux.dev,
	sanyog.r.kale@...el.com,
	gregkh@...uxfoundation.org,
	rafael@...nel.org,
	dakr@...nel.org,
	david.e.box@...ux.intel.com,
	dan.j.williams@...el.com,
	andriy.shevchenko@...ux.intel.com
Cc: linux-doc@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	linux-pci@...r.kernel.org,
	platform-driver-x86@...r.kernel.org,
	Dell.Client.Kernel@...l.com,
	linux-sound@...r.kernel.org
Subject: [PATCH 5/7] soundwire: sysfs: Use ATTRIBUTE_GROUP_VISIBLE()

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@...ux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@...ux.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


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ