Skip to content

Commit

Permalink
net: dsa: microchip: ksz8795: use port_cnt instead of TOTOAL_PORT_NUM
Browse files Browse the repository at this point in the history
To get the driver working with other chips using different port counts
the dyn_mac_table should be flushed depending on the amount of available
ports. This patch remove the extra define TOTOAL_PORT_NUM and is
making use of the dynamic port_cnt variable instead.

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>
  • Loading branch information
Michael Grzeschik authored and Jakub Kicinski committed Dec 3, 2020
1 parent c9f4633 commit 241ed71
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 2 additions & 2 deletions drivers/net/dsa/microchip/ksz8795.c
Original file line number Diff line number Diff line change
Expand Up @@ -751,11 +751,11 @@ static void ksz8795_port_stp_state_set(struct dsa_switch *ds, int port,

static void ksz8795_flush_dyn_mac_table(struct ksz_device *dev, int port)
{
u8 learn[TOTAL_PORT_NUM];
u8 learn[DSA_MAX_PORTS];
int first, index, cnt;
struct ksz_port *p;

if ((uint)port < TOTAL_PORT_NUM) {
if ((uint)port < dev->port_cnt) {
first = port;
cnt = port + 1;
} else {
Expand Down
2 changes: 0 additions & 2 deletions drivers/net/dsa/microchip/ksz8795_reg.h
Original file line number Diff line number Diff line change
Expand Up @@ -846,8 +846,6 @@

#define KS_PRIO_IN_REG 4

#define TOTAL_PORT_NUM 5

#define KSZ8795_COUNTER_NUM 0x20

/* Common names used by other drivers */
Expand Down

0 comments on commit 241ed71

Please sign in to comment.