netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH] net: dsa: microchip: delete dead code
@ 2020-07-21  8:33 Helmut Grohne
  2020-07-22 14:39 ` Andrew Lunn
  0 siblings, 1 reply; 13+ messages in thread
From: Helmut Grohne @ 2020-07-21  8:33 UTC (permalink / raw)
  To: Woojung Huh, Microchip Linux Driver Support, Andrew Lunn
  Cc: Vivien Didelot, Florian Fainelli, David S. Miller,
	Jakub Kicinski, netdev

None of the removed assignments is ever read back and never influences
logic.

Signed-off-by: Helmut Grohne <helmut.grohne@intenta.de>
---
 drivers/net/dsa/microchip/ksz8795.c    | 26 ++--------------------
 drivers/net/dsa/microchip/ksz9477.c    | 30 +-------------------------
 drivers/net/dsa/microchip/ksz_common.c | 23 --------------------
 drivers/net/dsa/microchip/ksz_common.h | 11 ----------
 4 files changed, 3 insertions(+), 87 deletions(-)

While working on the driver (e.g.
https://lore.kernel.org/netdev/20200720210449.GP1339445@lunn.ch/), it
became clear that we don't have a good understanding of what all that
code does. It turns out that part of the code simply does nothing useful
and this patch attempts to figure out whether it can be simply removed.

diff --git a/drivers/net/dsa/microchip/ksz8795.c b/drivers/net/dsa/microchip/ksz8795.c
index 7c17b0f705ec..545cb7871712 100644
--- a/drivers/net/dsa/microchip/ksz8795.c
+++ b/drivers/net/dsa/microchip/ksz8795.c
@@ -731,14 +731,6 @@ static void ksz8795_port_stp_state_set(struct dsa_switch *ds, int port,
 
 	ksz_pwrite8(dev, port, P_STP_CTRL, data);
 	p->stp_state = state;
-	if (data & PORT_RX_ENABLE)
-		dev->rx_ports |= BIT(port);
-	else
-		dev->rx_ports &= ~BIT(port);
-	if (data & PORT_TX_ENABLE)
-		dev->tx_ports |= BIT(port);
-	else
-		dev->tx_ports &= ~BIT(port);
 
 	/* Port membership may share register with STP state. */
 	if (member >= 0 && member != p->member)
@@ -976,15 +968,8 @@ static void ksz8795_port_setup(struct ksz_device *dev, int port, bool cpu_port)
 		p->phydev.duplex = 1;
 
 		member = dev->port_mask;
-		dev->on_ports = dev->host_mask;
-		dev->live_ports = dev->host_mask;
 	} else {
 		member = dev->host_mask | p->vid_member;
-		dev->on_ports |= BIT(port);
-
-		/* Link was detected before port is enabled. */
-		if (p->phydev.link)
-			dev->live_ports |= BIT(port);
 	}
 	ksz8795_cfg_port_member(dev, port, member);
 }
@@ -1023,7 +1008,6 @@ static void ksz8795_config_cpu_port(struct dsa_switch *ds)
 		if (i == dev->port_cnt)
 			break;
 		p->on = 1;
-		p->phy = 1;
 	}
 	for (i = 0; i < dev->phy_port_cnt; i++) {
 		p = &dev->ports[i];
@@ -1032,12 +1016,8 @@ static void ksz8795_config_cpu_port(struct dsa_switch *ds)
 		ksz_pread8(dev, i, P_REMOTE_STATUS, &remote);
 		if (remote & PORT_FIBER_MODE)
 			p->fiber = 1;
-		if (p->fiber)
-			ksz_port_cfg(dev, i, P_STP_CTRL, PORT_FORCE_FLOW_CTRL,
-				     true);
-		else
-			ksz_port_cfg(dev, i, P_STP_CTRL, PORT_FORCE_FLOW_CTRL,
-				     false);
+		ksz_port_cfg(dev, i, P_STP_CTRL, PORT_FORCE_FLOW_CTRL,
+			     !!p->fiber);
 	}
 }
 
@@ -1113,7 +1093,6 @@ static const struct dsa_switch_ops ksz8795_switch_ops = {
 	.phy_write		= ksz_phy_write16,
 	.adjust_link		= ksz_adjust_link,
 	.port_enable		= ksz_enable_port,
-	.port_disable		= ksz_disable_port,
 	.get_strings		= ksz8795_get_strings,
 	.get_ethtool_stats	= ksz_get_ethtool_stats,
 	.get_sset_count		= ksz_sset_count,
@@ -1168,7 +1147,6 @@ static int ksz8795_switch_detect(struct ksz_device *dev)
 			id2 = 0x65;
 	} else if (id2 == CHIP_ID_94) {
 		dev->port_cnt--;
-		dev->last_port = dev->port_cnt;
 		id2 = 0x94;
 	}
 	id16 &= ~0xff;
diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c
index 8d15c3016024..db2e8f95fa65 100644
--- a/drivers/net/dsa/microchip/ksz9477.c
+++ b/drivers/net/dsa/microchip/ksz9477.c
@@ -452,14 +452,6 @@ static void ksz9477_port_stp_state_set(struct dsa_switch *ds, int port,
 	ksz_pwrite8(dev, port, P_STP_CTRL, data);
 	p->stp_state = state;
 	mutex_lock(&dev->dev_mutex);
-	if (data & PORT_RX_ENABLE)
-		dev->rx_ports |= (1 << port);
-	else
-		dev->rx_ports &= ~(1 << port);
-	if (data & PORT_TX_ENABLE)
-		dev->tx_ports |= (1 << port);
-	else
-		dev->tx_ports &= ~(1 << port);
 
 	/* Port membership may share register with STP state. */
 	if (member >= 0 && member != p->member)
@@ -1268,18 +1260,7 @@ static void ksz9477_port_setup(struct ksz_device *dev, int port, bool cpu_port)
 		p->phydev.duplex = 1;
 	}
 	mutex_lock(&dev->dev_mutex);
-	if (cpu_port) {
-		member = dev->port_mask;
-		dev->on_ports = dev->host_mask;
-		dev->live_ports = dev->host_mask;
-	} else {
-		member = dev->host_mask | p->vid_member;
-		dev->on_ports |= (1 << port);
-
-		/* Link was detected before port is enabled. */
-		if (p->phydev.link)
-			dev->live_ports |= (1 << port);
-	}
+	member = cpu_port ? dev->port_mask : (dev->host_mask | p->vid_member);
 	mutex_unlock(&dev->dev_mutex);
 	ksz9477_cfg_port_member(dev, port, member);
 
@@ -1339,14 +1320,6 @@ static void ksz9477_config_cpu_port(struct dsa_switch *ds)
 		p->member = dev->port_mask;
 		ksz9477_port_stp_state_set(ds, i, BR_STATE_DISABLED);
 		p->on = 1;
-		if (i < dev->phy_port_cnt)
-			p->phy = 1;
-		if (dev->chip_id == 0x00947700 && i == 6) {
-			p->sgmii = 1;
-
-			/* SGMII PHY detection code is not implemented yet. */
-			p->phy = 0;
-		}
 	}
 }
 
@@ -1401,7 +1374,6 @@ static const struct dsa_switch_ops ksz9477_switch_ops = {
 	.phy_write		= ksz9477_phy_write16,
 	.adjust_link		= ksz_adjust_link,
 	.port_enable		= ksz_enable_port,
-	.port_disable		= ksz_disable_port,
 	.get_strings		= ksz9477_get_strings,
 	.get_ethtool_stats	= ksz_get_ethtool_stats,
 	.get_sset_count		= ksz_sset_count,
diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c
index fd1d6676ae4f..d39644bec85e 100644
--- a/drivers/net/dsa/microchip/ksz_common.c
+++ b/drivers/net/dsa/microchip/ksz_common.c
@@ -146,13 +146,6 @@ void ksz_adjust_link(struct dsa_switch *ds, int port,
 		p->read = true;
 		schedule_delayed_work(&dev->mib_read, 0);
 	}
-	mutex_lock(&dev->dev_mutex);
-	if (!phydev->link)
-		dev->live_ports &= ~(1 << port);
-	else
-		/* Remember which port is connected and active. */
-		dev->live_ports |= (1 << port) & dev->on_ports;
-	mutex_unlock(&dev->dev_mutex);
 }
 EXPORT_SYMBOL_GPL(ksz_adjust_link);
 
@@ -369,22 +362,6 @@ int ksz_enable_port(struct dsa_switch *ds, int port, struct phy_device *phy)
 }
 EXPORT_SYMBOL_GPL(ksz_enable_port);
 
-void ksz_disable_port(struct dsa_switch *ds, int port)
-{
-	struct ksz_device *dev = ds->priv;
-
-	if (!dsa_is_user_port(ds, port))
-		return;
-
-	dev->on_ports &= ~(1 << port);
-	dev->live_ports &= ~(1 << port);
-
-	/* port_stp_state_set() will be called after to disable the port so
-	 * there is no need to do anything.
-	 */
-}
-EXPORT_SYMBOL_GPL(ksz_disable_port);
-
 struct ksz_device *ksz_switch_alloc(struct device *base, void *priv)
 {
 	struct dsa_switch *ds;
diff --git a/drivers/net/dsa/microchip/ksz_common.h b/drivers/net/dsa/microchip/ksz_common.h
index f2c9bb68fd33..80b56448d7d9 100644
--- a/drivers/net/dsa/microchip/ksz_common.h
+++ b/drivers/net/dsa/microchip/ksz_common.h
@@ -31,10 +31,7 @@ struct ksz_port {
 	struct phy_device phydev;
 
 	u32 on:1;			/* port is not disabled by hardware */
-	u32 phy:1;			/* port has a PHY */
 	u32 fiber:1;			/* port is fiber */
-	u32 sgmii:1;			/* port is SGMII */
-	u32 force:1;
 	u32 read:1;			/* read MIB counters in background */
 	u32 freeze:1;			/* MIB counter freeze is enabled */
 
@@ -71,9 +68,7 @@ struct ksz_device {
 	int reg_mib_cnt;
 	int mib_cnt;
 	int mib_port_cnt;
-	int last_port;			/* ports after that not used */
 	phy_interface_t interface;
-	u32 regs_size;
 	bool phy_errata_9477;
 	bool synclko_125;
 
@@ -84,14 +79,9 @@ struct ksz_device {
 	unsigned long mib_read_interval;
 	u16 br_member;
 	u16 member;
-	u16 live_ports;
-	u16 on_ports;			/* ports enabled by DSA */
-	u16 rx_ports;
-	u16 tx_ports;
 	u16 mirror_rx;
 	u16 mirror_tx;
 	u32 features;			/* chip specific features */
-	u32 overrides;			/* chip functions set by user */
 	u16 host_mask;
 	u16 port_mask;
 };
@@ -179,7 +169,6 @@ void ksz_port_mdb_add(struct dsa_switch *ds, int port,
 int ksz_port_mdb_del(struct dsa_switch *ds, int port,
 		     const struct switchdev_obj_port_mdb *mdb);
 int ksz_enable_port(struct dsa_switch *ds, int port, struct phy_device *phy);
-void ksz_disable_port(struct dsa_switch *ds, int port);
 
 /* Common register access functions */
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [RFC PATCH] net: dsa: microchip: delete dead code
  2020-07-21  8:33 [RFC PATCH] net: dsa: microchip: delete dead code Helmut Grohne
@ 2020-07-22 14:39 ` Andrew Lunn
  2020-07-23  4:24   ` Helmut Grohne
  0 siblings, 1 reply; 13+ messages in thread
From: Andrew Lunn @ 2020-07-22 14:39 UTC (permalink / raw)
  To: Helmut Grohne
  Cc: Woojung Huh, Microchip Linux Driver Support, Vivien Didelot,
	Florian Fainelli, David S. Miller, Jakub Kicinski, netdev

On Tue, Jul 21, 2020 at 10:33:01AM +0200, Helmut Grohne wrote:
> None of the removed assignments is ever read back and never influences
> logic.
> 
> Signed-off-by: Helmut Grohne <helmut.grohne@intenta.de>

Hi Helmut

This patch probably is correct. But it is not obviously correct,
because there are so many changes at once. Please could you break it
up.

> @@ -31,10 +31,7 @@ struct ksz_port {
>  	struct phy_device phydev;
>  
>  	u32 on:1;			/* port is not disabled by hardware */
> -	u32 phy:1;			/* port has a PHY */
>  	u32 fiber:1;			/* port is fiber */
> -	u32 sgmii:1;			/* port is SGMII */
> -	u32 force:1;
>  	u32 read:1;			/* read MIB counters in background */
>  	u32 freeze:1;			/* MIB counter freeze is enabled */
>  
> @@ -71,9 +68,7 @@ struct ksz_device {
>  	int reg_mib_cnt;
>  	int mib_cnt;
>  	int mib_port_cnt;
> -	int last_port;			/* ports after that not used */
>  	phy_interface_t interface;
> -	u32 regs_size;
>  	bool phy_errata_9477;
>  	bool synclko_125;
>  
> @@ -84,14 +79,9 @@ struct ksz_device {
>  	unsigned long mib_read_interval;
>  	u16 br_member;
>  	u16 member;
> -	u16 live_ports;
> -	u16 on_ports;			/* ports enabled by DSA */
> -	u16 rx_ports;
> -	u16 tx_ports;
>  	u16 mirror_rx;
>  	u16 mirror_tx;
>  	u32 features;			/* chip specific features */
> -	u32 overrides;			/* chip functions set by user */
>  	u16 host_mask;
>  	u16 port_mask;

So at minimum, break it up into 3 patches, one per structure.  I would
even go further.

Small patches are easier to review. And if something does break, a git
bisect gives you more information about what change broke it.

Thanks
	Andrew

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [RFC PATCH] net: dsa: microchip: delete dead code
  2020-07-22 14:39 ` Andrew Lunn
@ 2020-07-23  4:24   ` Helmut Grohne
  2020-07-25 17:41     ` Andrew Lunn
  0 siblings, 1 reply; 13+ messages in thread
From: Helmut Grohne @ 2020-07-23  4:24 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Woojung Huh, Microchip Linux Driver Support, Vivien Didelot,
	Florian Fainelli, David S. Miller, Jakub Kicinski, netdev

Hi Andrew,

On Wed, Jul 22, 2020 at 04:39:53PM +0200, Andrew Lunn wrote:
> This patch probably is correct. But it is not obviously correct,
> because there are so many changes at once. Please could you break it
> up.

From my pov, it is less a question of whether it is correct, but whether
it goes into the desired direction. There are a few comments in the
driver that point to pending work. It might as well be that I'm removing
the infrastructure that other patches are meant to build upon.

I guess only the microchip people can answer this and in the event of
silence, the best course of action likely is to proceed. Maybe give it
some time? It's summer holdiday time in northern hemisphere.

> So at minimum, break it up into 3 patches, one per structure.  I would
> even go further.
> 
> Small patches are easier to review. And if something does break, a git
> bisect gives you more information about what change broke it.

Yes, sure. But this was deliberately RFC and I deliberately merged all
the removals to give you a quick idea of the dead code size. I didn't
expect this to be applied as is but rather generate a reply regarding
the purpose of the code that I propose to remove (in smaller steps).

Helmut

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [RFC PATCH] net: dsa: microchip: delete dead code
  2020-07-23  4:24   ` Helmut Grohne
@ 2020-07-25 17:41     ` Andrew Lunn
  2020-08-17 14:55       ` [PATCH v2 0/6] " Helmut Grohne
  0 siblings, 1 reply; 13+ messages in thread
From: Andrew Lunn @ 2020-07-25 17:41 UTC (permalink / raw)
  To: Helmut Grohne
  Cc: Woojung Huh, Microchip Linux Driver Support, Vivien Didelot,
	Florian Fainelli, David S. Miller, Jakub Kicinski, netdev

On Thu, Jul 23, 2020 at 06:24:31AM +0200, Helmut Grohne wrote:
> Hi Andrew,
> 
> On Wed, Jul 22, 2020 at 04:39:53PM +0200, Andrew Lunn wrote:
> > This patch probably is correct. But it is not obviously correct,
> > because there are so many changes at once. Please could you break it
> > up.
> 
> >From my pov, it is less a question of whether it is correct, but whether
> it goes into the desired direction. There are a few comments in the
> driver that point to pending work. It might as well be that I'm removing
> the infrastructure that other patches are meant to build upon.

Hi Helmut

There was a small burst of patches from Microchip in this month. But
apart from that, you need to go a long way back.

I say clean it up now. The code is in the git history, so it is easy
to get back if needed.

   Andrew

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v2 0/6] net: dsa: microchip: delete dead code
  2020-07-25 17:41     ` Andrew Lunn
@ 2020-08-17 14:55       ` Helmut Grohne
  2020-08-17 14:55         ` [PATCH v2 1/6] net: dsa: microchip: delete unused member ksz_port.phy Helmut Grohne
                           ` (6 more replies)
  0 siblings, 7 replies; 13+ messages in thread
From: Helmut Grohne @ 2020-08-17 14:55 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Woojung Huh, Microchip Linux Driver Support, Vivien Didelot,
	Florian Fainelli, David S. Miller, Jakub Kicinski, netdev

Andrew Lunn asked me to turn my dead code removal RFC patch into a real
one splitting it per member. This is what this v2 series does. Some
parts of the RFC patch are already applied via:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b20a6b29a811bee0e44b64958d415eb50436154c

All other structure members are read at least once.

Helmut

Helmut Grohne (6):
  net: dsa: microchip: delete unused member ksz_port.phy
  net: dsa: microchip: delete unused member ksz_port.sgmii
  net: dsa: microchip: delete unused member ksz_port.force
  net: dsa: microchip: delete unused member ksz_device.last_port
  net: dsa: microchip: delete unused member ksz_device.regs_size
  net: dsa: microchip: delete unused member ksz_device.overrides

 drivers/net/dsa/microchip/ksz8795.c    | 2 --
 drivers/net/dsa/microchip/ksz9477.c    | 8 --------
 drivers/net/dsa/microchip/ksz_common.h | 6 ------
 3 files changed, 16 deletions(-)

-- 
2.20.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v2 1/6] net: dsa: microchip: delete unused member ksz_port.phy
  2020-08-17 14:55       ` [PATCH v2 0/6] " Helmut Grohne
@ 2020-08-17 14:55         ` Helmut Grohne
  2020-08-17 14:55         ` [PATCH v2 2/6] net: dsa: microchip: delete unused member ksz_port.sgmii Helmut Grohne
                           ` (5 subsequent siblings)
  6 siblings, 0 replies; 13+ messages in thread
From: Helmut Grohne @ 2020-08-17 14:55 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Woojung Huh, Microchip Linux Driver Support, Vivien Didelot,
	Florian Fainelli, David S. Miller, Jakub Kicinski, netdev

Link: https://lore.kernel.org/netdev/20200721083300.GA12970@laureti-dev/
Signed-off-by: Helmut Grohne <helmut.grohne@intenta.de>
---
 drivers/net/dsa/microchip/ksz8795.c    | 1 -
 drivers/net/dsa/microchip/ksz9477.c    | 8 +-------
 drivers/net/dsa/microchip/ksz_common.h | 1 -
 3 files changed, 1 insertion(+), 9 deletions(-)

diff --git a/drivers/net/dsa/microchip/ksz8795.c b/drivers/net/dsa/microchip/ksz8795.c
index 8f1d15ea15d9..e62d54306765 100644
--- a/drivers/net/dsa/microchip/ksz8795.c
+++ b/drivers/net/dsa/microchip/ksz8795.c
@@ -1007,7 +1007,6 @@ static void ksz8795_config_cpu_port(struct dsa_switch *ds)
 		if (i == dev->port_cnt)
 			break;
 		p->on = 1;
-		p->phy = 1;
 	}
 	for (i = 0; i < dev->phy_port_cnt; i++) {
 		p = &dev->ports[i];
diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c
index dc999406ce86..c548894553bc 100644
--- a/drivers/net/dsa/microchip/ksz9477.c
+++ b/drivers/net/dsa/microchip/ksz9477.c
@@ -1305,14 +1305,8 @@ static void ksz9477_config_cpu_port(struct dsa_switch *ds)
 		p->member = dev->port_mask;
 		ksz9477_port_stp_state_set(ds, i, BR_STATE_DISABLED);
 		p->on = 1;
-		if (i < dev->phy_port_cnt)
-			p->phy = 1;
-		if (dev->chip_id == 0x00947700 && i == 6) {
+		if (dev->chip_id == 0x00947700 && i == 6)
 			p->sgmii = 1;
-
-			/* SGMII PHY detection code is not implemented yet. */
-			p->phy = 0;
-		}
 	}
 }
 
diff --git a/drivers/net/dsa/microchip/ksz_common.h b/drivers/net/dsa/microchip/ksz_common.h
index 206838160f49..0432cd38bf0b 100644
--- a/drivers/net/dsa/microchip/ksz_common.h
+++ b/drivers/net/dsa/microchip/ksz_common.h
@@ -31,7 +31,6 @@ struct ksz_port {
 	struct phy_device phydev;
 
 	u32 on:1;			/* port is not disabled by hardware */
-	u32 phy:1;			/* port has a PHY */
 	u32 fiber:1;			/* port is fiber */
 	u32 sgmii:1;			/* port is SGMII */
 	u32 force:1;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 2/6] net: dsa: microchip: delete unused member ksz_port.sgmii
  2020-08-17 14:55       ` [PATCH v2 0/6] " Helmut Grohne
  2020-08-17 14:55         ` [PATCH v2 1/6] net: dsa: microchip: delete unused member ksz_port.phy Helmut Grohne
@ 2020-08-17 14:55         ` Helmut Grohne
  2020-08-17 14:55         ` [PATCH v2 3/6] net: dsa: microchip: delete unused member ksz_port.force Helmut Grohne
                           ` (4 subsequent siblings)
  6 siblings, 0 replies; 13+ messages in thread
From: Helmut Grohne @ 2020-08-17 14:55 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Woojung Huh, Microchip Linux Driver Support, Vivien Didelot,
	Florian Fainelli, David S. Miller, Jakub Kicinski, netdev

Link: https://lore.kernel.org/netdev/20200721083300.GA12970@laureti-dev/
Signed-off-by: Helmut Grohne <helmut.grohne@intenta.de>
---
 drivers/net/dsa/microchip/ksz9477.c    | 2 --
 drivers/net/dsa/microchip/ksz_common.h | 1 -
 2 files changed, 3 deletions(-)

diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c
index c548894553bc..0ff54ee4f963 100644
--- a/drivers/net/dsa/microchip/ksz9477.c
+++ b/drivers/net/dsa/microchip/ksz9477.c
@@ -1305,8 +1305,6 @@ static void ksz9477_config_cpu_port(struct dsa_switch *ds)
 		p->member = dev->port_mask;
 		ksz9477_port_stp_state_set(ds, i, BR_STATE_DISABLED);
 		p->on = 1;
-		if (dev->chip_id == 0x00947700 && i == 6)
-			p->sgmii = 1;
 	}
 }
 
diff --git a/drivers/net/dsa/microchip/ksz_common.h b/drivers/net/dsa/microchip/ksz_common.h
index 0432cd38bf0b..83247140b784 100644
--- a/drivers/net/dsa/microchip/ksz_common.h
+++ b/drivers/net/dsa/microchip/ksz_common.h
@@ -32,7 +32,6 @@ struct ksz_port {
 
 	u32 on:1;			/* port is not disabled by hardware */
 	u32 fiber:1;			/* port is fiber */
-	u32 sgmii:1;			/* port is SGMII */
 	u32 force:1;
 	u32 read:1;			/* read MIB counters in background */
 	u32 freeze:1;			/* MIB counter freeze is enabled */
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 3/6] net: dsa: microchip: delete unused member ksz_port.force
  2020-08-17 14:55       ` [PATCH v2 0/6] " Helmut Grohne
  2020-08-17 14:55         ` [PATCH v2 1/6] net: dsa: microchip: delete unused member ksz_port.phy Helmut Grohne
  2020-08-17 14:55         ` [PATCH v2 2/6] net: dsa: microchip: delete unused member ksz_port.sgmii Helmut Grohne
@ 2020-08-17 14:55         ` Helmut Grohne
  2020-08-17 14:55         ` [PATCH v2 4/6] net: dsa: microchip: delete unused member ksz_device.last_port Helmut Grohne
                           ` (3 subsequent siblings)
  6 siblings, 0 replies; 13+ messages in thread
From: Helmut Grohne @ 2020-08-17 14:55 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Woojung Huh, Microchip Linux Driver Support, Vivien Didelot,
	Florian Fainelli, David S. Miller, Jakub Kicinski, netdev

Link: https://lore.kernel.org/netdev/20200721083300.GA12970@laureti-dev/
Signed-off-by: Helmut Grohne <helmut.grohne@intenta.de>
---
 drivers/net/dsa/microchip/ksz_common.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/dsa/microchip/ksz_common.h b/drivers/net/dsa/microchip/ksz_common.h
index 83247140b784..8e277033bff7 100644
--- a/drivers/net/dsa/microchip/ksz_common.h
+++ b/drivers/net/dsa/microchip/ksz_common.h
@@ -32,7 +32,6 @@ struct ksz_port {
 
 	u32 on:1;			/* port is not disabled by hardware */
 	u32 fiber:1;			/* port is fiber */
-	u32 force:1;
 	u32 read:1;			/* read MIB counters in background */
 	u32 freeze:1;			/* MIB counter freeze is enabled */
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 4/6] net: dsa: microchip: delete unused member ksz_device.last_port
  2020-08-17 14:55       ` [PATCH v2 0/6] " Helmut Grohne
                           ` (2 preceding siblings ...)
  2020-08-17 14:55         ` [PATCH v2 3/6] net: dsa: microchip: delete unused member ksz_port.force Helmut Grohne
@ 2020-08-17 14:55         ` Helmut Grohne
  2020-08-17 14:59         ` [PATCH v2 5/6] net: dsa: microchip: delete unused member ksz_device.regs_size Helmut Grohne
                           ` (2 subsequent siblings)
  6 siblings, 0 replies; 13+ messages in thread
From: Helmut Grohne @ 2020-08-17 14:55 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Woojung Huh, Microchip Linux Driver Support, Vivien Didelot,
	Florian Fainelli, David S. Miller, Jakub Kicinski, netdev

Link: https://lore.kernel.org/netdev/20200721083300.GA12970@laureti-dev/
Signed-off-by: Helmut Grohne <helmut.grohne@intenta.de>
---
 drivers/net/dsa/microchip/ksz8795.c    | 1 -
 drivers/net/dsa/microchip/ksz_common.h | 1 -
 2 files changed, 2 deletions(-)

diff --git a/drivers/net/dsa/microchip/ksz8795.c b/drivers/net/dsa/microchip/ksz8795.c
index e62d54306765..3bdfe1f4d0f5 100644
--- a/drivers/net/dsa/microchip/ksz8795.c
+++ b/drivers/net/dsa/microchip/ksz8795.c
@@ -1150,7 +1150,6 @@ static int ksz8795_switch_detect(struct ksz_device *dev)
 			id2 = 0x65;
 	} else if (id2 == CHIP_ID_94) {
 		dev->port_cnt--;
-		dev->last_port = dev->port_cnt;
 		id2 = 0x94;
 	}
 	id16 &= ~0xff;
diff --git a/drivers/net/dsa/microchip/ksz_common.h b/drivers/net/dsa/microchip/ksz_common.h
index 8e277033bff7..1791442f04ee 100644
--- a/drivers/net/dsa/microchip/ksz_common.h
+++ b/drivers/net/dsa/microchip/ksz_common.h
@@ -68,7 +68,6 @@ struct ksz_device {
 	int reg_mib_cnt;
 	int mib_cnt;
 	int mib_port_cnt;
-	int last_port;			/* ports after that not used */
 	phy_interface_t interface;
 	u32 regs_size;
 	bool phy_errata_9477;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 5/6] net: dsa: microchip: delete unused member ksz_device.regs_size
  2020-08-17 14:55       ` [PATCH v2 0/6] " Helmut Grohne
                           ` (3 preceding siblings ...)
  2020-08-17 14:55         ` [PATCH v2 4/6] net: dsa: microchip: delete unused member ksz_device.last_port Helmut Grohne
@ 2020-08-17 14:59         ` Helmut Grohne
  2020-08-17 14:59         ` [PATCH v2 6/6] net: dsa: microchip: delete unused member ksz_device.overrides Helmut Grohne
  2020-08-17 15:18         ` [PATCH v2 0/6] net: dsa: microchip: delete dead code Florian Fainelli
  6 siblings, 0 replies; 13+ messages in thread
From: Helmut Grohne @ 2020-08-17 14:59 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Woojung Huh, Microchip Linux Driver Support, Vivien Didelot,
	Florian Fainelli, David S. Miller, Jakub Kicinski, netdev

Link: https://lore.kernel.org/netdev/20200721083300.GA12970@laureti-dev/
Signed-off-by: Helmut Grohne <helmut.grohne@intenta.de>
---
 drivers/net/dsa/microchip/ksz_common.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/dsa/microchip/ksz_common.h b/drivers/net/dsa/microchip/ksz_common.h
index 1791442f04ee..0120f2b72091 100644
--- a/drivers/net/dsa/microchip/ksz_common.h
+++ b/drivers/net/dsa/microchip/ksz_common.h
@@ -69,7 +69,6 @@ struct ksz_device {
 	int mib_cnt;
 	int mib_port_cnt;
 	phy_interface_t interface;
-	u32 regs_size;
 	bool phy_errata_9477;
 	bool synclko_125;
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 6/6] net: dsa: microchip: delete unused member ksz_device.overrides
  2020-08-17 14:55       ` [PATCH v2 0/6] " Helmut Grohne
                           ` (4 preceding siblings ...)
  2020-08-17 14:59         ` [PATCH v2 5/6] net: dsa: microchip: delete unused member ksz_device.regs_size Helmut Grohne
@ 2020-08-17 14:59         ` Helmut Grohne
  2020-08-17 15:18         ` [PATCH v2 0/6] net: dsa: microchip: delete dead code Florian Fainelli
  6 siblings, 0 replies; 13+ messages in thread
From: Helmut Grohne @ 2020-08-17 14:59 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Woojung Huh, Microchip Linux Driver Support, Vivien Didelot,
	Florian Fainelli, David S. Miller, Jakub Kicinski, netdev

Link: https://lore.kernel.org/netdev/20200721083300.GA12970@laureti-dev/
Signed-off-by: Helmut Grohne <helmut.grohne@intenta.de>
---
 drivers/net/dsa/microchip/ksz_common.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/dsa/microchip/ksz_common.h b/drivers/net/dsa/microchip/ksz_common.h
index 0120f2b72091..10ff7774a867 100644
--- a/drivers/net/dsa/microchip/ksz_common.h
+++ b/drivers/net/dsa/microchip/ksz_common.h
@@ -82,7 +82,6 @@ struct ksz_device {
 	u16 mirror_rx;
 	u16 mirror_tx;
 	u32 features;			/* chip specific features */
-	u32 overrides;			/* chip functions set by user */
 	u16 host_mask;
 	u16 port_mask;
 };
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 0/6] net: dsa: microchip: delete dead code
  2020-08-17 14:55       ` [PATCH v2 0/6] " Helmut Grohne
                           ` (5 preceding siblings ...)
  2020-08-17 14:59         ` [PATCH v2 6/6] net: dsa: microchip: delete unused member ksz_device.overrides Helmut Grohne
@ 2020-08-17 15:18         ` Florian Fainelli
  2020-08-18  7:57           ` Helmut Grohne
  6 siblings, 1 reply; 13+ messages in thread
From: Florian Fainelli @ 2020-08-17 15:18 UTC (permalink / raw)
  To: Helmut Grohne, Andrew Lunn
  Cc: Woojung Huh, Microchip Linux Driver Support, Vivien Didelot,
	David S. Miller, Jakub Kicinski, netdev



On 8/17/2020 7:55 AM, Helmut Grohne wrote:
> Andrew Lunn asked me to turn my dead code removal RFC patch into a real
> one splitting it per member. This is what this v2 series does. Some
> parts of the RFC patch are already applied via:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b20a6b29a811bee0e44b64958d415eb50436154c
> 
> All other structure members are read at least once.

net-next is currently closed at the moment, and these patches are 
clearly targeted at that tree:

http://vger.kernel.org/~davem/net-next.html

Also, please provide a commit message, even if it is only paraphrasing 
what the subject does. The changes do look good, so once you fix that, 
we should be good.

Thank you
-- 
Florian

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 0/6] net: dsa: microchip: delete dead code
  2020-08-17 15:18         ` [PATCH v2 0/6] net: dsa: microchip: delete dead code Florian Fainelli
@ 2020-08-18  7:57           ` Helmut Grohne
  0 siblings, 0 replies; 13+ messages in thread
From: Helmut Grohne @ 2020-08-18  7:57 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: Andrew Lunn, Woojung Huh, Microchip Linux Driver Support,
	Vivien Didelot, David S. Miller, Jakub Kicinski, netdev

Hi Florian,

On Mon, Aug 17, 2020 at 08:18:41AM -0700, Florian Fainelli wrote:
> net-next is currently closed at the moment, and these patches are clearly
> targeted at that tree:

I agree that these are clearly net-next material.

> http://vger.kernel.org/~davem/net-next.html

It says "Come in we're open" for me. Maybe that changed over night and I
was just a day early? I'll check this for future submissions.

> Also, please provide a commit message, even if it is only paraphrasing what
> the subject does. The changes do look good, so once you fix that, we should
> be good.

I'm all for writing good commit messages and if you look into the few
commits I've authored thus far, you see that I usually do explain them
in detail. In these cases however, I'm left wondering what value any
further explanation would add. Repeating the subject does not make sense
to me.

I feel that we're overdoing it here and that there are more important
aspects to be improved about the driver. I'll be focusing on those.

Helmut

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2020-08-18  7:57 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-21  8:33 [RFC PATCH] net: dsa: microchip: delete dead code Helmut Grohne
2020-07-22 14:39 ` Andrew Lunn
2020-07-23  4:24   ` Helmut Grohne
2020-07-25 17:41     ` Andrew Lunn
2020-08-17 14:55       ` [PATCH v2 0/6] " Helmut Grohne
2020-08-17 14:55         ` [PATCH v2 1/6] net: dsa: microchip: delete unused member ksz_port.phy Helmut Grohne
2020-08-17 14:55         ` [PATCH v2 2/6] net: dsa: microchip: delete unused member ksz_port.sgmii Helmut Grohne
2020-08-17 14:55         ` [PATCH v2 3/6] net: dsa: microchip: delete unused member ksz_port.force Helmut Grohne
2020-08-17 14:55         ` [PATCH v2 4/6] net: dsa: microchip: delete unused member ksz_device.last_port Helmut Grohne
2020-08-17 14:59         ` [PATCH v2 5/6] net: dsa: microchip: delete unused member ksz_device.regs_size Helmut Grohne
2020-08-17 14:59         ` [PATCH v2 6/6] net: dsa: microchip: delete unused member ksz_device.overrides Helmut Grohne
2020-08-17 15:18         ` [PATCH v2 0/6] net: dsa: microchip: delete dead code Florian Fainelli
2020-08-18  7:57           ` Helmut Grohne

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).