Re: [PATCH net-next v1 2/5] net: dsa: microchip: add an enum for regmap widths

From: Oleksij Rempel
Date: Wed May 24 2023 - 13:53:21 EST


On Wed, May 24, 2023 at 07:03:38PM +0200, Andrew Lunn wrote:
> 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()?

As for me, it looks short. Less problems with line length restrictions.

--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |