device: Constify struct device * parameter to acpi_fill_ssdt()
.acpi_fill_ssdt() does not need to modify the device structure. This
change makes the struct device * parameter to acpi_fill_ssdt() as
const.
Change-Id: I110f4c67c3b6671c9ac0a82e02609902a8ee5d5c
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/40710
Reviewed-by: HAOUAS Elyes <ehaouas@noos.fr>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/src/superio/common/generic.c b/src/superio/common/generic.c
index 88432ff..cffe0c3 100644
--- a/src/superio/common/generic.c
+++ b/src/superio/common/generic.c
@@ -31,7 +31,7 @@
}
#if CONFIG(HAVE_ACPI_TABLES)
-static void generic_ssdt(struct device *dev)
+static void generic_ssdt(const struct device *dev)
{
const char *scope = acpi_device_scope(dev);
const char *name = acpi_device_name(dev);
diff --git a/src/superio/common/ssdt.c b/src/superio/common/ssdt.c
index f5ad765..9ff02fb 100644
--- a/src/superio/common/ssdt.c
+++ b/src/superio/common/ssdt.c
@@ -29,7 +29,7 @@
static const u8 io_idx[] = {PNP_IDX_IO0, PNP_IDX_IO1, PNP_IDX_IO2, PNP_IDX_IO3};
static const u8 irq_idx[] = {PNP_IDX_IRQ0, PNP_IDX_IRQ1};
-static const struct superio_dev *superio_guess_function(struct device *dev)
+static const struct superio_dev *superio_guess_function(const struct device *dev)
{
for (size_t i = 0; i < ARRAY_SIZE(io_idx); i++) {
struct resource *res = probe_resource(dev, io_idx[i]);
@@ -62,7 +62,7 @@
}
/* Return true if there are resources to report */
-static bool has_resources(struct device *dev)
+static bool has_resources(const struct device *dev)
{
for (size_t i = 0; i < ARRAY_SIZE(io_idx); i++) {
struct resource *res = probe_resource(dev, io_idx[i]);
@@ -80,7 +80,7 @@
}
/* Add IO and IRQ resources for _CRS or _PRS */
-static void ldn_gen_resources(struct device *dev)
+static void ldn_gen_resources(const struct device *dev)
{
uint16_t irq = 0;
for (size_t i = 0; i < ARRAY_SIZE(io_idx); i++) {
@@ -109,7 +109,7 @@
}
/* Add resource base and size for additional SuperIO code */
-static void ldn_gen_resources_use(struct device *dev)
+static void ldn_gen_resources_use(const struct device *dev)
{
char name[5];
for (size_t i = 0; i < ARRAY_SIZE(io_idx); i++) {
@@ -161,7 +161,7 @@
return "Generic device";
}
-void superio_common_fill_ssdt_generator(struct device *dev)
+void superio_common_fill_ssdt_generator(const struct device *dev)
{
if (!dev || !dev->bus || !dev->bus->dev) {
printk(BIOS_CRIT, "BUG: Invalid argument in %s!\n", __func__);
diff --git a/src/superio/common/ssdt.h b/src/superio/common/ssdt.h
index 1f99189..5b1efcf 100644
--- a/src/superio/common/ssdt.h
+++ b/src/superio/common/ssdt.h
@@ -7,6 +7,6 @@
#include <device/device.h>
const char *superio_common_ldn_acpi_name(const struct device *dev);
-void superio_common_fill_ssdt_generator(struct device *dev);
+void superio_common_fill_ssdt_generator(const struct device *dev);
#endif /* __SUPERIO_COMMON_SSDT_H__ */