[PATCH net-next v3 15/17] net: dsa: microchip: ksz9477: remove unused "on" variable

Oleksij Rempel posted 17 patches 3 years, 7 months ago
There is a newer version of this series
[PATCH net-next v3 15/17] net: dsa: microchip: ksz9477: remove unused "on" variable
Posted by Oleksij Rempel 3 years, 7 months ago
This variable is not used on ksz9477 side. Remove it.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
 drivers/net/dsa/microchip/ksz9477.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c
index bfefb60ec91bf..609bd63f4cdb1 100644
--- a/drivers/net/dsa/microchip/ksz9477.c
+++ b/drivers/net/dsa/microchip/ksz9477.c
@@ -1070,7 +1070,6 @@ void ksz9477_config_cpu_port(struct dsa_switch *ds)
 
 			/* enable cpu port */
 			ksz9477_port_setup(dev, i, true);
-			p->on = 1;
 		}
 	}
 
@@ -1080,7 +1079,6 @@ void ksz9477_config_cpu_port(struct dsa_switch *ds)
 		p = &dev->ports[i];
 
 		ksz_port_stp_state_set(ds, i, BR_STATE_DISABLED);
-		p->on = 1;
 		if (dev->chip_id == 0x00947700 && i == 6) {
 			p->sgmii = 1;
 		}
-- 
2.30.2
Re: [PATCH net-next v3 15/17] net: dsa: microchip: ksz9477: remove unused "on" variable
Posted by Vladimir Oltean 3 years, 7 months ago
On Tue, Aug 23, 2022 at 10:02:29AM +0200, Oleksij Rempel wrote:
> This variable is not used on ksz9477 side. Remove it.
> 
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> ---
>  drivers/net/dsa/microchip/ksz9477.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c
> index bfefb60ec91bf..609bd63f4cdb1 100644
> --- a/drivers/net/dsa/microchip/ksz9477.c
> +++ b/drivers/net/dsa/microchip/ksz9477.c
> @@ -1070,7 +1070,6 @@ void ksz9477_config_cpu_port(struct dsa_switch *ds)
>  
>  			/* enable cpu port */
>  			ksz9477_port_setup(dev, i, true);
> -			p->on = 1;
>  		}
>  	}
>  
> @@ -1080,7 +1079,6 @@ void ksz9477_config_cpu_port(struct dsa_switch *ds)
>  		p = &dev->ports[i];
>  
>  		ksz_port_stp_state_set(ds, i, BR_STATE_DISABLED);
> -		p->on = 1;
>  		if (dev->chip_id == 0x00947700 && i == 6) {
>  			p->sgmii = 1;
>  		}
> -- 
> 2.30.2
> 

And it seems like it's not used on ksz8 either. The reason I'm saying
that is that ksz8_flush_dyn_mac_table() is the only apparent user of
p->on, and that only for the case where flushing the FDB of all ports is
requested (port > dev->info->port_cnt). But ksz8_flush_dyn_mac_table()
(through dev->dev_ops->flush_dyn_mac_table) is only called from DSA's
ds->ops->port_fast_age() method, and that will never be requested
"for all ports" (and to my knowledge never was in the past, either).
Badly ported SDK code would be my guess. So there are more
simplifications which could be done.
Re: [PATCH net-next v3 15/17] net: dsa: microchip: ksz9477: remove unused "on" variable
Posted by Oleksij Rempel 3 years, 7 months ago
On Thu, Aug 25, 2022 at 11:54:07PM +0300, Vladimir Oltean wrote:
> On Tue, Aug 23, 2022 at 10:02:29AM +0200, Oleksij Rempel wrote:
> > This variable is not used on ksz9477 side. Remove it.
> > 
> > Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> > ---
> >  drivers/net/dsa/microchip/ksz9477.c | 2 --
> >  1 file changed, 2 deletions(-)
> > 
> > diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c
> > index bfefb60ec91bf..609bd63f4cdb1 100644
> > --- a/drivers/net/dsa/microchip/ksz9477.c
> > +++ b/drivers/net/dsa/microchip/ksz9477.c
> > @@ -1070,7 +1070,6 @@ void ksz9477_config_cpu_port(struct dsa_switch *ds)
> >  
> >  			/* enable cpu port */
> >  			ksz9477_port_setup(dev, i, true);
> > -			p->on = 1;
> >  		}
> >  	}
> >  
> > @@ -1080,7 +1079,6 @@ void ksz9477_config_cpu_port(struct dsa_switch *ds)
> >  		p = &dev->ports[i];
> >  
> >  		ksz_port_stp_state_set(ds, i, BR_STATE_DISABLED);
> > -		p->on = 1;
> >  		if (dev->chip_id == 0x00947700 && i == 6) {
> >  			p->sgmii = 1;
> >  		}
> > -- 
> > 2.30.2
> > 
> 
> And it seems like it's not used on ksz8 either. The reason I'm saying
> that is that ksz8_flush_dyn_mac_table() is the only apparent user of
> p->on, and that only for the case where flushing the FDB of all ports is
> requested (port > dev->info->port_cnt). But ksz8_flush_dyn_mac_table()
> (through dev->dev_ops->flush_dyn_mac_table) is only called from DSA's
> ds->ops->port_fast_age() method, and that will never be requested
> "for all ports" (and to my knowledge never was in the past, either).
> Badly ported SDK code would be my guess. So there are more
> simplifications which could be done.

Ok, i'll take a look on it as soon as i get one of ksz8 board in my
fingers.

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |