Skip to content

Commit 772ed12

Browse files
Srinivas Kandagatlabroonie
authored andcommitted
ASoC: codecs: wcdxxxx: use of_sdw_find_device_by_node helper
use of_sdw_find_device_by_node helper function, rather than duplicating this function in every codec driver. Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> Link: https://patch.msgid.link/20250909121954.225833-6-srinivas.kandagatla@oss.qualcomm.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 2e07017 commit 772ed12

9 files changed

Lines changed: 6 additions & 39 deletions

File tree

sound/soc/codecs/wcd937x-sdw.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,6 @@ static struct sdw_dpn_prop wcd937x_dpn_prop[WCD937X_MAX_SWR_PORTS] = {
7878
}
7979
};
8080

81-
struct device *wcd937x_sdw_device_get(struct device_node *np)
82-
{
83-
return bus_find_device_by_of_node(&sdw_bus_type, np);
84-
}
85-
EXPORT_SYMBOL_GPL(wcd937x_sdw_device_get);
86-
8781
int wcd937x_sdw_hw_params(struct wcd937x_sdw_priv *wcd,
8882
struct snd_pcm_substream *substream,
8983
struct snd_pcm_hw_params *params,

sound/soc/codecs/wcd937x.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2788,7 +2788,7 @@ static int wcd937x_bind(struct device *dev)
27882788
return ret;
27892789
}
27902790

2791-
wcd937x->rxdev = wcd937x_sdw_device_get(wcd937x->rxnode);
2791+
wcd937x->rxdev = of_sdw_find_device_by_node(wcd937x->rxnode);
27922792
if (!wcd937x->rxdev) {
27932793
dev_err(dev, "could not find slave with matching of node\n");
27942794
return -EINVAL;
@@ -2797,7 +2797,7 @@ static int wcd937x_bind(struct device *dev)
27972797
wcd937x->sdw_priv[AIF1_PB] = dev_get_drvdata(wcd937x->rxdev);
27982798
wcd937x->sdw_priv[AIF1_PB]->wcd937x = wcd937x;
27992799

2800-
wcd937x->txdev = wcd937x_sdw_device_get(wcd937x->txnode);
2800+
wcd937x->txdev = of_sdw_find_device_by_node(wcd937x->txnode);
28012801
if (!wcd937x->txdev) {
28022802
dev_err(dev, "could not find txslave with matching of node\n");
28032803
return -EINVAL;

sound/soc/codecs/wcd937x.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -549,8 +549,6 @@ int wcd937x_sdw_hw_params(struct wcd937x_sdw_priv *wcd,
549549
struct snd_pcm_hw_params *params,
550550
struct snd_soc_dai *dai);
551551

552-
struct device *wcd937x_sdw_device_get(struct device_node *np);
553-
554552
#else
555553
static inline int wcd937x_sdw_free(struct wcd937x_sdw_priv *wcd,
556554
struct snd_pcm_substream *substream,

sound/soc/codecs/wcd938x-sdw.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,6 @@ static struct sdw_dpn_prop wcd938x_dpn_prop[WCD938X_MAX_SWR_PORTS] = {
8282
}
8383
};
8484

85-
struct device *wcd938x_sdw_device_get(struct device_node *np)
86-
{
87-
return bus_find_device_by_of_node(&sdw_bus_type, np);
88-
89-
}
90-
EXPORT_SYMBOL_GPL(wcd938x_sdw_device_get);
91-
9285
int wcd938x_swr_get_current_bank(struct sdw_slave *sdev)
9386
{
9487
int bank;

sound/soc/codecs/wcd938x.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3400,7 +3400,7 @@ static int wcd938x_bind(struct device *dev)
34003400
return ret;
34013401
}
34023402

3403-
wcd938x->rxdev = wcd938x_sdw_device_get(wcd938x->rxnode);
3403+
wcd938x->rxdev = of_sdw_find_device_by_node(wcd938x->rxnode);
34043404
if (!wcd938x->rxdev) {
34053405
dev_err(dev, "could not find slave with matching of node\n");
34063406
ret = -EINVAL;
@@ -3409,7 +3409,7 @@ static int wcd938x_bind(struct device *dev)
34093409
wcd938x->sdw_priv[AIF1_PB] = dev_get_drvdata(wcd938x->rxdev);
34103410
wcd938x->sdw_priv[AIF1_PB]->wcd938x = wcd938x;
34113411

3412-
wcd938x->txdev = wcd938x_sdw_device_get(wcd938x->txnode);
3412+
wcd938x->txdev = of_sdw_find_device_by_node(wcd938x->txnode);
34133413
if (!wcd938x->txdev) {
34143414
dev_err(dev, "could not find txslave with matching of node\n");
34153415
ret = -EINVAL;

sound/soc/codecs/wcd938x.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,6 @@ int wcd938x_sdw_hw_params(struct wcd938x_sdw_priv *wcd,
670670
struct snd_pcm_hw_params *params,
671671
struct snd_soc_dai *dai);
672672

673-
struct device *wcd938x_sdw_device_get(struct device_node *np);
674673
int wcd938x_swr_get_current_bank(struct sdw_slave *sdev);
675674

676675
#else
@@ -697,11 +696,6 @@ static inline int wcd938x_sdw_hw_params(struct wcd938x_sdw_priv *wcd,
697696
return -EOPNOTSUPP;
698697
}
699698

700-
static inline struct device *wcd938x_sdw_device_get(struct device_node *np)
701-
{
702-
return NULL;
703-
}
704-
705699
static inline int wcd938x_swr_get_current_bank(struct sdw_slave *sdev)
706700
{
707701
return 0;

sound/soc/codecs/wcd939x-sdw.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,6 @@ static struct sdw_dpn_prop wcd939x_tx_dpn_prop[WCD939X_MAX_TX_SWR_PORTS] = {
128128
}
129129
};
130130

131-
struct device *wcd939x_sdw_device_get(struct device_node *np)
132-
{
133-
return bus_find_device_by_of_node(&sdw_bus_type, np);
134-
}
135-
EXPORT_SYMBOL_GPL(wcd939x_sdw_device_get);
136-
137131
unsigned int wcd939x_swr_get_current_bank(struct sdw_slave *sdev)
138132
{
139133
return FIELD_GET(SDW_SCP_STAT_CURR_BANK,

sound/soc/codecs/wcd939x.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3383,7 +3383,7 @@ static int wcd939x_bind(struct device *dev)
33833383
goto err_put_typec_switch;
33843384
}
33853385

3386-
wcd939x->rxdev = wcd939x_sdw_device_get(wcd939x->rxnode);
3386+
wcd939x->rxdev = of_sdw_find_device_by_node(wcd939x->rxnode);
33873387
if (!wcd939x->rxdev) {
33883388
dev_err(dev, "could not find slave with matching of node\n");
33893389
ret = -EINVAL;
@@ -3392,7 +3392,7 @@ static int wcd939x_bind(struct device *dev)
33923392
wcd939x->sdw_priv[AIF1_PB] = dev_get_drvdata(wcd939x->rxdev);
33933393
wcd939x->sdw_priv[AIF1_PB]->wcd939x = wcd939x;
33943394

3395-
wcd939x->txdev = wcd939x_sdw_device_get(wcd939x->txnode);
3395+
wcd939x->txdev = of_sdw_find_device_by_node(wcd939x->txnode);
33963396
if (!wcd939x->txdev) {
33973397
dev_err(dev, "could not find txslave with matching of node\n");
33983398
ret = -EINVAL;

sound/soc/codecs/wcd939x.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -930,7 +930,6 @@ int wcd939x_sdw_hw_params(struct wcd939x_sdw_priv *wcd,
930930
struct snd_pcm_hw_params *params,
931931
struct snd_soc_dai *dai);
932932

933-
struct device *wcd939x_sdw_device_get(struct device_node *np);
934933
unsigned int wcd939x_swr_get_current_bank(struct sdw_slave *sdev);
935934

936935
struct regmap *wcd939x_swr_get_regmap(struct wcd939x_sdw_priv *wcd);
@@ -958,11 +957,6 @@ static inline int wcd939x_sdw_hw_params(struct wcd939x_sdw_priv *wcd,
958957
return -EOPNOTSUPP;
959958
}
960959

961-
static inline struct device *wcd939x_sdw_device_get(struct device_node *np)
962-
{
963-
return NULL;
964-
}
965-
966960
static inline unsigned int wcd939x_swr_get_current_bank(struct sdw_slave *sdev)
967961
{
968962
return 0;

0 commit comments

Comments
 (0)