Replace DEVICE_NOOP with noop_(set|read)_resources
`.read_resources` and `.set_resources` are the only two device
operations that are considered mandatory. Other function pointers
can be left NULL. Having dedicated no-op implementations for the
two mandatory fields should stop the leaking of no-op pointers to
other fields.
Change-Id: I6469a7568dc24317c95e238749d878e798b0a362
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/40207
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: HAOUAS Elyes <ehaouas@noos.fr>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/src/soc/amd/common/block/smbus/sm.c b/src/soc/amd/common/block/smbus/sm.c
index 2863d22..cef5bba 100644
--- a/src/soc/amd/common/block/smbus/sm.c
+++ b/src/soc/amd/common/block/smbus/sm.c
@@ -75,8 +75,8 @@
.set_subsystem = pci_dev_set_subsystem,
};
static struct device_operations smbus_ops = {
- .read_resources = DEVICE_NOOP,
- .set_resources = DEVICE_NOOP,
+ .read_resources = noop_read_resources,
+ .set_resources = noop_set_resources,
.enable_resources = pci_dev_enable_resources,
.init = sm_init,
.scan_bus = scan_smbus,
diff --git a/src/soc/amd/picasso/chip.c b/src/soc/amd/picasso/chip.c
index 865dad8..7b3e7fb 100644
--- a/src/soc/amd/picasso/chip.c
+++ b/src/soc/amd/picasso/chip.c
@@ -19,8 +19,8 @@
extern const char *i2c_acpi_name(const struct device *dev);
struct device_operations cpu_bus_ops = {
- .read_resources = DEVICE_NOOP,
- .set_resources = DEVICE_NOOP,
+ .read_resources = noop_read_resources,
+ .set_resources = noop_set_resources,
.init = picasso_init_cpus,
.acpi_fill_ssdt = generate_cpu_entries,
};
diff --git a/src/soc/amd/picasso/i2c.c b/src/soc/amd/picasso/i2c.c
index f17eccd..22c6216 100644
--- a/src/soc/amd/picasso/i2c.c
+++ b/src/soc/amd/picasso/i2c.c
@@ -126,8 +126,8 @@
struct device_operations picasso_i2c_mmio_ops = {
/* TODO(teravest): Move I2C resource info here. */
- .read_resources = DEVICE_NOOP,
- .set_resources = DEVICE_NOOP,
+ .read_resources = noop_read_resources,
+ .set_resources = noop_set_resources,
.scan_bus = scan_smbus,
.acpi_name = i2c_acpi_name,
.acpi_fill_ssdt = dw_i2c_acpi_fill_ssdt,
diff --git a/src/soc/amd/stoneyridge/chip.c b/src/soc/amd/stoneyridge/chip.c
index b27683a..189f48e 100644
--- a/src/soc/amd/stoneyridge/chip.c
+++ b/src/soc/amd/stoneyridge/chip.c
@@ -24,8 +24,8 @@
extern const char *i2c_acpi_name(const struct device *dev);
struct device_operations cpu_bus_ops = {
- .read_resources = DEVICE_NOOP,
- .set_resources = DEVICE_NOOP,
+ .read_resources = noop_read_resources,
+ .set_resources = noop_set_resources,
.init = stoney_init_cpus,
.acpi_fill_ssdt = generate_cpu_entries,
};
diff --git a/src/soc/amd/stoneyridge/i2c.c b/src/soc/amd/stoneyridge/i2c.c
index 8ec3555..1fdb416 100644
--- a/src/soc/amd/stoneyridge/i2c.c
+++ b/src/soc/amd/stoneyridge/i2c.c
@@ -110,8 +110,8 @@
struct device_operations stoneyridge_i2c_mmio_ops = {
/* TODO(teravest): Move I2C resource info here. */
- .read_resources = DEVICE_NOOP,
- .set_resources = DEVICE_NOOP,
+ .read_resources = noop_read_resources,
+ .set_resources = noop_set_resources,
.scan_bus = scan_smbus,
.acpi_name = i2c_acpi_name,
.acpi_fill_ssdt = dw_i2c_acpi_fill_ssdt,
diff --git a/src/soc/cavium/cn81xx/soc.c b/src/soc/cavium/cn81xx/soc.c
index f3adc47..60eb225 100644
--- a/src/soc/cavium/cn81xx/soc.c
+++ b/src/soc/cavium/cn81xx/soc.c
@@ -381,7 +381,7 @@
static struct device_operations soc_ops = {
.read_resources = soc_read_resources,
- .set_resources = DEVICE_NOOP,
+ .set_resources = noop_set_resources,
.init = soc_init,
.final = soc_final,
};
diff --git a/src/soc/intel/apollolake/chip.c b/src/soc/intel/apollolake/chip.c
index cf4763d..1075642 100644
--- a/src/soc/intel/apollolake/chip.c
+++ b/src/soc/intel/apollolake/chip.c
@@ -219,8 +219,8 @@
};
static struct device_operations cpu_bus_ops = {
- .read_resources = DEVICE_NOOP,
- .set_resources = DEVICE_NOOP,
+ .read_resources = noop_read_resources,
+ .set_resources = noop_set_resources,
.init = apollolake_init_cpus,
.acpi_fill_ssdt = generate_cpu_entries,
};
diff --git a/src/soc/intel/baytrail/chip.c b/src/soc/intel/baytrail/chip.c
index b51d8c3..912347c 100644
--- a/src/soc/intel/baytrail/chip.c
+++ b/src/soc/intel/baytrail/chip.c
@@ -21,8 +21,8 @@
};
static struct device_operations cpu_bus_ops = {
- .read_resources = DEVICE_NOOP,
- .set_resources = DEVICE_NOOP,
+ .read_resources = noop_read_resources,
+ .set_resources = noop_set_resources,
.init = baytrail_init_cpus,
};
diff --git a/src/soc/intel/braswell/chip.c b/src/soc/intel/braswell/chip.c
index 991e30f..cb1c37d 100644
--- a/src/soc/intel/braswell/chip.c
+++ b/src/soc/intel/braswell/chip.c
@@ -24,8 +24,8 @@
};
static struct device_operations cpu_bus_ops = {
- .read_resources = DEVICE_NOOP,
- .set_resources = DEVICE_NOOP,
+ .read_resources = noop_read_resources,
+ .set_resources = noop_set_resources,
.init = soc_init_cpus
};
diff --git a/src/soc/intel/broadwell/chip.c b/src/soc/intel/broadwell/chip.c
index 4caa236..e81890e 100644
--- a/src/soc/intel/broadwell/chip.c
+++ b/src/soc/intel/broadwell/chip.c
@@ -23,8 +23,8 @@
};
static struct device_operations cpu_bus_ops = {
- .read_resources = DEVICE_NOOP,
- .set_resources = DEVICE_NOOP,
+ .read_resources = noop_read_resources,
+ .set_resources = noop_set_resources,
.init = &broadwell_init_cpus,
};
diff --git a/src/soc/intel/cannonlake/chip.c b/src/soc/intel/cannonlake/chip.c
index e323346..df9b908 100644
--- a/src/soc/intel/cannonlake/chip.c
+++ b/src/soc/intel/cannonlake/chip.c
@@ -184,8 +184,8 @@
};
static struct device_operations cpu_bus_ops = {
- .read_resources = DEVICE_NOOP,
- .set_resources = DEVICE_NOOP,
+ .read_resources = noop_read_resources,
+ .set_resources = noop_set_resources,
.acpi_fill_ssdt = generate_cpu_entries,
};
diff --git a/src/soc/intel/common/block/p2sb/p2sb.c b/src/soc/intel/common/block/p2sb/p2sb.c
index 050f958..731ce50 100644
--- a/src/soc/intel/common/block/p2sb/p2sb.c
+++ b/src/soc/intel/common/block/p2sb/p2sb.c
@@ -124,7 +124,7 @@
static const struct device_operations device_ops = {
.read_resources = read_resources,
- .set_resources = DEVICE_NOOP,
+ .set_resources = noop_set_resources,
.ops_pci = &pci_dev_ops_pci,
};
diff --git a/src/soc/intel/denverton_ns/chip.c b/src/soc/intel/denverton_ns/chip.c
index dbee297..fbe2b82 100644
--- a/src/soc/intel/denverton_ns/chip.c
+++ b/src/soc/intel/denverton_ns/chip.c
@@ -42,8 +42,8 @@
};
static struct device_operations cpu_bus_ops = {
- .read_resources = DEVICE_NOOP,
- .set_resources = DEVICE_NOOP,
+ .read_resources = noop_read_resources,
+ .set_resources = noop_set_resources,
.init = denverton_init_cpus,
#if CONFIG(HAVE_ACPI_TABLES)
.acpi_fill_ssdt = generate_cpu_entries,
diff --git a/src/soc/intel/icelake/chip.c b/src/soc/intel/icelake/chip.c
index 36cd0d1..43216e6 100644
--- a/src/soc/intel/icelake/chip.c
+++ b/src/soc/intel/icelake/chip.c
@@ -140,8 +140,8 @@
};
static struct device_operations cpu_bus_ops = {
- .read_resources = DEVICE_NOOP,
- .set_resources = DEVICE_NOOP,
+ .read_resources = noop_read_resources,
+ .set_resources = noop_set_resources,
.acpi_fill_ssdt = generate_cpu_entries,
};
diff --git a/src/soc/intel/jasperlake/chip.c b/src/soc/intel/jasperlake/chip.c
index 643d851..7b53e17 100644
--- a/src/soc/intel/jasperlake/chip.c
+++ b/src/soc/intel/jasperlake/chip.c
@@ -147,8 +147,8 @@
};
static struct device_operations cpu_bus_ops = {
- .read_resources = DEVICE_NOOP,
- .set_resources = DEVICE_NOOP,
+ .read_resources = noop_read_resources,
+ .set_resources = noop_set_resources,
#if CONFIG(HAVE_ACPI_TABLES)
.acpi_fill_ssdt = generate_cpu_entries,
#endif
diff --git a/src/soc/intel/skylake/chip.c b/src/soc/intel/skylake/chip.c
index 6e471fb..9df078b 100644
--- a/src/soc/intel/skylake/chip.c
+++ b/src/soc/intel/skylake/chip.c
@@ -95,8 +95,8 @@
};
static struct device_operations cpu_bus_ops = {
- .read_resources = DEVICE_NOOP,
- .set_resources = DEVICE_NOOP,
+ .read_resources = noop_read_resources,
+ .set_resources = noop_set_resources,
#if CONFIG(HAVE_ACPI_TABLES)
.acpi_fill_ssdt = generate_cpu_entries,
#endif
diff --git a/src/soc/intel/tigerlake/chip.c b/src/soc/intel/tigerlake/chip.c
index b93d1fc..073c8d2 100644
--- a/src/soc/intel/tigerlake/chip.c
+++ b/src/soc/intel/tigerlake/chip.c
@@ -147,8 +147,8 @@
};
static struct device_operations cpu_bus_ops = {
- .read_resources = DEVICE_NOOP,
- .set_resources = DEVICE_NOOP,
+ .read_resources = noop_read_resources,
+ .set_resources = noop_set_resources,
#if CONFIG(HAVE_ACPI_TABLES)
.acpi_fill_ssdt = generate_cpu_entries,
#endif
diff --git a/src/soc/intel/xeon_sp/cpx/chip.c b/src/soc/intel/xeon_sp/cpx/chip.c
index 5f1dedf..196f3df 100644
--- a/src/soc/intel/xeon_sp/cpx/chip.c
+++ b/src/soc/intel/xeon_sp/cpx/chip.c
@@ -31,8 +31,8 @@
};
static struct device_operations cpu_bus_ops = {
- .read_resources = DEVICE_NOOP,
- .set_resources = DEVICE_NOOP,
+ .read_resources = noop_read_resources,
+ .set_resources = noop_set_resources,
.init = cpx_init_cpus,
};
diff --git a/src/soc/intel/xeon_sp/skx/chip.c b/src/soc/intel/xeon_sp/skx/chip.c
index fbd13d5..be452a0 100644
--- a/src/soc/intel/xeon_sp/skx/chip.c
+++ b/src/soc/intel/xeon_sp/skx/chip.c
@@ -482,8 +482,8 @@
};
static struct device_operations cpu_bus_ops = {
- .read_resources = DEVICE_NOOP,
- .set_resources = DEVICE_NOOP,
+ .read_resources = noop_read_resources,
+ .set_resources = noop_set_resources,
.init = xeon_sp_init_cpus,
#if CONFIG(HAVE_ACPI_TABLES)
/* defined in src/soc/intel/common/block/acpi/acpi.c */
diff --git a/src/soc/nvidia/tegra124/soc.c b/src/soc/nvidia/tegra124/soc.c
index 270e5e5..1f9f290 100644
--- a/src/soc/nvidia/tegra124/soc.c
+++ b/src/soc/nvidia/tegra124/soc.c
@@ -42,8 +42,8 @@
}
static struct device_operations soc_ops = {
- .read_resources = DEVICE_NOOP,
- .set_resources = DEVICE_NOOP,
+ .read_resources = noop_read_resources,
+ .set_resources = noop_set_resources,
.enable_resources = soc_enable,
.init = soc_init,
};
diff --git a/src/soc/nvidia/tegra210/soc.c b/src/soc/nvidia/tegra210/soc.c
index 5fc1e6a..f5eb44f 100644
--- a/src/soc/nvidia/tegra210/soc.c
+++ b/src/soc/nvidia/tegra210/soc.c
@@ -51,7 +51,7 @@
static struct device_operations soc_ops = {
.read_resources = soc_read_resources,
- .set_resources = DEVICE_NOOP,
+ .set_resources = noop_set_resources,
};
static void enable_tegra210_dev(struct device *dev)
diff --git a/src/soc/rockchip/rk3288/soc.c b/src/soc/rockchip/rk3288/soc.c
index f7f1ec9..08b72ea 100644
--- a/src/soc/rockchip/rk3288/soc.c
+++ b/src/soc/rockchip/rk3288/soc.c
@@ -24,8 +24,8 @@
}
static struct device_operations soc_ops = {
- .read_resources = DEVICE_NOOP,
- .set_resources = DEVICE_NOOP,
+ .read_resources = noop_read_resources,
+ .set_resources = noop_set_resources,
.init = soc_init,
};
diff --git a/src/soc/samsung/exynos5250/cpu.c b/src/soc/samsung/exynos5250/cpu.c
index 8b087c9..8278b1e 100644
--- a/src/soc/samsung/exynos5250/cpu.c
+++ b/src/soc/samsung/exynos5250/cpu.c
@@ -112,8 +112,8 @@
}
static struct device_operations cpu_ops = {
- .read_resources = DEVICE_NOOP,
- .set_resources = DEVICE_NOOP,
+ .read_resources = noop_read_resources,
+ .set_resources = noop_set_resources,
.enable_resources = cpu_enable,
.init = cpu_init,
};
diff --git a/src/soc/samsung/exynos5420/cpu.c b/src/soc/samsung/exynos5420/cpu.c
index dd27730..4bb03f2 100644
--- a/src/soc/samsung/exynos5420/cpu.c
+++ b/src/soc/samsung/exynos5420/cpu.c
@@ -142,8 +142,8 @@
}
static struct device_operations cpu_ops = {
- .read_resources = DEVICE_NOOP,
- .set_resources = DEVICE_NOOP,
+ .read_resources = noop_read_resources,
+ .set_resources = noop_set_resources,
.enable_resources = cpu_enable,
.init = cpu_init,
};