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/drivers/i2c/adt7463/adt7463.c b/src/drivers/i2c/adt7463/adt7463.c
index 3e1a3a5..2fcd54e 100644
--- a/src/drivers/i2c/adt7463/adt7463.c
+++ b/src/drivers/i2c/adt7463/adt7463.c
@@ -78,8 +78,8 @@
}
static struct device_operations adt7463_operations = {
- .read_resources = DEVICE_NOOP,
- .set_resources = DEVICE_NOOP,
+ .read_resources = noop_read_resources,
+ .set_resources = noop_set_resources,
.init = adt7463_init,
};
diff --git a/src/drivers/i2c/at24rf08c/at24rf08c.c b/src/drivers/i2c/at24rf08c/at24rf08c.c
index 3841d64..3511502 100644
--- a/src/drivers/i2c/at24rf08c/at24rf08c.c
+++ b/src/drivers/i2c/at24rf08c/at24rf08c.c
@@ -33,8 +33,8 @@
}
static struct device_operations at24rf08c_operations = {
- .read_resources = DEVICE_NOOP,
- .set_resources = DEVICE_NOOP,
+ .read_resources = noop_read_resources,
+ .set_resources = noop_set_resources,
.init = at24rf08c_init,
};
diff --git a/src/drivers/i2c/ck505/ck505.c b/src/drivers/i2c/ck505/ck505.c
index fac5208..147776d 100644
--- a/src/drivers/i2c/ck505/ck505.c
+++ b/src/drivers/i2c/ck505/ck505.c
@@ -46,8 +46,8 @@
}
static struct device_operations ck505_operations = {
- .read_resources = DEVICE_NOOP,
- .set_resources = DEVICE_NOOP,
+ .read_resources = noop_read_resources,
+ .set_resources = noop_set_resources,
.init = ck505_init,
};
diff --git a/src/drivers/i2c/da7219/da7219.c b/src/drivers/i2c/da7219/da7219.c
index 43c6f9d..4cfeb9f 100644
--- a/src/drivers/i2c/da7219/da7219.c
+++ b/src/drivers/i2c/da7219/da7219.c
@@ -98,8 +98,8 @@
#endif
static struct device_operations da7219_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_name = da7219_acpi_name,
.acpi_fill_ssdt = da7219_fill_ssdt,
diff --git a/src/drivers/i2c/generic/generic.c b/src/drivers/i2c/generic/generic.c
index 32b984a..0466a6f 100644
--- a/src/drivers/i2c/generic/generic.c
+++ b/src/drivers/i2c/generic/generic.c
@@ -180,8 +180,8 @@
#endif
static struct device_operations i2c_generic_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_name = i2c_generic_acpi_name,
.acpi_fill_ssdt = i2c_generic_fill_ssdt_generator,
diff --git a/src/drivers/i2c/hid/hid.c b/src/drivers/i2c/hid/hid.c
index 11d9d18..de43eb9 100644
--- a/src/drivers/i2c/hid/hid.c
+++ b/src/drivers/i2c/hid/hid.c
@@ -37,8 +37,8 @@
#endif
static struct device_operations i2c_hid_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_name = i2c_hid_acpi_name,
.acpi_fill_ssdt = i2c_hid_fill_ssdt_generator,
diff --git a/src/drivers/i2c/lm96000/lm96000.c b/src/drivers/i2c/lm96000/lm96000.c
index 54d2b88..b1cf06e 100644
--- a/src/drivers/i2c/lm96000/lm96000.c
+++ b/src/drivers/i2c/lm96000/lm96000.c
@@ -205,8 +205,8 @@
}
static struct device_operations lm96000_ops = {
- .read_resources = DEVICE_NOOP,
- .set_resources = DEVICE_NOOP,
+ .read_resources = noop_read_resources,
+ .set_resources = noop_set_resources,
.init = lm96000_init,
};
diff --git a/src/drivers/i2c/max98373/max98373.c b/src/drivers/i2c/max98373/max98373.c
index c6fa2e4..a7df56b 100644
--- a/src/drivers/i2c/max98373/max98373.c
+++ b/src/drivers/i2c/max98373/max98373.c
@@ -75,8 +75,8 @@
}
static struct device_operations max98373_ops = {
- .read_resources = DEVICE_NOOP,
- .set_resources = DEVICE_NOOP,
+ .read_resources = noop_read_resources,
+ .set_resources = noop_set_resources,
.acpi_name = max98373_acpi_name,
.acpi_fill_ssdt = max98373_fill_ssdt,
};
diff --git a/src/drivers/i2c/max98927/max98927.c b/src/drivers/i2c/max98927/max98927.c
index 166a4ef..0cb80ae 100644
--- a/src/drivers/i2c/max98927/max98927.c
+++ b/src/drivers/i2c/max98927/max98927.c
@@ -71,8 +71,8 @@
}
static struct device_operations max98927_ops = {
- .read_resources = DEVICE_NOOP,
- .set_resources = DEVICE_NOOP,
+ .read_resources = noop_read_resources,
+ .set_resources = noop_set_resources,
.acpi_name = max98927_acpi_name,
.acpi_fill_ssdt = max98927_fill_ssdt,
};
diff --git a/src/drivers/i2c/nau8825/nau8825.c b/src/drivers/i2c/nau8825/nau8825.c
index 0c893a4..c3e95e7 100644
--- a/src/drivers/i2c/nau8825/nau8825.c
+++ b/src/drivers/i2c/nau8825/nau8825.c
@@ -86,8 +86,8 @@
#endif
static struct device_operations nau8825_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_name = nau8825_acpi_name,
.acpi_fill_ssdt = nau8825_fill_ssdt,
diff --git a/src/drivers/i2c/nct7802y/nct7802y.c b/src/drivers/i2c/nct7802y/nct7802y.c
index c21b002..dd8c0aa 100644
--- a/src/drivers/i2c/nct7802y/nct7802y.c
+++ b/src/drivers/i2c/nct7802y/nct7802y.c
@@ -20,8 +20,8 @@
}
static struct device_operations nct7802y_ops = {
- .read_resources = DEVICE_NOOP,
- .set_resources = DEVICE_NOOP,
+ .read_resources = noop_read_resources,
+ .set_resources = noop_set_resources,
.init = nct7802y_init,
};
diff --git a/src/drivers/i2c/pca9538/pca9538.c b/src/drivers/i2c/pca9538/pca9538.c
index 68283b8..b16ca48 100644
--- a/src/drivers/i2c/pca9538/pca9538.c
+++ b/src/drivers/i2c/pca9538/pca9538.c
@@ -39,8 +39,8 @@
}
static struct device_operations pca9538_ops = {
- .read_resources = DEVICE_NOOP,
- .set_resources = DEVICE_NOOP,
+ .read_resources = noop_read_resources,
+ .set_resources = noop_set_resources,
.init = pca9538_init,
};
diff --git a/src/drivers/i2c/pcf8523/pcf8523.c b/src/drivers/i2c/pcf8523/pcf8523.c
index 82945ff..03b6b22 100644
--- a/src/drivers/i2c/pcf8523/pcf8523.c
+++ b/src/drivers/i2c/pcf8523/pcf8523.c
@@ -118,8 +118,8 @@
}
static struct device_operations pcf8523c_ops = {
- .read_resources = DEVICE_NOOP,
- .set_resources = DEVICE_NOOP,
+ .read_resources = noop_read_resources,
+ .set_resources = noop_set_resources,
.init = pcf8523_init,
.final = pcf8523_final
};
diff --git a/src/drivers/i2c/ptn3460/ptn3460.c b/src/drivers/i2c/ptn3460/ptn3460.c
index 7b3bb56..851156f 100644
--- a/src/drivers/i2c/ptn3460/ptn3460.c
+++ b/src/drivers/i2c/ptn3460/ptn3460.c
@@ -127,8 +127,8 @@
}
static struct device_operations ptn3460_ops = {
- .read_resources = DEVICE_NOOP,
- .set_resources = DEVICE_NOOP,
+ .read_resources = noop_read_resources,
+ .set_resources = noop_set_resources,
.init = ptn3460_init,
};
diff --git a/src/drivers/i2c/rt1011/rt1011.c b/src/drivers/i2c/rt1011/rt1011.c
index 19ee1f2..68681ef 100644
--- a/src/drivers/i2c/rt1011/rt1011.c
+++ b/src/drivers/i2c/rt1011/rt1011.c
@@ -84,8 +84,8 @@
}
static struct device_operations rt1011_ops = {
- .read_resources = DEVICE_NOOP,
- .set_resources = DEVICE_NOOP,
+ .read_resources = noop_read_resources,
+ .set_resources = noop_set_resources,
.acpi_name = rt1011_acpi_name,
.acpi_fill_ssdt = rt1011_fill_ssdt,
};
diff --git a/src/drivers/i2c/rt5663/rt5663.c b/src/drivers/i2c/rt5663/rt5663.c
index 0e4bab0..70c14ef 100644
--- a/src/drivers/i2c/rt5663/rt5663.c
+++ b/src/drivers/i2c/rt5663/rt5663.c
@@ -75,8 +75,8 @@
}
static struct device_operations rt5663_ops = {
- .read_resources = DEVICE_NOOP,
- .set_resources = DEVICE_NOOP,
+ .read_resources = noop_read_resources,
+ .set_resources = noop_set_resources,
.acpi_name = rt5663_acpi_name,
.acpi_fill_ssdt = rt5663_fill_ssdt,
};
diff --git a/src/drivers/i2c/rtd2132/rtd2132.c b/src/drivers/i2c/rtd2132/rtd2132.c
index 5dffdc8..74037cc 100644
--- a/src/drivers/i2c/rtd2132/rtd2132.c
+++ b/src/drivers/i2c/rtd2132/rtd2132.c
@@ -225,8 +225,8 @@
}
static struct device_operations rtd2132_operations = {
- .read_resources = DEVICE_NOOP,
- .set_resources = DEVICE_NOOP,
+ .read_resources = noop_read_resources,
+ .set_resources = noop_set_resources,
.init = rtd2132_init,
};
diff --git a/src/drivers/i2c/rx6110sa/rx6110sa.c b/src/drivers/i2c/rx6110sa/rx6110sa.c
index c691965..028058a 100644
--- a/src/drivers/i2c/rx6110sa/rx6110sa.c
+++ b/src/drivers/i2c/rx6110sa/rx6110sa.c
@@ -165,8 +165,8 @@
}
static struct device_operations rx6110sa_ops = {
- .read_resources = DEVICE_NOOP,
- .set_resources = DEVICE_NOOP,
+ .read_resources = noop_read_resources,
+ .set_resources = noop_set_resources,
.init = rx6110sa_init,
.final = rx6110sa_final
};
diff --git a/src/drivers/i2c/sx9310/sx9310.c b/src/drivers/i2c/sx9310/sx9310.c
index e1fe104..a4fac10 100644
--- a/src/drivers/i2c/sx9310/sx9310.c
+++ b/src/drivers/i2c/sx9310/sx9310.c
@@ -79,8 +79,8 @@
}
static struct device_operations i2c_sx9310_ops = {
- .read_resources = DEVICE_NOOP,
- .set_resources = DEVICE_NOOP,
+ .read_resources = noop_read_resources,
+ .set_resources = noop_set_resources,
.acpi_name = i2c_sx9310_acpi_name,
.acpi_fill_ssdt = i2c_sx9310_fill_ssdt,
};
diff --git a/src/drivers/i2c/tpm/chip.c b/src/drivers/i2c/tpm/chip.c
index eeccb7d..b81b0d1 100644
--- a/src/drivers/i2c/tpm/chip.c
+++ b/src/drivers/i2c/tpm/chip.c
@@ -62,8 +62,8 @@
}
static struct device_operations i2c_tpm_ops = {
- .read_resources = DEVICE_NOOP,
- .set_resources = DEVICE_NOOP,
+ .read_resources = noop_read_resources,
+ .set_resources = noop_set_resources,
.acpi_name = i2c_tpm_acpi_name,
.acpi_fill_ssdt = i2c_tpm_fill_ssdt,
};
diff --git a/src/drivers/i2c/w83793/w83793.c b/src/drivers/i2c/w83793/w83793.c
index c52cbb2..822c2ce 100644
--- a/src/drivers/i2c/w83793/w83793.c
+++ b/src/drivers/i2c/w83793/w83793.c
@@ -292,8 +292,8 @@
}
static struct device_operations w83793_operations = {
- .read_resources = DEVICE_NOOP,
- .set_resources = DEVICE_NOOP,
+ .read_resources = noop_read_resources,
+ .set_resources = noop_set_resources,
.init = w83793_init,
};