Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

pinctrl: mcp23s08_spi: Simplify probe()

Simpilfy probe() by replacing device_get_match_data() and ID lookup for
retrieving match data by spi_get_device_match_data().

While at it, replace data type of variable type from 'int'->'unsigned int'
and declare variables following a reverse christmas tree order.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20231001150113.7752-3-biju.das.jz@bp.renesas.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Biju Das and committed by
Linus Walleij
b03f7aa8 880d3fcb

+4 -9
+4 -9
drivers/pinctrl/pinctrl-mcp23s08_spi.c
··· 143 143 144 144 static int mcp23s08_probe(struct spi_device *spi) 145 145 { 146 - struct device *dev = &spi->dev; 147 146 struct mcp23s08_driver_data *data; 147 + struct device *dev = &spi->dev; 148 148 unsigned long spi_present_mask; 149 - const void *match; 150 - unsigned int addr; 151 149 unsigned int ngpio = 0; 150 + unsigned int type; 151 + unsigned int addr; 152 152 int chips; 153 - int type; 154 153 int ret; 155 154 u32 v; 156 155 157 - match = device_get_match_data(dev); 158 - if (match) 159 - type = (int)(uintptr_t)match; 160 - else 161 - type = spi_get_device_id(spi)->driver_data; 156 + type = (uintptr_t)spi_get_device_match_data(spi); 162 157 163 158 ret = device_property_read_u32(dev, "microchip,spi-present-mask", &v); 164 159 if (ret) {