diff mbox series

[07/11] net: dsa: microchip: remove superfluous num_ports asignment

Message ID 20201118220357.22292-8-m.grzeschik@pengutronix.de
State Superseded
Headers show
Series net: dsa: microchip: make ksz8795 driver more dynamic | expand

Commit Message

Michael Grzeschik Nov. 18, 2020, 10:03 p.m. UTC
The variable num_ports is already assigned in the init function.
This patch removes the extra assignment of the variable.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
---
 drivers/net/dsa/microchip/ksz8795.c | 2 --
 drivers/net/dsa/microchip/ksz9477.c | 2 --
 2 files changed, 4 deletions(-)

Comments

Andrew Lunn Nov. 19, 2020, 12:32 a.m. UTC | #1
On Wed, Nov 18, 2020 at 11:03:53PM +0100, Michael Grzeschik wrote:
> The variable num_ports is already assigned in the init function.
> This patch removes the extra assignment of the variable.
> 
> Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
> ---
>  drivers/net/dsa/microchip/ksz8795.c | 2 --
>  drivers/net/dsa/microchip/ksz9477.c | 2 --
>  2 files changed, 4 deletions(-)
> 
> diff --git a/drivers/net/dsa/microchip/ksz8795.c b/drivers/net/dsa/microchip/ksz8795.c
> index 7114902495a0ebb..17dc720df2340b0 100644
> --- a/drivers/net/dsa/microchip/ksz8795.c
> +++ b/drivers/net/dsa/microchip/ksz8795.c
> @@ -992,8 +992,6 @@ static void ksz8795_config_cpu_port(struct dsa_switch *ds)
>  	u8 remote;
>  	int i;
>  
> -	ds->num_ports = dev->port_cnt + 1;
> -
>  	/* Switch marks the maximum frame with extra byte as oversize. */
>  	ksz_cfg(dev, REG_SW_CTRL_2, SW_LEGAL_PACKET_DISABLE, true);
>  	ksz_cfg(dev, S_TAIL_TAG_CTRL, SW_TAIL_TAG_ENABLE, true);
> diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c
> index abfd3802bb51706..2119965da10ae1e 100644
> --- a/drivers/net/dsa/microchip/ksz9477.c
> +++ b/drivers/net/dsa/microchip/ksz9477.c
> @@ -1267,8 +1267,6 @@ static void ksz9477_config_cpu_port(struct dsa_switch *ds)
>  	struct ksz_port *p;
>  	int i;
>  
> -	ds->num_ports = dev->port_cnt;

Please could you give a clue in the commit message that the init
function handles the difference between these two, the + 1 in ksz8795.

	 Andrew
Florian Fainelli Nov. 19, 2020, 3:10 a.m. UTC | #2
On 11/18/2020 2:03 PM, Michael Grzeschik wrote:
> The variable num_ports is already assigned in the init function.
> This patch removes the extra assignment of the variable.
> 
> Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
diff mbox series

Patch

diff --git a/drivers/net/dsa/microchip/ksz8795.c b/drivers/net/dsa/microchip/ksz8795.c
index 7114902495a0ebb..17dc720df2340b0 100644
--- a/drivers/net/dsa/microchip/ksz8795.c
+++ b/drivers/net/dsa/microchip/ksz8795.c
@@ -992,8 +992,6 @@  static void ksz8795_config_cpu_port(struct dsa_switch *ds)
 	u8 remote;
 	int i;
 
-	ds->num_ports = dev->port_cnt + 1;
-
 	/* Switch marks the maximum frame with extra byte as oversize. */
 	ksz_cfg(dev, REG_SW_CTRL_2, SW_LEGAL_PACKET_DISABLE, true);
 	ksz_cfg(dev, S_TAIL_TAG_CTRL, SW_TAIL_TAG_ENABLE, true);
diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c
index abfd3802bb51706..2119965da10ae1e 100644
--- a/drivers/net/dsa/microchip/ksz9477.c
+++ b/drivers/net/dsa/microchip/ksz9477.c
@@ -1267,8 +1267,6 @@  static void ksz9477_config_cpu_port(struct dsa_switch *ds)
 	struct ksz_port *p;
 	int i;
 
-	ds->num_ports = dev->port_cnt;
-
 	for (i = 0; i < dev->port_cnt; i++) {
 		if (dsa_is_cpu_port(ds, i) && (dev->cpu_ports & (1 << i))) {
 			phy_interface_t interface;