Skip to content

Commit f72a9c2

Browse files
jwrdegoedebroonie
authored andcommitted
ASoC: rt5645: Refactor rt5645_parse_dt()
Refactor rt5645_parse_dt(), make it take a pointer to struct rt5645_platform_data as argument instead of passing in the complete rt5645_priv struct. While at it also make it void since it always succeeds. This is a preparation patch for factoring the code to get the platform-data out into a separate helper function. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Link: https://msgid.link/r/20231126214024.300505-4-hdegoede@redhat.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 8f28e19 commit f72a9c2

1 file changed

Lines changed: 6 additions & 12 deletions

File tree

sound/soc/codecs/rt5645.c

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3869,18 +3869,12 @@ static bool rt5645_check_dp(struct device *dev)
38693869
return false;
38703870
}
38713871

3872-
static int rt5645_parse_dt(struct rt5645_priv *rt5645, struct device *dev)
3872+
static void rt5645_parse_dt(struct device *dev, struct rt5645_platform_data *pdata)
38733873
{
3874-
rt5645->pdata.in2_diff = device_property_read_bool(dev,
3875-
"realtek,in2-differential");
3876-
device_property_read_u32(dev,
3877-
"realtek,dmic1-data-pin", &rt5645->pdata.dmic1_data_pin);
3878-
device_property_read_u32(dev,
3879-
"realtek,dmic2-data-pin", &rt5645->pdata.dmic2_data_pin);
3880-
device_property_read_u32(dev,
3881-
"realtek,jd-mode", &rt5645->pdata.jd_mode);
3882-
3883-
return 0;
3874+
pdata->in2_diff = device_property_read_bool(dev, "realtek,in2-differential");
3875+
device_property_read_u32(dev, "realtek,dmic1-data-pin", &pdata->dmic1_data_pin);
3876+
device_property_read_u32(dev, "realtek,dmic2-data-pin", &pdata->dmic2_data_pin);
3877+
device_property_read_u32(dev, "realtek,jd-mode", &pdata->jd_mode);
38843878
}
38853879

38863880
static int rt5645_i2c_probe(struct i2c_client *i2c)
@@ -3909,7 +3903,7 @@ static int rt5645_i2c_probe(struct i2c_client *i2c)
39093903
if (pdata)
39103904
rt5645->pdata = *pdata;
39113905
else if (rt5645_check_dp(&i2c->dev))
3912-
rt5645_parse_dt(rt5645, &i2c->dev);
3906+
rt5645_parse_dt(&i2c->dev, &rt5645->pdata);
39133907
else
39143908
rt5645->pdata = jd_mode3_platform_data;
39153909

0 commit comments

Comments
 (0)