diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2020-04-07 20:38:42 +0300 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2020-04-16 14:21:23 +0200 |
commit | 84d02e785d34be9363a825d696cca1f07fac2634 (patch) | |
tree | f5b27539c45a36865e68b974724011b587801f42 /drivers/pinctrl | |
parent | 6aba6ed879b3471903c8ada28ba968a268df6143 (diff) | |
download | linux-84d02e785d34be9363a825d696cca1f07fac2634.tar.gz linux-84d02e785d34be9363a825d696cca1f07fac2634.tar.bz2 linux-84d02e785d34be9363a825d696cca1f07fac2634.zip |
pinctrl: mcp23s08: Deduplicate IRQ chip filling
In both cases, SPI and I²C, IRQ chip is filled in the same way.
Deduplicate this by moving common part to mcp23s08_probe_one().
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20200407173849.43628-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl')
-rw-r--r-- | drivers/pinctrl/pinctrl-mcp23s08.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/drivers/pinctrl/pinctrl-mcp23s08.c b/drivers/pinctrl/pinctrl-mcp23s08.c index 2c8b8c45b70e..e05219d3331f 100644 --- a/drivers/pinctrl/pinctrl-mcp23s08.c +++ b/drivers/pinctrl/pinctrl-mcp23s08.c @@ -669,7 +669,14 @@ static int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev, mcp->dev = dev; mcp->addr = addr; + mcp->irq_active_high = false; + mcp->irq_chip.name = dev_name(dev); + mcp->irq_chip.irq_mask = mcp23s08_irq_mask; + mcp->irq_chip.irq_unmask = mcp23s08_irq_unmask; + mcp->irq_chip.irq_set_type = mcp23s08_irq_set_type; + mcp->irq_chip.irq_bus_lock = mcp23s08_irq_bus_lock; + mcp->irq_chip.irq_bus_sync_unlock = mcp23s08_irq_bus_unlock; mcp->chip.direction_input = mcp23s08_direction_input; mcp->chip.get = mcp23s08_get; @@ -921,12 +928,6 @@ static int mcp230xx_probe(struct i2c_client *client, return -ENOMEM; mcp->irq = client->irq; - mcp->irq_chip.name = dev_name(&client->dev); - mcp->irq_chip.irq_mask = mcp23s08_irq_mask; - mcp->irq_chip.irq_unmask = mcp23s08_irq_unmask; - mcp->irq_chip.irq_set_type = mcp23s08_irq_set_type; - mcp->irq_chip.irq_bus_lock = mcp23s08_irq_bus_lock; - mcp->irq_chip.irq_bus_sync_unlock = mcp23s08_irq_bus_unlock; status = mcp23s08_probe_one(mcp, &client->dev, client, client->addr, id->driver_data, -1, 0); @@ -1029,13 +1030,6 @@ static int mcp23s08_probe(struct spi_device *spi) chips--; data->mcp[addr] = &data->chip[chips]; data->mcp[addr]->irq = spi->irq; - data->mcp[addr]->irq_chip.name = dev_name(&spi->dev); - data->mcp[addr]->irq_chip.irq_mask = mcp23s08_irq_mask; - data->mcp[addr]->irq_chip.irq_unmask = mcp23s08_irq_unmask; - data->mcp[addr]->irq_chip.irq_set_type = mcp23s08_irq_set_type; - data->mcp[addr]->irq_chip.irq_bus_lock = mcp23s08_irq_bus_lock; - data->mcp[addr]->irq_chip.irq_bus_sync_unlock = - mcp23s08_irq_bus_unlock; status = mcp23s08_probe_one(data->mcp[addr], &spi->dev, spi, 0x40 | (addr << 1), type, -1, addr); |