[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [linux-2.6.18-xen] linux/pciback: constify struct config_field instances



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1224512947 -3600
# Node ID c87adc9760134abb7275728718e44af3dacc515b
# Parent  2406578997720703426d2a44e32e32bfc53ad83b
linux/pciback: constify struct config_field instances

... plus the necessary adjustments to declarations. Also simplify the
static list terminators.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
---
 drivers/xen/pciback/conf_space.c                |   32 ++++++++++++------------
 drivers/xen/pciback/conf_space.h                |   10 +++----
 drivers/xen/pciback/conf_space_capability.c     |    6 +---
 drivers/xen/pciback/conf_space_capability.h     |    2 -
 drivers/xen/pciback/conf_space_capability_pm.c  |    6 +---
 drivers/xen/pciback/conf_space_capability_vpd.c |    6 +---
 drivers/xen/pciback/conf_space_header.c         |   22 ++++++----------
 drivers/xen/pciback/pci_stub.c                  |    6 ++--
 8 files changed, 39 insertions(+), 51 deletions(-)

diff -r 240657899772 -r c87adc976013 drivers/xen/pciback/conf_space.c
--- a/drivers/xen/pciback/conf_space.c  Fri Oct 17 12:02:53 2008 +0100
+++ b/drivers/xen/pciback/conf_space.c  Mon Oct 20 15:29:07 2008 +0100
@@ -31,11 +31,11 @@ DEFINE_PCI_CONFIG(write, dword, u32)
 DEFINE_PCI_CONFIG(write, dword, u32)
 
 static int conf_space_read(struct pci_dev *dev,
-                          struct config_field_entry *entry, int offset,
-                          u32 * value)
+                          const struct config_field_entry *entry,
+                          int offset, u32 *value)
 {
        int ret = 0;
-       struct config_field *field = entry->field;
+       const struct config_field *field = entry->field;
 
        *value = 0;
 
@@ -59,11 +59,11 @@ static int conf_space_read(struct pci_de
 }
 
 static int conf_space_write(struct pci_dev *dev,
-                           struct config_field_entry *entry, int offset,
-                           u32 value)
+                           const struct config_field_entry *entry,
+                           int offset, u32 value)
 {
        int ret = 0;
-       struct config_field *field = entry->field;
+       const struct config_field *field = entry->field;
 
        switch (field->size) {
        case 1:
@@ -140,8 +140,8 @@ int pciback_config_read(struct pci_dev *
 {
        int err = 0;
        struct pciback_dev_data *dev_data = pci_get_drvdata(dev);
-       struct config_field_entry *cfg_entry;
-       struct config_field *field;
+       const struct config_field_entry *cfg_entry;
+       const struct config_field *field;
        int req_start, req_end, field_start, field_end;
        /* if read fails for any reason, return 0 (as if device didn't respond) 
*/
        u32 value = 0, tmp_val;
@@ -202,8 +202,8 @@ int pciback_config_write(struct pci_dev 
 {
        int err = 0, handled = 0;
        struct pciback_dev_data *dev_data = pci_get_drvdata(dev);
-       struct config_field_entry *cfg_entry;
-       struct config_field *field;
+       const struct config_field_entry *cfg_entry;
+       const struct config_field *field;
        u32 tmp_val;
        int req_start, req_end, field_start, field_end;
 
@@ -290,7 +290,7 @@ void pciback_config_free_dyn_fields(stru
 {
        struct pciback_dev_data *dev_data = pci_get_drvdata(dev);
        struct config_field_entry *cfg_entry, *t;
-       struct config_field *field;
+       const struct config_field *field;
 
        dev_dbg(&dev->dev,
                "free-ing dynamically allocated virtual configuration space 
fields\n");
@@ -299,7 +299,7 @@ void pciback_config_free_dyn_fields(stru
                field = cfg_entry->field;
 
                if (field->clean) {
-                       field->clean(field);
+                       field->clean((struct config_field *)field);
 
                        if (cfg_entry->data)
                                kfree(cfg_entry->data);
@@ -314,8 +314,8 @@ void pciback_config_reset_dev(struct pci
 void pciback_config_reset_dev(struct pci_dev *dev)
 {
        struct pciback_dev_data *dev_data = pci_get_drvdata(dev);
-       struct config_field_entry *cfg_entry;
-       struct config_field *field;
+       const struct config_field_entry *cfg_entry;
+       const struct config_field *field;
 
        dev_dbg(&dev->dev, "resetting virtual configuration space\n");
 
@@ -331,7 +331,7 @@ void pciback_config_free_dev(struct pci_
 {
        struct pciback_dev_data *dev_data = pci_get_drvdata(dev);
        struct config_field_entry *cfg_entry, *t;
-       struct config_field *field;
+       const struct config_field *field;
 
        dev_dbg(&dev->dev, "free-ing virtual configuration space fields\n");
 
@@ -348,7 +348,7 @@ void pciback_config_free_dev(struct pci_
 }
 
 int pciback_config_add_field_offset(struct pci_dev *dev,
-                                   struct config_field *field,
+                                   const struct config_field *field,
                                    unsigned int base_offset)
 {
        int err = 0;
diff -r 240657899772 -r c87adc976013 drivers/xen/pciback/conf_space.h
--- a/drivers/xen/pciback/conf_space.h  Fri Oct 17 12:02:53 2008 +0100
+++ b/drivers/xen/pciback/conf_space.h  Mon Oct 20 15:29:07 2008 +0100
@@ -59,7 +59,7 @@ struct config_field {
 
 struct config_field_entry {
        struct list_head list;
-       struct config_field *field;
+       const struct config_field *field;
        unsigned int base_offset;
        void *data;
 };
@@ -70,17 +70,17 @@ struct config_field_entry {
  * the first entry in an array (of which the ending is marked by size==0)
  */
 int pciback_config_add_field_offset(struct pci_dev *dev,
-                                   struct config_field *field,
+                                   const struct config_field *field,
                                    unsigned int offset);
 
 static inline int pciback_config_add_field(struct pci_dev *dev,
-                                          struct config_field *field)
+                                          const struct config_field *field)
 {
        return pciback_config_add_field_offset(dev, field, 0);
 }
 
 static inline int pciback_config_add_fields(struct pci_dev *dev,
-                                           struct config_field *field)
+                                           const struct config_field *field)
 {
        int i, err = 0;
        for (i = 0; field[i].size != 0; i++) {
@@ -92,7 +92,7 @@ static inline int pciback_config_add_fie
 }
 
 static inline int pciback_config_add_fields_offset(struct pci_dev *dev,
-                                                  struct config_field *field,
+                                                  const struct config_field 
*field,
                                                   unsigned int offset)
 {
        int i, err = 0;
diff -r 240657899772 -r c87adc976013 drivers/xen/pciback/conf_space_capability.c
--- a/drivers/xen/pciback/conf_space_capability.c       Fri Oct 17 12:02:53 
2008 +0100
+++ b/drivers/xen/pciback/conf_space_capability.c       Mon Oct 20 15:29:07 
2008 +0100
@@ -13,16 +13,14 @@
 
 static LIST_HEAD(capabilities);
 
-static struct config_field caplist_header[] = {
+static const struct config_field caplist_header[] = {
        {
         .offset    = PCI_CAP_LIST_ID,
         .size      = 2, /* encompass PCI_CAP_LIST_ID & PCI_CAP_LIST_NEXT */
         .u.w.read  = pciback_read_config_word,
         .u.w.write = NULL,
        },
-       {
-        .size = 0,
-       },
+       {}
 };
 
 static inline void register_capability(struct pciback_config_capability *cap)
diff -r 240657899772 -r c87adc976013 drivers/xen/pciback/conf_space_capability.h
--- a/drivers/xen/pciback/conf_space_capability.h       Fri Oct 17 12:02:53 
2008 +0100
+++ b/drivers/xen/pciback/conf_space_capability.h       Mon Oct 20 15:29:07 
2008 +0100
@@ -17,7 +17,7 @@ struct pciback_config_capability {
        int capability;
 
        /* If the device has the capability found above, add these fields */
-       struct config_field *fields;
+       const struct config_field *fields;
 };
 
 #endif
diff -r 240657899772 -r c87adc976013 
drivers/xen/pciback/conf_space_capability_pm.c
--- a/drivers/xen/pciback/conf_space_capability_pm.c    Fri Oct 17 12:02:53 
2008 +0100
+++ b/drivers/xen/pciback/conf_space_capability_pm.c    Mon Oct 20 15:29:07 
2008 +0100
@@ -94,7 +94,7 @@ static void *pm_ctrl_init(struct pci_dev
        return ERR_PTR(err);
 }
 
-static struct config_field caplist_pm[] = {
+static const struct config_field caplist_pm[] = {
        {
                .offset     = PCI_PM_PMC,
                .size       = 2,
@@ -117,9 +117,7 @@ static struct config_field caplist_pm[] 
                .size       = 1,
                .u.b.read   = pciback_read_config_byte,
        },
-       {
-               .size = 0,
-       },
+       {}
 };
 
 struct pciback_config_capability pciback_config_capability_pm = {
diff -r 240657899772 -r c87adc976013 
drivers/xen/pciback/conf_space_capability_vpd.c
--- a/drivers/xen/pciback/conf_space_capability_vpd.c   Fri Oct 17 12:02:53 
2008 +0100
+++ b/drivers/xen/pciback/conf_space_capability_vpd.c   Mon Oct 20 15:29:07 
2008 +0100
@@ -18,7 +18,7 @@ static int vpd_address_write(struct pci_
                return pci_write_config_word(dev, offset, value);
 }
 
-static struct config_field caplist_vpd[] = {
+static const struct config_field caplist_vpd[] = {
        {
         .offset    = PCI_VPD_ADDR,
         .size      = 2,
@@ -31,9 +31,7 @@ static struct config_field caplist_vpd[]
         .u.dw.read  = pciback_read_config_dword,
         .u.dw.write = NULL,
         },
-       {
-        .size = 0,
-        },
+       {}
 };
  
 struct pciback_config_capability pciback_config_capability_vpd = {
diff -r 240657899772 -r c87adc976013 drivers/xen/pciback/conf_space_header.c
--- a/drivers/xen/pciback/conf_space_header.c   Fri Oct 17 12:02:53 2008 +0100
+++ b/drivers/xen/pciback/conf_space_header.c   Mon Oct 20 15:29:07 2008 +0100
@@ -210,7 +210,7 @@ static int bist_write(struct pci_dev *de
        return err;
 }
 
-static struct config_field header_common[] = {
+static const struct config_field header_common[] = {
        {
         .offset    = PCI_COMMAND,
         .size      = 2,
@@ -245,9 +245,7 @@ static struct config_field header_common
         .u.b.read  = pciback_read_config_byte,
         .u.b.write = bist_write,
        },
-       {
-        .size = 0,
-       },
+       {}
 };
 
 #define CFG_FIELD_BAR(reg_offset)                      \
@@ -272,7 +270,7 @@ static struct config_field header_common
         .u.dw.write = rom_write,                       \
         }
 
-static struct config_field header_0[] = {
+static const struct config_field header_0[] = {
        CFG_FIELD_BAR(PCI_BASE_ADDRESS_0),
        CFG_FIELD_BAR(PCI_BASE_ADDRESS_1),
        CFG_FIELD_BAR(PCI_BASE_ADDRESS_2),
@@ -280,18 +278,14 @@ static struct config_field header_0[] = 
        CFG_FIELD_BAR(PCI_BASE_ADDRESS_4),
        CFG_FIELD_BAR(PCI_BASE_ADDRESS_5),
        CFG_FIELD_ROM(PCI_ROM_ADDRESS),
-       {
-        .size = 0,
-       },
-};
-
-static struct config_field header_1[] = {
+       {}
+};
+
+static const struct config_field header_1[] = {
        CFG_FIELD_BAR(PCI_BASE_ADDRESS_0),
        CFG_FIELD_BAR(PCI_BASE_ADDRESS_1),
        CFG_FIELD_ROM(PCI_ROM_ADDRESS1),
-       {
-        .size = 0,
-       },
+       {}
 };
 
 int pciback_config_header_add_fields(struct pci_dev *dev)
diff -r 240657899772 -r c87adc976013 drivers/xen/pciback/pci_stub.c
--- a/drivers/xen/pciback/pci_stub.c    Fri Oct 17 12:02:53 2008 +0100
+++ b/drivers/xen/pciback/pci_stub.c    Mon Oct 20 15:29:07 2008 +0100
@@ -467,7 +467,7 @@ static void pcistub_remove(struct pci_de
        }
 }
 
-static struct pci_device_id pcistub_ids[] = {
+static const struct pci_device_id pcistub_ids[] = {
        {
         .vendor = PCI_ANY_ID,
         .device = PCI_ANY_ID,
@@ -700,8 +700,8 @@ static ssize_t pcistub_quirk_show(struct
        extern struct list_head pciback_quirks;
        struct pciback_config_quirk *quirk;
        struct pciback_dev_data *dev_data;
-       struct config_field *field;
-       struct config_field_entry *cfg_entry;
+       const struct config_field *field;
+       const struct config_field_entry *cfg_entry;
 
        spin_lock_irqsave(&device_ids_lock, flags);
        list_for_each_entry(quirk, &pciback_quirks, quirks_list) {

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.