Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86: constify PCI raw ops structures

As with any other such change, the goal is to prevent inadvertent
writes to these structures (assuming DEBUG_RODATA is enabled), and to
separate data (possibly frequently) written to from such never getting
modified.

Reviewed-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>

authored by

Jan Beulich and committed by
Jesse Barnes
72da0b07 a94d072b

+15 -15
+3 -3
arch/x86/include/asm/pci_x86.h
··· 99 99 int reg, int len, u32 val); 100 100 }; 101 101 102 - extern struct pci_raw_ops *raw_pci_ops; 103 - extern struct pci_raw_ops *raw_pci_ext_ops; 102 + extern const struct pci_raw_ops *raw_pci_ops; 103 + extern const struct pci_raw_ops *raw_pci_ext_ops; 104 104 105 - extern struct pci_raw_ops pci_direct_conf1; 105 + extern const struct pci_raw_ops pci_direct_conf1; 106 106 extern bool port_cf9_safe; 107 107 108 108 /* arch_initcall level */
+1 -1
arch/x86/pci/ce4100.c
··· 304 304 return pci_direct_conf1.write(seg, bus, devfn, reg, len, value); 305 305 } 306 306 307 - struct pci_raw_ops ce4100_pci_conf = { 307 + static const struct pci_raw_ops ce4100_pci_conf = { 308 308 .read = ce4100_conf_read, 309 309 .write = ce4100_conf_write, 310 310 };
+2 -2
arch/x86/pci/common.c
··· 33 33 int pcibios_last_bus = -1; 34 34 unsigned long pirq_table_addr; 35 35 struct pci_bus *pci_root_bus; 36 - struct pci_raw_ops *raw_pci_ops; 37 - struct pci_raw_ops *raw_pci_ext_ops; 36 + const struct pci_raw_ops *__read_mostly raw_pci_ops; 37 + const struct pci_raw_ops *__read_mostly raw_pci_ext_ops; 38 38 39 39 int raw_pci_read(unsigned int domain, unsigned int bus, unsigned int devfn, 40 40 int reg, int len, u32 *val)
+3 -3
arch/x86/pci/direct.c
··· 79 79 80 80 #undef PCI_CONF1_ADDRESS 81 81 82 - struct pci_raw_ops pci_direct_conf1 = { 82 + const struct pci_raw_ops pci_direct_conf1 = { 83 83 .read = pci_conf1_read, 84 84 .write = pci_conf1_write, 85 85 }; ··· 175 175 176 176 #undef PCI_CONF2_ADDRESS 177 177 178 - struct pci_raw_ops pci_direct_conf2 = { 178 + static const struct pci_raw_ops pci_direct_conf2 = { 179 179 .read = pci_conf2_read, 180 180 .write = pci_conf2_write, 181 181 }; ··· 191 191 * This should be close to trivial, but it isn't, because there are buggy 192 192 * chipsets (yes, you guessed it, by Intel and Compaq) that have no class ID. 193 193 */ 194 - static int __init pci_sanity_check(struct pci_raw_ops *o) 194 + static int __init pci_sanity_check(const struct pci_raw_ops *o) 195 195 { 196 196 u32 x = 0; 197 197 int year, devfn;
+1 -1
arch/x86/pci/mmconfig_32.c
··· 117 117 return 0; 118 118 } 119 119 120 - static struct pci_raw_ops pci_mmcfg = { 120 + static const struct pci_raw_ops pci_mmcfg = { 121 121 .read = pci_mmcfg_read, 122 122 .write = pci_mmcfg_write, 123 123 };
+1 -1
arch/x86/pci/mmconfig_64.c
··· 81 81 return 0; 82 82 } 83 83 84 - static struct pci_raw_ops pci_mmcfg = { 84 + static const struct pci_raw_ops pci_mmcfg = { 85 85 .read = pci_mmcfg_read, 86 86 .write = pci_mmcfg_write, 87 87 };
+1 -1
arch/x86/pci/numaq_32.c
··· 110 110 111 111 #undef PCI_CONF1_MQ_ADDRESS 112 112 113 - static struct pci_raw_ops pci_direct_conf1_mq = { 113 + static const struct pci_raw_ops pci_direct_conf1_mq = { 114 114 .read = pci_conf1_mq_read, 115 115 .write = pci_conf1_mq_write 116 116 };
+1 -1
arch/x86/pci/olpc.c
··· 301 301 return 0; 302 302 } 303 303 304 - static struct pci_raw_ops pci_olpc_conf = { 304 + static const struct pci_raw_ops pci_olpc_conf = { 305 305 .read = pci_olpc_read, 306 306 .write = pci_olpc_write, 307 307 };
+2 -2
arch/x86/pci/pcbios.c
··· 303 303 * Function table for BIOS32 access 304 304 */ 305 305 306 - static struct pci_raw_ops pci_bios_access = { 306 + static const struct pci_raw_ops pci_bios_access = { 307 307 .read = pci_bios_read, 308 308 .write = pci_bios_write 309 309 }; ··· 312 312 * Try to find PCI BIOS. 313 313 */ 314 314 315 - static struct pci_raw_ops * __devinit pci_find_bios(void) 315 + static const struct pci_raw_ops * __devinit pci_find_bios(void) 316 316 { 317 317 union bios32 *check; 318 318 unsigned char sum;