[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 17/31] Coalesce pci.c functions in xenbus.c.
This is the first commit in the process to relocate the driver to drivers/pci/xen-pcifront.c. Moving pcifront_disconnect and pcifront_connect in xenbus.c. Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx> --- drivers/xen/pcifront/Makefile | 2 +- drivers/xen/pcifront/pci.c | 46 --------------------------------------- drivers/xen/pcifront/pcifront.h | 2 - drivers/xen/pcifront/xenbus.c | 36 ++++++++++++++++++++++++++++++ 4 files changed, 37 insertions(+), 49 deletions(-) delete mode 100644 drivers/xen/pcifront/pci.c diff --git a/drivers/xen/pcifront/Makefile b/drivers/xen/pcifront/Makefile index 621e988..1f8fa9d 100644 --- a/drivers/xen/pcifront/Makefile +++ b/drivers/xen/pcifront/Makefile @@ -1,6 +1,6 @@ obj-y += pcifront.o -pcifront-y := pci_op.o xenbus.o pci.o +pcifront-y := pci_op.o xenbus.o ifeq ($(CONFIG_XEN_PCIDEV_FE_DEBUG),y) EXTRA_CFLAGS += -DDEBUG diff --git a/drivers/xen/pcifront/pci.c b/drivers/xen/pcifront/pci.c deleted file mode 100644 index 4239f00..0000000 --- a/drivers/xen/pcifront/pci.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * PCI Frontend Operations - ensure only one PCI frontend runs at a time - * - * Author: Ryan Wilson <hap9@xxxxxxxxxxxxxx> - */ -#include <linux/module.h> -#include <linux/init.h> -#include <linux/pci.h> -#include <linux/spinlock.h> -#include "pcifront.h" - -DEFINE_SPINLOCK(pcifront_dev_lock); -static struct pcifront_device *pcifront_dev = NULL; - -int pcifront_connect(struct pcifront_device *pdev) -{ - int err = 0; - - spin_lock(&pcifront_dev_lock); - - if (!pcifront_dev) { - dev_info(&pdev->xdev->dev, "Installing PCI frontend\n"); - pcifront_dev = pdev; - } - else { - dev_err(&pdev->xdev->dev, "PCI frontend already installed!\n"); - err = -EEXIST; - } - - spin_unlock(&pcifront_dev_lock); - - return err; -} - -void pcifront_disconnect(struct pcifront_device *pdev) -{ - spin_lock(&pcifront_dev_lock); - - if (pdev == pcifront_dev) { - dev_info(&pdev->xdev->dev, - "Disconnecting PCI Frontend Buses\n"); - pcifront_dev = NULL; - } - - spin_unlock(&pcifront_dev_lock); -} diff --git a/drivers/xen/pcifront/pcifront.h b/drivers/xen/pcifront/pcifront.h index 909726b..8e24fbe 100644 --- a/drivers/xen/pcifront/pcifront.h +++ b/drivers/xen/pcifront/pcifront.h @@ -41,8 +41,6 @@ struct pcifront_device { }; -int pcifront_connect(struct pcifront_device *pdev); -void pcifront_disconnect(struct pcifront_device *pdev); int pcifront_scan_root(struct pcifront_device *pdev, unsigned int domain, unsigned int bus); diff --git a/drivers/xen/pcifront/xenbus.c b/drivers/xen/pcifront/xenbus.c index 8d8c2ca..23d9f22 100644 --- a/drivers/xen/pcifront/xenbus.c +++ b/drivers/xen/pcifront/xenbus.c @@ -19,6 +19,42 @@ #define INVALID_GRANT_REF (0) #define INVALID_EVTCHN (-1) + +DEFINE_SPINLOCK(pcifront_dev_lock); +static struct pcifront_device *pcifront_dev = NULL; + +int pcifront_connect(struct pcifront_device *pdev) +{ + int err = 0; + + spin_lock(&pcifront_dev_lock); + + if (!pcifront_dev) { + dev_info(&pdev->xdev->dev, "Installing PCI frontend\n"); + pcifront_dev = pdev; + } + else { + dev_err(&pdev->xdev->dev, "PCI frontend already installed!\n"); + err = -EEXIST; + } + + spin_unlock(&pcifront_dev_lock); + + return err; +} + +void pcifront_disconnect(struct pcifront_device *pdev) +{ + spin_lock(&pcifront_dev_lock); + + if (pdev == pcifront_dev) { + dev_info(&pdev->xdev->dev, + "Disconnecting PCI Frontend Buses\n"); + pcifront_dev = NULL; + } + + spin_unlock(&pcifront_dev_lock); +} static struct pcifront_device *alloc_pdev(struct xenbus_device *xdev) { struct pcifront_device *pdev; -- 1.6.2.5 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |