Commit f88c1afe authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman Committed by Vinod Koul

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@kernel.org>
Cc: Bard Liao <yung-chuan.liao@linux.intel.com>
Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Cc: Sanyog Kale <sanyog.r.kale@intel.com>
Cc: alsa-devel@alsa-project.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: default avatarDan Williams <dan.j.williams@intel.com>
Tested-By: default avatarVijendar Mukunda <Vijendar.Mukunda@amd.com>
Link: https://lore.kernel.org/r/2024013030-denatured-swaddling-b047@gregkhSigned-off-by: default avatarVinod Koul <vkoul@kernel.org>
parent fc7e5601
...@@ -126,8 +126,8 @@ static int sdw_drv_probe(struct device *dev) ...@@ -126,8 +126,8 @@ static int sdw_drv_probe(struct device *dev)
if (slave->prop.use_domain_irq) if (slave->prop.use_domain_irq)
sdw_irq_create_mapping(slave); sdw_irq_create_mapping(slave);
/* init the sysfs as we have properties now */ /* init the dynamic sysfs attributes we need */
ret = sdw_slave_sysfs_init(slave); ret = sdw_slave_sysfs_dpn_init(slave);
if (ret < 0) if (ret < 0)
dev_warn(dev, "Slave sysfs init failed:%d\n", ret); dev_warn(dev, "Slave sysfs init failed:%d\n", ret);
......
...@@ -15,7 +15,6 @@ extern const struct attribute_group *sdw_slave_status_attr_groups[]; ...@@ -15,7 +15,6 @@ extern const struct attribute_group *sdw_slave_status_attr_groups[];
extern const struct attribute_group *sdw_attr_groups[]; extern const struct attribute_group *sdw_attr_groups[];
/* additional device-managed properties reported after driver probe */ /* 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); int sdw_slave_sysfs_dpn_init(struct sdw_slave *slave);
#endif /* __SDW_SYSFS_LOCAL_H */ #endif /* __SDW_SYSFS_LOCAL_H */
...@@ -221,19 +221,6 @@ const struct attribute_group *sdw_attr_groups[] = { ...@@ -221,19 +221,6 @@ const struct attribute_group *sdw_attr_groups[] = {
NULL, 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 * the status is shown in capital letters for UNATTACHED and RESERVED
* on purpose, to highligh users to the fact that these status values * on purpose, to highligh users to the fact that these status values
......
...@@ -283,6 +283,9 @@ int sdw_slave_sysfs_dpn_init(struct sdw_slave *slave) ...@@ -283,6 +283,9 @@ int sdw_slave_sysfs_dpn_init(struct sdw_slave *slave)
int ret; int ret;
int i; int i;
if (!slave->prop.source_ports && !slave->prop.sink_ports)
return 0;
mask = slave->prop.source_ports; mask = slave->prop.source_ports;
for_each_set_bit(i, &mask, 32) { for_each_set_bit(i, &mask, 32) {
ret = add_all_attributes(&slave->dev, i, 1); ret = add_all_attributes(&slave->dev, i, 1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment