ia64/linux-2.6.18-xen.hg

changeset 705:c87adc976013

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@novell.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Oct 20 15:29:07 2008 +0100 (2008-10-20)
parents 240657899772
children 45c3a3dfa5b5 f7a2c0985f99
files drivers/xen/pciback/conf_space.c drivers/xen/pciback/conf_space.h drivers/xen/pciback/conf_space_capability.c drivers/xen/pciback/conf_space_capability.h drivers/xen/pciback/conf_space_capability_pm.c drivers/xen/pciback/conf_space_capability_vpd.c drivers/xen/pciback/conf_space_header.c drivers/xen/pciback/pci_stub.c
line diff
     1.1 --- a/drivers/xen/pciback/conf_space.c	Fri Oct 17 12:02:53 2008 +0100
     1.2 +++ b/drivers/xen/pciback/conf_space.c	Mon Oct 20 15:29:07 2008 +0100
     1.3 @@ -31,11 +31,11 @@ DEFINE_PCI_CONFIG(write, word, u16)
     1.4  DEFINE_PCI_CONFIG(write, dword, u32)
     1.5  
     1.6  static int conf_space_read(struct pci_dev *dev,
     1.7 -			   struct config_field_entry *entry, int offset,
     1.8 -			   u32 * value)
     1.9 +			   const struct config_field_entry *entry,
    1.10 +			   int offset, u32 *value)
    1.11  {
    1.12  	int ret = 0;
    1.13 -	struct config_field *field = entry->field;
    1.14 +	const struct config_field *field = entry->field;
    1.15  
    1.16  	*value = 0;
    1.17  
    1.18 @@ -59,11 +59,11 @@ static int conf_space_read(struct pci_de
    1.19  }
    1.20  
    1.21  static int conf_space_write(struct pci_dev *dev,
    1.22 -			    struct config_field_entry *entry, int offset,
    1.23 -			    u32 value)
    1.24 +			    const struct config_field_entry *entry,
    1.25 +			    int offset, u32 value)
    1.26  {
    1.27  	int ret = 0;
    1.28 -	struct config_field *field = entry->field;
    1.29 +	const struct config_field *field = entry->field;
    1.30  
    1.31  	switch (field->size) {
    1.32  	case 1:
    1.33 @@ -140,8 +140,8 @@ int pciback_config_read(struct pci_dev *
    1.34  {
    1.35  	int err = 0;
    1.36  	struct pciback_dev_data *dev_data = pci_get_drvdata(dev);
    1.37 -	struct config_field_entry *cfg_entry;
    1.38 -	struct config_field *field;
    1.39 +	const struct config_field_entry *cfg_entry;
    1.40 +	const struct config_field *field;
    1.41  	int req_start, req_end, field_start, field_end;
    1.42  	/* if read fails for any reason, return 0 (as if device didn't respond) */
    1.43  	u32 value = 0, tmp_val;
    1.44 @@ -202,8 +202,8 @@ int pciback_config_write(struct pci_dev 
    1.45  {
    1.46  	int err = 0, handled = 0;
    1.47  	struct pciback_dev_data *dev_data = pci_get_drvdata(dev);
    1.48 -	struct config_field_entry *cfg_entry;
    1.49 -	struct config_field *field;
    1.50 +	const struct config_field_entry *cfg_entry;
    1.51 +	const struct config_field *field;
    1.52  	u32 tmp_val;
    1.53  	int req_start, req_end, field_start, field_end;
    1.54  
    1.55 @@ -290,7 +290,7 @@ void pciback_config_free_dyn_fields(stru
    1.56  {
    1.57  	struct pciback_dev_data *dev_data = pci_get_drvdata(dev);
    1.58  	struct config_field_entry *cfg_entry, *t;
    1.59 -	struct config_field *field;
    1.60 +	const struct config_field *field;
    1.61  
    1.62  	dev_dbg(&dev->dev,
    1.63  		"free-ing dynamically allocated virtual configuration space fields\n");
    1.64 @@ -299,7 +299,7 @@ void pciback_config_free_dyn_fields(stru
    1.65  		field = cfg_entry->field;
    1.66  
    1.67  		if (field->clean) {
    1.68 -			field->clean(field);
    1.69 +			field->clean((struct config_field *)field);
    1.70  
    1.71  			if (cfg_entry->data)
    1.72  				kfree(cfg_entry->data);
    1.73 @@ -314,8 +314,8 @@ void pciback_config_free_dyn_fields(stru
    1.74  void pciback_config_reset_dev(struct pci_dev *dev)
    1.75  {
    1.76  	struct pciback_dev_data *dev_data = pci_get_drvdata(dev);
    1.77 -	struct config_field_entry *cfg_entry;
    1.78 -	struct config_field *field;
    1.79 +	const struct config_field_entry *cfg_entry;
    1.80 +	const struct config_field *field;
    1.81  
    1.82  	dev_dbg(&dev->dev, "resetting virtual configuration space\n");
    1.83  
    1.84 @@ -331,7 +331,7 @@ void pciback_config_free_dev(struct pci_
    1.85  {
    1.86  	struct pciback_dev_data *dev_data = pci_get_drvdata(dev);
    1.87  	struct config_field_entry *cfg_entry, *t;
    1.88 -	struct config_field *field;
    1.89 +	const struct config_field *field;
    1.90  
    1.91  	dev_dbg(&dev->dev, "free-ing virtual configuration space fields\n");
    1.92  
    1.93 @@ -348,7 +348,7 @@ void pciback_config_free_dev(struct pci_
    1.94  }
    1.95  
    1.96  int pciback_config_add_field_offset(struct pci_dev *dev,
    1.97 -				    struct config_field *field,
    1.98 +				    const struct config_field *field,
    1.99  				    unsigned int base_offset)
   1.100  {
   1.101  	int err = 0;
     2.1 --- a/drivers/xen/pciback/conf_space.h	Fri Oct 17 12:02:53 2008 +0100
     2.2 +++ b/drivers/xen/pciback/conf_space.h	Mon Oct 20 15:29:07 2008 +0100
     2.3 @@ -59,7 +59,7 @@ struct config_field {
     2.4  
     2.5  struct config_field_entry {
     2.6  	struct list_head list;
     2.7 -	struct config_field *field;
     2.8 +	const struct config_field *field;
     2.9  	unsigned int base_offset;
    2.10  	void *data;
    2.11  };
    2.12 @@ -70,17 +70,17 @@ struct config_field_entry {
    2.13   * the first entry in an array (of which the ending is marked by size==0)
    2.14   */
    2.15  int pciback_config_add_field_offset(struct pci_dev *dev,
    2.16 -				    struct config_field *field,
    2.17 +				    const struct config_field *field,
    2.18  				    unsigned int offset);
    2.19  
    2.20  static inline int pciback_config_add_field(struct pci_dev *dev,
    2.21 -					   struct config_field *field)
    2.22 +					   const struct config_field *field)
    2.23  {
    2.24  	return pciback_config_add_field_offset(dev, field, 0);
    2.25  }
    2.26  
    2.27  static inline int pciback_config_add_fields(struct pci_dev *dev,
    2.28 -					    struct config_field *field)
    2.29 +					    const struct config_field *field)
    2.30  {
    2.31  	int i, err = 0;
    2.32  	for (i = 0; field[i].size != 0; i++) {
    2.33 @@ -92,7 +92,7 @@ static inline int pciback_config_add_fie
    2.34  }
    2.35  
    2.36  static inline int pciback_config_add_fields_offset(struct pci_dev *dev,
    2.37 -						   struct config_field *field,
    2.38 +						   const struct config_field *field,
    2.39  						   unsigned int offset)
    2.40  {
    2.41  	int i, err = 0;
     3.1 --- a/drivers/xen/pciback/conf_space_capability.c	Fri Oct 17 12:02:53 2008 +0100
     3.2 +++ b/drivers/xen/pciback/conf_space_capability.c	Mon Oct 20 15:29:07 2008 +0100
     3.3 @@ -13,16 +13,14 @@
     3.4  
     3.5  static LIST_HEAD(capabilities);
     3.6  
     3.7 -static struct config_field caplist_header[] = {
     3.8 +static const struct config_field caplist_header[] = {
     3.9  	{
    3.10  	 .offset    = PCI_CAP_LIST_ID,
    3.11  	 .size      = 2, /* encompass PCI_CAP_LIST_ID & PCI_CAP_LIST_NEXT */
    3.12  	 .u.w.read  = pciback_read_config_word,
    3.13  	 .u.w.write = NULL,
    3.14  	},
    3.15 -	{
    3.16 -	 .size = 0,
    3.17 -	},
    3.18 +	{}
    3.19  };
    3.20  
    3.21  static inline void register_capability(struct pciback_config_capability *cap)
     4.1 --- a/drivers/xen/pciback/conf_space_capability.h	Fri Oct 17 12:02:53 2008 +0100
     4.2 +++ b/drivers/xen/pciback/conf_space_capability.h	Mon Oct 20 15:29:07 2008 +0100
     4.3 @@ -17,7 +17,7 @@ struct pciback_config_capability {
     4.4  	int capability;
     4.5  
     4.6  	/* If the device has the capability found above, add these fields */
     4.7 -	struct config_field *fields;
     4.8 +	const struct config_field *fields;
     4.9  };
    4.10  
    4.11  #endif
     5.1 --- a/drivers/xen/pciback/conf_space_capability_pm.c	Fri Oct 17 12:02:53 2008 +0100
     5.2 +++ b/drivers/xen/pciback/conf_space_capability_pm.c	Mon Oct 20 15:29:07 2008 +0100
     5.3 @@ -94,7 +94,7 @@ static void *pm_ctrl_init(struct pci_dev
     5.4  	return ERR_PTR(err);
     5.5  }
     5.6  
     5.7 -static struct config_field caplist_pm[] = {
     5.8 +static const struct config_field caplist_pm[] = {
     5.9  	{
    5.10  		.offset     = PCI_PM_PMC,
    5.11  		.size       = 2,
    5.12 @@ -117,9 +117,7 @@ static struct config_field caplist_pm[] 
    5.13  		.size       = 1,
    5.14  		.u.b.read   = pciback_read_config_byte,
    5.15  	},
    5.16 -	{
    5.17 -		.size = 0,
    5.18 -	},
    5.19 +	{}
    5.20  };
    5.21  
    5.22  struct pciback_config_capability pciback_config_capability_pm = {
     6.1 --- a/drivers/xen/pciback/conf_space_capability_vpd.c	Fri Oct 17 12:02:53 2008 +0100
     6.2 +++ b/drivers/xen/pciback/conf_space_capability_vpd.c	Mon Oct 20 15:29:07 2008 +0100
     6.3 @@ -18,7 +18,7 @@ static int vpd_address_write(struct pci_
     6.4  		return pci_write_config_word(dev, offset, value);
     6.5  }
     6.6  
     6.7 -static struct config_field caplist_vpd[] = {
     6.8 +static const struct config_field caplist_vpd[] = {
     6.9  	{
    6.10  	 .offset    = PCI_VPD_ADDR,
    6.11  	 .size      = 2,
    6.12 @@ -31,9 +31,7 @@ static struct config_field caplist_vpd[]
    6.13  	 .u.dw.read  = pciback_read_config_dword,
    6.14  	 .u.dw.write = NULL,
    6.15  	 },
    6.16 -	{
    6.17 -	 .size = 0,
    6.18 -	 },
    6.19 +	{}
    6.20  };
    6.21   
    6.22  struct pciback_config_capability pciback_config_capability_vpd = {
     7.1 --- a/drivers/xen/pciback/conf_space_header.c	Fri Oct 17 12:02:53 2008 +0100
     7.2 +++ b/drivers/xen/pciback/conf_space_header.c	Mon Oct 20 15:29:07 2008 +0100
     7.3 @@ -210,7 +210,7 @@ static int bist_write(struct pci_dev *de
     7.4  	return err;
     7.5  }
     7.6  
     7.7 -static struct config_field header_common[] = {
     7.8 +static const struct config_field header_common[] = {
     7.9  	{
    7.10  	 .offset    = PCI_COMMAND,
    7.11  	 .size      = 2,
    7.12 @@ -245,9 +245,7 @@ static struct config_field header_common
    7.13  	 .u.b.read  = pciback_read_config_byte,
    7.14  	 .u.b.write = bist_write,
    7.15  	},
    7.16 -	{
    7.17 -	 .size = 0,
    7.18 -	},
    7.19 +	{}
    7.20  };
    7.21  
    7.22  #define CFG_FIELD_BAR(reg_offset) 			\
    7.23 @@ -272,7 +270,7 @@ static struct config_field header_common
    7.24  	 .u.dw.write = rom_write, 			\
    7.25  	 }
    7.26  
    7.27 -static struct config_field header_0[] = {
    7.28 +static const struct config_field header_0[] = {
    7.29  	CFG_FIELD_BAR(PCI_BASE_ADDRESS_0),
    7.30  	CFG_FIELD_BAR(PCI_BASE_ADDRESS_1),
    7.31  	CFG_FIELD_BAR(PCI_BASE_ADDRESS_2),
    7.32 @@ -280,18 +278,14 @@ static struct config_field header_0[] = 
    7.33  	CFG_FIELD_BAR(PCI_BASE_ADDRESS_4),
    7.34  	CFG_FIELD_BAR(PCI_BASE_ADDRESS_5),
    7.35  	CFG_FIELD_ROM(PCI_ROM_ADDRESS),
    7.36 -	{
    7.37 -	 .size = 0,
    7.38 -	},
    7.39 +	{}
    7.40  };
    7.41  
    7.42 -static struct config_field header_1[] = {
    7.43 +static const struct config_field header_1[] = {
    7.44  	CFG_FIELD_BAR(PCI_BASE_ADDRESS_0),
    7.45  	CFG_FIELD_BAR(PCI_BASE_ADDRESS_1),
    7.46  	CFG_FIELD_ROM(PCI_ROM_ADDRESS1),
    7.47 -	{
    7.48 -	 .size = 0,
    7.49 -	},
    7.50 +	{}
    7.51  };
    7.52  
    7.53  int pciback_config_header_add_fields(struct pci_dev *dev)
     8.1 --- a/drivers/xen/pciback/pci_stub.c	Fri Oct 17 12:02:53 2008 +0100
     8.2 +++ b/drivers/xen/pciback/pci_stub.c	Mon Oct 20 15:29:07 2008 +0100
     8.3 @@ -467,7 +467,7 @@ static void pcistub_remove(struct pci_de
     8.4  	}
     8.5  }
     8.6  
     8.7 -static struct pci_device_id pcistub_ids[] = {
     8.8 +static const struct pci_device_id pcistub_ids[] = {
     8.9  	{
    8.10  	 .vendor = PCI_ANY_ID,
    8.11  	 .device = PCI_ANY_ID,
    8.12 @@ -700,8 +700,8 @@ static ssize_t pcistub_quirk_show(struct
    8.13  	extern struct list_head pciback_quirks;
    8.14  	struct pciback_config_quirk *quirk;
    8.15  	struct pciback_dev_data *dev_data;
    8.16 -	struct config_field *field;
    8.17 -	struct config_field_entry *cfg_entry;
    8.18 +	const struct config_field *field;
    8.19 +	const struct config_field_entry *cfg_entry;
    8.20  
    8.21  	spin_lock_irqsave(&device_ids_lock, flags);
    8.22  	list_for_each_entry(quirk, &pciback_quirks, quirks_list) {