xen/pciback: Drop two backends, squash and cleanup some code.
[pandora-kernel.git] / drivers / xen / xen-pciback / conf_space_header.c
index 22ad0f5..da3cbdf 100644 (file)
@@ -15,6 +15,7 @@ struct pci_bar_info {
        int which;
 };
 
+#define DRV_NAME       "xen-pciback"
 #define is_enable_cmd(value) ((value)&(PCI_COMMAND_MEMORY|PCI_COMMAND_IO))
 #define is_master_cmd(value) ((value)&PCI_COMMAND_MASTER)
 
@@ -23,7 +24,7 @@ static int command_read(struct pci_dev *dev, int offset, u16 *value, void *data)
        int i;
        int ret;
 
-       ret = pciback_read_config_word(dev, offset, value, data);
+       ret = xen_pcibk_read_config_word(dev, offset, value, data);
        if (!atomic_read(&dev->enable_cnt))
                return ret;
 
@@ -39,13 +40,13 @@ static int command_read(struct pci_dev *dev, int offset, u16 *value, void *data)
 
 static int command_write(struct pci_dev *dev, int offset, u16 value, void *data)
 {
-       struct pciback_dev_data *dev_data;
+       struct xen_pcibk_dev_data *dev_data;
        int err;
 
        dev_data = pci_get_drvdata(dev);
        if (!pci_is_enabled(dev) && is_enable_cmd(value)) {
                if (unlikely(verbose_request))
-                       printk(KERN_DEBUG "pciback: %s: enable\n",
+                       printk(KERN_DEBUG DRV_NAME ": %s: enable\n",
                               pci_name(dev));
                err = pci_enable_device(dev);
                if (err)
@@ -54,7 +55,7 @@ static int command_write(struct pci_dev *dev, int offset, u16 value, void *data)
                        dev_data->enable_intx = 1;
        } else if (pci_is_enabled(dev) && !is_enable_cmd(value)) {
                if (unlikely(verbose_request))
-                       printk(KERN_DEBUG "pciback: %s: disable\n",
+                       printk(KERN_DEBUG DRV_NAME ": %s: disable\n",
                               pci_name(dev));
                pci_disable_device(dev);
                if (dev_data)
@@ -63,7 +64,7 @@ static int command_write(struct pci_dev *dev, int offset, u16 value, void *data)
 
        if (!dev->is_busmaster && is_master_cmd(value)) {
                if (unlikely(verbose_request))
-                       printk(KERN_DEBUG "pciback: %s: set bus master\n",
+                       printk(KERN_DEBUG DRV_NAME ": %s: set bus master\n",
                               pci_name(dev));
                pci_set_master(dev);
        }
@@ -71,12 +72,12 @@ static int command_write(struct pci_dev *dev, int offset, u16 value, void *data)
        if (value & PCI_COMMAND_INVALIDATE) {
                if (unlikely(verbose_request))
                        printk(KERN_DEBUG
-                              "pciback: %s: enable memory-write-invalidate\n",
+                              DRV_NAME ": %s: enable memory-write-invalidate\n",
                               pci_name(dev));
                err = pci_set_mwi(dev);
                if (err) {
                        printk(KERN_WARNING
-                              "pciback: %s: cannot enable "
+                              DRV_NAME ": %s: cannot enable "
                               "memory-write-invalidate (%d)\n",
                               pci_name(dev), err);
                        value &= ~PCI_COMMAND_INVALIDATE;
@@ -91,7 +92,7 @@ static int rom_write(struct pci_dev *dev, int offset, u32 value, void *data)
        struct pci_bar_info *bar = data;
 
        if (unlikely(!bar)) {
-               printk(KERN_WARNING "pciback: driver data not found for %s\n",
+               printk(KERN_WARNING DRV_NAME ": driver data not found for %s\n",
                       pci_name(dev));
                return XEN_PCI_ERR_op_failed;
        }
@@ -125,7 +126,7 @@ static int bar_write(struct pci_dev *dev, int offset, u32 value, void *data)
        struct pci_bar_info *bar = data;
 
        if (unlikely(!bar)) {
-               printk(KERN_WARNING "pciback: driver data not found for %s\n",
+               printk(KERN_WARNING DRV_NAME ": driver data not found for %s\n",
                       pci_name(dev));
                return XEN_PCI_ERR_op_failed;
        }
@@ -153,7 +154,7 @@ static int bar_read(struct pci_dev *dev, int offset, u32 * value, void *data)
        struct pci_bar_info *bar = data;
 
        if (unlikely(!bar)) {
-               printk(KERN_WARNING "pciback: driver data not found for %s\n",
+               printk(KERN_WARNING DRV_NAME ": driver data not found for %s\n",
                       pci_name(dev));
                return XEN_PCI_ERR_op_failed;
        }
@@ -227,7 +228,7 @@ static void bar_release(struct pci_dev *dev, int offset, void *data)
        kfree(data);
 }
 
-static int pciback_read_vendor(struct pci_dev *dev, int offset,
+static int xen_pcibk_read_vendor(struct pci_dev *dev, int offset,
                               u16 *value, void *data)
 {
        *value = dev->vendor;
@@ -235,7 +236,7 @@ static int pciback_read_vendor(struct pci_dev *dev, int offset,
        return 0;
 }
 
-static int pciback_read_device(struct pci_dev *dev, int offset,
+static int xen_pcibk_read_device(struct pci_dev *dev, int offset,
                               u16 *value, void *data)
 {
        *value = dev->device;
@@ -272,12 +273,12 @@ static const struct config_field header_common[] = {
        {
         .offset    = PCI_VENDOR_ID,
         .size      = 2,
-        .u.w.read  = pciback_read_vendor,
+        .u.w.read  = xen_pcibk_read_vendor,
        },
        {
         .offset    = PCI_DEVICE_ID,
         .size      = 2,
-        .u.w.read  = pciback_read_device,
+        .u.w.read  = xen_pcibk_read_device,
        },
        {
         .offset    = PCI_COMMAND,
@@ -293,24 +294,24 @@ static const struct config_field header_common[] = {
        {
         .offset    = PCI_INTERRUPT_PIN,
         .size      = 1,
-        .u.b.read  = pciback_read_config_byte,
+        .u.b.read  = xen_pcibk_read_config_byte,
        },
        {
         /* Any side effects of letting driver domain control cache line? */
         .offset    = PCI_CACHE_LINE_SIZE,
         .size      = 1,
-        .u.b.read  = pciback_read_config_byte,
-        .u.b.write = pciback_write_config_byte,
+        .u.b.read  = xen_pcibk_read_config_byte,
+        .u.b.write = xen_pcibk_write_config_byte,
        },
        {
         .offset    = PCI_LATENCY_TIMER,
         .size      = 1,
-        .u.b.read  = pciback_read_config_byte,
+        .u.b.read  = xen_pcibk_read_config_byte,
        },
        {
         .offset    = PCI_BIST,
         .size      = 1,
-        .u.b.read  = pciback_read_config_byte,
+        .u.b.read  = xen_pcibk_read_config_byte,
         .u.b.write = bist_write,
        },
        {}
@@ -356,26 +357,26 @@ static const struct config_field header_1[] = {
        {}
 };
 
-int pciback_config_header_add_fields(struct pci_dev *dev)
+int xen_pcibk_config_header_add_fields(struct pci_dev *dev)
 {
        int err;
 
-       err = pciback_config_add_fields(dev, header_common);
+       err = xen_pcibk_config_add_fields(dev, header_common);
        if (err)
                goto out;
 
        switch (dev->hdr_type) {
        case PCI_HEADER_TYPE_NORMAL:
-               err = pciback_config_add_fields(dev, header_0);
+               err = xen_pcibk_config_add_fields(dev, header_0);
                break;
 
        case PCI_HEADER_TYPE_BRIDGE:
-               err = pciback_config_add_fields(dev, header_1);
+               err = xen_pcibk_config_add_fields(dev, header_1);
                break;
 
        default:
                err = -EINVAL;
-               printk(KERN_ERR "pciback: %s: Unsupported header type %d!\n",
+               printk(KERN_ERR DRV_NAME ": %s: Unsupported header type %d!\n",
                       pci_name(dev), dev->hdr_type);
                break;
        }