Re: [PATCH v3 3/3] pinctrl: mcp23s08: Simplify probe()/mcp23s08_spi_regmap_init()

From: Andy Shevchenko
Date: Mon Sep 25 2023 - 03:52:36 EST


On Sun, Sep 24, 2023 at 06:23:20PM +0100, Biju Das wrote:
> Add struct mcp23s08_info and simplify probe()/mcp23s08_spi_regmap_init() by
> replacing match data 'type' with 'struct mcp23s08_info'.
>
> While at it, replace 'dev_err()'->'dev_err_probe()' and drop printing
> 'type' in error path for i2c_get_match_data().

No need to duplicate info in the name of variables (see below).
With this fixed,
Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>

...

> +static const struct mcp23s08_info mcp23s08_i2c_0008 = {

static const struct mcp23s08_info mcp23008_i2c = {

> + .regmap = &mcp23x08_regmap,
> + .label = "mcp23008",
> + .type = MCP_TYPE_008,
> + .ngpio = 8,
> + .reg_shift = 0,
> +};
> +
> +static const struct mcp23s08_info mcp23s08_i2c_0017 = {

static const struct mcp23s08_info mcp23017_i2c = {

> + .regmap = &mcp23x17_regmap,
> + .label = "mcp23017",
> + .type = MCP_TYPE_017,
> + .ngpio = 16,
> + .reg_shift = 1,
> +};
> +
> +static const struct mcp23s08_info mcp23s08_i2c_0018 = {

static const struct mcp23s08_info mcp23018_i2c = {

> + .regmap = &mcp23x17_regmap,
> + .label = "mcp23018",
> + .type = MCP_TYPE_018,
> + .ngpio = 16,
> + .reg_shift = 1,
> +};

...

> +static const struct mcp23s08_info mcp23s08_spi_s08 = {

static const struct mcp23s08_info mcp23s08_spi = {

> + .regmap = &mcp23x08_regmap,
> + .type = MCP_TYPE_S08,
> + .ngpio = 8,
> + .reg_shift = 0,
> +};
> +
> +static const struct mcp23s08_info mcp23s08_spi_s17 = {

static const struct mcp23s08_info mcp23s17_spi = {

> + .regmap = &mcp23x17_regmap,
> + .type = MCP_TYPE_S17,
> + .ngpio = 16,
> + .reg_shift = 1,
> +};
> +
> +static const struct mcp23s08_info mcp23s08_spi_s18 = {

static const struct mcp23s08_info mcp23s18_spi = {

> + .regmap = &mcp23x17_regmap,
> + .label = "mcp23s18",
> + .type = MCP_TYPE_S18,
> + .ngpio = 16,
> + .reg_shift = 1,
> +};

--
With Best Regards,
Andy Shevchenko