summaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl/pinctrl-mcp23s08_i2c.c
diff options
context:
space:
mode:
authorBiju Das <biju.das.jz@bp.renesas.com>2023-10-01 16:01:11 +0100
committerLinus Walleij <linus.walleij@linaro.org>2023-10-10 13:39:38 +0200
commit880d3fcbe5b54920df7a5c8878ca6785938df62a (patch)
treeba57e5e04fc467bc84c579bbc4f5b01d74676f10 /drivers/pinctrl/pinctrl-mcp23s08_i2c.c
parent0aa5369fdb9ee5910a369c321b1c519d49592678 (diff)
downloadlinux-880d3fcbe5b54920df7a5c8878ca6785938df62a.tar.gz
linux-880d3fcbe5b54920df7a5c8878ca6785938df62a.tar.bz2
linux-880d3fcbe5b54920df7a5c8878ca6785938df62a.zip
pinctrl: mcp23s08_i2c: Extend match support for OF tables
The driver has OF match table, still it uses ID lookup table for retrieving match data. Currently the driver is working on the assumption that a I2C device registered via OF will always match a legacy I2C device ID. The correct approach is to have an OF device ID table using of_device_match_data() if the devices are registered via OF. 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/20231001150113.7752-2-biju.das.jz@bp.renesas.com Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/pinctrl-mcp23s08_i2c.c')
-rw-r--r--drivers/pinctrl/pinctrl-mcp23s08_i2c.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/pinctrl/pinctrl-mcp23s08_i2c.c b/drivers/pinctrl/pinctrl-mcp23s08_i2c.c
index 3dd1bd8e73eb..41ea2650a7e4 100644
--- a/drivers/pinctrl/pinctrl-mcp23s08_i2c.c
+++ b/drivers/pinctrl/pinctrl-mcp23s08_i2c.c
@@ -10,16 +10,16 @@
static int mcp230xx_probe(struct i2c_client *client)
{
- const struct i2c_device_id *id = i2c_client_get_device_id(client);
struct device *dev = &client->dev;
- unsigned int type = id->driver_data;
struct mcp23s08 *mcp;
+ unsigned int type;
int ret;
mcp = devm_kzalloc(dev, sizeof(*mcp), GFP_KERNEL);
if (!mcp)
return -ENOMEM;
+ type = (uintptr_t)i2c_get_match_data(client);
switch (type) {
case MCP_TYPE_008:
mcp->regmap = devm_regmap_init_i2c(client, &mcp23x08_regmap);