Re: [PATCH v1 2/5] ASoC: cs35l56: Add struct to index firmware registers
From: Richard Fitzgerald
Date: Tue Apr 08 2025 - 09:21:44 EST
On 07/04/2025 8:16 pm, Mark Brown wrote:
On Mon, Apr 07, 2025 at 04:16:41PM +0100, Stefan Binding wrote:
Firmware based registers may be different addresses across different
device ids and revision ids. Create a structure to store and access
these addresses.
This is fine but note that this is the use case that the regmap_field_
APIs were created for, that also helps deal with things if anyone is
clever and resizes fields or shifts within registers. It's purely a
question of taste if you want to use that.
The regmap_field stuff looks like a lot of unnecessary complexity and
overhead just for 6 registers with alternate addresses.
(In fact, the regmap_field stuff looks like an over-complex way of
solving a non-problem. The original commit is talking about replacing
masks and shifts "all over the code" to make the code neater. But
really, all those extra structs and pointers and allocated memory just
to replace a logical & or | ? Every struct regmap_field has a pointer
to the struct regmap !!?! So if I've got 100 fields there are 100 copies
of the struct regmap pointer that my driver already has.)