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.

ASoC: tas5720: Remove use of i2c_match_id()

The function i2c_match_id() is used to fetch the matching ID from
the i2c_device_id table. This is often used to then retrieve the
matching driver_data. This can be done in one step with the helper
i2c_get_match_data().

This helper has a couple other benefits:
* It doesn't need the i2c_device_id passed in so we do not need
to have that forward declared, allowing us to remove those or
move the i2c_device_id table down to its more natural spot
with the other module info.
* It also checks for device match data, which allows for OF and
ACPI based probing. That means we do not have to manually check
those first and can remove those checks.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://patch.msgid.link/20241203200001.197295-15-afd@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Andrew Davis and committed by
Mark Brown
06c61070 af4cffb2

+3 -7
+3 -7
sound/soc/codecs/tas5720.c
··· 43 43 struct tas5720_data { 44 44 struct snd_soc_component *component; 45 45 struct regmap *regmap; 46 - struct i2c_client *tas5720_client; 47 46 enum tas572x_type devtype; 48 47 struct regulator_bulk_data supplies[TAS5720_NUM_SUPPLIES]; 49 48 struct delayed_work fault_check_work; ··· 728 729 struct device *dev = &client->dev; 729 730 struct tas5720_data *data; 730 731 const struct regmap_config *regmap_config; 731 - const struct i2c_device_id *id; 732 732 int ret; 733 733 int i; 734 734 ··· 735 737 if (!data) 736 738 return -ENOMEM; 737 739 738 - id = i2c_match_id(tas5720_id, client); 739 - data->tas5720_client = client; 740 - data->devtype = id->driver_data; 740 + data->devtype = (uintptr_t)i2c_get_match_data(client); 741 741 742 - switch (id->driver_data) { 742 + switch (data->devtype) { 743 743 case TAS5720: 744 744 regmap_config = &tas5720_regmap_config; 745 745 break; ··· 770 774 771 775 dev_set_drvdata(dev, data); 772 776 773 - switch (id->driver_data) { 777 + switch (data->devtype) { 774 778 case TAS5720: 775 779 ret = devm_snd_soc_register_component(&client->dev, 776 780 &soc_component_dev_tas5720,