[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2024013030-denatured-swaddling-b047@gregkh>
Date: Tue, 30 Jan 2024 10:46:31 -0800
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: alsa-devel@...a-project.org
Cc: linux-kernel@...r.kernel.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Dan Williams <dan.j.williams@...el.com>,
Vinod Koul <vkoul@...nel.org>,
Bard Liao <yung-chuan.liao@...ux.intel.com>,
Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>,
Sanyog Kale <sanyog.r.kale@...el.com>
Subject: [PATCH 5/6] soundwire: sysfs: remove sdw_slave_sysfs_init()
Now that sdw_slave_sysfs_init() only calls sdw_slave_sysfs_dpn_init(),
just do that instead and remove sdw_slave_sysfs_init() to get it out of
the way to save a bit of logic and code size.
Cc: Vinod Koul <vkoul@...nel.org>
Cc: Bard Liao <yung-chuan.liao@...ux.intel.com>
Cc: Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>
Cc: Sanyog Kale <sanyog.r.kale@...el.com>
Cc: alsa-devel@...a-project.org
Cc: linux-kernel@...r.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
drivers/soundwire/bus_type.c | 4 ++--
drivers/soundwire/sysfs_local.h | 1 -
drivers/soundwire/sysfs_slave.c | 13 -------------
drivers/soundwire/sysfs_slave_dpn.c | 3 +++
4 files changed, 5 insertions(+), 16 deletions(-)
diff --git a/drivers/soundwire/bus_type.c b/drivers/soundwire/bus_type.c
index 5abe5593395a..6085eb8c8d85 100644
--- a/drivers/soundwire/bus_type.c
+++ b/drivers/soundwire/bus_type.c
@@ -126,8 +126,8 @@ static int sdw_drv_probe(struct device *dev)
if (slave->prop.use_domain_irq)
sdw_irq_create_mapping(slave);
- /* init the sysfs as we have properties now */
- ret = sdw_slave_sysfs_init(slave);
+ /* init the dynamic sysfs attributes we need */
+ ret = sdw_slave_sysfs_dpn_init(slave);
if (ret < 0)
dev_warn(dev, "Slave sysfs init failed:%d\n", ret);
diff --git a/drivers/soundwire/sysfs_local.h b/drivers/soundwire/sysfs_local.h
index 3ab8658a7782..fa048e112629 100644
--- a/drivers/soundwire/sysfs_local.h
+++ b/drivers/soundwire/sysfs_local.h
@@ -15,7 +15,6 @@ extern const struct attribute_group *sdw_slave_status_attr_groups[];
extern const struct attribute_group *sdw_attr_groups[];
/* additional device-managed properties reported after driver probe */
-int sdw_slave_sysfs_init(struct sdw_slave *slave);
int sdw_slave_sysfs_dpn_init(struct sdw_slave *slave);
#endif /* __SDW_SYSFS_LOCAL_H */
diff --git a/drivers/soundwire/sysfs_slave.c b/drivers/soundwire/sysfs_slave.c
index 3afc0dc06c98..0eefc205f697 100644
--- a/drivers/soundwire/sysfs_slave.c
+++ b/drivers/soundwire/sysfs_slave.c
@@ -221,19 +221,6 @@ const struct attribute_group *sdw_attr_groups[] = {
NULL,
};
-int sdw_slave_sysfs_init(struct sdw_slave *slave)
-{
- int ret;
-
- if (slave->prop.source_ports || slave->prop.sink_ports) {
- ret = sdw_slave_sysfs_dpn_init(slave);
- if (ret < 0)
- return ret;
- }
-
- return 0;
-}
-
/*
* the status is shown in capital letters for UNATTACHED and RESERVED
* on purpose, to highligh users to the fact that these status values
diff --git a/drivers/soundwire/sysfs_slave_dpn.c b/drivers/soundwire/sysfs_slave_dpn.c
index c4b6543c09fd..a3fb380ee519 100644
--- a/drivers/soundwire/sysfs_slave_dpn.c
+++ b/drivers/soundwire/sysfs_slave_dpn.c
@@ -283,6 +283,9 @@ int sdw_slave_sysfs_dpn_init(struct sdw_slave *slave)
int ret;
int i;
+ if (!slave->prop.source_ports && !slave->prop.sink_ports)
+ return 0;
+
mask = slave->prop.source_ports;
for_each_set_bit(i, &mask, 32) {
ret = add_all_attributes(&slave->dev, i, 1);
--
2.43.0
Powered by blists - more mailing lists