summaryrefslogtreecommitdiff
path: root/drivers/pinctrl/pinctrl-mcp23s08_spi.c
diff options
context:
space:
mode:
authorBiju Das <biju.das.jz@bp.renesas.com>2023-10-01 18:01:12 +0300
committerLinus Walleij <linus.walleij@linaro.org>2023-10-10 14:39:38 +0300
commitb03f7aa802b6b89165b4ad340129ef2cbac231a4 (patch)
treebc078a83466bc6fe43074ebc6331d49f7911a901 /drivers/pinctrl/pinctrl-mcp23s08_spi.c
parent880d3fcbe5b54920df7a5c8878ca6785938df62a (diff)
downloadlinux-b03f7aa802b6b89165b4ad340129ef2cbac231a4.tar.xz
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>
Diffstat (limited to 'drivers/pinctrl/pinctrl-mcp23s08_spi.c')
-rw-r--r--drivers/pinctrl/pinctrl-mcp23s08_spi.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/drivers/pinctrl/pinctrl-mcp23s08_spi.c b/drivers/pinctrl/pinctrl-mcp23s08_spi.c
index ea059b9c5542..caf528284d07 100644
--- a/drivers/pinctrl/pinctrl-mcp23s08_spi.c
+++ b/drivers/pinctrl/pinctrl-mcp23s08_spi.c
@@ -143,22 +143,17 @@ static int mcp23s08_spi_regmap_init(struct mcp23s08 *mcp, struct device *dev,
static int mcp23s08_probe(struct spi_device *spi)
{
- struct device *dev = &spi->dev;
struct mcp23s08_driver_data *data;
+ struct device *dev = &spi->dev;
unsigned long spi_present_mask;
- const void *match;
- unsigned int addr;
unsigned int ngpio = 0;
+ unsigned int type;
+ unsigned int addr;
int chips;
- int type;
int ret;
u32 v;
- match = device_get_match_data(dev);
- if (match)
- type = (int)(uintptr_t)match;
- else
- type = spi_get_device_id(spi)->driver_data;
+ type = (uintptr_t)spi_get_device_match_data(spi);
ret = device_property_read_u32(dev, "microchip,spi-present-mask", &v);
if (ret) {