Skip to content

Commit ea05787

Browse files
bijudasBartosz Golaszewski
authored andcommitted
gpio: pca953x: Use i2c_get_match_data()
Replace device_get_match_data() and id lookup for retrieving match data by i2c_get_match_data(). Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
1 parent 1d2a22f commit ea05787

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

drivers/gpio/gpio-pca953x.c

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,7 +1051,6 @@ static int device_pca957x_init(struct pca953x_chip *chip, u32 invert)
10511051

10521052
static int pca953x_probe(struct i2c_client *client)
10531053
{
1054-
const struct i2c_device_id *i2c_id = i2c_client_get_device_id(client);
10551054
struct pca953x_platform_data *pdata;
10561055
struct pca953x_chip *chip;
10571056
int irq_base = 0;
@@ -1090,6 +1089,9 @@ static int pca953x_probe(struct i2c_client *client)
10901089
}
10911090

10921091
chip->client = client;
1092+
chip->driver_data = (uintptr_t)i2c_get_match_data(client);
1093+
if (!chip->driver_data)
1094+
return -ENODEV;
10931095

10941096
reg = devm_regulator_get(&client->dev, "vcc");
10951097
if (IS_ERR(reg))
@@ -1102,20 +1104,6 @@ static int pca953x_probe(struct i2c_client *client)
11021104
}
11031105
chip->regulator = reg;
11041106

1105-
if (i2c_id) {
1106-
chip->driver_data = i2c_id->driver_data;
1107-
} else {
1108-
const void *match;
1109-
1110-
match = device_get_match_data(&client->dev);
1111-
if (!match) {
1112-
ret = -ENODEV;
1113-
goto err_exit;
1114-
}
1115-
1116-
chip->driver_data = (uintptr_t)match;
1117-
}
1118-
11191107
i2c_set_clientdata(client, chip);
11201108

11211109
pca953x_setup_gpio(chip, chip->driver_data & PCA_GPIO_MASK);

0 commit comments

Comments
 (0)