mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-27 06:04:23 +08:00
ASoC: tlv320aic32x4-i2c: Simplify probe()
Simplify probe() by replacing of_match_node() and i2c_match_id() with i2c_get_match_data(). Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20230831194622.87653-3-biju.das.jz@bp.renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
cac1636e21
commit
d44f7bc9d1
@ -16,9 +16,6 @@
|
|||||||
|
|
||||||
#include "tlv320aic32x4.h"
|
#include "tlv320aic32x4.h"
|
||||||
|
|
||||||
static const struct of_device_id aic32x4_of_id[];
|
|
||||||
static const struct i2c_device_id aic32x4_i2c_id[];
|
|
||||||
|
|
||||||
static int aic32x4_i2c_probe(struct i2c_client *i2c)
|
static int aic32x4_i2c_probe(struct i2c_client *i2c)
|
||||||
{
|
{
|
||||||
struct regmap *regmap;
|
struct regmap *regmap;
|
||||||
@ -30,18 +27,7 @@ static int aic32x4_i2c_probe(struct i2c_client *i2c)
|
|||||||
config.val_bits = 8;
|
config.val_bits = 8;
|
||||||
|
|
||||||
regmap = devm_regmap_init_i2c(i2c, &config);
|
regmap = devm_regmap_init_i2c(i2c, &config);
|
||||||
|
type = (uintptr_t)i2c_get_match_data(i2c);
|
||||||
if (i2c->dev.of_node) {
|
|
||||||
const struct of_device_id *oid;
|
|
||||||
|
|
||||||
oid = of_match_node(aic32x4_of_id, i2c->dev.of_node);
|
|
||||||
type = (uintptr_t)oid->data;
|
|
||||||
} else {
|
|
||||||
const struct i2c_device_id *id;
|
|
||||||
|
|
||||||
id = i2c_match_id(aic32x4_i2c_id, i2c);
|
|
||||||
type = id->driver_data;
|
|
||||||
}
|
|
||||||
|
|
||||||
return aic32x4_probe(&i2c->dev, regmap, type);
|
return aic32x4_probe(&i2c->dev, regmap, type);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user