diff options
author | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2011-07-19 19:40:51 -0400 |
---|---|---|
committer | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2011-07-19 20:58:35 -0400 |
commit | a92336a1176b2119eaa990a1e8bf3109665fdbc6 (patch) | |
tree | af8ac49b47136acddb5320b9a62be2361bfaf99c /drivers/xen/xen-pciback/conf_space_header.c | |
parent | c288b67b9b4d65790e1a1a1fd982330730b68f46 (diff) |
xen/pciback: Drop two backends, squash and cleanup some code.
- Remove the slot and controller controller backend as they
are not used.
- Document the find pciback_[read|write]_config_[byte|word|dword]
to make it easier to find.
- Collapse the code from conf_space_capability_msi into pciback_ops.c
- Collapse conf_space_capability_[pm|vpd].c in conf_space_capability.c
[and remove the conf_space_capability.h file]
- Rename all visible functions from pciback to xen_pcibk.
- Rename all the printk/pr_info, etc that use the "pciback" to say
"xen-pciback".
- Convert functions that are not referenced outside the code to be
static to save on name space.
- Do the same thing for structures that are internal to the driver.
- Run checkpatch.pl after the renames and fixup its warnings and
fix any compile errors caused by the variable rename
- Cleanup any structs that checkpath.pl commented about or just
look odd.
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Diffstat (limited to 'drivers/xen/xen-pciback/conf_space_header.c')
-rw-r--r-- | drivers/xen/xen-pciback/conf_space_header.c | 49 |
1 files changed, 25 insertions, 24 deletions
diff --git a/drivers/xen/xen-pciback/conf_space_header.c b/drivers/xen/xen-pciback/conf_space_header.c index 22ad0f560669..da3cbdfcb5dc 100644 --- a/drivers/xen/xen-pciback/conf_space_header.c +++ b/drivers/xen/xen-pciback/conf_space_header.c @@ -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; } |