Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: pcm186x: 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 table is moved up before the probe function, as suggested
by Wolfram Sang.

Signed-off-by: Stephen Kitt <steve@sk2.org>
Link: https://lore.kernel.org/r/20220415160613.148882-5-steve@sk2.org
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Stephen Kitt and committed by
Mark Brown
3577a8a0 4ac8ebb6

+12 -12
+12 -12
sound/soc/codecs/pcm186x-i2c.c
··· 22 22 }; 23 23 MODULE_DEVICE_TABLE(of, pcm186x_of_match); 24 24 25 - static int pcm186x_i2c_probe(struct i2c_client *i2c, 26 - const struct i2c_device_id *id) 25 + static const struct i2c_device_id pcm186x_i2c_id[] = { 26 + { "pcm1862", PCM1862 }, 27 + { "pcm1863", PCM1863 }, 28 + { "pcm1864", PCM1864 }, 29 + { "pcm1865", PCM1865 }, 30 + { } 31 + }; 32 + MODULE_DEVICE_TABLE(i2c, pcm186x_i2c_id); 33 + 34 + static int pcm186x_i2c_probe(struct i2c_client *i2c) 27 35 { 36 + const struct i2c_device_id *id = i2c_match_id(pcm186x_i2c_id, i2c); 28 37 const enum pcm186x_type type = (enum pcm186x_type)id->driver_data; 29 38 int irq = i2c->irq; 30 39 struct regmap *regmap; ··· 45 36 return pcm186x_probe(&i2c->dev, type, irq, regmap); 46 37 } 47 38 48 - static const struct i2c_device_id pcm186x_i2c_id[] = { 49 - { "pcm1862", PCM1862 }, 50 - { "pcm1863", PCM1863 }, 51 - { "pcm1864", PCM1864 }, 52 - { "pcm1865", PCM1865 }, 53 - { } 54 - }; 55 - MODULE_DEVICE_TABLE(i2c, pcm186x_i2c_id); 56 - 57 39 static struct i2c_driver pcm186x_i2c_driver = { 58 - .probe = pcm186x_i2c_probe, 40 + .probe_new = pcm186x_i2c_probe, 59 41 .id_table = pcm186x_i2c_id, 60 42 .driver = { 61 43 .name = "pcm186x",