diff options
author | Sebastian Reichel <sebastian.reichel@collabora.co.uk> | 2017-05-15 11:24:33 +0200 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2017-05-23 09:49:30 +0200 |
commit | 5f853acfa9242b3091c145265131232e246d95d4 (patch) | |
tree | a47887b6fc4b83a67eec741fc74af3708f48b041 /drivers/pinctrl | |
parent | d0e49dabc60bf00b4a148742d3e4a16b1dbd8577 (diff) | |
download | linux-5f853acfa9242b3091c145265131232e246d95d4.tar.gz linux-5f853acfa9242b3091c145265131232e246d95d4.tar.bz2 linux-5f853acfa9242b3091c145265131232e246d95d4.zip |
pinctrl: mcp23s08: simplify i2c pdata handling
Simplify i2c pdata handling, so that it uses pdata when available
and falls back to reading device properties otherwise.
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl')
-rw-r--r-- | drivers/pinctrl/pinctrl-mcp23s08.c | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/drivers/pinctrl/pinctrl-mcp23s08.c b/drivers/pinctrl/pinctrl-mcp23s08.c index 3fc4195ad415..aec2dad26560 100644 --- a/drivers/pinctrl/pinctrl-mcp23s08.c +++ b/drivers/pinctrl/pinctrl-mcp23s08.c @@ -995,28 +995,16 @@ static int mcp230xx_probe(struct i2c_client *client, struct mcp23s08_platform_data *pdata, local_pdata; struct mcp23s08 *mcp; int status; - const struct of_device_id *match; - match = of_match_device(of_match_ptr(mcp23s08_i2c_of_match), - &client->dev); - if (match) { + pdata = dev_get_platdata(&client->dev); + if (!pdata) { pdata = &local_pdata; pdata->base = -1; - pdata->irq_controller = of_property_read_bool( - client->dev.of_node, - "interrupt-controller"); - pdata->mirror = of_property_read_bool(client->dev.of_node, - "microchip,irq-mirror"); - } else { - pdata = dev_get_platdata(&client->dev); - if (!pdata) { - pdata = devm_kzalloc(&client->dev, - sizeof(struct mcp23s08_platform_data), - GFP_KERNEL); - if (!pdata) - return -ENOMEM; - pdata->base = -1; - } + + pdata->irq_controller = device_property_read_bool( + &client->dev, "interrupt-controller"); + pdata->mirror = device_property_read_bool( + &client->dev, "microchip,irq-mirror"); } mcp = devm_kzalloc(&client->dev, sizeof(*mcp), GFP_KERNEL); |