diff options
author | Stephen Kitt <steve@sk2.org> | 2022-04-15 18:06:11 +0200 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2022-04-25 13:58:55 +0100 |
commit | 55116b39e5e1c2d0fd1a77e9f46ce8437623e0e8 (patch) | |
tree | 141cefdfe602659df0cae310b4fb616d2321990d /sound/soc/codecs/tas571x.c | |
parent | 3577a8a0ac5b9aaf22ff4fa6a9670cf85351ae50 (diff) | |
download | lwn-55116b39e5e1c2d0fd1a77e9f46ce8437623e0e8.tar.gz lwn-55116b39e5e1c2d0fd1a77e9f46ce8437623e0e8.zip |
ASoC: tas*: use i2c_match_id and simple i2c probe
As part of the ongoing i2c transition to the simple probe
("probe_new"), this patch uses i2c_match_id to retrieve the
driver_data for the probed device. The id parameter is thus no longer
necessary and the simple probe can be used instead.
The i2c id tables are moved up before the probe function, as
suggested by Wolfram Sang, except where the existing code already had
a declaration for the of_device_id table.
Signed-off-by: Stephen Kitt <steve@sk2.org>
Link: https://lore.kernel.org/r/20220415160613.148882-6-steve@sk2.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/codecs/tas571x.c')
-rw-r--r-- | sound/soc/codecs/tas571x.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/sound/soc/codecs/tas571x.c b/sound/soc/codecs/tas571x.c index a3e682376946..dd289774efb2 100644 --- a/sound/soc/codecs/tas571x.c +++ b/sound/soc/codecs/tas571x.c @@ -774,9 +774,9 @@ static struct snd_soc_dai_driver tas571x_dai = { }; static const struct of_device_id tas571x_of_match[] __maybe_unused; +static const struct i2c_device_id tas571x_i2c_id[]; -static int tas571x_i2c_probe(struct i2c_client *client, - const struct i2c_device_id *id) +static int tas571x_i2c_probe(struct i2c_client *client) { struct tas571x_private *priv; struct device *dev = &client->dev; @@ -791,8 +791,11 @@ static int tas571x_i2c_probe(struct i2c_client *client, of_id = of_match_device(tas571x_of_match, dev); if (of_id) priv->chip = of_id->data; - else + else { + const struct i2c_device_id *id = + i2c_match_id(tas571x_i2c_id, client); priv->chip = (void *) id->driver_data; + } priv->mclk = devm_clk_get(dev, "mclk"); if (IS_ERR(priv->mclk) && PTR_ERR(priv->mclk) != -ENOENT) { @@ -914,7 +917,7 @@ static struct i2c_driver tas571x_i2c_driver = { .name = "tas571x", .of_match_table = of_match_ptr(tas571x_of_match), }, - .probe = tas571x_i2c_probe, + .probe_new = tas571x_i2c_probe, .remove = tas571x_i2c_remove, .id_table = tas571x_i2c_id, }; |