Skip to contentSkip to conversation

code clean up

PATCH Applied Justin Chen 2 participants 4 messages Jan 22 – Jan 27

Subsystems (3)
lore
Share & tools
lore

Justin Chen

author maintainer
#0 lore raw

v3 cover code clean up

Clean up and streamlined some code that is no longer needed due to older HW support being dropped.

v2:
Dropped a bug fix patch and sent to net instead so that it can be backported to stable.

v3:
Extracted the early exit leak bug and sent to net instead.

Justin Chen (2):
net: bcmasp: clean up some legacy logic
net: bcmasp: streamline early exit in probe

 drivers/net/ethernet/broadcom/asp2/bcmasp.c   | 32 +++++-----
 drivers/net/ethernet/broadcom/asp2/bcmasp.h   | 36 ------------
 .../net/ethernet/broadcom/asp2/bcmasp_intf.c  | 58 ++++---------------
 3 files changed, 24 insertions(+), 102 deletions(-)
Signature · 1 line
2.34.1
author maintainer
#1 lore raw

PATCH v3 1/2 net: bcmasp: clean up some legacy logic

Removed wol_irq check. This was needed for brcm,asp-v2.0, which was removed in previous commits.

Removed bcmasp_intf_ops. These function pointers were added to make it easier to implement pseudo channels. These channels were removed in newer versions of the hardware and were never implemented.

---
 drivers/net/ethernet/broadcom/asp2/bcmasp.c   |  5 --
 drivers/net/ethernet/broadcom/asp2/bcmasp.h   | 36 ------------
 .../net/ethernet/broadcom/asp2/bcmasp_intf.c  | 58 ++++---------------
 3 files changed, 10 insertions(+), 89 deletions(-)
drivers/net/ethernet/broadcom/asp2/bcmasp.c +0 -5
index 014340f33345..36df7d1a9be3 100644
@@ -1081,15 +1081,10 @@ static irqreturn_t bcmasp_isr_wol(int irq, void *data)
 	struct bcmasp_priv *priv = data;
 	u32 status;
 
-	/* No L3 IRQ, so we good */
-	if (priv->wol_irq <= 0)
-		goto irq_handled;
-
 	status = wakeup_intr2_core_rl(priv, ASP_WAKEUP_INTR2_STATUS) &
 		~wakeup_intr2_core_rl(priv, ASP_WAKEUP_INTR2_MASK_STATUS);
 	wakeup_intr2_core_wl(priv, status, ASP_WAKEUP_INTR2_CLEAR);
 
-irq_handled:
 	pm_wakeup_event(&priv->pdev->dev, 0);
 	return IRQ_HANDLED;
 }
drivers/net/ethernet/broadcom/asp2/bcmasp.h +0 -36
index e238507be40a..29cd87335ec8 100644
@@ -268,13 +268,6 @@ struct bcmasp_mib_counters {
 	u32	tx_timeout_cnt;
 };
 
-struct bcmasp_intf_ops {
-	unsigned long (*rx_desc_read)(struct bcmasp_intf *intf);
-	void (*rx_buffer_write)(struct bcmasp_intf *intf, dma_addr_t addr);
-	void (*rx_desc_write)(struct bcmasp_intf *intf, dma_addr_t addr);
-	unsigned long (*tx_read)(struct bcmasp_intf *intf);
-	void (*tx_write)(struct bcmasp_intf *intf, dma_addr_t addr);
-};
 
 struct bcmasp_priv;
 
@@ -286,7 +279,6 @@ struct bcmasp_intf {
 	/* ASP Ch */
 	int				channel;
 	int				port;
-	const struct bcmasp_intf_ops	*ops;
 
 	/* Used for splitting shared resources */
 	int				index;
@@ -407,34 +399,6 @@ struct bcmasp_priv {
 	struct mutex			net_lock;
 };
 
-static inline unsigned long bcmasp_intf_rx_desc_read(struct bcmasp_intf *intf)
-{
-	return intf->ops->rx_desc_read(intf);
-}
-
-static inline void bcmasp_intf_rx_buffer_write(struct bcmasp_intf *intf,
-					       dma_addr_t addr)
-{
-	intf->ops->rx_buffer_write(intf, addr);
-}
-
-static inline void bcmasp_intf_rx_desc_write(struct bcmasp_intf *intf,
-					     dma_addr_t addr)
-{
-	intf->ops->rx_desc_write(intf, addr);
-}
-
-static inline unsigned long bcmasp_intf_tx_read(struct bcmasp_intf *intf)
-{
-	return intf->ops->tx_read(intf);
-}
-
-static inline void bcmasp_intf_tx_write(struct bcmasp_intf *intf,
-					dma_addr_t addr)
-{
-	intf->ops->tx_write(intf, addr);
-}
-
 #define __BCMASP_IO_MACRO(name, m)					\
 static inline u32 name##_rl(struct bcmasp_intf *intf, u32 off)		\
 {									\
drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c +10 -48

112 lines not on this page · raw message

Signature · 1 line
2.34.1
author maintainer
#2 lore raw

PATCH v3 2/2 net: bcmasp: streamline early exit in probe

In reply to Justin Chen

Streamline the bcmasp_probe early exit. As support for other functionality is added(i.e. ptp), it is easier to keep track of early exit cleanup when it is all in one place.

---
 drivers/net/ethernet/broadcom/asp2/bcmasp.c | 27 +++++++++++----------
 1 file changed, 14 insertions(+), 13 deletions(-)
drivers/net/ethernet/broadcom/asp2/bcmasp.c +14 -13
index 36df7d1a9be3..aa6d8606849f 100644
@@ -1317,6 +1317,8 @@ static int bcmasp_probe(struct platform_device *pdev)
 
 	bcmasp_core_init_filters(priv);
 
+	bcmasp_init_wol(priv);
+
 	ports_node = of_find_node_by_name(dev->of_node, "ethernet-ports");
 	if (!ports_node) {
 		dev_warn(dev, "No ports found\n");
@@ -1328,16 +1330,14 @@ static int bcmasp_probe(struct platform_device *pdev)
 		intf = bcmasp_interface_create(priv, intf_node, i);
 		if (!intf) {
 			dev_err(dev, "Cannot create eth interface %d\n", i);
-			bcmasp_remove_intfs(priv);
-			ret = -ENOMEM;
-			goto of_put_exit;
+			of_node_put(ports_node);
+			ret = -EINVAL;
+			goto err_cleanup;
 		}
 		list_add_tail(&intf->list, &priv->intfs);
 		i++;
 	}
-
-	/* Check and enable WoL */
-	bcmasp_init_wol(priv);
+	of_node_put(ports_node);
 
 	/* Drop the clock reference count now and let ndo_open()/ndo_close()
 	 * manage it for us from now on.
@@ -1352,19 +1352,20 @@ static int bcmasp_probe(struct platform_device *pdev)
 	list_for_each_entry(intf, &priv->intfs, list) {
 		ret = register_netdev(intf->ndev);
 		if (ret) {
-			netdev_err(intf->ndev,
-				   "failed to register net_device: %d\n", ret);
-			bcmasp_wol_irq_destroy(priv);
-			bcmasp_remove_intfs(priv);
-			goto of_put_exit;
+			dev_err(dev, "failed to register net_device: %d\n", ret);
+			goto err_cleanup;
 		}
 		count++;
 	}
 
 	dev_info(dev, "Initialized %d port(s)\n", count);
 
-of_put_exit:
-	of_node_put(ports_node);
+	return ret;
+
+err_cleanup:
+	bcmasp_wol_irq_destroy(priv);
+	bcmasp_remove_intfs(priv);
+
 	return ret;
 }
 
Signature · 1 line
2.34.1
#3 lore raw
In reply to Justin Chen
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Thu, 22 Jan 2026 11:49:47 -0800 you wrote:

Clean up and streamlined some code that is no longer needed due to older HW support being dropped.

v2:
Dropped a bug fix patch and sent to net instead so that it can be backported to stable.

[...]

Here is the summary with links:
- [net-next,v3,1/2] net: bcmasp: clean up some legacy logic

    https://git.kernel.org/netdev/net-next/c/9271fc31901d
  - [net-next,v3,2/2] net: bcmasp: streamline early exit in probe
    https://git.kernel.org/netdev/net-next/c/1fd1281250c3

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html