net: mscc: ocelot: refactor enum ocelot_reg decoding to helper
authorVladimir Oltean <vladimir.oltean@nxp.com>
Wed, 12 Apr 2023 12:47:31 +0000 (15:47 +0300)
committerJakub Kicinski <kuba@kernel.org>
Fri, 14 Apr 2023 04:56:06 +0000 (21:56 -0700)
commit40cd07cb42617f0e8b8597d0db288a5ce66621d9
treeb7d75e2edcb5f4b56421425ff7940ff5ba2060db
parent9ecd05794b8da1f6cfca4c3721a3b0fed2e21a82
net: mscc: ocelot: refactor enum ocelot_reg decoding to helper

ocelot_io.c duplicates the decoding of an enum ocelot_reg (which holds
an enum ocelot_target in the upper bits and an index into a regmap array
in the lower bits) 4 times.

We'd like to reuse that logic once more, from ocelot.c. In order to do
that, let's consolidate the existing 4 instances into a header
accessible both by ocelot.c as well as by ocelot_io.c.

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.h
drivers/net/ethernet/mscc/ocelot_io.c