Skip to content

Commit db3b16d

Browse files
bijudasBartosz Golaszewski
authored andcommitted
gpio: pcf857x: Extend match data support for OF tables
The driver has OF match table, but still it uses an ID lookup table for retrieving match data. Currently, the driver is working on the assumption that an I2C device registered via OF will always match a legacy I2C device ID. Extend match data support for OF tables by using i2c_get_match_data() instead of the ID lookup for both OF/ID matches by making similar OF/ID tables. Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Reviewed-by: Andy Shevchenko <andy@kernel.org> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
1 parent bb5ad5e commit db3b16d

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

drivers/gpio/gpio-pcf857x.c

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,19 @@ static const struct i2c_device_id pcf857x_id[] = {
3636
MODULE_DEVICE_TABLE(i2c, pcf857x_id);
3737

3838
static const struct of_device_id pcf857x_of_table[] = {
39-
{ .compatible = "nxp,pcf8574" },
40-
{ .compatible = "nxp,pcf8574a" },
41-
{ .compatible = "nxp,pca8574" },
42-
{ .compatible = "nxp,pca9670" },
43-
{ .compatible = "nxp,pca9672" },
44-
{ .compatible = "nxp,pca9674" },
45-
{ .compatible = "nxp,pcf8575" },
46-
{ .compatible = "nxp,pca8575" },
47-
{ .compatible = "nxp,pca9671" },
48-
{ .compatible = "nxp,pca9673" },
49-
{ .compatible = "nxp,pca9675" },
50-
{ .compatible = "maxim,max7328" },
51-
{ .compatible = "maxim,max7329" },
39+
{ .compatible = "nxp,pcf8574", (void *)8 },
40+
{ .compatible = "nxp,pcf8574a", (void *)8 },
41+
{ .compatible = "nxp,pca8574", (void *)8 },
42+
{ .compatible = "nxp,pca9670", (void *)8 },
43+
{ .compatible = "nxp,pca9672", (void *)8 },
44+
{ .compatible = "nxp,pca9674", (void *)8 },
45+
{ .compatible = "nxp,pcf8575", (void *)16 },
46+
{ .compatible = "nxp,pca8575", (void *)16 },
47+
{ .compatible = "nxp,pca9671", (void *)16 },
48+
{ .compatible = "nxp,pca9673", (void *)16 },
49+
{ .compatible = "nxp,pca9675", (void *)16 },
50+
{ .compatible = "maxim,max7328", (void *)8 },
51+
{ .compatible = "maxim,max7329", (void *)8 },
5252
{ }
5353
};
5454
MODULE_DEVICE_TABLE(of, pcf857x_of_table);
@@ -272,7 +272,6 @@ static const struct irq_chip pcf857x_irq_chip = {
272272

273273
static int pcf857x_probe(struct i2c_client *client)
274274
{
275-
const struct i2c_device_id *id = i2c_client_get_device_id(client);
276275
struct pcf857x *gpio;
277276
unsigned int n_latch = 0;
278277
int status;
@@ -296,7 +295,7 @@ static int pcf857x_probe(struct i2c_client *client)
296295
gpio->chip.set_multiple = pcf857x_set_multiple;
297296
gpio->chip.direction_input = pcf857x_input;
298297
gpio->chip.direction_output = pcf857x_output;
299-
gpio->chip.ngpio = id->driver_data;
298+
gpio->chip.ngpio = (uintptr_t)i2c_get_match_data(client);
300299

301300
/* NOTE: the OnSemi jlc1562b is also largely compatible with
302301
* these parts, notably for output. It has a low-resolution

0 commit comments

Comments
 (0)