Re: [PATCH net-next v1 2/5] net: dsa: microchip: add an enum for regmap widths
From: Andrew Lunn
Date: Wed May 24 2023 - 13:03:52 EST
On Wed, May 24, 2023 at 02:32:17PM +0200, Oleksij Rempel wrote:
> From: Vladimir Oltean <vladimir.oltean@xxxxxxx>
>
> It is not immediately obvious that this driver allocates, via the
> KSZ_REGMAP_TABLE() macro, 3 regmaps for register access: dev->regmap[0]
> for 8-bit access, dev->regmap[1] for 16-bit and dev->regmap[2] for
> 32-bit access.
>
> In future changes that add support for reg_fields, each field will have
> to specify through which of the 3 regmaps it's going to go. Add an enum
> now, to denote one of the 3 register access widths, and make the code go
> through some wrapper functions for easier review and further
> modification.
Given the patches in this series, it is not obvious why the wrapper is
needed.
dev->regmap[KSZ_REGMAP_8] is just as readable as ksz_regmap_8(dev).
Do future changes add extra parameters to ksz_regmap_8()?
Andrew