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>
This commit is contained in:
Aaron Durbin 2017-09-13 16:01:52 -06:00
parent d07f377872
commit aa090cb6ea
36 changed files with 39 additions and 38 deletions

View File

@ -136,7 +136,7 @@ static void root_dev_reset(struct bus *bus)
}
#if IS_ENABLED(CONFIG_HAVE_ACPI_TABLES)
static const char *root_dev_acpi_name(struct device *dev)
static const char *root_dev_acpi_name(const struct device *dev)
{
return "\\_SB";
}

View File

@ -60,7 +60,7 @@ static void gpio_regulator_fill_ssdt_generator(struct device *dev)
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];

View File

@ -66,7 +66,7 @@ static void max98357a_fill_ssdt(struct device *dev)
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;
}

View File

@ -34,7 +34,7 @@ static void i2c_alps_fill_ssdt_generator(struct device *dev)
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";
}

View File

@ -95,7 +95,7 @@ static void da7219_fill_ssdt(struct device *dev)
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;
}

View File

@ -165,7 +165,7 @@ static void i2c_generic_fill_ssdt_generator(struct device *dev)
}
/* 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];

View File

@ -37,7 +37,7 @@ static void i2c_hid_fill_ssdt_generator(struct device *dev)
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);

View File

@ -73,7 +73,7 @@ static void max98927_fill_ssdt(struct device *dev)
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;

View File

@ -92,7 +92,7 @@ static void nau8825_fill_ssdt(struct device *dev)
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;
}

View File

@ -82,7 +82,7 @@ static void rt5663_fill_ssdt(struct device *dev)
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;
}

View File

@ -65,7 +65,7 @@ static void i2c_tpm_fill_ssdt(struct device *dev)
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";
}

View File

@ -74,7 +74,7 @@ static void camera_fill_ssdt(struct device *dev)
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;

View File

@ -195,7 +195,7 @@ static void intel_wifi_fill_ssdt(struct device *dev)
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";
}

View File

@ -988,7 +988,7 @@ static void lpc_tpm_fill_ssdt(struct device *dev)
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";
}

View File

@ -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 @@ static void spi_acpi_fill_ssdt_generator(struct device *dev)
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];

View File

@ -65,7 +65,7 @@ struct device_operations {
unsigned long start, struct acpi_rsdp *rsdp);
void (*acpi_fill_ssdt_generator)(struct device *dev);
void (*acpi_inject_dsdt_generator)(struct device *dev);
const char *(*acpi_name)(struct device *dev);
const char *(*acpi_name)(const struct device *dev);
#endif
const struct pci_operations *ops_pci;
const struct i2c_bus_operations *ops_i2c_bus;

View File

@ -606,7 +606,7 @@ static void domain_enable_resources(device_t dev)
#endif
}
static const char *domain_acpi_name(struct device *dev)
static const char *domain_acpi_name(const struct device *dev)
{
if (dev->path.type == DEVICE_PATH_DOMAIN)
return "PCI0";

View File

@ -645,7 +645,7 @@ static void mcf0_control_init(struct device *dev)
}
#if IS_ENABLED(CONFIG_HAVE_ACPI_TABLES)
static const char *amdfam10_northbridge_acpi_name(struct device *dev)
static const char *amdfam10_northbridge_acpi_name(const struct device *dev)
{
return "";
}
@ -1311,7 +1311,7 @@ static int amdfam10_get_smbios_data(device_t dev, int *handle, unsigned long *cu
#endif
#if IS_ENABLED(CONFIG_HAVE_ACPI_TABLES)
static const char *amdfam10_domain_acpi_name(struct device *dev)
static const char *amdfam10_domain_acpi_name(const struct device *dev)
{
if (dev->path.type == DEVICE_PATH_DOMAIN)
return "PCI0";

View File

@ -813,7 +813,7 @@ static void domain_set_resources(device_t dev)
}
}
static const char *domain_acpi_name(struct device *dev)
static const char *domain_acpi_name(const struct device *dev)
{
if (dev->path.type == DEVICE_PATH_DOMAIN)
return "PCI0";

View File

@ -718,7 +718,7 @@ gma_write_acpi_tables(struct device *const dev,
return current;
}
static const char *gma_acpi_name(device_t dev)
static const char *gma_acpi_name(const struct device *dev)
{
return "GFX0";
}

View File

@ -242,7 +242,7 @@ static void pci_domain_set_resources(device_t dev)
assign_resources(dev->link_list);
}
static const char *northbridge_acpi_name(struct device *dev)
static const char *northbridge_acpi_name(const struct device *dev)
{
if (dev->path.type == DEVICE_PATH_DOMAIN)
return "PCI0";

View File

@ -49,7 +49,7 @@
static void *vbt;
static struct region_device vbt_rdev;
static const char *soc_acpi_name(struct device *dev)
static const char *soc_acpi_name(const struct device *dev)
{
if (dev->path.type == DEVICE_PATH_DOMAIN)
return "PCI0";

View File

@ -25,7 +25,7 @@
#include <string.h>
#if IS_ENABLED(CONFIG_HAVE_ACPI_TABLES)
static const char *soc_acpi_name(struct device *dev)
static const char *soc_acpi_name(const struct device *dev)
{
if (dev->path.type == DEVICE_PATH_DOMAIN)
return "PCI0";

View File

@ -636,7 +636,7 @@ __attribute__((weak)) void acpi_mainboard_gnvs(global_nvs_t *gnvs)
{
}
const char *soc_acpi_name(struct device *dev)
const char *soc_acpi_name(const struct device *dev)
{
if (dev->path.type == DEVICE_PATH_DOMAIN)
return "PCI0";

View File

@ -29,7 +29,7 @@ void soc_irq_settings(FSP_SIL_UPD *params);
void pch_enable_dev(device_t dev);
void soc_init_pre_device(void *chip_info);
void soc_fsp_load(void);
const char *soc_acpi_name(struct device *dev);
const char *soc_acpi_name(const struct device *dev);
extern struct pci_operations soc_pci_ops;
/* Get igd framebuffer bar */

View File

@ -31,7 +31,7 @@ void pch_enable_dev(device_t dev);
void soc_fsp_load(void);
void soc_init_pre_device(void *chip_info);
void soc_irq_settings(FSP_SIL_UPD *params);
const char *soc_acpi_name(struct device *dev);
const char *soc_acpi_name(const struct device *dev);
extern struct pci_operations soc_pci_ops;

View File

@ -143,7 +143,7 @@ unsigned long acpi_fill_mcfg(unsigned long current)
return current;
}
static const char *lpc_acpi_name(struct device *dev)
static const char *lpc_acpi_name(const struct device *dev)
{
if (dev->path.type != DEVICE_PATH_PCI)
return NULL;

View File

@ -339,7 +339,7 @@ unsigned long acpi_fill_mcfg(unsigned long current)
return current;
}
static const char *lpc_acpi_name(struct device *dev)
static const char *lpc_acpi_name(const struct device *dev)
{
if (dev->path.type != DEVICE_PATH_PCI)
return NULL;

View File

@ -252,7 +252,8 @@ static void southbridge_acpi_fill_ssdt_generator(device_t device) {
amd_generate_powernow(ACPI_CPU_CONTROL, 6, 1);
}
static const char *lpc_acpi_name(struct device *dev) {
static const char *lpc_acpi_name(const struct device *dev)
{
if (dev->path.type != DEVICE_PATH_PCI)
return NULL;

View File

@ -331,7 +331,7 @@ static void azalia_init(struct device *dev)
pci_write_config8(dev, 0x43, reg8);
}
static const char *azalia_acpi_name(device_t dev)
static const char *azalia_acpi_name(const struct device *dev)
{
return "HDEF";
}

View File

@ -814,7 +814,7 @@ void acpi_fill_fadt(acpi_fadt_t *fadt)
fadt->x_gpe1_blk.addrh = 0x0;
}
static const char *lpc_acpi_name(device_t dev)
static const char *lpc_acpi_name(const struct device *dev)
{
return "LPCB";
}

View File

@ -285,7 +285,7 @@ static void pch_pciexp_scan_bridge(device_t dev)
pch_pcie_pm_late(dev);
}
static const char *pch_pcie_acpi_name(device_t dev)
static const char *pch_pcie_acpi_name(const struct device *dev)
{
ASSERT(dev);

View File

@ -244,7 +244,7 @@ static void sata_set_subsystem(device_t dev, unsigned vendor, unsigned device)
}
}
static const char *sata_acpi_name(device_t dev)
static const char *sata_acpi_name(const struct device *dev)
{
return "SATA";
}

View File

@ -100,7 +100,7 @@ static void smbus_read_resources(device_t dev)
res = pci_get_resource(dev, PCI_BASE_ADDRESS_0);
}
static const char *smbus_acpi_name(device_t dev)
static const char *smbus_acpi_name(const struct device *dev)
{
return "SBUS";
}

View File

@ -94,7 +94,7 @@ static void usb_ehci_set_subsystem(device_t dev, unsigned vendor, unsigned devic
pci_write_config8(dev, 0x80, access_cntl);
}
static const char *usb_ehci_acpi_name(device_t dev)
static const char *usb_ehci_acpi_name(const struct device *dev)
{
switch (dev->path.pci.devfn) {
case PCI_DEVFN(0x1a, 0):

View File

@ -51,7 +51,7 @@ static void usb_xhci_init(struct device *dev)
printk(BIOS_DEBUG, "done.\n");
}
static const char *xhci_acpi_name(device_t dev)
static const char *xhci_acpi_name(const struct device *dev)
{
return "XHC";
}