treewide: Staticize and constify acpi ops

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>
This commit is contained in:
Marek Vasut
2026-06-29 15:29:44 -06:00
committed by Tom Rini
parent 4a0990218a
commit d504639843
21 changed files with 24 additions and 26 deletions
+1 -1
View 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
+1 -1
View 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
+1 -3
View 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,
+1 -1
View 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,
+1 -1
View 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,
+1 -1
View 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,
};
+1 -1
View 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
+1 -1
View 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,
};
+2 -2
View 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) {
+1 -1
View 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
+1 -1
View 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,
};
+1 -1
View 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,
};
+2 -2
View 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
+1 -1
View 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,
};
+2 -2
View 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 },
+1 -1
View 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
+1 -1
View 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
+1 -1
View 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
+1 -1
View 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,
};
+1 -1
View 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
};
+1 -1
View 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,