device: acpi_name() should take a const struct device
There's no reason to mutate the struct device when determining
the ACPI name for a device. Adjust the function pointer
signature and the respective implementations to use const
struct device.
Change-Id: If5e1f4de36a53646616581b01f47c4e86822c42e
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://review.coreboot.org/21527
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
Reviewed-by: Subrata Banik <subrata.banik@intel.com>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
diff --git a/src/drivers/generic/gpio_regulator/gpio_regulator.c b/src/drivers/generic/gpio_regulator/gpio_regulator.c
index def1744..c038392 100644
--- a/src/drivers/generic/gpio_regulator/gpio_regulator.c
+++ b/src/drivers/generic/gpio_regulator/gpio_regulator.c
@@ -60,7 +60,7 @@
acpigen_pop_len(); /* Scope */
}
-static const char *gpio_regulator_acpi_name(struct device *dev)
+static const char *gpio_regulator_acpi_name(const struct device *dev)
{
struct drivers_generic_gpio_regulator_config *config = dev->chip_info;
static char name[5];
diff --git a/src/drivers/generic/max98357a/max98357a.c b/src/drivers/generic/max98357a/max98357a.c
index 4a057b51..71ab1b9 100644
--- a/src/drivers/generic/max98357a/max98357a.c
+++ b/src/drivers/generic/max98357a/max98357a.c
@@ -66,7 +66,7 @@
printk(BIOS_INFO, "%s: %s\n", path, dev->chip_ops->name);
}
-static const char *max98357a_acpi_name(struct device *dev)
+static const char *max98357a_acpi_name(const struct device *dev)
{
return MAX98357A_ACPI_NAME;
}
diff --git a/src/drivers/i2c/alps/alps.c b/src/drivers/i2c/alps/alps.c
index f0ccd6c..2862374 100644
--- a/src/drivers/i2c/alps/alps.c
+++ b/src/drivers/i2c/alps/alps.c
@@ -34,7 +34,7 @@
i2c_generic_fill_ssdt(dev, &i2c_alps_fill_dsm, &config->generic);
}
-static const char *i2c_alps_acpi_name(struct device *dev)
+static const char *i2c_alps_acpi_name(const struct device *dev)
{
return "ALPS";
}
diff --git a/src/drivers/i2c/da7219/da7219.c b/src/drivers/i2c/da7219/da7219.c
index 2e7d460..4eef00c 100644
--- a/src/drivers/i2c/da7219/da7219.c
+++ b/src/drivers/i2c/da7219/da7219.c
@@ -95,7 +95,7 @@
dev->path.i2c.device, config->irq.pin);
}
-static const char *da7219_acpi_name(struct device *dev)
+static const char *da7219_acpi_name(const struct device *dev)
{
return DA7219_ACPI_NAME;
}
diff --git a/src/drivers/i2c/generic/generic.c b/src/drivers/i2c/generic/generic.c
index 460f015..13f8393 100644
--- a/src/drivers/i2c/generic/generic.c
+++ b/src/drivers/i2c/generic/generic.c
@@ -165,7 +165,7 @@
}
/* Use name specified in config or build one from I2C address */
-static const char *i2c_generic_acpi_name(struct device *dev)
+static const char *i2c_generic_acpi_name(const struct device *dev)
{
struct drivers_i2c_generic_config *config = dev->chip_info;
static char name[5];
diff --git a/src/drivers/i2c/hid/hid.c b/src/drivers/i2c/hid/hid.c
index 9eb56c2..71d70d0 100644
--- a/src/drivers/i2c/hid/hid.c
+++ b/src/drivers/i2c/hid/hid.c
@@ -37,7 +37,7 @@
i2c_generic_fill_ssdt(dev, &i2c_hid_fill_dsm, &config->generic);
}
-static const char *i2c_hid_acpi_name(struct device *dev)
+static const char *i2c_hid_acpi_name(const struct device *dev)
{
static char name[5];
snprintf(name, sizeof(name), "H%03.3X", dev->path.i2c.device);
diff --git a/src/drivers/i2c/max98927/max98927.c b/src/drivers/i2c/max98927/max98927.c
index e9fc00d..50b3e0c 100644
--- a/src/drivers/i2c/max98927/max98927.c
+++ b/src/drivers/i2c/max98927/max98927.c
@@ -73,7 +73,7 @@
dev->chip_ops->name, dev->path.i2c.device);
}
-static const char *max98927_acpi_name(struct device *dev)
+static const char *max98927_acpi_name(const struct device *dev)
{
struct drivers_i2c_max98927_config *config = dev->chip_info;
diff --git a/src/drivers/i2c/nau8825/nau8825.c b/src/drivers/i2c/nau8825/nau8825.c
index 42dd847..3cf5edd 100644
--- a/src/drivers/i2c/nau8825/nau8825.c
+++ b/src/drivers/i2c/nau8825/nau8825.c
@@ -92,7 +92,7 @@
dev->path.i2c.device, config->irq.pin);
}
-static const char *nau8825_acpi_name(struct device *dev)
+static const char *nau8825_acpi_name(const struct device *dev)
{
return NAU8825_ACPI_NAME;
}
diff --git a/src/drivers/i2c/rt5663/rt5663.c b/src/drivers/i2c/rt5663/rt5663.c
index e8734dc8..16237d6 100644
--- a/src/drivers/i2c/rt5663/rt5663.c
+++ b/src/drivers/i2c/rt5663/rt5663.c
@@ -82,7 +82,7 @@
dev->chip_ops->name, dev->path.i2c.device);
}
-static const char *rt5663_acpi_name(struct device *dev)
+static const char *rt5663_acpi_name(const struct device *dev)
{
return RT5663_ACPI_NAME;
}
diff --git a/src/drivers/i2c/tpm/chip.c b/src/drivers/i2c/tpm/chip.c
index 595a05c..6d5c28a 100644
--- a/src/drivers/i2c/tpm/chip.c
+++ b/src/drivers/i2c/tpm/chip.c
@@ -65,7 +65,7 @@
dev->chip_ops->name, dev_path(dev));
}
-static const char *i2c_tpm_acpi_name(struct device *dev)
+static const char *i2c_tpm_acpi_name(const struct device *dev)
{
return "TPMI";
}
diff --git a/src/drivers/intel/mipi_camera/camera.c b/src/drivers/intel/mipi_camera/camera.c
index 00ffad9..9def973 100644
--- a/src/drivers/intel/mipi_camera/camera.c
+++ b/src/drivers/intel/mipi_camera/camera.c
@@ -74,7 +74,7 @@
dev->chip_ops->name, dev->path.i2c.device);
}
-static const char *camera_acpi_name(struct device *dev)
+static const char *camera_acpi_name(const struct device *dev)
{
struct drivers_intel_mipi_camera_config *config = dev->chip_info;
return config->acpi_name;
diff --git a/src/drivers/intel/wifi/wifi.c b/src/drivers/intel/wifi/wifi.c
index 77918e4..3b21165 100644
--- a/src/drivers/intel/wifi/wifi.c
+++ b/src/drivers/intel/wifi/wifi.c
@@ -195,7 +195,7 @@
dev->chip_ops ? dev->chip_ops->name : "", dev_path(dev));
}
-static const char *intel_wifi_acpi_name(struct device *dev)
+static const char *intel_wifi_acpi_name(const struct device *dev)
{
return "WIFI";
}
diff --git a/src/drivers/pc80/tpm/tpm.c b/src/drivers/pc80/tpm/tpm.c
index e9730a9..c0afd4c 100644
--- a/src/drivers/pc80/tpm/tpm.c
+++ b/src/drivers/pc80/tpm/tpm.c
@@ -988,7 +988,7 @@
dev->chip_ops->name, dev_path(dev));
}
-static const char *lpc_tpm_acpi_name(struct device *dev)
+static const char *lpc_tpm_acpi_name(const struct device *dev)
{
return "TPM";
}
diff --git a/src/drivers/spi/acpi/acpi.c b/src/drivers/spi/acpi/acpi.c
index 2a39814..d36a03a 100644
--- a/src/drivers/spi/acpi/acpi.c
+++ b/src/drivers/spi/acpi/acpi.c
@@ -24,7 +24,7 @@
#include <string.h>
#include "chip.h"
-static int spi_acpi_get_bus(struct device *dev)
+static int spi_acpi_get_bus(const struct device *dev)
{
struct device *spi_dev;
struct device_operations *ops;
@@ -178,7 +178,7 @@
config->desc ? : dev->chip_ops->name, dev_path(dev));
}
-static const char *spi_acpi_name(struct device *dev)
+static const char *spi_acpi_name(const struct device *dev)
{
struct drivers_spi_acpi_config *config = dev->chip_info;
static char name[5];