diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2020-04-07 20:38:41 +0300 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2020-04-16 15:21:23 +0300 |
commit | 6aba6ed879b3471903c8ada28ba968a268df6143 (patch) | |
tree | 32a1fdb7d4f5c1c077126713286f808399a36ea3 /drivers/pinctrl/pinctrl-mcp23s08.c | |
parent | f9a8744dde48f368768b3a6de389b7ec2751d192 (diff) | |
download | linux-6aba6ed879b3471903c8ada28ba968a268df6143.tar.xz |
pinctrl: mcp23s08: Get rid of legacy platform data
Platform data is a legacy interface to supply device properties
to the driver. In this case we even don't have in-kernel users
for it. Just remove it for good.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20200407173849.43628-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/pinctrl-mcp23s08.c')
-rw-r--r-- | drivers/pinctrl/pinctrl-mcp23s08.c | 42 |
1 files changed, 12 insertions, 30 deletions
diff --git a/drivers/pinctrl/pinctrl-mcp23s08.c b/drivers/pinctrl/pinctrl-mcp23s08.c index 3a235487e38d..2c8b8c45b70e 100644 --- a/drivers/pinctrl/pinctrl-mcp23s08.c +++ b/drivers/pinctrl/pinctrl-mcp23s08.c @@ -8,7 +8,6 @@ #include <linux/gpio/driver.h> #include <linux/i2c.h> #include <linux/spi/spi.h> -#include <linux/spi/mcp23s08.h> #include <linux/slab.h> #include <asm/byteorder.h> #include <linux/interrupt.h> @@ -914,16 +913,9 @@ MODULE_DEVICE_TABLE(of, mcp23s08_i2c_of_match); static int mcp230xx_probe(struct i2c_client *client, const struct i2c_device_id *id) { - struct mcp23s08_platform_data *pdata, local_pdata; struct mcp23s08 *mcp; int status; - pdata = dev_get_platdata(&client->dev); - if (!pdata) { - pdata = &local_pdata; - pdata->base = -1; - } - mcp = devm_kzalloc(&client->dev, sizeof(*mcp), GFP_KERNEL); if (!mcp) return -ENOMEM; @@ -937,7 +929,7 @@ static int mcp230xx_probe(struct i2c_client *client, mcp->irq_chip.irq_bus_sync_unlock = mcp23s08_irq_bus_unlock; status = mcp23s08_probe_one(mcp, &client->dev, client, client->addr, - id->driver_data, pdata->base, 0); + id->driver_data, -1, 0); if (status) return status; @@ -986,13 +978,13 @@ static void mcp23s08_i2c_exit(void) { } static int mcp23s08_probe(struct spi_device *spi) { - struct mcp23s08_platform_data *pdata, local_pdata; unsigned addr; int chips = 0; struct mcp23s08_driver_data *data; int status, type; unsigned ngpio = 0; const struct of_device_id *match; + u32 spi_present_mask; match = of_match_device(of_match_ptr(mcp23s08_spi_of_match), &spi->dev); if (match) @@ -1000,32 +992,24 @@ static int mcp23s08_probe(struct spi_device *spi) else type = spi_get_device_id(spi)->driver_data; - pdata = dev_get_platdata(&spi->dev); - if (!pdata) { - pdata = &local_pdata; - pdata->base = -1; - + status = device_property_read_u32(&spi->dev, + "microchip,spi-present-mask", &spi_present_mask); + if (status) { status = device_property_read_u32(&spi->dev, - "microchip,spi-present-mask", &pdata->spi_present_mask); + "mcp,spi-present-mask", &spi_present_mask); if (status) { - status = device_property_read_u32(&spi->dev, - "mcp,spi-present-mask", - &pdata->spi_present_mask); - - if (status) { - dev_err(&spi->dev, "missing spi-present-mask"); - return -ENODEV; - } + dev_err(&spi->dev, "missing spi-present-mask"); + return -ENODEV; } } - if (!pdata->spi_present_mask || pdata->spi_present_mask > 0xff) { + if (!spi_present_mask || spi_present_mask > 0xff) { dev_err(&spi->dev, "invalid spi-present-mask"); return -ENODEV; } for (addr = 0; addr < MCP_MAX_DEV_PER_CS; addr++) { - if (pdata->spi_present_mask & BIT(addr)) + if (spi_present_mask & BIT(addr)) chips++; } @@ -1040,7 +1024,7 @@ static int mcp23s08_probe(struct spi_device *spi) spi_set_drvdata(spi, data); for (addr = 0; addr < MCP_MAX_DEV_PER_CS; addr++) { - if (!(pdata->spi_present_mask & BIT(addr))) + if (!(spi_present_mask & BIT(addr))) continue; chips--; data->mcp[addr] = &data->chip[chips]; @@ -1054,12 +1038,10 @@ static int mcp23s08_probe(struct spi_device *spi) mcp23s08_irq_bus_unlock; status = mcp23s08_probe_one(data->mcp[addr], &spi->dev, spi, 0x40 | (addr << 1), type, - pdata->base, addr); + -1, addr); if (status < 0) return status; - if (pdata->base != -1) - pdata->base += data->mcp[addr]->chip.ngpio; ngpio += data->mcp[addr]->chip.ngpio; } data->ngpio = ngpio; |