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>
This commit is contained in:
@@ -11,8 +11,8 @@
|
||||
#include "conf_space.h"
|
||||
#include "conf_space_quirks.h"
|
||||
|
||||
LIST_HEAD(pciback_quirks);
|
||||
|
||||
LIST_HEAD(xen_pcibk_quirks);
|
||||
#define DRV_NAME "xen-pciback"
|
||||
static inline const struct pci_device_id *
|
||||
match_one_device(const struct pci_device_id *id, const struct pci_dev *dev)
|
||||
{
|
||||
@@ -27,29 +27,29 @@ match_one_device(const struct pci_device_id *id, const struct pci_dev *dev)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct pciback_config_quirk *pciback_find_quirk(struct pci_dev *dev)
|
||||
static struct xen_pcibk_config_quirk *xen_pcibk_find_quirk(struct pci_dev *dev)
|
||||
{
|
||||
struct pciback_config_quirk *tmp_quirk;
|
||||
struct xen_pcibk_config_quirk *tmp_quirk;
|
||||
|
||||
list_for_each_entry(tmp_quirk, &pciback_quirks, quirks_list)
|
||||
list_for_each_entry(tmp_quirk, &xen_pcibk_quirks, quirks_list)
|
||||
if (match_one_device(&tmp_quirk->devid, dev) != NULL)
|
||||
goto out;
|
||||
tmp_quirk = NULL;
|
||||
printk(KERN_DEBUG
|
||||
"quirk didn't match any device pciback knows about\n");
|
||||
printk(KERN_DEBUG DRV_NAME
|
||||
":quirk didn't match any device xen_pciback knows about\n");
|
||||
out:
|
||||
return tmp_quirk;
|
||||
}
|
||||
|
||||
static inline void register_quirk(struct pciback_config_quirk *quirk)
|
||||
static inline void register_quirk(struct xen_pcibk_config_quirk *quirk)
|
||||
{
|
||||
list_add_tail(&quirk->quirks_list, &pciback_quirks);
|
||||
list_add_tail(&quirk->quirks_list, &xen_pcibk_quirks);
|
||||
}
|
||||
|
||||
int pciback_field_is_dup(struct pci_dev *dev, unsigned int reg)
|
||||
int xen_pcibk_field_is_dup(struct pci_dev *dev, unsigned int reg)
|
||||
{
|
||||
int ret = 0;
|
||||
struct pciback_dev_data *dev_data = pci_get_drvdata(dev);
|
||||
struct xen_pcibk_dev_data *dev_data = pci_get_drvdata(dev);
|
||||
struct config_field_entry *cfg_entry;
|
||||
|
||||
list_for_each_entry(cfg_entry, &dev_data->config_fields, list) {
|
||||
@@ -61,38 +61,38 @@ int pciback_field_is_dup(struct pci_dev *dev, unsigned int reg)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int pciback_config_quirks_add_field(struct pci_dev *dev, struct config_field
|
||||
int xen_pcibk_config_quirks_add_field(struct pci_dev *dev, struct config_field
|
||||
*field)
|
||||
{
|
||||
int err = 0;
|
||||
|
||||
switch (field->size) {
|
||||
case 1:
|
||||
field->u.b.read = pciback_read_config_byte;
|
||||
field->u.b.write = pciback_write_config_byte;
|
||||
field->u.b.read = xen_pcibk_read_config_byte;
|
||||
field->u.b.write = xen_pcibk_write_config_byte;
|
||||
break;
|
||||
case 2:
|
||||
field->u.w.read = pciback_read_config_word;
|
||||
field->u.w.write = pciback_write_config_word;
|
||||
field->u.w.read = xen_pcibk_read_config_word;
|
||||
field->u.w.write = xen_pcibk_write_config_word;
|
||||
break;
|
||||
case 4:
|
||||
field->u.dw.read = pciback_read_config_dword;
|
||||
field->u.dw.write = pciback_write_config_dword;
|
||||
field->u.dw.read = xen_pcibk_read_config_dword;
|
||||
field->u.dw.write = xen_pcibk_write_config_dword;
|
||||
break;
|
||||
default:
|
||||
err = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
pciback_config_add_field(dev, field);
|
||||
xen_pcibk_config_add_field(dev, field);
|
||||
|
||||
out:
|
||||
return err;
|
||||
}
|
||||
|
||||
int pciback_config_quirks_init(struct pci_dev *dev)
|
||||
int xen_pcibk_config_quirks_init(struct pci_dev *dev)
|
||||
{
|
||||
struct pciback_config_quirk *quirk;
|
||||
struct xen_pcibk_config_quirk *quirk;
|
||||
int ret = 0;
|
||||
|
||||
quirk = kzalloc(sizeof(*quirk), GFP_ATOMIC);
|
||||
@@ -116,17 +116,17 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
void pciback_config_field_free(struct config_field *field)
|
||||
void xen_pcibk_config_field_free(struct config_field *field)
|
||||
{
|
||||
kfree(field);
|
||||
}
|
||||
|
||||
int pciback_config_quirk_release(struct pci_dev *dev)
|
||||
int xen_pcibk_config_quirk_release(struct pci_dev *dev)
|
||||
{
|
||||
struct pciback_config_quirk *quirk;
|
||||
struct xen_pcibk_config_quirk *quirk;
|
||||
int ret = 0;
|
||||
|
||||
quirk = pciback_find_quirk(dev);
|
||||
quirk = xen_pcibk_find_quirk(dev);
|
||||
if (!quirk) {
|
||||
ret = -ENXIO;
|
||||
goto out;
|
||||
|
Reference in New Issue
Block a user