Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1641468
| From | Sebastian Reichel <sebastian.reichel@collabora.co.uk> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCHv3 09/14] pinctrl: mcp23s08: simplify i2c pdata handling |
| Date | 2017-05-15 11:30 +0200 |
| Message-ID | <tHkuf-6eH-23@gated-at.bofh.it> (permalink) |
| References | <tHkud-6eH-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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>
---
drivers/pinctrl/pinctrl-mcp23s08.c | 26 +++++++-------------------
1 file 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);
--
2.11.0
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCHv3 00/14] mcp23s08 pinconf & cleanup Sebastian Reichel <sebastian.reichel@collabora.co.uk> - 2017-05-15 11:30 +0200
[PATCHv3 09/14] pinctrl: mcp23s08: simplify i2c pdata handling Sebastian Reichel <sebastian.reichel@collabora.co.uk> - 2017-05-15 11:30 +0200
[PATCHv3 13/14] pinctrl: mcp23s08: drop comment about missing irq support Sebastian Reichel <sebastian.reichel@collabora.co.uk> - 2017-05-15 11:30 +0200
[PATCHv3 03/14] pinctrl: mcp23s08: drop pullup config from pdata Sebastian Reichel <sebastian.reichel@collabora.co.uk> - 2017-05-15 11:30 +0200
[PATCHv3 07/14] pinctrl: mcp23s08: use managed kzalloc for mcp Sebastian Reichel <sebastian.reichel@collabora.co.uk> - 2017-05-15 11:30 +0200
[PATCHv3 12/14] pinctrl: mcp23s08: simplify spi_present_mask handling Sebastian Reichel <sebastian.reichel@collabora.co.uk> - 2017-05-15 11:30 +0200
[PATCHv3 08/14] pinctrl: mcp23s08: switch to devm_gpiochip_add_data Sebastian Reichel <sebastian.reichel@collabora.co.uk> - 2017-05-15 11:30 +0200
[PATCHv3 10/14] pinctrl: mcp23s08: simplify spi pdata handling Sebastian Reichel <sebastian.reichel@collabora.co.uk> - 2017-05-15 11:30 +0200
[PATCHv3 02/14] pinctrl: mcp23s08: add pinconf support Sebastian Reichel <sebastian.reichel@collabora.co.uk> - 2017-05-15 11:30 +0200
Re: [PATCHv3 02/14] pinctrl: mcp23s08: add pinconf support Sebastian Reichel <sebastian.reichel@collabora.co.uk> - 2017-05-15 14:40 +0200
[PATCHv3 05/14] pinctrl: mcp23s08: drop OF_GPIO dependency Sebastian Reichel <sebastian.reichel@collabora.co.uk> - 2017-05-15 11:30 +0200
[PATCHv3 01/14] gpio: mcp23s08: move to pinctrl Sebastian Reichel <sebastian.reichel@collabora.co.uk> - 2017-05-15 11:30 +0200
Re: [PATCHv3 01/14] gpio: mcp23s08: move to pinctrl Sylvain Lemieux <slemieux.tyco@gmail.com> - 2017-05-16 21:50 +0200
[PATCHv3 11/14] pinctrl: mcp23s08: generalize irq property handling Sebastian Reichel <sebastian.reichel@collabora.co.uk> - 2017-05-15 11:30 +0200
Re: [PATCHv3 00/14] mcp23s08 pinconf & cleanup Linus Walleij <linus.walleij@linaro.org> - 2017-05-23 10:00 +0200
csiph-web