Re: [PATCH net-next 1/8] net: mscc: ocelot: strengthen type of "u32 reg" in I/O accessors

From: Jacob Keller
Date: Wed Apr 12 2023 - 17:11:34 EST




On 4/12/2023 5:47 AM, Vladimir Oltean wrote:
> The "u32 reg" argument that is passed to these functions is not a plain
> address, but rather a driver-specific encoding of another enum
> ocelot_target target in the upper bits, and an index into the
> u32 ocelot->map[target][] array in the lower bits. That encoded value
> takes the type "enum ocelot_reg" and is what is passed to these I/O
> functions, so let's actually use that to prevent type confusion.
>
> Signed-off-by: Vladimir Oltean <vladimir.oltean@xxxxxxx>

It does make the prototypes a bit longer, but clarity of the type of
value you need to pass is good.

Reviewed-by: Jacob Keller <jacob.e.keller@xxxxxxxxx>