From 497cdb74841c03a204d7e1b0b3e352f97553e60e Mon Sep 17 00:00:00 2001 From: Uwe Hermann Date: Mon, 26 Nov 2007 13:28:52 +0000 Subject: [PATCH] Constify structs which can be const. Signed-off-by: Uwe Hermann Acked-by: Ronald G. Minnich git-svn-id: svn://coreboot.org/repository/LinuxBIOSv3@519 f3766cd6-281f-0410-b1cd-43a5c92072e9 --- arch/x86/geodelx/cpu.c | 4 ++-- arch/x86/pci_ops_conf1.c | 3 +-- arch/x86/pci_ops_conf2.c | 3 +-- arch/x86/pci_ops_mmconf.c | 4 +--- device/agp_device.c | 4 ++-- device/cardbus_device.c | 2 +- device/hypertransport.c | 4 ++-- device/pcie_device.c | 4 ++-- device/pcix_device.c | 4 ++-- device/root_device.c | 2 +- include/arch/x86/pci_ops.h | 6 +++--- include/device/device.h | 2 +- mainboard/artecgroup/dbe61/initram.c | 2 +- mainboard/artecgroup/dbe61/stage1.c | 2 +- mainboard/emulation/qemu-x86/vga.c | 4 ++-- 15 files changed, 23 insertions(+), 27 deletions(-) diff --git a/arch/x86/geodelx/cpu.c b/arch/x86/geodelx/cpu.c index a0ac5558f5..0753fd353f 100644 --- a/arch/x86/geodelx/cpu.c +++ b/arch/x86/geodelx/cpu.c @@ -83,7 +83,7 @@ static void lx_init(struct device *dev) * in multiple CPU files and use the device ID, at scan time, to pick which * one is used. There is a lot of flexibility here! */ -static struct device_operations geodelx_cpuops = { +static const struct device_operations geodelx_cpuops = { .constructor = default_device_constructor, .phase3_scan = NULL, .phase6_init = lx_init, @@ -97,7 +97,7 @@ static struct device_operations geodelx_cpuops = { * depending on date manufactured they can be all over the place (the Geode * alone has had 3 vendors!) so we will have to be careful. */ -struct constructor geodelx_constructors[] = { +const struct constructor geodelx_constructors[] = { {.id = {.type = DEVICE_ID_PCI, /* TODO: This is incorrect, these are _not_ PCI IDs! */ .u = {.pci = {.vendor = X86_VENDOR_AMD,.device = 0x05A2}}}, diff --git a/arch/x86/pci_ops_conf1.c b/arch/x86/pci_ops_conf1.c index af3e47298d..b0b0f19047 100644 --- a/arch/x86/pci_ops_conf1.c +++ b/arch/x86/pci_ops_conf1.c @@ -58,8 +58,7 @@ static void pci_conf1_write_config32(struct bus *pbus, int bus, int devfn, int w #undef CONFIG_CMD -struct pci_bus_operations pci_cf8_conf1 = -{ +const struct pci_bus_operations pci_cf8_conf1 = { .read8 = pci_conf1_read_config8, .read16 = pci_conf1_read_config16, .read32 = pci_conf1_read_config32, diff --git a/arch/x86/pci_ops_conf2.c b/arch/x86/pci_ops_conf2.c index 278a1d0d18..2a7b4ca216 100644 --- a/arch/x86/pci_ops_conf2.c +++ b/arch/x86/pci_ops_conf2.c @@ -67,8 +67,7 @@ static void pci_conf2_write_config32(struct bus *pbus, int bus, int devfn, int w #undef IOADDR #undef DEVFUNC -struct pci_bus_operations pci_cf8_conf2 = -{ +const struct pci_bus_operations pci_cf8_conf2 = { .read8 = pci_conf2_read_config8, .read16 = pci_conf2_read_config16, .read32 = pci_conf2_read_config32, diff --git a/arch/x86/pci_ops_mmconf.c b/arch/x86/pci_ops_mmconf.c index de2313e396..e09692c0e6 100644 --- a/arch/x86/pci_ops_mmconf.c +++ b/arch/x86/pci_ops_mmconf.c @@ -48,9 +48,7 @@ static void pci_mmconf_write_config32(struct bus *pbus, int bus, int devfn, int write8x(PCI_MMIO_ADDR(bus, devfn, where), value); } - -const struct pci_bus_operations pci_ops_mmconf = -{ +const struct pci_bus_operations pci_ops_mmconf = { .read8 = pci_mmconf_read_config8, .read16 = pci_mmconf_read_config16, .read32 = pci_mmconf_read_config32, diff --git a/device/agp_device.c b/device/agp_device.c index 6f56c22b75..fcdbb70932 100644 --- a/device/agp_device.c +++ b/device/agp_device.c @@ -55,11 +55,11 @@ unsigned int agp_scan_bridge(struct device *dev, unsigned int max) } /** Default device operations for AGP bridges. */ -static struct pci_operations agp_bus_ops_pci = { +static const struct pci_operations agp_bus_ops_pci = { .set_subsystem = 0, }; -struct device_operations default_agp_ops_bus = { +const struct device_operations default_agp_ops_bus = { .read_resources = pci_bus_read_resources, .set_resources = pci_dev_set_resources, .enable_resources = pci_bus_enable_resources, diff --git a/device/cardbus_device.c b/device/cardbus_device.c index 376bd421ae..a9070d3c06 100644 --- a/device/cardbus_device.c +++ b/device/cardbus_device.c @@ -242,7 +242,7 @@ unsigned int cardbus_scan_bridge(struct device *dev, unsigned int max) return max; } -struct device_operations default_cardbus_ops_bus = { +const struct device_operations default_cardbus_ops_bus = { .read_resources = cardbus_read_resources, .set_resources = pci_dev_set_resources, .enable_resources = cardbus_enable_resources, diff --git a/device/hypertransport.c b/device/hypertransport.c index 198434d0a8..06a71041a0 100644 --- a/device/hypertransport.c +++ b/device/hypertransport.c @@ -629,11 +629,11 @@ unsigned int ht_scan_bridge(struct device *dev, unsigned int max) } /** Default device operations for hypertransport bridges. */ -static struct pci_operations ht_bus_ops_pci = { +static const struct pci_operations ht_bus_ops_pci = { .set_subsystem = 0, }; -struct device_operations default_ht_ops_bus = { +const struct device_operations default_ht_ops_bus = { .read_resources = pci_bus_read_resources, .set_resources = pci_dev_set_resources, .enable_resources = pci_bus_enable_resources, diff --git a/device/pcie_device.c b/device/pcie_device.c index 5caf05d0c5..63983351b0 100644 --- a/device/pcie_device.c +++ b/device/pcie_device.c @@ -57,11 +57,11 @@ unsigned int pcie_scan_bridge(struct device *dev, unsigned int max) } /** Default device operations for PCI Express bridges. */ -static struct pci_operations pcie_bus_ops_pci = { +static const struct pci_operations pcie_bus_ops_pci = { .set_subsystem = 0, }; -struct device_operations default_pcie_ops_bus = { +const struct device_operations default_pcie_ops_bus = { .read_resources = pci_bus_read_resources, .set_resources = pci_dev_set_resources, .enable_resources = pci_bus_enable_resources, diff --git a/device/pcix_device.c b/device/pcix_device.c index 7b091f8a8e..1eff7b101d 100644 --- a/device/pcix_device.c +++ b/device/pcix_device.c @@ -136,11 +136,11 @@ unsigned int pcix_scan_bridge(struct device *dev, unsigned int max) } /** Default device operations for PCI-X bridges. */ -static struct pci_operations pcix_bus_ops_pci = { +static const struct pci_operations pcix_bus_ops_pci = { .set_subsystem = 0, }; -struct device_operations default_pcix_ops_bus = { +const struct device_operations default_pcix_ops_bus = { .read_resources = pci_bus_read_resources, .set_resources = pci_dev_set_resources, .enable_resources = pci_bus_enable_resources, diff --git a/device/root_device.c b/device/root_device.c index 7780b02d51..cf87c3d3e3 100644 --- a/device/root_device.c +++ b/device/root_device.c @@ -216,7 +216,7 @@ void root_dev_reset(struct bus *bus) * own ops in (e.g.) the mainboard, and initialize it in the dts in the * mainboard directory. */ -struct device_operations default_dev_ops_root = { +const struct device_operations default_dev_ops_root = { .phase4_read_resources = root_dev_read_resources, .phase4_set_resources = root_dev_set_resources, .phase5_enable_resources = root_dev_enable_resources, diff --git a/include/arch/x86/pci_ops.h b/include/arch/x86/pci_ops.h index 816617fb99..283aa03b5e 100644 --- a/include/arch/x86/pci_ops.h +++ b/include/arch/x86/pci_ops.h @@ -17,11 +17,11 @@ #ifndef ARCH_X86_PCI_OPS_H #define ARCH_X86_PCI_OPS_H -extern struct pci_bus_operations pci_cf8_conf1; -extern struct pci_bus_operations pci_cf8_conf2; +extern const struct pci_bus_operations pci_cf8_conf1; +extern const struct pci_bus_operations pci_cf8_conf2; #if defined(CONFIG_MMCONF_SUPPORT) && (CONFIG_MMCONF_SUPPORT==1) -extern struct pci_bus_operations pci_ops_mmconf; +extern const struct pci_bus_operations pci_ops_mmconf; #endif void pci_set_method(struct device * dev); diff --git a/include/device/device.h b/include/device/device.h index b01735d715..fad48d9c33 100644 --- a/include/device/device.h +++ b/include/device/device.h @@ -270,7 +270,7 @@ void default_device_constructor(struct device *dev, struct constructor *construc resource_t align_up(resource_t val, unsigned long gran); resource_t align_down(resource_t val, unsigned long gran); -extern struct device_operations default_dev_ops_root; +extern const struct device_operations default_dev_ops_root; extern int id_eq(struct device_id *id1, struct device_id *id2); void root_dev_read_resources(struct device * dev); diff --git a/mainboard/artecgroup/dbe61/initram.c b/mainboard/artecgroup/dbe61/initram.c index 2d9551cab6..792b3f4d3f 100644 --- a/mainboard/artecgroup/dbe61/initram.c +++ b/mainboard/artecgroup/dbe61/initram.c @@ -107,7 +107,7 @@ static void sdram_hardwire(void) /* Hold Count - how long we will sit in reset */ #define PLLMSRlo 0x00DE0000 -struct wmsr { +static const struct wmsr { u32 reg; struct msr msr; } dbe61_msr[] = { diff --git a/mainboard/artecgroup/dbe61/stage1.c b/mainboard/artecgroup/dbe61/stage1.c index 923b48002c..0b05a52450 100644 --- a/mainboard/artecgroup/dbe61/stage1.c +++ b/mainboard/artecgroup/dbe61/stage1.c @@ -30,7 +30,7 @@ #include #include -struct wmsr { +static const struct wmsr { u32 reg; struct msr msr; } dbe61_msr[] = { diff --git a/mainboard/emulation/qemu-x86/vga.c b/mainboard/emulation/qemu-x86/vga.c index ea8d058fb6..ac16a392d8 100644 --- a/mainboard/emulation/qemu-x86/vga.c +++ b/mainboard/emulation/qemu-x86/vga.c @@ -40,7 +40,7 @@ static void setup_onboard(struct device *dev) init_pc_keyboard(0x60, 0x64, &conf); } -static struct device_operations qemuvga_pci_ops_dev = { +static const struct device_operations qemuvga_pci_ops_dev = { .constructor = default_device_constructor, .phase3_scan = 0, .phase4_read_resources = pci_dev_read_resources, @@ -51,7 +51,7 @@ static struct device_operations qemuvga_pci_ops_dev = { .ops_pci = &pci_dev_ops_pci, }; -struct constructor qemuvga_constructors[] = { +const struct constructor qemuvga_constructors[] = { {.id = {.type = DEVICE_ID_PCI, .u = {.pci = {.vendor = PCI_VENDOR_ID_CIRRUS, .device = PCI_DEVICE_ID_CIRRUS_5446}}},