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: wm8985: 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-21-afd@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Andrew Davis and committed by
Mark Brown
7d57d1ce 77f3bfea

+1 -3
+1 -3
sound/soc/codecs/wm8985.c
··· 1166 1166 #endif 1167 1167 1168 1168 #if IS_ENABLED(CONFIG_I2C) 1169 - static const struct i2c_device_id wm8985_i2c_id[]; 1170 1169 1171 1170 static int wm8985_i2c_probe(struct i2c_client *i2c) 1172 1171 { 1173 1172 struct wm8985_priv *wm8985; 1174 - const struct i2c_device_id *id = i2c_match_id(wm8985_i2c_id, i2c); 1175 1173 int ret; 1176 1174 1177 1175 wm8985 = devm_kzalloc(&i2c->dev, sizeof *wm8985, GFP_KERNEL); ··· 1178 1180 1179 1181 i2c_set_clientdata(i2c, wm8985); 1180 1182 1181 - wm8985->dev_type = id->driver_data; 1183 + wm8985->dev_type = (uintptr_t)i2c_get_match_data(i2c); 1182 1184 1183 1185 wm8985->regmap = devm_regmap_init_i2c(i2c, &wm8985_regmap); 1184 1186 if (IS_ERR(wm8985->regmap)) {