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.
Unified · Split
| @@ -8,7 +8,6 @@ · 7 unmodified lines | ||
| 8 | 8 | #include <linux/gpio/driver.h> |
| 9 | 9 | #include <linux/i2c.h> |
| 10 | 10 | #include <linux/spi/spi.h> |
| 11 | −#include <linux/spi/mcp23s08.h> | |
| 12 | 11 | #include <linux/slab.h> |
| 13 | 12 | #include <asm/byteorder.h> |
| 14 | 13 | #include <linux/interrupt.h> |
| @@ -914,16 +913,9 @@ MODULE_DEVICE_TABLE(of, mcp23s08_i2c_of_match); · 899 unmodified lines | ||
| 914 | 913 | static int mcp230xx_probe(struct i2c_client *client, |
| 915 | 914 | const struct i2c_device_id *id) |
| 916 | 915 | { |
| 917 | − struct mcp23s08_platform_data *pdata, local_pdata; | |
| 918 | 916 | struct mcp23s08 *mcp; |
| 919 | 917 | int status; |
| 920 | 918 | |
| 921 | − pdata = dev_get_platdata(&client->dev); | |
| 922 | − if (!pdata) { | |
| 923 | − pdata = &local_pdata; | |
| 924 | − pdata->base = -1; | |
| 925 | − } | |
| 926 | − | |
| 927 | 919 | mcp = devm_kzalloc(&client->dev, sizeof(*mcp), GFP_KERNEL); |
| 928 | 920 | if (!mcp) |
| 929 | 921 | return -ENOMEM; |
| @@ -937,7 +929,7 @@ static int mcp230xx_probe(struct i2c_client *client, · 7 unmodified lines | ||
| 937 | 929 | mcp->irq_chip.irq_bus_sync_unlock = mcp23s08_irq_bus_unlock; |
| 938 | 930 | |
| 939 | 931 | status = mcp23s08_probe_one(mcp, &client->dev, client, client->addr, |
| 940 | − id->driver_data, pdata->base, 0); | |
| 932 | + id->driver_data, -1, 0); | |
| 941 | 933 | if (status) |
| 942 | 934 | return status; |
| 943 | 935 | |
| @@ -986,13 +978,13 @@ static void mcp23s08_i2c_exit(void) { } · 42 unmodified lines | ||
| 986 | 978 | |
| 987 | 979 | static int mcp23s08_probe(struct spi_device *spi) |
| 988 | 980 | { |
| 989 | − struct mcp23s08_platform_data *pdata, local_pdata; | |
| 990 | 981 | unsigned addr; |
| 991 | 982 | int chips = 0; |
| 992 | 983 | struct mcp23s08_driver_data *data; |
| 993 | 984 | int status, type; |
| 994 | 985 | unsigned ngpio = 0; |
| 995 | 986 | const struct of_device_id *match; |
| 987 | + u32 spi_present_mask; | |
| 996 | 988 | |
| 997 | 989 | match = of_match_device(of_match_ptr(mcp23s08_spi_of_match), &spi->dev); |
| 998 | 990 | if (match) |
| @@ -1000,32 +992,24 @@ static int mcp23s08_probe(struct spi_device *spi) · 1 unmodified line | ||
| 1000 | 992 | else |
| 1001 | 993 | type = spi_get_device_id(spi)->driver_data; |
| 1002 | 994 | |
| 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) { | |
| 1008 | 998 | status = device_property_read_u32(&spi->dev, |
| 1009 | − "microchip,spi-present-mask", &pdata->spi_present_mask); | |
| 999 | + "mcp,spi-present-mask", &spi_present_mask); | |
| 1010 | 1000 | 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; | |
| 1019 | 1003 | } |
| 1020 | 1004 | } |
| 1021 | 1005 | |
| 1022 | − if (!pdata->spi_present_mask || pdata->spi_present_mask > 0xff) { | |
| 1006 | + if (!spi_present_mask || spi_present_mask > 0xff) { | |
| 1023 | 1007 | dev_err(&spi->dev, "invalid spi-present-mask"); |
| 1024 | 1008 | return -ENODEV; |
| 1025 | 1009 | } |
| 1026 | 1010 | |
| 1027 | 1011 | 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)) | |
| 1029 | 1013 | chips++; |
| 1030 | 1014 | } |
| 1031 | 1015 | |
| @@ -1040,7 +1024,7 @@ static int mcp23s08_probe(struct spi_device *spi) · 8 unmodified lines | ||
| 1040 | 1024 | spi_set_drvdata(spi, data); |
| 1041 | 1025 | |
| 1042 | 1026 | 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))) | |
| 1044 | 1028 | continue; |
| 1045 | 1029 | chips--; |
| 1046 | 1030 | data->mcp[addr] = &data->chip[chips]; |
| @@ -1054,12 +1038,10 @@ static int mcp23s08_probe(struct spi_device *spi) · 7 unmodified lines | ||
| 1054 | 1038 | mcp23s08_irq_bus_unlock; |
| 1055 | 1039 | status = mcp23s08_probe_one(data->mcp[addr], &spi->dev, spi, |
| 1056 | 1040 | 0x40 | (addr << 1), type, |
| 1057 | − pdata->base, addr); | |
| 1041 | + -1, addr); | |
| 1058 | 1042 | if (status < 0) |
| 1059 | 1043 | return status; |
| 1060 | 1044 | |
| 1061 | − if (pdata->base != -1) | |
| 1062 | − pdata->base += data->mcp[addr]->chip.ngpio; | |
| 1063 | 1045 | ngpio += data->mcp[addr]->chip.ngpio; |
| 1064 | 1046 | } |
| 1065 | 1047 | data->ngpio = ngpio; |
| @@ -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 | −}; | |