Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Dan Williams <dan.j.williams@intel.com>
Tested-By: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Link: https://lore.kernel.org/r/2024013030-denatured-swaddling-b047@gregkh
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Greg Kroah-Hartman and committed by
Vinod Koul
f88c1afe fc7e5601

+5 -16
+2 -2
drivers/soundwire/bus_type.c
··· 126 126 if (slave->prop.use_domain_irq) 127 127 sdw_irq_create_mapping(slave); 128 128 129 - /* init the sysfs as we have properties now */ 130 - ret = sdw_slave_sysfs_init(slave); 129 + /* init the dynamic sysfs attributes we need */ 130 + ret = sdw_slave_sysfs_dpn_init(slave); 131 131 if (ret < 0) 132 132 dev_warn(dev, "Slave sysfs init failed:%d\n", ret); 133 133
-1
drivers/soundwire/sysfs_local.h
··· 15 15 extern const struct attribute_group *sdw_attr_groups[]; 16 16 17 17 /* additional device-managed properties reported after driver probe */ 18 - int sdw_slave_sysfs_init(struct sdw_slave *slave); 19 18 int sdw_slave_sysfs_dpn_init(struct sdw_slave *slave); 20 19 21 20 #endif /* __SDW_SYSFS_LOCAL_H */
-13
drivers/soundwire/sysfs_slave.c
··· 221 221 NULL, 222 222 }; 223 223 224 - int sdw_slave_sysfs_init(struct sdw_slave *slave) 225 - { 226 - int ret; 227 - 228 - if (slave->prop.source_ports || slave->prop.sink_ports) { 229 - ret = sdw_slave_sysfs_dpn_init(slave); 230 - if (ret < 0) 231 - return ret; 232 - } 233 - 234 - return 0; 235 - } 236 - 237 224 /* 238 225 * the status is shown in capital letters for UNATTACHED and RESERVED 239 226 * on purpose, to highligh users to the fact that these status values
+3
drivers/soundwire/sysfs_slave_dpn.c
··· 283 283 int ret; 284 284 int i; 285 285 286 + if (!slave->prop.source_ports && !slave->prop.sink_ports) 287 + return 0; 288 + 286 289 mask = slave->prop.source_ports; 287 290 for_each_set_bit(i, &mask, 32) { 288 291 ret = add_all_attributes(&slave->dev, i, 1);