net: dsa: microchip: ksz8795: use mib_cnt where possible
authorMichael Grzeschik <m.grzeschik@pengutronix.de>
Tue, 1 Dec 2020 20:45:00 +0000 (21:45 +0100)
committerJakub Kicinski <kuba@kernel.org>
Thu, 3 Dec 2020 01:16:29 +0000 (17:16 -0800)
commit65fe1acf07d76198c77a9c9a672928c539bcbc72
treeb647a1a6856955165ae967f8cf5325567bd5e901
parent31b62c78c1645e829a08453458224f832ac1ac7b
net: dsa: microchip: ksz8795: use mib_cnt where possible

The variable mib_cnt is assigned with TOTAL_SWITCH_COUNTER_NUM. This
value can also be derived from the array size of mib_names. This patch
uses this calculated value instead, removes the extra define and uses
mib_cnt everywhere possible instead of the static define
TOTAL_SWITCH_COUNTER_NUM. Keeping it in a separate variable instead of
using ARRAY_SIZE everywhere instead makes the driver more flexible for
future use of devices with different amount of counters.

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/dsa/microchip/ksz8795.c
drivers/net/dsa/microchip/ksz8795_reg.h