ASoC: da7218: 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. This patch follows the model set by da7218_of_get_id(). Signed-off-by: Stephen Kitt <steve@sk2.org> Reviewed-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com> Link: https://lore.kernel.org/r/20220325171904.1223539-1-steve@sk2.org Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Родитель
89be5dc60d
Коммит
5e9058ea2b
|
@ -3258,8 +3258,19 @@ static const struct regmap_config da7218_regmap_config = {
|
|||
* I2C layer
|
||||
*/
|
||||
|
||||
static int da7218_i2c_probe(struct i2c_client *i2c,
|
||||
const struct i2c_device_id *id)
|
||||
static const struct i2c_device_id da7218_i2c_id[];
|
||||
|
||||
static inline int da7218_i2c_get_id(struct i2c_client *i2c)
|
||||
{
|
||||
const struct i2c_device_id *id = i2c_match_id(da7218_i2c_id, i2c);
|
||||
|
||||
if (id)
|
||||
return (uintptr_t)id->driver_data;
|
||||
else
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static int da7218_i2c_probe(struct i2c_client *i2c)
|
||||
{
|
||||
struct da7218_priv *da7218;
|
||||
int ret;
|
||||
|
@ -3273,7 +3284,7 @@ static int da7218_i2c_probe(struct i2c_client *i2c,
|
|||
if (i2c->dev.of_node)
|
||||
da7218->dev_id = da7218_of_get_id(&i2c->dev);
|
||||
else
|
||||
da7218->dev_id = id->driver_data;
|
||||
da7218->dev_id = da7218_i2c_get_id(i2c);
|
||||
|
||||
if ((da7218->dev_id != DA7217_DEV_ID) &&
|
||||
(da7218->dev_id != DA7218_DEV_ID)) {
|
||||
|
@ -3311,7 +3322,7 @@ static struct i2c_driver da7218_i2c_driver = {
|
|||
.name = "da7218",
|
||||
.of_match_table = da7218_of_match,
|
||||
},
|
||||
.probe = da7218_i2c_probe,
|
||||
.probe_new = da7218_i2c_probe,
|
||||
.id_table = da7218_i2c_id,
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче