mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 04:18:39 +08:00
mfd: arizona-i2c: Simplify obtaining I2C match data
Simplify probe() by replacing device_get_match_data() and ID lookup for retrieving match data by i2c_get_match_data(). After this drop intializing the variable type. Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com> Tested-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20230923174928.56824-2-biju.das.jz@bp.renesas.com Signed-off-by: Lee Jones <lee@kernel.org>
This commit is contained in:
parent
69c3f91545
commit
7ec9f1f31d
@ -22,19 +22,12 @@
|
|||||||
|
|
||||||
static int arizona_i2c_probe(struct i2c_client *i2c)
|
static int arizona_i2c_probe(struct i2c_client *i2c)
|
||||||
{
|
{
|
||||||
const struct i2c_device_id *id = i2c_client_get_device_id(i2c);
|
|
||||||
const void *match_data;
|
|
||||||
struct arizona *arizona;
|
struct arizona *arizona;
|
||||||
const struct regmap_config *regmap_config = NULL;
|
const struct regmap_config *regmap_config = NULL;
|
||||||
unsigned long type = 0;
|
unsigned long type;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
match_data = device_get_match_data(&i2c->dev);
|
type = (uintptr_t)i2c_get_match_data(i2c);
|
||||||
if (match_data)
|
|
||||||
type = (unsigned long)match_data;
|
|
||||||
else if (id)
|
|
||||||
type = id->driver_data;
|
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case WM5102:
|
case WM5102:
|
||||||
if (IS_ENABLED(CONFIG_MFD_WM5102))
|
if (IS_ENABLED(CONFIG_MFD_WM5102))
|
||||||
|
Loading…
Reference in New Issue
Block a user