ia64/linux-2.6.18-xen.hg

changeset 619:268d6984c8e2

xen: fix warnings (some errors with -Werror-implicit-function-declaration) in PCI-MSI code

Plus a little bit of other cleanup.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Jul 23 13:36:53 2008 +0100 (2008-07-23)
parents 3bcc901cbd7a
children 72234a8ee99c
files drivers/pci/msi-xen.c drivers/pci/msi.h drivers/xen/core/pci.c drivers/xen/pciback/pci_stub.c include/linux/pci.h
line diff
     1.1 --- a/drivers/pci/msi-xen.c	Wed Jul 23 09:57:44 2008 +0100
     1.2 +++ b/drivers/pci/msi-xen.c	Wed Jul 23 13:36:53 2008 +0100
     1.3 @@ -116,7 +116,7 @@ static void detach_pirq_entry(int entry_
     1.4  /*
     1.5   * pciback will provide device's owner
     1.6   */
     1.7 -int (*get_owner)(struct pci_dev *dev);
     1.8 +static int (*get_owner)(struct pci_dev *dev);
     1.9  
    1.10  int register_msi_get_owner(int (*func)(struct pci_dev *dev))
    1.11  {
    1.12 @@ -130,33 +130,32 @@ int register_msi_get_owner(int (*func)(s
    1.13  
    1.14  int unregister_msi_get_owner(int (*func)(struct pci_dev *dev))
    1.15  {
    1.16 -	if (get_owner == func)
    1.17 -		get_owner = NULL;
    1.18 +	if (get_owner != func)
    1.19 +		return -EINVAL;
    1.20 +	get_owner = NULL;
    1.21  	return 0;
    1.22  }
    1.23  
    1.24  static int msi_get_dev_owner(struct pci_dev *dev)
    1.25  {
    1.26 -	int owner = DOMID_SELF;
    1.27 +	int owner;
    1.28  
    1.29  	BUG_ON(!is_initial_xendomain());
    1.30 -	if (get_owner && (owner = get_owner(dev)) >=0 ) {
    1.31 +	if (get_owner && (owner = get_owner(dev)) >= 0) {
    1.32  		printk(KERN_INFO "get owner for dev %x get %x \n",
    1.33 -				    dev->devfn, owner);
    1.34 +		       dev->devfn, owner);
    1.35  		return owner;
    1.36  	}
    1.37 -	else
    1.38 -		return DOMID_SELF;
    1.39 +
    1.40 +	return DOMID_SELF;
    1.41  }
    1.42  
    1.43  static int msi_unmap_pirq(struct pci_dev *dev, int pirq)
    1.44  {
    1.45  	struct physdev_unmap_pirq unmap;
    1.46  	int rc;
    1.47 -	domid_t domid = DOMID_SELF;
    1.48  
    1.49 -	domid = msi_get_dev_owner(dev);
    1.50 -	unmap.domid = domid;
    1.51 +	unmap.domid = msi_get_dev_owner(dev);
    1.52  	unmap.pirq = pirq;
    1.53  
    1.54  	if ((rc = HYPERVISOR_physdev_op(PHYSDEVOP_unmap_pirq, &unmap)))
    1.55 @@ -164,7 +163,7 @@ static int msi_unmap_pirq(struct pci_dev
    1.56  
    1.57  	if (rc < 0)
    1.58  		return rc;
    1.59 -    return 0;
    1.60 +	return 0;
    1.61  }
    1.62  
    1.63  /*
     2.1 --- a/drivers/pci/msi.h	Wed Jul 23 09:57:44 2008 +0100
     2.2 +++ b/drivers/pci/msi.h	Wed Jul 23 13:36:53 2008 +0100
     2.3 @@ -84,11 +84,6 @@ extern int vector_irq[NR_VECTORS];
     2.4  extern void (*interrupt[NR_IRQS])(void);
     2.5  extern int pci_vector_resources(int last, int nr_released);
     2.6  
     2.7 -#ifdef CONFIG_XEN
     2.8 -extern int unregister_msi_get_owner(int (*func)(struct pci_dev *dev));
     2.9 -extern int register_msi_get_owner(int (*func)(struct pci_dev *dev));
    2.10 -#endif
    2.11 -
    2.12  /*
    2.13   * MSI-X Address Register
    2.14   */
     3.1 --- a/drivers/xen/core/pci.c	Wed Jul 23 09:57:44 2008 +0100
     3.2 +++ b/drivers/xen/core/pci.c	Wed Jul 23 13:36:53 2008 +0100
     3.3 @@ -24,7 +24,8 @@ static int pci_bus_probe_wrapper(struct 
     3.4  
     3.5  	r = pci_bus_probe(dev);
     3.6  	if (r)
     3.7 -		HYPERVISOR_physdev_op(PHYSDEVOP_manage_pci_remove, &manage_pci);
     3.8 +		WARN_ON(HYPERVISOR_physdev_op(PHYSDEVOP_manage_pci_remove,
     3.9 +					      &manage_pci));
    3.10  
    3.11  	return r;
    3.12  }
    3.13 @@ -40,7 +41,8 @@ static int pci_bus_remove_wrapper(struct
    3.14  	r = pci_bus_remove(dev);
    3.15  	/* dev and pci_dev are no longer valid!! */
    3.16  
    3.17 -	HYPERVISOR_physdev_op(PHYSDEVOP_manage_pci_remove, &manage_pci);
    3.18 +	WARN_ON(HYPERVISOR_physdev_op(PHYSDEVOP_manage_pci_remove,
    3.19 +		&manage_pci));
    3.20  	return r;
    3.21  }
    3.22  
     4.1 --- a/drivers/xen/pciback/pci_stub.c	Wed Jul 23 09:57:44 2008 +0100
     4.2 +++ b/drivers/xen/pciback/pci_stub.c	Wed Jul 23 13:36:53 2008 +0100
     4.3 @@ -832,9 +832,7 @@ static void pcistub_exit(void)
     4.4  	driver_remove_file(&pciback_pci_driver.driver, &driver_attr_permissive);
     4.5  
     4.6  	pci_unregister_driver(&pciback_pci_driver);
     4.7 -#ifdef CONFIG_PCI_MSI
     4.8 -	unregister_msi_get_owner(pciback_get_owner);
     4.9 -#endif
    4.10 +	WARN_ON(unregister_msi_get_owner(pciback_get_owner));
    4.11  }
    4.12  
    4.13  static int __init pcistub_init(void)
    4.14 @@ -892,10 +890,8 @@ static int __init pcistub_init(void)
    4.15  		err = driver_create_file(&pciback_pci_driver.driver,
    4.16  					 &driver_attr_permissive);
    4.17  
    4.18 -#ifdef CONFIG_PCI_MSI
    4.19  	if (!err)
    4.20  		err = register_msi_get_owner(pciback_get_owner);
    4.21 -#endif
    4.22  	if (err)
    4.23  		pcistub_exit();
    4.24  
     5.1 --- a/include/linux/pci.h	Wed Jul 23 09:57:44 2008 +0100
     5.2 +++ b/include/linux/pci.h	Wed Jul 23 13:36:53 2008 +0100
     5.3 @@ -599,6 +599,10 @@ static inline int pci_enable_msix(struct
     5.4  	struct msix_entry *entries, int nvec) {return -1;}
     5.5  static inline void pci_disable_msix(struct pci_dev *dev) {}
     5.6  static inline void msi_remove_pci_irq_vectors(struct pci_dev *dev) {}
     5.7 +#ifdef CONFIG_XEN
     5.8 +#define register_msi_get_owner(func) 0
     5.9 +#define unregister_msi_get_owner(func) 0
    5.10 +#endif
    5.11  #else
    5.12  extern void pci_scan_msi_device(struct pci_dev *dev);
    5.13  extern int pci_enable_msi(struct pci_dev *dev);
    5.14 @@ -607,6 +611,10 @@ extern int pci_enable_msix(struct pci_de
    5.15  	struct msix_entry *entries, int nvec);
    5.16  extern void pci_disable_msix(struct pci_dev *dev);
    5.17  extern void msi_remove_pci_irq_vectors(struct pci_dev *dev);
    5.18 +#ifdef CONFIG_XEN
    5.19 +extern int register_msi_get_owner(int (*func)(struct pci_dev *dev));
    5.20 +extern int unregister_msi_get_owner(int (*func)(struct pci_dev *dev));
    5.21 +#endif
    5.22  #endif
    5.23  
    5.24  extern void pci_block_user_cfg_access(struct pci_dev *dev);