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

Configure Feed

Select the types of activity you want to include in your feed.

soundwire: bus: add of_sdw_find_device_by_node helper

There has been more than 3 instances of this helper in multiple codec
drivers, it does not make sense to keep duplicating this part of code.

Lets add a helper of_sdw_find_device_by_node for codec drivers to use it.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Acked-by: Vinod Koul <vkoul@kernel.org>
Link: https://patch.msgid.link/20250909121954.225833-4-srinivas.kandagatla@oss.qualcomm.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Srinivas Kandagatla and committed by
Mark Brown
76cffc3e c4bb62eb

+15
+6
drivers/soundwire/slave.c
··· 273 273 return 0; 274 274 } 275 275 276 + struct device *of_sdw_find_device_by_node(struct device_node *np) 277 + { 278 + return bus_find_device_by_of_node(&sdw_bus_type, np); 279 + } 280 + EXPORT_SYMBOL_GPL(of_sdw_find_device_by_node); 281 + 276 282 MODULE_IMPORT_NS("SND_SOC_SDCA");
+9
include/linux/soundwire/sdw.h
··· 19 19 20 20 struct dentry; 21 21 struct fwnode_handle; 22 + struct device_node; 22 23 23 24 struct sdw_bus; 24 25 struct sdw_slave; ··· 1087 1086 int sdw_stream_remove_slave(struct sdw_slave *slave, 1088 1087 struct sdw_stream_runtime *stream); 1089 1088 1089 + struct device *of_sdw_find_device_by_node(struct device_node *np); 1090 + 1090 1091 int sdw_slave_get_scale_index(struct sdw_slave *slave, u8 *base); 1091 1092 1092 1093 /* messaging and data APIs */ ··· 1120 1117 { 1121 1118 WARN_ONCE(1, "SoundWire API is disabled"); 1122 1119 return -EINVAL; 1120 + } 1121 + 1122 + static inline struct device *of_sdw_find_device_by_node(struct device_node *np) 1123 + { 1124 + WARN_ONCE(1, "SoundWire API is disabled"); 1125 + return NULL; 1123 1126 } 1124 1127 1125 1128 /* messaging and data APIs */