Re: [RFC Patch net-next v2 06/15] net: dsa: microchip: get P_STP_CTRL in ksz_port_stp_state by ksz_dev_ops

Vladimir Oltean
2022-06-13T09:31:24Z

On Mon, May 30, 2022 at 04:12:48PM +0530, Arun Ramadoss wrote:
> At present, P_STP_CTRL register value is passed as parameter to
> ksz_port_stp_state from the individual dsa_switch_ops hooks. This patch
> update the function to retrieve the register value through the
> ksz_dev_ops function pointer.
> And add the static to ksz_update_port_member since it is not called
> outside the ksz_common.
>
> Signed-off-by: Arun Ramadoss <arun.ramadoss@microchip.com>
> ---
> drivers/net/dsa/microchip/ksz8795.c | 9 +++++----
> drivers/net/dsa/microchip/ksz9477.c | 10 +++++-----
> drivers/net/dsa/microchip/ksz_common.c | 9 +++++----
> drivers/net/dsa/microchip/ksz_common.h | 5 ++---
> 4 files changed, 17 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/net/dsa/microchip/ksz8795.c b/drivers/net/dsa/microchip/ksz8795.c
> index 8657b520b336..e6982fa9d382 100644
> --- a/drivers/net/dsa/microchip/ksz8795.c
> +++ b/drivers/net/dsa/microchip/ksz8795.c
> @@ -920,9 +920,9 @@ static void ksz8_cfg_port_member(struct ksz_device *dev, int port, u8 member)
> ksz_pwrite8(dev, port, P_MIRROR_CTRL, data);
> }
>
> -static void ksz8_port_stp_state_set(struct dsa_switch *ds, int port, u8 state)
> +static int ksz8_get_stp_reg(void)
> {
> - ksz_port_stp_state_set(ds, port, state, P_STP_CTRL);
> + return P_STP_CTRL;
> }

Since there's nothing dynamic about get_stp_reg(), can the STP register
location stay in struct ksz_chip_data?