diff mbox series

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

Message ID 20220823080231.2466017-16-o.rempel@pengutronix.de (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series net: dsa: microchip: add error handling and register access validation | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Series has a cover letter
netdev/patch_count fail Series longer than 15 patches (and no cover letter)
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 85 this patch: 85
netdev/cc_maintainers success CCed 11 of 11 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 85 this patch: 85
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 14 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Oleksij Rempel Aug. 23, 2022, 8:02 a.m. UTC
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(-)

Comments

Vladimir Oltean Aug. 25, 2022, 8:54 p.m. UTC | #1
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.
Oleksij Rempel Aug. 26, 2022, 7:51 a.m. UTC | #2
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.
diff mbox series

Patch

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;
 		}