Skip to content

Commit b03f7aa

Browse files
bijudasLinus Walleij
authored andcommitted
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>
1 parent 880d3fc commit b03f7aa

1 file changed

Lines changed: 4 additions & 9 deletions

File tree

drivers/pinctrl/pinctrl-mcp23s08_spi.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -143,22 +143,17 @@ static int mcp23s08_spi_regmap_init(struct mcp23s08 *mcp, struct device *dev,
143143

144144
static int mcp23s08_probe(struct spi_device *spi)
145145
{
146-
struct device *dev = &spi->dev;
147146
struct mcp23s08_driver_data *data;
147+
struct device *dev = &spi->dev;
148148
unsigned long spi_present_mask;
149-
const void *match;
150-
unsigned int addr;
151149
unsigned int ngpio = 0;
150+
unsigned int type;
151+
unsigned int addr;
152152
int chips;
153-
int type;
154153
int ret;
155154
u32 v;
156155

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);
162157

163158
ret = device_property_read_u32(dev, "microchip,spi-present-mask", &v);
164159
if (ret) {

0 commit comments

Comments
 (0)