All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] net: macb: fix CONFIG_OF=n build
@ 2026-08-19  4:09 Zhixing Chen
  2026-08-19  7:10 ` Nicolai Buchwitz
  0 siblings, 1 reply; 3+ messages in thread
From: Zhixing Chen @ 2026-08-19  4:09 UTC (permalink / raw)
  To: Théo Lebrun
  Cc: Conor Dooley, Andrew Lunn, David S . Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Nicolai Buchwitz, netdev,
	Zhixing Chen

macb_alloc_tieoff() and macb_free_tieoff() are called from macb_probe()
and macb_remove(), which are built regardless of CONFIG_OF.

The helpers were added inside the CONFIG_OF block, although the tieoff
descriptor handling does not depend on OF. This breaks CONFIG_OF=n builds
with implicit function declaration errors.

Move the helpers outside the CONFIG_OF block.

Fixes: 5262eab9462a ("net: macb: allocate tieoff descriptor once across device lifetime")
Signed-off-by: Zhixing Chen <running910@gmail.com>
---

I hit this while building the latest net-next tree with my local config,
where CONFIG_MACB is enabled and CONFIG_OF is disabled.

Since CONFIG_MACB does not depend on CONFIG_OF, macb_main.c still needs
to build in this configuration. However, macb_probe() and macb_remove()
are built while macb_alloc_tieoff() and macb_free_tieoff() are hidden
behind CONFIG_OF.

Build error:

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' [-Werror=implicit-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' [-Werror=implicit-function-declaration]
 5973 |         macb_free_tieoff(bp);
  CC [M]  drivers/gpu/drm/i915/display/intel_qp_tables.o

---
 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..c7e3b630b49e 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -5507,38 +5507,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,
 };
@@ -5756,6 +5724,38 @@ static const struct of_device_id macb_dt_ids[] = {
 MODULE_DEVICE_TABLE(of, macb_dt_ids);
 #endif /* CONFIG_OF */
 
+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_config default_gem_config = {
 	.caps = MACB_CAPS_GIGABIT_MODE_AVAILABLE |
 		MACB_CAPS_JUMBO |

base-commit: 61eb236c41c2a4717015dff18016a75a5eb90052
-- 
2.34.1


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

* Re: [PATCH net-next] net: macb: fix CONFIG_OF=n build
  2026-08-19  4:09 [PATCH net-next] net: macb: fix CONFIG_OF=n build Zhixing Chen
@ 2026-08-19  7:10 ` Nicolai Buchwitz
  2026-08-19  7:44   ` Zhixing Chen
  0 siblings, 1 reply; 3+ messages in thread
From: Nicolai Buchwitz @ 2026-08-19  7:10 UTC (permalink / raw)
  To: Zhixing Chen
  Cc: Théo Lebrun, Conor Dooley, Andrew Lunn, David S . Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, netdev

Hi Zhixing

On 19.8.2026 06:09, Zhixing Chen wrote:
> macb_alloc_tieoff() and macb_free_tieoff() are called from macb_probe()
> and macb_remove(), which are built regardless of CONFIG_OF.
> 
> The helpers were added inside the CONFIG_OF block, although the tieoff
> descriptor handling does not depend on OF. This breaks CONFIG_OF=n 
> builds
> with implicit function declaration errors.
> 
> Move the helpers outside the CONFIG_OF block.
> 
> Fixes: 5262eab9462a ("net: macb: allocate tieoff descriptor once across 
> device lifetime")
> Signed-off-by: Zhixing Chen <running910@gmail.com>
> ---
> 
> I hit this while building the latest net-next tree with my local 
> config,
> where CONFIG_MACB is enabled and CONFIG_OF is disabled.
> 
> Since CONFIG_MACB does not depend on CONFIG_OF, macb_main.c still needs
> to build in this configuration. However, macb_probe() and macb_remove()
> are built while macb_alloc_tieoff() and macb_free_tieoff() are hidden
> behind CONFIG_OF.
> 
> Build error:
> 
> 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' 
> [-Werror=implicit-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' 
> [-Werror=implicit-function-declaration]
>  5973 |         macb_free_tieoff(bp);
>   CC [M]  drivers/gpu/drm/i915/display/intel_qp_tables.o
> 
> ---

Nathan sent the same patch a few hours earlier [1]. I will follow up 
there.

> [...]

[1] 
https://lore.kernel.org/netdev/20260818-macb-fix-no-of-build-v1-1-f2a009616384@kernel.org/

Thanks,
Nicolai

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

* Re: [PATCH net-next] net: macb: fix CONFIG_OF=n build
  2026-08-19  7:10 ` Nicolai Buchwitz
@ 2026-08-19  7:44   ` Zhixing Chen
  0 siblings, 0 replies; 3+ messages in thread
From: Zhixing Chen @ 2026-08-19  7:44 UTC (permalink / raw)
  To: Nicolai Buchwitz
  Cc: Théo Lebrun, Conor Dooley, Andrew Lunn, David S . Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, netdev

> Hi Zhixing
>
> On 19.8.2026 06:09, Zhixing Chen wrote:
> > macb_alloc_tieoff() and macb_free_tieoff() are called from macb_probe()

>
> Nathan sent the same patch a few hours earlier [1]. I will follow up
> there.
>
> > [...]
>
> [1]
> https://lore.kernel.org/netdev/20260818-macb-fix-no-of-build-v1-1-f2a009616384@kernel.org/
>
> Thanks,
> Nicolai

Hi Nicolai,

Thanks for the pointer.

I missed Nathan's earlier patch before sending mine. Please disregard my
patch.

Thanks,
Zhixing

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

end of thread, other threads:[~2026-08-19  7:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-19  4:09 [PATCH net-next] net: macb: fix CONFIG_OF=n build Zhixing Chen
2026-08-19  7:10 ` Nicolai Buchwitz
2026-08-19  7:44   ` Zhixing Chen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.