mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-02 15:18:19 +00:00
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>
This commit is contained in:
parent
1d2a22fa6d
commit
ea05787136
1 changed files with 3 additions and 15 deletions
|
@ -1051,7 +1051,6 @@ static int device_pca957x_init(struct pca953x_chip *chip, u32 invert)
|
||||||
|
|
||||||
static int pca953x_probe(struct i2c_client *client)
|
static int pca953x_probe(struct i2c_client *client)
|
||||||
{
|
{
|
||||||
const struct i2c_device_id *i2c_id = i2c_client_get_device_id(client);
|
|
||||||
struct pca953x_platform_data *pdata;
|
struct pca953x_platform_data *pdata;
|
||||||
struct pca953x_chip *chip;
|
struct pca953x_chip *chip;
|
||||||
int irq_base = 0;
|
int irq_base = 0;
|
||||||
|
@ -1090,6 +1089,9 @@ static int pca953x_probe(struct i2c_client *client)
|
||||||
}
|
}
|
||||||
|
|
||||||
chip->client = client;
|
chip->client = client;
|
||||||
|
chip->driver_data = (uintptr_t)i2c_get_match_data(client);
|
||||||
|
if (!chip->driver_data)
|
||||||
|
return -ENODEV;
|
||||||
|
|
||||||
reg = devm_regulator_get(&client->dev, "vcc");
|
reg = devm_regulator_get(&client->dev, "vcc");
|
||||||
if (IS_ERR(reg))
|
if (IS_ERR(reg))
|
||||||
|
@ -1102,20 +1104,6 @@ static int pca953x_probe(struct i2c_client *client)
|
||||||
}
|
}
|
||||||
chip->regulator = reg;
|
chip->regulator = reg;
|
||||||
|
|
||||||
if (i2c_id) {
|
|
||||||
chip->driver_data = i2c_id->driver_data;
|
|
||||||
} else {
|
|
||||||
const void *match;
|
|
||||||
|
|
||||||
match = device_get_match_data(&client->dev);
|
|
||||||
if (!match) {
|
|
||||||
ret = -ENODEV;
|
|
||||||
goto err_exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
chip->driver_data = (uintptr_t)match;
|
|
||||||
}
|
|
||||||
|
|
||||||
i2c_set_clientdata(client, chip);
|
i2c_set_clientdata(client, chip);
|
||||||
|
|
||||||
pca953x_setup_gpio(chip, chip->driver_data & PCA_GPIO_MASK);
|
pca953x_setup_gpio(chip, chip->driver_data & PCA_GPIO_MASK);
|
||||||
|
|
Loading…
Reference in a new issue