OSDN Git Service

net: mscc: ocelot: strengthen type of "u32 reg" in I/O accessors
authorVladimir Oltean <vladimir.oltean@nxp.com>
Wed, 12 Apr 2023 12:47:30 +0000 (15:47 +0300)
committerJakub Kicinski <kuba@kernel.org>
Fri, 14 Apr 2023 04:56:06 +0000 (21:56 -0700)
commit9ecd05794b8da1f6cfca4c3721a3b0fed2e21a82
tree510d1b28bf6991346b3d0ee53db239124c7a6c66
parentc2865b1122595e69e7df52d01f7f02338b8babca
net: mscc: ocelot: strengthen type of "u32 reg" in I/O accessors

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@nxp.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/mscc/ocelot_io.c
include/soc/mscc/ocelot.h