ia64/linux-2.6.18-xen.hg

changeset 790:77e3b255381e

linux: remove xen specific member from pci_dev

Move msi related variable irq_old out of struct pci_dev. This is
logically more consistent and has the additional benefit that xen
kernel and vanilla kernel now have the same pci_dev layout

Signed-off-by: Qing He <qing.he@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Feb 04 12:25:09 2009 +0000 (2009-02-04)
parents 25cc543a02e8
children 4f998fd102e2
files drivers/pci/msi-xen.c include/linux/pci.h
line diff
     1.1 --- a/drivers/pci/msi-xen.c	Tue Feb 03 13:59:17 2009 +0000
     1.2 +++ b/drivers/pci/msi-xen.c	Wed Feb 04 12:25:09 2009 +0000
     1.3 @@ -44,6 +44,8 @@ struct msi_dev_list {
     1.4  	struct list_head pirq_list_head;
     1.5  	/* Used for saving/restoring MSI-X tables */
     1.6  	void __iomem *mask_base;
     1.7 +	/* Store default pre-assigned irq */
     1.8 +	unsigned int default_irq;
     1.9  };
    1.10  
    1.11  struct msi_pirq_entry {
    1.12 @@ -589,6 +591,7 @@ int pci_enable_msi(struct pci_dev* dev)
    1.13  {
    1.14  	struct pci_bus *bus;
    1.15  	int pos, temp, status = -EINVAL;
    1.16 +	struct msi_dev_list *msi_dev_entry = get_msi_dev_pirq_list(dev);
    1.17  
    1.18  	if (!pci_msi_enable || !dev)
    1.19   		return status;
    1.20 @@ -615,7 +618,7 @@ int pci_enable_msi(struct pci_dev* dev)
    1.21  			return ret;
    1.22  
    1.23  		dev->irq = evtchn_map_pirq(-1, dev->irq);
    1.24 -		dev->irq_old = temp;
    1.25 +		msi_dev_entry->default_irq = temp;
    1.26  
    1.27  		return ret;
    1.28  	}
    1.29 @@ -638,8 +641,8 @@ int pci_enable_msi(struct pci_dev* dev)
    1.30  
    1.31  	status = msi_capability_init(dev);
    1.32  	if ( !status )
    1.33 -		dev->irq_old = temp;
    1.34 -    else
    1.35 +		msi_dev_entry->default_irq = temp;
    1.36 +	else
    1.37  		dev->irq = temp;
    1.38  
    1.39  	return status;
    1.40 @@ -650,6 +653,7 @@ void pci_disable_msi(struct pci_dev* dev
    1.41  {
    1.42  	int pos;
    1.43  	int pirq;
    1.44 +	struct msi_dev_list *msi_dev_entry = get_msi_dev_pirq_list(dev);
    1.45  
    1.46  	if (!pci_msi_enable)
    1.47  		return;
    1.48 @@ -660,7 +664,7 @@ void pci_disable_msi(struct pci_dev* dev
    1.49  	if (!is_initial_xendomain()) {
    1.50  		evtchn_map_pirq(dev->irq, 0);
    1.51  		pci_frontend_disable_msi(dev);
    1.52 -		dev->irq = dev->irq_old;
    1.53 +		dev->irq = msi_dev_entry->default_irq;
    1.54  		return;
    1.55  	}
    1.56  #endif
    1.57 @@ -671,7 +675,7 @@ void pci_disable_msi(struct pci_dev* dev
    1.58  
    1.59  	pirq = dev->irq;
    1.60  	/* Restore dev->irq to its default pin-assertion vector */
    1.61 -	dev->irq = dev->irq_old;
    1.62 +	dev->irq = msi_dev_entry->default_irq;
    1.63  	msi_unmap_pirq(dev, pirq);
    1.64  
    1.65  	/* Disable MSI mode */
    1.66 @@ -701,6 +705,7 @@ int pci_enable_msix(struct pci_dev* dev,
    1.67  	int status, pos, nr_entries;
    1.68  	int i, j, temp;
    1.69  	u16 control;
    1.70 +	struct msi_dev_list *msi_dev_entry = get_msi_dev_pirq_list(dev);
    1.71  
    1.72  	if (!pci_msi_enable || !dev || !entries)
    1.73   		return -EINVAL;
    1.74 @@ -718,11 +723,13 @@ int pci_enable_msix(struct pci_dev* dev,
    1.75  		struct msi_pirq_entry *pirq_entry;
    1.76  		int ret, irq;
    1.77  
    1.78 +		temp = dev->irq;
    1.79  		ret = pci_frontend_enable_msix(dev, entries, nvec);
    1.80  		if (ret) {
    1.81  			printk("get %x from pci_frontend_enable_msix\n", ret);
    1.82  			return ret;
    1.83  		}
    1.84 +		msi_dev_entry->default_irq = temp;
    1.85  
    1.86  		msi_dev_entry = get_msi_dev_pirq_list(dev);
    1.87  		for (i = 0; i < nvec; i++) {
    1.88 @@ -783,7 +790,7 @@ int pci_enable_msix(struct pci_dev* dev,
    1.89  	status = msix_capability_init(dev, entries, nvec);
    1.90  
    1.91  	if ( !status )
    1.92 -		dev->irq_old = temp;
    1.93 +		msi_dev_entry->default_irq = temp;
    1.94  	else
    1.95  		dev->irq = temp;
    1.96  
    1.97 @@ -795,6 +802,7 @@ void pci_disable_msix(struct pci_dev* de
    1.98  {
    1.99  	int pos;
   1.100  	u16 control;
   1.101 +	struct msi_dev_list *msi_dev_entry = get_msi_dev_pirq_list(dev);
   1.102  
   1.103  
   1.104  	if (!pci_msi_enable)
   1.105 @@ -817,7 +825,7 @@ void pci_disable_msix(struct pci_dev* de
   1.106  			kfree(pirq_entry);
   1.107  		}
   1.108  
   1.109 -		dev->irq = dev->irq_old;
   1.110 +		dev->irq = msi_dev_entry->default_irq;
   1.111  		return;
   1.112  	}
   1.113  #endif
   1.114 @@ -867,7 +875,7 @@ void msi_remove_pci_irq_vectors(struct p
   1.115  	spin_unlock_irqrestore(&msi_dev_entry->pirq_list_lock, flags);
   1.116  	iounmap(msi_dev_entry->mask_base);
   1.117  	msi_dev_entry->mask_base = NULL;
   1.118 -	dev->irq = dev->irq_old;
   1.119 +	dev->irq = msi_dev_entry->default_irq;
   1.120  }
   1.121  
   1.122  void pci_no_msi(void)
     2.1 --- a/include/linux/pci.h	Tue Feb 03 13:59:17 2009 +0000
     2.2 +++ b/include/linux/pci.h	Wed Feb 04 12:25:09 2009 +0000
     2.3 @@ -152,9 +152,6 @@ struct pci_dev {
     2.4  	 * directly, use the values stored here. They might be different!
     2.5  	 */
     2.6  	unsigned int	irq;
     2.7 -#ifdef CONFIG_XEN
     2.8 -	unsigned int    irq_old;
     2.9 -#endif
    2.10  	struct resource resource[DEVICE_COUNT_RESOURCE]; /* I/O and memory regions + expansion ROMs */
    2.11  
    2.12  	/* These fields are used by common fixups */