History

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.

Andy Shevchenko committed 6 years ago

Commit 6aba6ed1 parent f9a87442 files · +12 −48Browse files

Unified · Split

2 files
  1. drivers/pinctrl/pinctrl-mcp23s08.c +12 −30
  2. include/linux/spi/mcp23s08.h +0 −18
drivers/pinctrl/pinctrl-mcp23s08.c+12−30
@@ -8,7 +8,6 @@ · 7 unmodified lines
88 #include <linux/gpio/driver.h>
99 #include <linux/i2c.h>
1010 #include <linux/spi/spi.h>
11−#include <linux/spi/mcp23s08.h>
1211 #include <linux/slab.h>
1312 #include <asm/byteorder.h>
1413 #include <linux/interrupt.h>
@@ -914,16 +913,9 @@ MODULE_DEVICE_TABLE(of, mcp23s08_i2c_of_match); · 899 unmodified lines
914913 static int mcp230xx_probe(struct i2c_client *client,
915914 const struct i2c_device_id *id)
916915 {
917− struct mcp23s08_platform_data *pdata, local_pdata;
918916 struct mcp23s08 *mcp;
919917 int status;
920918
921− pdata = dev_get_platdata(&client->dev);
922− if (!pdata) {
923− pdata = &local_pdata;
924− pdata->base = -1;
925− }
926−
927919 mcp = devm_kzalloc(&client->dev, sizeof(*mcp), GFP_KERNEL);
928920 if (!mcp)
929921 return -ENOMEM;
@@ -937,7 +929,7 @@ static int mcp230xx_probe(struct i2c_client *client, · 7 unmodified lines
937929 mcp->irq_chip.irq_bus_sync_unlock = mcp23s08_irq_bus_unlock;
938930
939931 status = mcp23s08_probe_one(mcp, &client->dev, client, client->addr,
940− id->driver_data, pdata->base, 0);
932+ id->driver_data, -1, 0);
941933 if (status)
942934 return status;
943935
@@ -986,13 +978,13 @@ static void mcp23s08_i2c_exit(void) { } · 42 unmodified lines
986978
987979 static int mcp23s08_probe(struct spi_device *spi)
988980 {
989− struct mcp23s08_platform_data *pdata, local_pdata;
990981 unsigned addr;
991982 int chips = 0;
992983 struct mcp23s08_driver_data *data;
993984 int status, type;
994985 unsigned ngpio = 0;
995986 const struct of_device_id *match;
987+ u32 spi_present_mask;
996988
997989 match = of_match_device(of_match_ptr(mcp23s08_spi_of_match), &spi->dev);
998990 if (match)
@@ -1000,32 +992,24 @@ static int mcp23s08_probe(struct spi_device *spi) · 1 unmodified line
1000992 else
1001993 type = spi_get_device_id(spi)->driver_data;
1002994
1003− pdata = dev_get_platdata(&spi->dev);
1004− if (!pdata) {
1005− pdata = &local_pdata;
1006− pdata->base = -1;
1007−
995+ status = device_property_read_u32(&spi->dev,
996+ "microchip,spi-present-mask", &spi_present_mask);
997+ if (status) {
1008998 status = device_property_read_u32(&spi->dev,
1009− "microchip,spi-present-mask", &pdata->spi_present_mask);
999+ "mcp,spi-present-mask", &spi_present_mask);
10101000 if (status) {
1011− status = device_property_read_u32(&spi->dev,
1012− "mcp,spi-present-mask",
1013− &pdata->spi_present_mask);
1014−
1015− if (status) {
1016− dev_err(&spi->dev, "missing spi-present-mask");
1017− return -ENODEV;
1018− }
1001+ dev_err(&spi->dev, "missing spi-present-mask");
1002+ return -ENODEV;
10191003 }
10201004 }
10211005
1022− if (!pdata->spi_present_mask || pdata->spi_present_mask > 0xff) {
1006+ if (!spi_present_mask || spi_present_mask > 0xff) {
10231007 dev_err(&spi->dev, "invalid spi-present-mask");
10241008 return -ENODEV;
10251009 }
10261010
10271011 for (addr = 0; addr < MCP_MAX_DEV_PER_CS; addr++) {
1028− if (pdata->spi_present_mask & BIT(addr))
1012+ if (spi_present_mask & BIT(addr))
10291013 chips++;
10301014 }
10311015
@@ -1040,7 +1024,7 @@ static int mcp23s08_probe(struct spi_device *spi) · 8 unmodified lines
10401024 spi_set_drvdata(spi, data);
10411025
10421026 for (addr = 0; addr < MCP_MAX_DEV_PER_CS; addr++) {
1043− if (!(pdata->spi_present_mask & BIT(addr)))
1027+ if (!(spi_present_mask & BIT(addr)))
10441028 continue;
10451029 chips--;
10461030 data->mcp[addr] = &data->chip[chips];
@@ -1054,12 +1038,10 @@ static int mcp23s08_probe(struct spi_device *spi) · 7 unmodified lines
10541038 mcp23s08_irq_bus_unlock;
10551039 status = mcp23s08_probe_one(data->mcp[addr], &spi->dev, spi,
10561040 0x40 | (addr << 1), type,
1057− pdata->base, addr);
1041+ -1, addr);
10581042 if (status < 0)
10591043 return status;
10601044
1061− if (pdata->base != -1)
1062− pdata->base += data->mcp[addr]->chip.ngpio;
10631045 ngpio += data->mcp[addr]->chip.ngpio;
10641046 }
10651047 data->ngpio = ngpio;
include/linux/spi/mcp23s08.h+0−18
@@ -1,18 +0,0 @@
1−/* SPDX-License-Identifier: GPL-2.0 */
2−struct mcp23s08_platform_data {
3− /* For mcp23s08, up to 4 slaves (numbered 0..3) can share one SPI
4− * chipselect, each providing 1 gpio_chip instance with 8 gpios.
5− * For mpc23s17, up to 8 slaves (numbered 0..7) can share one SPI
6− * chipselect, each providing 1 gpio_chip (port A + port B) with
7− * 16 gpios.
8− */
9− u32 spi_present_mask;
10−
11− /* "base" is the number of the first GPIO or -1 for dynamic
12− * assignment. If there are gaps in chip addressing the GPIO
13− * numbers are sequential .. so for example if only slaves 0
14− * and 3 are present, their GPIOs range from base to base+15
15− * (or base+31 for s17 variant).
16− */
17− unsigned base;
18−};