Thread (7 messages) flat view 7 messages, 4 authors, 29d ago
COLD29d

[PATCH net] net: macb: Move macb_{alloc,free}_tieoff() out of CONFIG_OF block

From: Nathan Chancellor <nathan@kernel.org>
Date: 2026-08-19 01:14:10
Also in: lkml
Subsystem: atmel macb ethernet driver, networking drivers, the rest · Maintainers: Théo Lebrun, Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds

Commit 5262eab9462a ("net: macb: allocate tieoff descriptor once across
device lifetime") moved macb_alloc_tieoff() and macb_free_tieoff() into
a CONFIG_OF block, breaking the build when it is disabled:

  drivers/net/ethernet/cadence/macb_main.c: In function 'macb_probe':
  drivers/net/ethernet/cadence/macb_main.c:5951:15: error: implicit declaration of function 'macb_alloc_tieoff' [-Wimplicit-function-declaration]
   5951 |         err = macb_alloc_tieoff(bp);
        |               ^~~~~~~~~~~~~~~~~
  drivers/net/ethernet/cadence/macb_main.c:5973:9: error: implicit declaration of function 'macb_free_tieoff' [-Wimplicit-function-declaration]
   5973 |         macb_free_tieoff(bp);
        |         ^~~~~~~~~~~~~~~~

Moving macb_alloc_tieoff() from its original positive does not appear to
be necessary, so move it and macb_free_tieoff() back out of the
CONFIG_OF block to clear up the error.

Fixes: 5262eab9462a ("net: macb: allocate tieoff descriptor once across device lifetime")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
This does not apply to net currently but I assume net will be fast
forwarded when net-next-7.3 is merged.
---
 drivers/net/ethernet/cadence/macb_main.c | 64 ++++++++++++++++----------------
 1 file changed, 32 insertions(+), 32 deletions(-)
diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index 1476bce77f34..96a7e7777e62 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -2776,6 +2776,38 @@ static int macb_alloc(struct macb *bp)
 	return -ENOMEM;
 }
 
+static int macb_alloc_tieoff(struct macb *bp)
+{
+	/* Tieoff is a workaround in case HW cannot disable queues, for PM. */
+	if (bp->caps & MACB_CAPS_QUEUE_DISABLE)
+		return 0;
+
+	bp->rx_ring_tieoff = dma_alloc_coherent(&bp->pdev->dev,
+						macb_dma_desc_get_size(bp),
+						&bp->rx_ring_tieoff_dma,
+						GFP_KERNEL);
+	if (!bp->rx_ring_tieoff)
+		return -ENOMEM;
+
+	macb_set_addr(bp, bp->rx_ring_tieoff,
+		      MACB_BIT(RX_WRAP) | MACB_BIT(RX_USED));
+
+	bp->rx_ring_tieoff->ctrl = 0;
+
+	return 0;
+}
+
+static void macb_free_tieoff(struct macb *bp)
+{
+	if (!bp->rx_ring_tieoff)
+		return;
+
+	dma_free_coherent(&bp->pdev->dev, macb_dma_desc_get_size(bp),
+			  bp->rx_ring_tieoff,
+			  bp->rx_ring_tieoff_dma);
+	bp->rx_ring_tieoff = NULL;
+}
+
 static void gem_init_rx_ring(struct macb_queue *queue)
 {
 	queue->rx_tail = 0;
@@ -5507,38 +5539,6 @@ static int eyeq5_init(struct platform_device *pdev)
 	return ret;
 }
 
-static int macb_alloc_tieoff(struct macb *bp)
-{
-	/* Tieoff is a workaround in case HW cannot disable queues, for PM. */
-	if (bp->caps & MACB_CAPS_QUEUE_DISABLE)
-		return 0;
-
-	bp->rx_ring_tieoff = dma_alloc_coherent(&bp->pdev->dev,
-						macb_dma_desc_get_size(bp),
-						&bp->rx_ring_tieoff_dma,
-						GFP_KERNEL);
-	if (!bp->rx_ring_tieoff)
-		return -ENOMEM;
-
-	macb_set_addr(bp, bp->rx_ring_tieoff,
-		      MACB_BIT(RX_WRAP) | MACB_BIT(RX_USED));
-
-	bp->rx_ring_tieoff->ctrl = 0;
-
-	return 0;
-}
-
-static void macb_free_tieoff(struct macb *bp)
-{
-	if (!bp->rx_ring_tieoff)
-		return;
-
-	dma_free_coherent(&bp->pdev->dev, macb_dma_desc_get_size(bp),
-			  bp->rx_ring_tieoff,
-			  bp->rx_ring_tieoff_dma);
-	bp->rx_ring_tieoff = NULL;
-}
-
 static const struct macb_usrio_config mpfs_usrio = {
 	.tsu_source = 0,
 };
---
base-commit: 61eb236c41c2a4717015dff18016a75a5eb90052
change-id: 20260818-macb-fix-no-of-build-eee72c7cf20d

Best regards,
--  
Cheers,
Nathan
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help