1
1

realtek: dsa: drop array from stp_get signature

Now that the stp_set() helpers have been refactored the stp_get()
helpers can be simplified. Drop the last array parameter. It is
no longer needed/evaluated by its callers.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/23080
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
This commit is contained in:
Markus Stockhausen 2026-04-24 13:09:02 +02:00 committed by Hauke Mehrtens
parent 4b8af19582
commit a30c6aa556
6 changed files with 18 additions and 19 deletions

View File

@ -20,7 +20,6 @@ struct phylink_pcs *rtpcs_create(struct device *dev, struct device_node *np, int
int rtldsa_port_get_stp_state(struct rtl838x_switch_priv *priv, int port)
{
u32 table[4];
u32 msti = 0;
int state;
@ -28,7 +27,7 @@ int rtldsa_port_get_stp_state(struct rtl838x_switch_priv *priv, int port)
return -EINVAL;
mutex_lock(&priv->reg_mutex);
state = priv->r->stp_get(priv, msti, port, table);
state = priv->r->stp_get(priv, msti, port);
mutex_unlock(&priv->reg_mutex);
return state;

View File

@ -1439,7 +1439,7 @@ struct rtldsa_config {
void (*enable_mcast_flood)(int port, bool enable);
void (*enable_bcast_flood)(int port, bool enable);
void (*set_static_move_action)(int port, bool forward);
int (*stp_get)(struct rtl838x_switch_priv *priv, u16 msti, int port, u32 port_state[]);
int (*stp_get)(struct rtl838x_switch_priv *priv, u16 msti, int port);
void (*stp_set)(struct rtl838x_switch_priv *priv, u16 msti, int port, int state);
int mac_link_sts;
int (*mac_force_mode_ctrl)(int port);

View File

@ -641,18 +641,18 @@ static void rtl838x_set_static_move_action(int port, bool forward)
RTL838X_L2_PORT_STATIC_MV_ACT(port));
}
static int rtldsa_838x_stp_get(struct rtl838x_switch_priv *priv, u16 msti, int port, u32 port_state[])
static int rtldsa_838x_stp_get(struct rtl838x_switch_priv *priv, u16 msti, int port)
{
struct table_reg *r = rtl_table_get(RTL8380_TBL_0, 2);
int idx = 1 - (port / 16);
int bit = 2 * (port % 16);
int state;
rtl_table_read(r, msti);
for (int i = 0; i < 2; i++)
port_state[i] = sw_r32(rtl_table_data(r, i));
state = (sw_r32(rtl_table_data(r, idx)) >> bit) & 0x3;
rtl_table_release(r);
return (port_state[idx] >> bit) & 3;
return state;
}
static void rtl838x_stp_set(struct rtl838x_switch_priv *priv, u16 msti, int port, int state)

View File

@ -708,18 +708,18 @@ rtldsa_839x_vlan_profile_dump(struct rtl838x_switch_priv *priv, int idx)
sw_r32(RTL839X_VLAN_PROFILE(idx) + 4));
}
static int rtldsa_839x_stp_get(struct rtl838x_switch_priv *priv, u16 msti, int port, u32 port_state[])
static int rtldsa_839x_stp_get(struct rtl838x_switch_priv *priv, u16 msti, int port)
{
struct table_reg *r = rtl_table_get(RTL8390_TBL_0, 5);
int idx = 3 - ((port + 12) / 16);
int bit = 2 * ((port + 12) % 16);
int state;
rtl_table_read(r, msti);
for (int i = 0; i < 4; i++)
port_state[i] = sw_r32(rtl_table_data(r, i));
state = (sw_r32(rtl_table_data(r, idx)) >> bit) & 0x3;
rtl_table_release(r);
return (port_state[idx] >> bit) & 3;
return state;
}
static void rtl839x_stp_set(struct rtl838x_switch_priv *priv, u16 msti, int port, int state)

View File

@ -627,18 +627,18 @@ static struct table_reg *rtldsa_930x_lag_table(void)
return rtl_table_get(RTL9300_TBL_0, 7);
}
static int rtldsa_930x_stp_get(struct rtl838x_switch_priv *priv, u16 msti, int port, u32 port_state[])
static int rtldsa_930x_stp_get(struct rtl838x_switch_priv *priv, u16 msti, int port)
{
struct table_reg *r = rtl_table_get(RTL9300_TBL_0, 4);
int idx = 1 - ((port + 3) / 16);
int bit = 2 * ((port + 3) % 16);
int state;
rtl_table_read(r, msti);
for (int i = 0; i < 2; i++)
port_state[i] = sw_r32(rtl_table_data(r, i));
state = (sw_r32(rtl_table_data(r, idx)) >> bit) & 0x3;
rtl_table_release(r);
return (port_state[idx] >> bit) & 3;
return state;
}
static void rtl930x_stp_set(struct rtl838x_switch_priv *priv, u16 msti, int port, int state)

View File

@ -250,18 +250,18 @@ rtldsa_931x_vlan_profile_dump(struct rtl838x_switch_priv *priv, int idx)
p.unkn_mc_fld.pmsks.ip, p.unkn_mc_fld.pmsks.ip6);
}
static int rtldsa_931x_stp_get(struct rtl838x_switch_priv *priv, u16 msti, int port, u32 port_state[])
static int rtldsa_931x_stp_get(struct rtl838x_switch_priv *priv, u16 msti, int port)
{
struct table_reg *r = rtl_table_get(RTL9310_TBL_0, 5);
int idx = 3 - ((port + 8) / 16);
int bit = 2 * ((port + 8) % 16);
int state;
rtl_table_read(r, msti);
for (int i = 0; i < 4; i++)
port_state[i] = sw_r32(rtl_table_data(r, i));
state = (sw_r32(rtl_table_data(r, idx)) >> bit) & 0x3;
rtl_table_release(r);
return (port_state[idx] >> bit) & 3;
return state;
}
static void rtl931x_stp_set(struct rtl838x_switch_priv *priv, u16 msti, int port, int state)