]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
treewide: Staticize and constify acpi ops
authorMarek Vasut <marek.vasut+renesas@mailbox.org>
Fri, 12 Jun 2026 02:05:38 +0000 (04:05 +0200)
committerTom Rini <trini@konsulko.com>
Mon, 29 Jun 2026 21:29:44 +0000 (15:29 -0600)
Set the acpi_ops structure as static const where applicable. The
The structure is not accessible from outside of drivers and is not
going to be modified at runtime. The structure may be unused in a
couple of drivers depending on their configuration, mark those
sites with __maybe_unused .

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
21 files changed:
arch/arm/lib/gic-v2.c
arch/arm/lib/gic-v3-its.c
arch/x86/cpu/apollolake/cpu.c
arch/x86/cpu/apollolake/hostbridge.c
arch/x86/cpu/apollolake/lpc.c
arch/x86/cpu/intel_common/generic_wifi.c
arch/x86/lib/fsp/fsp_graphics.c
board/google/chromebook_coral/coral.c
drivers/core/acpi.c
drivers/core/root.c
drivers/cpu/armv8_cpu.c
drivers/cpu/bcm283x_cpu.c
drivers/gpio/sandbox.c
drivers/i2c/designware_i2c_pci.c
drivers/mmc/pci_mmc.c
drivers/rtc/sandbox_rtc.c
drivers/sound/da7219.c
drivers/sound/max98357a.c
drivers/tpm/cr50_i2c.c
include/dm/device.h
test/dm/acpi.c

index b70434a45d466a8c7cd5f4af3d4d26744ec9c057..378bdb54c898110cb820f7ce179497224b71fbab 100644 (file)
@@ -38,7 +38,7 @@ static int acpi_gicv2_fill_madt(const struct udevice *dev, struct acpi_ctx *ctx)
        return 0;
 }
 
-static struct acpi_ops gic_v2_acpi_ops = {
+static const struct acpi_ops gic_v2_acpi_ops = {
        .fill_madt      = acpi_gicv2_fill_madt,
 };
 #endif
index d11a1ea436e97e1b9ab2b33fc3b8e95fe8e9508b..064b93b2aa1485b0c602d51fcbcdabcd5d3b6a70 100644 (file)
@@ -197,7 +197,7 @@ static int acpi_gicv3_fill_madt(const struct udevice *dev, struct acpi_ctx *ctx)
        return 0;
 }
 
-struct acpi_ops gic_v3_acpi_ops = {
+static const struct acpi_ops gic_v3_acpi_ops = {
        .fill_madt      = acpi_gicv3_fill_madt,
 };
 #endif
index f480bb1d8c347f43997987cefe381fb9f6510f82..d1f592ec57eb90e16317f329ce0ff5727917979e 100644 (file)
@@ -171,11 +171,9 @@ static int cpu_apl_probe(struct udevice *dev)
        return 0;
 }
 
-#ifdef CONFIG_ACPIGEN
-struct acpi_ops apl_cpu_acpi_ops = {
+static const struct acpi_ops __maybe_unused apl_cpu_acpi_ops = {
        .fill_ssdt      = acpi_cpu_fill_ssdt,
 };
-#endif
 
 static const struct cpu_ops cpu_x86_apl_ops = {
        .get_desc       = cpu_x86_get_desc,
index 284f16cfd91a4b4016bb268fae9f7c291af13f5b..360d091121cdfb3af6301d249514a4fed3ba4a31 100644 (file)
@@ -366,7 +366,7 @@ ulong sa_get_tseg_base(struct udevice *dev)
        return sa_read_reg(dev, TSEG);
 }
 
-struct acpi_ops apl_hostbridge_acpi_ops = {
+static const struct acpi_ops __maybe_unused apl_hostbridge_acpi_ops = {
        .get_name       = apl_acpi_hb_get_name,
 #if CONFIG_IS_ENABLED(GENERATE_ACPI_TABLE)
        .write_tables   = apl_acpi_hb_write_tables,
index f34c199bf734d10678510cac74cd702c12c420ea..008c4dc0037246256145ab4efad94ffe1361d90b 100644 (file)
@@ -119,7 +119,7 @@ static int apl_acpi_lpc_get_name(const struct udevice *dev, char *out_name)
        return acpi_copy_name(out_name, "LPCB");
 }
 
-struct acpi_ops apl_lpc_acpi_ops = {
+static const struct acpi_ops __maybe_unused apl_lpc_acpi_ops = {
        .get_name       = apl_acpi_lpc_get_name,
 #ifdef CONFIG_GENERATE_ACPI_TABLE
        .write_tables   = intel_southbridge_write_acpi_tables,
index 75fa4e01d8ad481cae8de61d3a0df2ee321b1073..1a24c10ab0b58f58a4d014edc837c5ff8594ed76 100644 (file)
@@ -102,7 +102,7 @@ static int intel_wifi_acpi_fill_ssdt(const struct udevice *dev,
        return 0;
 }
 
-struct acpi_ops wifi_acpi_ops = {
+static const struct acpi_ops wifi_acpi_ops = {
        .fill_ssdt      = intel_wifi_acpi_fill_ssdt,
 };
 
index ad25020086c614fce32c93c5f99d8c4455b1ce8b..d425e80760bba3406c92604d07da321f8ec95db6 100644 (file)
@@ -150,7 +150,7 @@ static int fsp_video_acpi_write_tables(const struct udevice *dev,
 }
 #endif
 
-struct acpi_ops fsp_video_acpi_ops = {
+static const struct acpi_ops __maybe_unused fsp_video_acpi_ops = {
 #ifdef CONFIG_INTEL_GMA_ACPI
        .write_tables   = fsp_video_acpi_write_tables,
 #endif
index b4053fa097d688e70ad19f25bbeb02057f9e440d..2bb54d59bb8bd808432c810367f57fd2c909235f 100644 (file)
@@ -293,7 +293,7 @@ static int coral_write_acpi_tables(const struct udevice *dev,
        return 0;
 }
 
-struct acpi_ops coral_acpi_ops = {
+static const struct acpi_ops __maybe_unused coral_acpi_ops = {
        .write_tables   = coral_write_acpi_tables,
        .inject_dsdt    = chromeos_acpi_gpio_generate,
 };
index 6a431171c8deedf83c9a584e99a3eea7801ce69a..284fb70b03644e943045b47420d4b0443e24988f 100644 (file)
@@ -87,7 +87,7 @@ int acpi_copy_name(char *out_name, const char *name)
 
 int acpi_get_name(const struct udevice *dev, char *out_name)
 {
-       struct acpi_ops *aops;
+       const struct acpi_ops *aops;
        const char *name;
        int ret;
 
@@ -275,7 +275,7 @@ static int sort_acpi_item_type(struct acpi_ctx *ctx, void *start,
 
 acpi_method acpi_get_method(struct udevice *dev, enum method_t method)
 {
-       struct acpi_ops *aops;
+       const struct acpi_ops *aops;
 
        aops = device_get_acpi_ops(dev);
        if (aops) {
index 1f32f33b2955bc226a416a8df2a7e0a8682a04c5..2aa16d59b69329533acb537b1339b6edef82c677 100644 (file)
@@ -459,7 +459,7 @@ static int root_acpi_get_name(const struct udevice *dev, char *out_name)
        return acpi_copy_name(out_name, "\\_SB");
 }
 
-struct acpi_ops root_acpi_ops = {
+static const struct acpi_ops root_acpi_ops = {
        .get_name       = root_acpi_get_name,
 };
 #endif
index ed87841b7230df8e0ebdf7034d61c84a19312cef..337661c23a84d654194c0d0f1d71c06a9cab386f 100644 (file)
@@ -124,7 +124,7 @@ int armv8_cpu_fill_madt(const struct udevice *dev, struct acpi_ctx *ctx)
        return 0;
 }
 
-static struct acpi_ops armv8_cpu_acpi_ops = {
+static const struct acpi_ops armv8_cpu_acpi_ops = {
        .fill_ssdt      = armv8_cpu_fill_ssdt,
        .fill_madt      = armv8_cpu_fill_madt,
 };
index ad638cd8fff91a6ed5e77cac6a1147eaeca610ee..43e74d1811bdd962fa4d27143a62aa0c27698cac 100644 (file)
@@ -193,7 +193,7 @@ static int bcm_cpu_probe(struct udevice *dev)
        return ret;
 }
 
-struct acpi_ops bcm283x_cpu_acpi_ops = {
+static const struct acpi_ops __maybe_unused bcm283x_cpu_acpi_ops = {
        .fill_ssdt      = armv8_cpu_fill_ssdt,
        .fill_madt      = armv8_cpu_fill_madt,
 };
index e8f50d815d73b72a85a55607ad28d26a6419d248..76aff0ed5aa8e2c551803ad43c49a749d1a5104c 100644 (file)
@@ -306,7 +306,7 @@ static int sb_gpio_get_name(const struct udevice *dev, char *out_name)
        return acpi_copy_name(out_name, "GPIO");
 }
 
-struct acpi_ops gpio_sandbox_acpi_ops = {
+static const struct acpi_ops gpio_sandbox_acpi_ops = {
        .get_name       = sb_gpio_get_name,
 };
 #endif /* ACPIGEN */
@@ -568,7 +568,7 @@ static struct pinctrl_ops sandbox_pinctrl_gpio_ops = {
 };
 
 #if CONFIG_IS_ENABLED(ACPIGEN)
-struct acpi_ops pinctrl_sandbox_acpi_ops = {
+static const struct acpi_ops pinctrl_sandbox_acpi_ops = {
        .get_name       = sb_pinctrl_get_name,
 };
 #endif
index ad4122c2abdf731e12997191a787ef679d4b4b72..db2706fdb6eff6767ae87a27005d0140a6f84538 100644 (file)
@@ -168,7 +168,7 @@ static int dw_i2c_acpi_fill_ssdt(const struct udevice *dev,
        return 0;
 }
 
-static struct acpi_ops dw_i2c_acpi_ops = {
+static const struct acpi_ops dw_i2c_acpi_ops = {
        .fill_ssdt      = dw_i2c_acpi_fill_ssdt,
 };
 
index d446c55f72b269b4096b6b7cfedef556ff4a020b..82e393fd9d60d0cbd1ee2dda6b37c2d88b278218 100644 (file)
@@ -137,11 +137,11 @@ static int pci_mmc_acpi_fill_ssdt(const struct udevice *dev,
        return 0;
 }
 
-struct acpi_ops pci_mmc_acpi_ops = {
 #ifdef CONFIG_ACPIGEN
+static const struct acpi_ops pci_mmc_acpi_ops = {
        .fill_ssdt      = pci_mmc_acpi_fill_ssdt,
-#endif
 };
+#endif
 
 static const struct udevice_id pci_mmc_match[] = {
        { .compatible = "intel,apl-sd", .data = TYPE_SD },
index 4404501c2f65c3ac0ac2409bf8752d353bd93857..1ade5d50b23084d4c6d839350c262cf3a616a024 100644 (file)
@@ -73,7 +73,7 @@ static int sandbox_rtc_get_name(const struct udevice *dev, char *out_name)
        return acpi_copy_name(out_name, "RTCC");
 }
 
-struct acpi_ops sandbox_rtc_acpi_ops = {
+static const struct acpi_ops sandbox_rtc_acpi_ops = {
        .get_name       = sandbox_rtc_get_name,
 };
 #endif
index 5b9b3f65263fa559780bf85722dcacf5240ae480..d1d03ae91d437e3fef40f5266278b94aad24a874 100644 (file)
@@ -170,7 +170,7 @@ static int da7219_acpi_setup_nhlt(const struct udevice *dev,
 }
 #endif
 
-struct acpi_ops da7219_acpi_ops = {
+static const struct acpi_ops da7219_acpi_ops = {
 #ifdef CONFIG_ACPIGEN
        .fill_ssdt      = da7219_acpi_fill_ssdt,
 #ifdef CONFIG_X86
index da56ffdd6bb4e7d37b626cb2ea5153b47ceb6a06..47978d4fe27caa359057cb23f0b58171031a230b 100644 (file)
@@ -136,7 +136,7 @@ static int max98357a_acpi_setup_nhlt(const struct udevice *dev,
 }
 #endif
 
-struct acpi_ops max98357a_acpi_ops = {
+static const struct acpi_ops max98357a_acpi_ops = {
 #ifdef CONFIG_ACPIGEN
        .fill_ssdt      = max98357a_acpi_fill_ssdt,
 #ifdef CONFIG_X86
index 14a94f8d4a8e33e9a75199a93da094ac482e492b..46805eaa0131d5b8abf43d874de8da03c8b5a355 100644 (file)
@@ -889,7 +889,7 @@ static int cr50_i2c_probe(struct udevice *dev)
        return 0;
 }
 
-struct acpi_ops cr50_acpi_ops = {
+static const struct acpi_ops cr50_acpi_ops = {
        .fill_ssdt      = cr50_acpi_fill_ssdt,
 };
 
index 7bcf6df2892d95fe567d67d77ebfa331e56fcb13..5d700888503a4af28c97207e76d77f389882b118 100644 (file)
@@ -388,7 +388,7 @@ struct driver {
        const void *ops;        /* driver-specific operations */
        uint32_t flags;
 #if CONFIG_IS_ENABLED(ACPIGEN)
-       struct acpi_ops *acpi_ops;
+       const struct acpi_ops *acpi_ops;
 #endif
 };
 
index 2de7983f9ae995dc3b806d9baef468f68be1959c..293ea0274b56c38b248154a831092e7b90f1797d 100644 (file)
@@ -136,7 +136,7 @@ static int testacpi_inject_dsdt(const struct udevice *dev, struct acpi_ctx *ctx)
        return 0;
 }
 
-struct acpi_ops testacpi_ops = {
+static const struct acpi_ops testacpi_ops = {
        .get_name       = testacpi_get_name,
        .write_tables   = testacpi_write_tables,
        .fill_madt      = testacpi_fill_madt,