x86: constify PCI raw ops structures
authorJan Beulich <JBeulich@suse.com>
Thu, 15 Sep 2011 07:58:51 +0000 (08:58 +0100)
committerJesse Barnes <jbarnes@virtuousgeek.org>
Fri, 14 Oct 2011 16:05:28 +0000 (09:05 -0700)
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>
arch/x86/include/asm/pci_x86.h
arch/x86/pci/ce4100.c
arch/x86/pci/common.c
arch/x86/pci/direct.c
arch/x86/pci/mmconfig_32.c
arch/x86/pci/mmconfig_64.c
arch/x86/pci/numaq_32.c
arch/x86/pci/olpc.c
arch/x86/pci/pcbios.c

index 704526734bef3536adcfed591de79159b2313329..e381978068533292e67ef9dfc613b1b939671bbb 100644 (file)
@@ -99,10 +99,10 @@ struct pci_raw_ops {
                                                int reg, int len, u32 val);
 };
 
-extern struct pci_raw_ops *raw_pci_ops;
-extern struct pci_raw_ops *raw_pci_ext_ops;
+extern const struct pci_raw_ops *raw_pci_ops;
+extern const struct pci_raw_ops *raw_pci_ext_ops;
 
-extern struct pci_raw_ops pci_direct_conf1;
+extern const struct pci_raw_ops pci_direct_conf1;
 extern bool port_cf9_safe;
 
 /* arch_initcall level */
index 99176094500b02aab75b8f8ba591ac50220b1186..41bd2a2d2c50f61a4948f954f296631c8dfd7961 100644 (file)
@@ -304,7 +304,7 @@ static int ce4100_conf_write(unsigned int seg, unsigned int bus,
        return pci_direct_conf1.write(seg, bus, devfn, reg, len, value);
 }
 
-struct pci_raw_ops ce4100_pci_conf = {
+static const struct pci_raw_ops ce4100_pci_conf = {
        .read = ce4100_conf_read,
        .write = ce4100_conf_write,
 };
index 92df322e0b571a09c49aa236e7dae3118fe353cb..7962ccb4d9b26aeb3354d2ab1814d9d04a69d695 100644 (file)
@@ -33,8 +33,8 @@ int noioapicreroute = 1;
 int pcibios_last_bus = -1;
 unsigned long pirq_table_addr;
 struct pci_bus *pci_root_bus;
-struct pci_raw_ops *raw_pci_ops;
-struct pci_raw_ops *raw_pci_ext_ops;
+const struct pci_raw_ops *__read_mostly raw_pci_ops;
+const struct pci_raw_ops *__read_mostly raw_pci_ext_ops;
 
 int raw_pci_read(unsigned int domain, unsigned int bus, unsigned int devfn,
                                                int reg, int len, u32 *val)
index 4f2c70439d7fbb352993c4b8b9f3a76d39dfc438..15460590b8c551c023e7cd0eb1df768cdb572d45 100644 (file)
@@ -79,7 +79,7 @@ static int pci_conf1_write(unsigned int seg, unsigned int bus,
 
 #undef PCI_CONF1_ADDRESS
 
-struct pci_raw_ops pci_direct_conf1 = {
+const struct pci_raw_ops pci_direct_conf1 = {
        .read =         pci_conf1_read,
        .write =        pci_conf1_write,
 };
@@ -175,7 +175,7 @@ static int pci_conf2_write(unsigned int seg, unsigned int bus,
 
 #undef PCI_CONF2_ADDRESS
 
-struct pci_raw_ops pci_direct_conf2 = {
+static const struct pci_raw_ops pci_direct_conf2 = {
        .read =         pci_conf2_read,
        .write =        pci_conf2_write,
 };
@@ -191,7 +191,7 @@ struct pci_raw_ops pci_direct_conf2 = {
  * This should be close to trivial, but it isn't, because there are buggy
  * chipsets (yes, you guessed it, by Intel and Compaq) that have no class ID.
  */
-static int __init pci_sanity_check(struct pci_raw_ops *o)
+static int __init pci_sanity_check(const struct pci_raw_ops *o)
 {
        u32 x = 0;
        int year, devfn;
index a3d9c54792aef245843eef8da9a7025d7179cd85..5372e86834c03dbda433db01811c9a6be072622f 100644 (file)
@@ -117,7 +117,7 @@ static int pci_mmcfg_write(unsigned int seg, unsigned int bus,
        return 0;
 }
 
-static struct pci_raw_ops pci_mmcfg = {
+static const struct pci_raw_ops pci_mmcfg = {
        .read =         pci_mmcfg_read,
        .write =        pci_mmcfg_write,
 };
index e783841bd1d7c42ea8ca4607d884ffe1e65ba97f..915a493502cbb44410ed26dd9f24cbd9422bfe4d 100644 (file)
@@ -81,7 +81,7 @@ static int pci_mmcfg_write(unsigned int seg, unsigned int bus,
        return 0;
 }
 
-static struct pci_raw_ops pci_mmcfg = {
+static const struct pci_raw_ops pci_mmcfg = {
        .read =         pci_mmcfg_read,
        .write =        pci_mmcfg_write,
 };
index 512a88c4150139027709645e797746f0555c5fb7..51abf02f9226687c234945e1ff39fb9a8c13695b 100644 (file)
@@ -110,7 +110,7 @@ static int pci_conf1_mq_write(unsigned int seg, unsigned int bus,
 
 #undef PCI_CONF1_MQ_ADDRESS
 
-static struct pci_raw_ops pci_direct_conf1_mq = {
+static const struct pci_raw_ops pci_direct_conf1_mq = {
        .read   = pci_conf1_mq_read,
        .write  = pci_conf1_mq_write
 };
index 5262603b04d9d0b849df61ab98890705c1bed155..7043a4f0e98ab258c06116e675bac65d19080a7e 100644 (file)
@@ -301,7 +301,7 @@ static int pci_olpc_write(unsigned int seg, unsigned int bus,
        return 0;
 }
 
-static struct pci_raw_ops pci_olpc_conf = {
+static const struct pci_raw_ops pci_olpc_conf = {
        .read = pci_olpc_read,
        .write = pci_olpc_write,
 };
index f68553551467a0cbe6dd11a2cba04c6afaff5172..db0e9a51e611dcaeb66b8b7b961312ac2f0795c1 100644 (file)
@@ -303,7 +303,7 @@ static int pci_bios_write(unsigned int seg, unsigned int bus,
  * Function table for BIOS32 access
  */
 
-static struct pci_raw_ops pci_bios_access = {
+static const struct pci_raw_ops pci_bios_access = {
        .read =         pci_bios_read,
        .write =        pci_bios_write
 };
@@ -312,7 +312,7 @@ static struct pci_raw_ops pci_bios_access = {
  * Try to find PCI BIOS.
  */
 
-static struct pci_raw_ops * __devinit pci_find_bios(void)
+static const struct pci_raw_ops * __devinit pci_find_bios(void)
 {
        union bios32 *check;
        unsigned char sum;
This page took 0.030409 seconds and 5 git commands to generate.