git: 476d590738cf - stable/14 - busdma_bounce: Replace a SYSINIT with static initializations

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Tue, 19 Nov 2024 14:31:22 UTC
The branch stable/14 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=476d590738cf6cbecb9d2f62ec962d49d02ec96c

commit 476d590738cf6cbecb9d2f62ec962d49d02ec96c
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-11-12 01:57:35 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-11-19 14:15:21 +0000

    busdma_bounce: Replace a SYSINIT with static initializations
    
    No functional change intended.
    
    MFC after:      1 week
    
    (cherry picked from commit 195402c5c5b7b3236c0680f06b60b7f9465982c8)
---
 sys/kern/subr_busdma_bounce.c | 18 +++++-------------
 1 file changed, 5 insertions(+), 13 deletions(-)

diff --git a/sys/kern/subr_busdma_bounce.c b/sys/kern/subr_busdma_bounce.c
index f5f27dae9b05..134bc6a5eb68 100644
--- a/sys/kern/subr_busdma_bounce.c
+++ b/sys/kern/subr_busdma_bounce.c
@@ -85,11 +85,14 @@ struct bounce_zone {
 };
 
 static struct mtx bounce_lock;
+MTX_SYSINIT(bounce_lock, &bounce_lock, "bounce pages lock", MTX_DEF);
 static int total_bpages;
 static int busdma_zonecount;
 
-static STAILQ_HEAD(, bounce_zone) bounce_zone_list;
-static STAILQ_HEAD(, bus_dmamap) bounce_map_callbacklist;
+static STAILQ_HEAD(, bounce_zone) bounce_zone_list =
+    STAILQ_HEAD_INITIALIZER(bounce_zone_list);
+static STAILQ_HEAD(, bus_dmamap) bounce_map_callbacklist =
+    STAILQ_HEAD_INITIALIZER(bounce_map_callbacklist);
 
 static MALLOC_DEFINE(M_BOUNCE, "bounce", "busdma bounce pages");
 
@@ -128,17 +131,6 @@ _bus_dmamap_reserve_pages(bus_dma_tag_t dmat, bus_dmamap_t map, int flags)
 	return (0);
 }
 
-static void
-init_bounce_pages(void *dummy __unused)
-{
-
-	total_bpages = 0;
-	STAILQ_INIT(&bounce_zone_list);
-	STAILQ_INIT(&bounce_map_callbacklist);
-	mtx_init(&bounce_lock, "bounce pages lock", NULL, MTX_DEF);
-}
-SYSINIT(bpages, SI_SUB_LOCK, SI_ORDER_ANY, init_bounce_pages, NULL);
-
 static struct sysctl_ctx_list *
 busdma_sysctl_tree(struct bounce_zone *bz)
 {