Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
---
drivers/xen/pciback/conf_space.c | 34 +++---
drivers/xen/pciback/conf_space.h | 30 ++--
drivers/xen/pciback/conf_space_capability.c | 5 +-
drivers/xen/pciback/conf_space_capability.h | 3 +
drivers/xen/pciback/conf_space_capability_msi.c | 3 +-
drivers/xen/pciback/conf_space_capability_pm.c | 4 +-
drivers/xen/pciback/conf_space_capability_vpd.c | 2 +-
drivers/xen/pciback/conf_space_header.c | 7 +-
drivers/xen/pciback/conf_space_quirks.c | 16 ++-
drivers/xen/pciback/controller.c | 15 +-
drivers/xen/pciback/passthrough.c | 6 +-
drivers/xen/pciback/pci_stub.c | 165 +++++++++++------------
drivers/xen/pciback/pciback.h | 28 +++--
drivers/xen/pciback/pciback_ops.c | 74 +++++------
drivers/xen/pciback/slot.c | 22 ++--
drivers/xen/pciback/vpci.c | 28 ++--
drivers/xen/pciback/xenbus.c | 42 +++---
17 files changed, 245 insertions(+), 239 deletions(-)
diff --git a/drivers/xen/pciback/conf_space.c b/drivers/xen/pciback/conf_space.c
index 0c76db1..370c18e 100644
--- a/drivers/xen/pciback/conf_space.c
+++ b/drivers/xen/pciback/conf_space.c
@@ -18,11 +18,11 @@
static int permissive;
module_param(permissive, bool, 0644);
-#define DEFINE_PCI_CONFIG(op,size,type) \
+#define DEFINE_PCI_CONFIG(op, size, type) \
int pciback_##op##_config_##size \
(struct pci_dev *dev, int offset, type value, void *data) \
{ \
- return pci_##op##_config_##size (dev, offset, value); \
+ return pci_##op##_config_##size(dev, offset, value); \
}
DEFINE_PCI_CONFIG(read, byte, u8 *)
@@ -139,14 +139,15 @@ static int pcibios_err_to_errno(int err)
}
int pciback_config_read(struct pci_dev *dev, int offset, int size,
- u32 * ret_val)
+ u32 *ret_val)
{
int err = 0;
struct pciback_dev_data *dev_data = pci_get_drvdata(dev);
const struct config_field_entry *cfg_entry;
const struct config_field *field;
int req_start, req_end, field_start, field_end;
- /* if read fails for any reason, return 0 (as if device didn't respond)
*/
+ /* if read fails for any reason, return 0
+ * (as if device didn't respond) */
u32 value = 0, tmp_val;
if (unlikely(verbose_request))
@@ -161,10 +162,10 @@ int pciback_config_read(struct pci_dev *dev, int offset,
int size,
/* Get the real value first, then modify as appropriate */
switch (size) {
case 1:
- err = pci_read_config_byte(dev, offset, (u8 *) & value);
+ err = pci_read_config_byte(dev, offset, (u8 *) &value);
break;
case 2:
- err = pci_read_config_word(dev, offset, (u16 *) & value);
+ err = pci_read_config_word(dev, offset, (u16 *) &value);
break;
case 4:
err = pci_read_config_dword(dev, offset, &value);
@@ -192,7 +193,7 @@ int pciback_config_read(struct pci_dev *dev, int offset,
int size,
}
}
- out:
+out:
if (unlikely(verbose_request))
printk(KERN_DEBUG "pciback: %s: read %d bytes at 0x%x = %x\n",
pci_name(dev), size, offset, value);
@@ -276,8 +277,8 @@ int pciback_config_write(struct pci_dev *dev, int offset,
int size, u32 value)
} else if (!dev_data->warned_on_write) {
dev_data->warned_on_write = 1;
dev_warn(&dev->dev, "Driver tried to write to a "
- "read-only configuration space field at offset
"
- "0x%x, size %d. This may be harmless, but if "
+ "read-only configuration space field at offset"
+ " 0x%x, size %d. This may be harmless, but if "
"you have problems with your device:\n"
"1) see permissive attribute in sysfs\n"
"2) report problems to the xen-devel "
@@ -295,8 +296,8 @@ void pciback_config_free_dyn_fields(struct pci_dev *dev)
struct config_field_entry *cfg_entry, *t;
const struct config_field *field;
- dev_dbg(&dev->dev,
- "free-ing dynamically allocated virtual configuration space
fields\n");
+ dev_dbg(&dev->dev, "free-ing dynamically allocated virtual "
+ "configuration space fields\n");
if (!dev_data)
return;
@@ -306,8 +307,7 @@ void pciback_config_free_dyn_fields(struct pci_dev *dev)
if (field->clean) {
field->clean((struct config_field *)field);
- if (cfg_entry->data)
- kfree(cfg_entry->data);
+ kfree(cfg_entry->data);
list_del(&cfg_entry->list);
kfree(cfg_entry);
@@ -376,7 +376,7 @@ int pciback_config_add_field_offset(struct pci_dev *dev,
cfg_entry->base_offset = base_offset;
/* silently ignore duplicate fields */
- err = pciback_field_is_dup(dev,OFFSET(cfg_entry));
+ err = pciback_field_is_dup(dev, OFFSET(cfg_entry));
if (err)
goto out;
@@ -395,14 +395,14 @@ int pciback_config_add_field_offset(struct pci_dev *dev,
OFFSET(cfg_entry));
list_add_tail(&cfg_entry->list, &dev_data->config_fields);
- out:
+out:
if (err)
kfree(cfg_entry);
return err;
}
-/* This sets up the device's virtual configuration space to keep track of
+/* This sets up the device's virtual configuration space to keep track of
* certain registers (like the base address registers (BARs) so that we can
* keep the client from manipulating them directly.
*/
@@ -425,7 +425,7 @@ int pciback_config_init_dev(struct pci_dev *dev)
err = pciback_config_quirks_init(dev);
- out:
+out:
return err;
}
diff --git a/drivers/xen/pciback/conf_space.h b/drivers/xen/pciback/conf_space.h
index fe746ef..50ebef2 100644
--- a/drivers/xen/pciback/conf_space.h
+++ b/drivers/xen/pciback/conf_space.h
@@ -11,21 +11,21 @@
#include <linux/err.h>
/* conf_field_init can return an errno in a ptr with ERR_PTR() */
-typedef void *(*conf_field_init) (struct pci_dev * dev, int offset);
-typedef void (*conf_field_reset) (struct pci_dev * dev, int offset, void
*data);
-typedef void (*conf_field_free) (struct pci_dev * dev, int offset, void *data);
+typedef void *(*conf_field_init) (struct pci_dev *dev, int offset);
+typedef void (*conf_field_reset) (struct pci_dev *dev, int offset, void *data);
+typedef void (*conf_field_free) (struct pci_dev *dev, int offset, void *data);
-typedef int (*conf_dword_write) (struct pci_dev * dev, int offset, u32 value,
+typedef int (*conf_dword_write) (struct pci_dev *dev, int offset, u32 value,
void *data);
-typedef int (*conf_word_write) (struct pci_dev * dev, int offset, u16 value,
+typedef int (*conf_word_write) (struct pci_dev *dev, int offset, u16 value,
void *data);
-typedef int (*conf_byte_write) (struct pci_dev * dev, int offset, u8 value,
+typedef int (*conf_byte_write) (struct pci_dev *dev, int offset, u8 value,
void *data);
-typedef int (*conf_dword_read) (struct pci_dev * dev, int offset, u32 * value,
+typedef int (*conf_dword_read) (struct pci_dev *dev, int offset, u32 *value,
void *data);
-typedef int (*conf_word_read) (struct pci_dev * dev, int offset, u16 * value,
+typedef int (*conf_word_read) (struct pci_dev *dev, int offset, u16 *value,
void *data);
-typedef int (*conf_byte_read) (struct pci_dev * dev, int offset, u8 * value,
+typedef int (*conf_byte_read) (struct pci_dev *dev, int offset, u8 *value,
void *data);
/* These are the fields within the configuration space which we
@@ -39,7 +39,7 @@ struct config_field {
conf_field_init init;
conf_field_reset reset;
conf_field_free release;
- void (*clean) (struct config_field * field);
+ void (*clean) (struct config_field *field);
union {
struct {
conf_dword_write write;
@@ -92,8 +92,8 @@ static inline int pciback_config_add_fields(struct pci_dev
*dev,
}
static inline int pciback_config_add_fields_offset(struct pci_dev *dev,
- const struct config_field
*field,
- unsigned int offset)
+ const struct config_field *field,
+ unsigned int offset)
{
int i, err = 0;
for (i = 0; field[i].size != 0; i++) {
@@ -105,11 +105,11 @@ static inline int pciback_config_add_fields_offset(struct
pci_dev *dev,
}
/* Read/Write the real configuration space */
-int pciback_read_config_byte(struct pci_dev *dev, int offset, u8 * value,
+int pciback_read_config_byte(struct pci_dev *dev, int offset, u8 *value,
void *data);
-int pciback_read_config_word(struct pci_dev *dev, int offset, u16 * value,
+int pciback_read_config_word(struct pci_dev *dev, int offset, u16 *value,
void *data);
-int pciback_read_config_dword(struct pci_dev *dev, int offset, u32 * value,
+int pciback_read_config_dword(struct pci_dev *dev, int offset, u32 *value,
void *data);
int pciback_write_config_byte(struct pci_dev *dev, int offset, u8 value,
void *data);
diff --git a/drivers/xen/pciback/conf_space_capability.c
b/drivers/xen/pciback/conf_space_capability.c
index 50efca4..0ea84d6 100644
--- a/drivers/xen/pciback/conf_space_capability.c
+++ b/drivers/xen/pciback/conf_space_capability.c
@@ -53,13 +53,10 @@ int pciback_config_capability_add_fields(struct pci_dev
*dev)
}
}
- out:
+out:
return err;
}
-extern struct pciback_config_capability pciback_config_capability_vpd;
-extern struct pciback_config_capability pciback_config_capability_pm;
-
int pciback_config_capability_init(void)
{
register_capability(&pciback_config_capability_vpd);
diff --git a/drivers/xen/pciback/conf_space_capability.h
b/drivers/xen/pciback/conf_space_capability.h
index 823392e..8da3ac4 100644
--- a/drivers/xen/pciback/conf_space_capability.h
+++ b/drivers/xen/pciback/conf_space_capability.h
@@ -20,4 +20,7 @@ struct pciback_config_capability {
const struct config_field *fields;
};
+extern struct pciback_config_capability pciback_config_capability_vpd;
+extern struct pciback_config_capability pciback_config_capability_pm;
+
#endif
diff --git a/drivers/xen/pciback/conf_space_capability_msi.c
b/drivers/xen/pciback/conf_space_capability_msi.c
index 7fb5371..b70ea8b 100644
--- a/drivers/xen/pciback/conf_space_capability_msi.c
+++ b/drivers/xen/pciback/conf_space_capability_msi.c
@@ -18,7 +18,8 @@ int pciback_enable_msi(struct pciback_device *pdev,
status = pci_enable_msi(dev);
if (status) {
- printk("error enable msi for guest %x status %x\n", otherend,
status);
+ printk(KERN_ERR "error enable msi for guest %x status %x\n",
+ otherend, status);
op->value = 0;
return XEN_PCI_ERR_op_failed;
}
diff --git a/drivers/xen/pciback/conf_space_capability_pm.c
b/drivers/xen/pciback/conf_space_capability_pm.c
index e1d3af4..0442616 100644
--- a/drivers/xen/pciback/conf_space_capability_pm.c
+++ b/drivers/xen/pciback/conf_space_capability_pm.c
@@ -20,7 +20,7 @@ static int pm_caps_read(struct pci_dev *dev, int offset, u16
*value,
*value = real_value & ~PCI_PM_CAP_PME_MASK;
- out:
+out:
return err;
}
@@ -77,7 +77,7 @@ static void *pm_ctrl_init(struct pci_dev *dev, int offset)
err = pci_write_config_word(dev, offset, value);
}
- out:
+out:
return ERR_PTR(err);
}
diff --git a/drivers/xen/pciback/conf_space_capability_vpd.c
b/drivers/xen/pciback/conf_space_capability_vpd.c
index 920cb4a..e7b4d66 100644
--- a/drivers/xen/pciback/conf_space_capability_vpd.c
+++ b/drivers/xen/pciback/conf_space_capability_vpd.c
@@ -33,7 +33,7 @@ static const struct config_field caplist_vpd[] = {
},
{}
};
-
+
struct pciback_config_capability pciback_config_capability_vpd = {
.capability = PCI_CAP_ID_VPD,
.fields = caplist_vpd,
diff --git a/drivers/xen/pciback/conf_space_header.c
b/drivers/xen/pciback/conf_space_header.c
index 5a9e028..3ae7da1 100644
--- a/drivers/xen/pciback/conf_space_header.c
+++ b/drivers/xen/pciback/conf_space_header.c
@@ -51,7 +51,8 @@ static int command_write(struct pci_dev *dev, int offset, u16
value, void *data)
err = pci_set_mwi(dev);
if (err) {
printk(KERN_WARNING
- "pciback: %s: cannot enable
memory-write-invalidate (%d)\n",
+ "pciback: %s: cannot enable "
+ "memory-write-invalidate (%d)\n",
pci_name(dev), err);
value &= ~PCI_COMMAND_INVALIDATE;
}
@@ -206,7 +207,7 @@ static int bist_write(struct pci_dev *dev, int offset, u8
value, void *data)
|| value == PCI_BIST_START)
err = pci_write_config_byte(dev, offset, value);
- out:
+out:
return err;
}
@@ -312,6 +313,6 @@ int pciback_config_header_add_fields(struct pci_dev *dev)
break;
}
- out:
+out:
return err;
}
diff --git a/drivers/xen/pciback/conf_space_quirks.c
b/drivers/xen/pciback/conf_space_quirks.c
index 244a438..45c31fb 100644
--- a/drivers/xen/pciback/conf_space_quirks.c
+++ b/drivers/xen/pciback/conf_space_quirks.c
@@ -18,8 +18,10 @@ match_one_device(const struct pci_device_id *id, const
struct pci_dev *dev)
{
if ((id->vendor == PCI_ANY_ID || id->vendor == dev->vendor) &&
(id->device == PCI_ANY_ID || id->device == dev->device) &&
- (id->subvendor == PCI_ANY_ID || id->subvendor ==
dev->subsystem_vendor) &&
- (id->subdevice == PCI_ANY_ID || id->subdevice ==
dev->subsystem_device) &&
+ (id->subvendor == PCI_ANY_ID ||
+ id->subvendor == dev->subsystem_vendor) &&
+ (id->subdevice == PCI_ANY_ID ||
+ id->subdevice == dev->subsystem_device) &&
!((id->class ^ dev->class) & id->class_mask))
return id;
return NULL;
@@ -35,7 +37,7 @@ struct pciback_config_quirk *pciback_find_quirk(struct
pci_dev *dev)
tmp_quirk = NULL;
printk(KERN_DEBUG
"quirk didn't match any device pciback knows about\n");
- out:
+out:
return tmp_quirk;
}
@@ -51,7 +53,7 @@ int pciback_field_is_dup(struct pci_dev *dev, unsigned int
reg)
struct config_field_entry *cfg_entry;
list_for_each_entry(cfg_entry, &dev_data->config_fields, list) {
- if ( OFFSET(cfg_entry) == reg) {
+ if (OFFSET(cfg_entry) == reg) {
ret = 1;
break;
}
@@ -84,7 +86,7 @@ int pciback_config_quirks_add_field(struct pci_dev *dev,
struct config_field
pciback_config_add_field(dev, field);
- out:
+out:
return err;
}
@@ -110,7 +112,7 @@ int pciback_config_quirks_init(struct pci_dev *dev)
quirk->pdev = dev;
register_quirk(quirk);
- out:
+out:
return ret;
}
@@ -133,6 +135,6 @@ int pciback_config_quirk_release(struct pci_dev *dev)
list_del(&quirk->quirks_list);
kfree(quirk);
- out:
+out:
return ret;
}
diff --git a/drivers/xen/pciback/controller.c b/drivers/xen/pciback/controller.c
index 294e48f..7f04f11 100644
--- a/drivers/xen/pciback/controller.c
+++ b/drivers/xen/pciback/controller.c
@@ -259,7 +259,7 @@ static acpi_status write_xenbus_resource(struct
acpi_resource *res, void *data)
!(addr.resource_type == ACPI_IO_RANGE &&
addr.info.io.translation))
return AE_OK;
-
+
/* Store the resource in xenbus for the guest */
len = snprintf(str, sizeof(str), "root-%d-resource-%d",
info->root_num, info->resource_count);
@@ -314,7 +314,7 @@ int pciback_publish_pci_roots(struct pciback_device *pdev,
goto out;
/*
- * Now figure out which root-%d this belongs to
+ * Now figure out which root-%d this belongs to
* so we can associate resources with it.
*/
err = xenbus_scanf(XBT_NIL, pdev->xdev->nodename,
@@ -407,8 +407,8 @@ void pciback_release_devices(struct pciback_device *pdev)
pdev->pci_dev_data = NULL;
}
-int pciback_get_pcifront_dev(struct pci_dev *pcidev,
- struct pciback_device *pdev,
+int pciback_get_pcifront_dev(struct pci_dev *pcidev,
+ struct pciback_device *pdev,
unsigned int *domain, unsigned int *bus, unsigned int *devfn)
{
struct controller_dev_data *dev_data = pdev->pci_dev_data;
@@ -420,13 +420,12 @@ int pciback_get_pcifront_dev(struct pci_dev *pcidev,
list_for_each_entry(cntrl_entry, &dev_data->list, list) {
list_for_each_entry(dev_entry, &cntrl_entry->dev_list, list) {
- if ( (dev_entry->dev->bus->number ==
+ if ((dev_entry->dev->bus->number ==
pcidev->bus->number) &&
- (dev_entry->dev->devfn ==
+ (dev_entry->dev->devfn ==
pcidev->devfn) &&
(pci_domain_nr(dev_entry->dev->bus) ==
- pci_domain_nr(pcidev->bus)))
- {
+ pci_domain_nr(pcidev->bus))) {
found = 1;
*domain = cntrl_entry->domain;
*bus = cntrl_entry->bus;
diff --git a/drivers/xen/pciback/passthrough.c
b/drivers/xen/pciback/passthrough.c
index 9e7a0c4..5386beb 100644
--- a/drivers/xen/pciback/passthrough.c
+++ b/drivers/xen/pciback/passthrough.c
@@ -165,8 +165,10 @@ void pciback_release_devices(struct pciback_device *pdev)
pdev->pci_dev_data = NULL;
}
-int pciback_get_pcifront_dev(struct pci_dev *pcidev, struct pciback_device
*pdev,
- unsigned int *domain, unsigned int *bus, unsigned int *devfn)
+int pciback_get_pcifront_dev(struct pci_dev *pcidev,
+ struct pciback_device *pdev,
+ unsigned int *domain, unsigned int *bus,
+ unsigned int *devfn)
{
*domain = pci_domain_nr(pcidev->bus);
diff --git a/drivers/xen/pciback/pci_stub.c b/drivers/xen/pciback/pci_stub.c
index 88c742b..c65c7c1 100644
--- a/drivers/xen/pciback/pci_stub.c
+++ b/drivers/xen/pciback/pci_stub.c
@@ -18,7 +18,7 @@
#include "conf_space.h"
#include "conf_space_quirks.h"
-static char *pci_devs_to_hide = NULL;
+static char *pci_devs_to_hide;
wait_queue_head_t aer_wait_queue;
/*Add sem for sync AER handling and pciback remove/reconfigue ops,
* We want to avoid in middle of AER ops, pciback devices is being removed
@@ -41,7 +41,7 @@ struct pcistub_device {
spinlock_t lock;
struct pci_dev *dev;
- struct pciback_device *pdev; /* non-NULL if struct pci_dev is in use
*/
+ struct pciback_device *pdev;/* non-NULL if struct pci_dev is in use */
};
/* Access to pcistub_devices & seized_devices lists and the initialize_devices
@@ -53,7 +53,7 @@ static LIST_HEAD(pcistub_devices);
/* wait for device_initcall before initializing our devices
* (see pcistub_init_devices_late)
*/
-static int initialize_devices = 0;
+static int initialize_devices;
static LIST_HEAD(seized_devices);
static struct pcistub_device *pcistub_device_alloc(struct pci_dev *dev)
@@ -130,7 +130,7 @@ static struct pcistub_device *pcistub_device_find(int
domain, int bus,
/* didn't find it */
psdev = NULL;
- out:
+out:
spin_unlock_irqrestore(&pcistub_devices_lock, flags);
return psdev;
}
@@ -319,10 +319,10 @@ static int __devinit pcistub_init_device(struct pci_dev
*dev)
return 0;
- config_release:
+config_release:
pciback_config_free_dev(dev);
- out:
+out:
pci_set_drvdata(dev, NULL);
kfree(dev_data);
return err;
@@ -441,7 +441,7 @@ static int __devinit pcistub_probe(struct pci_dev *dev,
/* Didn't find the device */
err = -ENODEV;
- out:
+out:
return err;
}
@@ -509,26 +509,24 @@ static void kill_domain_by_device(struct pcistub_device
*psdev)
int err;
char nodename[1024];
- if (!psdev)
+ if (!psdev)
dev_err(&psdev->dev->dev,
"device is NULL when do AER recovery/kill_domain\n");
- sprintf(nodename, "/local/domain/0/backend/pci/%d/0",
+ sprintf(nodename, "/local/domain/0/backend/pci/%d/0",
psdev->pdev->xdev->otherend_id);
nodename[strlen(nodename)] = '\0';
again:
err = xenbus_transaction_start(&xbt);
- if (err)
- {
+ if (err) {
dev_err(&psdev->dev->dev,
"error %d when start xenbus transaction\n", err);
return;
}
/*PV AER handlers will set this flag*/
- xenbus_printf(xbt, nodename, "aerState" , "aerfail" );
+ xenbus_printf(xbt, nodename, "aerState" , "aerfail");
err = xenbus_transaction_end(xbt, 0);
- if (err)
- {
+ if (err) {
if (err == -EAGAIN)
goto again;
dev_err(&psdev->dev->dev,
@@ -539,9 +537,9 @@ again:
/* For each aer recovery step error_detected, mmio_enabled, etc, front_end and
* backend need to have cooperation. In pciback, those steps will do similar
- * jobs: send service request and waiting for front_end response.
+ * jobs: send service request and waiting for front_end response.
*/
-static pci_ers_result_t common_process(struct pcistub_device *psdev,
+static pci_ers_result_t common_process(struct pcistub_device *psdev,
pci_channel_state_t state, int aer_cmd, pci_ers_result_t result)
{
pci_ers_result_t res = result;
@@ -559,12 +557,12 @@ static pci_ers_result_t common_process(struct
pcistub_device *psdev,
if (!ret) {
dev_err(&psdev->dev->dev,
"pciback: failed to get pcifront device\n");
- return PCI_ERS_RESULT_NONE;
+ return PCI_ERS_RESULT_NONE;
}
wmb();
- dev_dbg(&psdev->dev->dev,
- "pciback: aer_op %x dom %x bus %x devfn %x\n",
+ dev_dbg(&psdev->dev->dev,
+ "pciback: aer_op %x dom %x bus %x devfn %x\n",
aer_cmd, aer_op->domain, aer_op->bus, aer_op->devfn);
/*local flag to mark there's aer request, pciback callback will use this
* flag to judge whether we need to check pci-front give aer service
@@ -573,21 +571,21 @@ static pci_ers_result_t common_process(struct
pcistub_device *psdev,
set_bit(_PCIB_op_pending, (unsigned long *)&psdev->pdev->flags);
/*It is possible that a pcifront conf_read_write ops request invokes
- * the callback which cause the spurious execution of wake_up.
+ * the callback which cause the spurious execution of wake_up.
* Yet it is harmless and better than a spinlock here
*/
- set_bit(_XEN_PCIB_active,
+ set_bit(_XEN_PCIB_active,
(unsigned long *)&psdev->pdev->sh_info->flags);
wmb();
notify_remote_via_irq(psdev->pdev->evtchn_irq);
ret = wait_event_timeout(aer_wait_queue, !(test_bit(_XEN_PCIB_active,
- (unsigned long *)&psdev->pdev->sh_info->flags)), 300*HZ);
+ (unsigned long *)&psdev->pdev->sh_info->flags)), 300*HZ);
if (!ret) {
- if (test_bit(_XEN_PCIB_active,
+ if (test_bit(_XEN_PCIB_active,
(unsigned long *)&psdev->pdev->sh_info->flags)) {
- dev_err(&psdev->dev->dev,
+ dev_err(&psdev->dev->dev,
"pcifront aer process not responding!\n");
clear_bit(_XEN_PCIB_active,
(unsigned long *)&psdev->pdev->sh_info->flags);
@@ -597,16 +595,16 @@ static pci_ers_result_t common_process(struct
pcistub_device *psdev,
}
clear_bit(_PCIB_op_pending, (unsigned long *)&psdev->pdev->flags);
- if ( test_bit( _XEN_PCIF_active,
- (unsigned long*)&psdev->pdev->sh_info->flags)) {
- dev_dbg(&psdev->dev->dev,
+ if (test_bit(_XEN_PCIF_active,
+ (unsigned long *)&psdev->pdev->sh_info->flags)) {
+ dev_dbg(&psdev->dev->dev,
"schedule pci_conf service in pciback \n");
test_and_schedule_op(psdev->pdev);
}
res = (pci_ers_result_t)aer_op->err;
return res;
-}
+}
/*
* pciback_slot_reset: it will send the slot_reset request to pcifront in case
@@ -630,24 +628,22 @@ static pci_ers_result_t pciback_slot_reset(struct pci_dev
*dev)
PCI_SLOT(dev->devfn),
PCI_FUNC(dev->devfn));
- if ( !psdev || !psdev->pdev )
- {
- dev_err(&dev->dev,
+ if (!psdev || !psdev->pdev) {
+ dev_err(&dev->dev,
"pciback device is not found/assigned\n");
goto end;
}
- if ( !psdev->pdev->sh_info )
- {
+ if (!psdev->pdev->sh_info) {
dev_err(&dev->dev, "pciback device is not connected or owned"
" by HVM, kill it\n");
kill_domain_by_device(psdev);
goto release;
}
- if ( !test_bit(_XEN_PCIB_AERHANDLER,
- (unsigned long *)&psdev->pdev->sh_info->flags) ) {
- dev_err(&dev->dev,
+ if (!test_bit(_XEN_PCIB_AERHANDLER,
+ (unsigned long *)&psdev->pdev->sh_info->flags)) {
+ dev_err(&dev->dev,
"guest with no AER driver should have been killed\n");
goto release;
}
@@ -655,7 +651,7 @@ static pci_ers_result_t pciback_slot_reset(struct pci_dev
*dev)
if (result == PCI_ERS_RESULT_NONE ||
result == PCI_ERS_RESULT_DISCONNECT) {
- dev_dbg(&dev->dev,
+ dev_dbg(&dev->dev,
"No AER slot_reset service or disconnected!\n");
kill_domain_by_device(psdev);
}
@@ -668,9 +664,9 @@ end:
}
-/*pciback_mmio_enabled: it will send the mmio_enabled request to pcifront
-* in case of the device driver could provide this service, and then wait
-* for pcifront ack.
+/*pciback_mmio_enabled: it will send the mmio_enabled request to pcifront
+* in case of the device driver could provide this service, and then wait
+* for pcifront ack
* @dev: pointer to PCI devices
* return value is used by aer_core do_recovery policy
*/
@@ -690,24 +686,22 @@ static pci_ers_result_t pciback_mmio_enabled(struct
pci_dev *dev)
PCI_SLOT(dev->devfn),
PCI_FUNC(dev->devfn));
- if ( !psdev || !psdev->pdev )
- {
- dev_err(&dev->dev,
+ if (!psdev || !psdev->pdev) {
+ dev_err(&dev->dev,
"pciback device is not found/assigned\n");
goto end;
}
- if ( !psdev->pdev->sh_info )
- {
+ if (!psdev->pdev->sh_info) {
dev_err(&dev->dev, "pciback device is not connected or owned"
" by HVM, kill it\n");
kill_domain_by_device(psdev);
goto release;
}
- if ( !test_bit(_XEN_PCIB_AERHANDLER,
- (unsigned long *)&psdev->pdev->sh_info->flags) ) {
- dev_err(&dev->dev,
+ if (!test_bit(_XEN_PCIB_AERHANDLER,
+ (unsigned long *)&psdev->pdev->sh_info->flags)) {
+ dev_err(&dev->dev,
"guest with no AER driver should have been killed\n");
goto release;
}
@@ -715,7 +709,7 @@ static pci_ers_result_t pciback_mmio_enabled(struct pci_dev
*dev)
if (result == PCI_ERS_RESULT_NONE ||
result == PCI_ERS_RESULT_DISCONNECT) {
- dev_dbg(&dev->dev,
+ dev_dbg(&dev->dev,
"No AER mmio_enabled service or disconnected!\n");
kill_domain_by_device(psdev);
}
@@ -726,8 +720,8 @@ end:
return result;
}
-/*pciback_error_detected: it will send the error_detected request to pcifront
-* in case of the device driver could provide this service, and then wait
+/*pciback_error_detected: it will send the error_detected request to pcifront
+* in case of the device driver could provide this service, and then wait
* for pcifront ack.
* @dev: pointer to PCI devices
* @error: the current PCI connection state
@@ -750,15 +744,13 @@ static pci_ers_result_t pciback_error_detected(struct
pci_dev *dev,
PCI_SLOT(dev->devfn),
PCI_FUNC(dev->devfn));
- if ( !psdev || !psdev->pdev )
- {
- dev_err(&dev->dev,
+ if (!psdev || !psdev->pdev) {
+ dev_err(&dev->dev,
"pciback device is not found/assigned\n");
goto end;
}
- if ( !psdev->pdev->sh_info )
- {
+ if (!psdev->pdev->sh_info) {
dev_err(&dev->dev, "pciback device is not connected or owned"
" by HVM, kill it\n");
kill_domain_by_device(psdev);
@@ -766,8 +758,8 @@ static pci_ers_result_t pciback_error_detected(struct
pci_dev *dev,
}
/*Guest owns the device yet no aer handler regiested, kill guest*/
- if ( !test_bit(_XEN_PCIB_AERHANDLER,
- (unsigned long *)&psdev->pdev->sh_info->flags) ) {
+ if (!test_bit(_XEN_PCIB_AERHANDLER,
+ (unsigned long *)&psdev->pdev->sh_info->flags)) {
dev_dbg(&dev->dev, "guest may have no aer driver, kill it\n");
kill_domain_by_device(psdev);
goto release;
@@ -776,7 +768,7 @@ static pci_ers_result_t pciback_error_detected(struct
pci_dev *dev,
if (result == PCI_ERS_RESULT_NONE ||
result == PCI_ERS_RESULT_DISCONNECT) {
- dev_dbg(&dev->dev,
+ dev_dbg(&dev->dev,
"No AER error_detected service or disconnected!\n");
kill_domain_by_device(psdev);
}
@@ -787,8 +779,8 @@ end:
return result;
}
-/*pciback_error_resume: it will send the error_resume request to pcifront
-* in case of the device driver could provide this service, and then wait
+/*pciback_error_resume: it will send the error_resume request to pcifront
+* in case of the device driver could provide this service, and then wait
* for pcifront ack.
* @dev: pointer to PCI devices
*/
@@ -806,29 +798,28 @@ static void pciback_error_resume(struct pci_dev *dev)
PCI_SLOT(dev->devfn),
PCI_FUNC(dev->devfn));
- if ( !psdev || !psdev->pdev )
- {
- dev_err(&dev->dev,
+ if (!psdev || !psdev->pdev) {
+ dev_err(&dev->dev,
"pciback device is not found/assigned\n");
goto end;
}
- if ( !psdev->pdev->sh_info )
- {
+ if (!psdev->pdev->sh_info) {
dev_err(&dev->dev, "pciback device is not connected or owned"
" by HVM, kill it\n");
kill_domain_by_device(psdev);
goto release;
}
- if ( !test_bit(_XEN_PCIB_AERHANDLER,
- (unsigned long *)&psdev->pdev->sh_info->flags) ) {
- dev_err(&dev->dev,
+ if (!test_bit(_XEN_PCIB_AERHANDLER,
+ (unsigned long *)&psdev->pdev->sh_info->flags)) {
+ dev_err(&dev->dev,
"guest with no AER driver should have been killed\n");
kill_domain_by_device(psdev);
goto release;
}
- common_process(psdev, 1, XEN_PCI_OP_aer_resume,
PCI_ERS_RESULT_RECOVERED);
+ common_process(psdev, 1, XEN_PCI_OP_aer_resume,
+ PCI_ERS_RESULT_RECOVERED);
release:
pcistub_device_put(psdev);
end:
@@ -921,8 +912,8 @@ static int pcistub_device_id_remove(int domain, int bus,
int slot, int func)
unsigned long flags;
spin_lock_irqsave(&device_ids_lock, flags);
- list_for_each_entry_safe(pci_dev_id, t, &pcistub_device_ids, slot_list)
{
-
+ list_for_each_entry_safe(pci_dev_id, t, &pcistub_device_ids,
+ slot_list) {
if (pci_dev_id->domain == domain
&& pci_dev_id->bus == bus && pci_dev_id->devfn == devfn) {
/* Don't break; here because it's possible the same
@@ -974,7 +965,7 @@ static int pcistub_reg_add(int domain, int bus, int slot,
int func, int reg,
err = pciback_config_quirks_add_field(dev, field);
if (err)
kfree(field);
- out:
+out:
return err;
}
@@ -990,7 +981,7 @@ static ssize_t pcistub_slot_add(struct device_driver *drv,
const char *buf,
err = pcistub_device_id_add(domain, bus, slot, func);
- out:
+out:
if (!err)
err = count;
return err;
@@ -1010,7 +1001,7 @@ static ssize_t pcistub_slot_remove(struct device_driver
*drv, const char *buf,
err = pcistub_device_id_remove(domain, bus, slot, func);
- out:
+out:
if (!err)
err = count;
return err;
@@ -1055,7 +1046,7 @@ static ssize_t pcistub_quirk_add(struct device_driver
*drv, const char *buf,
err = pcistub_reg_add(domain, bus, slot, func, reg, size, mask);
- out:
+out:
if (!err)
err = count;
return err;
@@ -1065,7 +1056,6 @@ static ssize_t pcistub_quirk_show(struct device_driver
*drv, char *buf)
{
int count = 0;
unsigned long flags;
- extern struct list_head pciback_quirks;
struct pciback_config_quirk *quirk;
struct pciback_dev_data *dev_data;
const struct config_field *field;
@@ -1094,12 +1084,13 @@ static ssize_t pcistub_quirk_show(struct device_driver
*drv, char *buf)
count += scnprintf(buf + count, PAGE_SIZE - count,
"\t\t%08x:%01x:%08x\n",
- cfg_entry->base_offset +
field->offset,
- field->size, field->mask);
+ cfg_entry->base_offset +
+ field->offset, field->size,
+ field->mask);
}
}
- out:
+out:
spin_unlock_irqrestore(&device_ids_lock, flags);
return count;
@@ -1135,14 +1126,14 @@ static ssize_t permissive_add(struct device_driver
*drv, const char *buf,
if (!dev_data->permissive) {
dev_data->permissive = 1;
/* Let user know that what they're doing could be unsafe */
- dev_warn(&psdev->dev->dev,
- "enabling permissive mode configuration space
accesses!\n");
+ dev_warn(&psdev->dev->dev, "enabling permissive mode "
+ "configuration space accesses!\n");
dev_warn(&psdev->dev->dev,
"permissive mode is potentially unsafe!\n");
}
- release:
+release:
pcistub_device_put(psdev);
- out:
+out:
if (!err)
err = count;
return err;
@@ -1259,10 +1250,10 @@ static int __init pcistub_init(void)
if (err)
pcistub_exit();
- out:
+out:
return err;
- parse_error:
+parse_error:
printk(KERN_ERR "pciback: Error parsing pci_devs_to_hide at \"%s\"\n",
pci_devs_to_hide + pos);
return -EINVAL;
@@ -1271,7 +1262,7 @@ static int __init pcistub_init(void)
#ifndef MODULE
/*
* fs_initcall happens before device_initcall
- * so pciback *should* get called first (b/c we
+ * so pciback *should* get called first (b/c we
* want to suck up any device before other drivers
* get a chance by being the first pci device
* driver to register)
diff --git a/drivers/xen/pciback/pciback.h b/drivers/xen/pciback/pciback.h
index 5e8e14e..98e2912 100644
--- a/drivers/xen/pciback/pciback.h
+++ b/drivers/xen/pciback/pciback.h
@@ -49,6 +49,12 @@ struct pciback_dev_data {
int warned_on_write;
};
+/* Used by XenBus and pciback_ops.c */
+extern wait_queue_head_t aer_wait_queue;
+extern struct workqueue_struct *pciback_wq;
+/* Used by pcistub.c and conf_space_quirks.c */
+extern struct list_head pciback_quirks;
+
/* Get/Put PCI Devices that are hidden from the PCI Backend Domain */
struct pci_dev *pcistub_get_pci_dev_by_slot(struct pciback_device *pdev,
int domain, int bus,
@@ -67,14 +73,14 @@ void pciback_config_free_dyn_fields(struct pci_dev *dev);
void pciback_config_reset_dev(struct pci_dev *dev);
void pciback_config_free_dev(struct pci_dev *dev);
int pciback_config_read(struct pci_dev *dev, int offset, int size,
- u32 * ret_val);
+ u32 *ret_val);
int pciback_config_write(struct pci_dev *dev, int offset, int size, u32 value);
/* Handle requests for specific devices from the frontend */
typedef int (*publish_pci_dev_cb) (struct pciback_device *pdev,
unsigned int domain, unsigned int bus,
unsigned int devfn, unsigned int devid);
-typedef int (*publish_pci_root_cb) (struct pciback_device * pdev,
+typedef int (*publish_pci_root_cb) (struct pciback_device *pdev,
unsigned int domain, unsigned int bus);
int pciback_add_pci_dev(struct pciback_device *pdev, struct pci_dev *dev,
int devid, publish_pci_dev_cb publish_cb);
@@ -83,15 +89,17 @@ struct pci_dev *pciback_get_pci_dev(struct pciback_device
*pdev,
unsigned int domain, unsigned int bus,
unsigned int devfn);
-/**
+/**
* Add for domain0 PCIE-AER handling. Get guest domain/bus/devfn in pciback
-* before sending aer request to pcifront, so that guest could identify
+* before sending aer request to pcifront, so that guest could identify
* device, coopearte with pciback to finish aer recovery job if device driver
* has the capability
*/
-int pciback_get_pcifront_dev(struct pci_dev *pcidev, struct pciback_device
*pdev,
- unsigned int *domain, unsigned int *bus,
unsigned int *devfn);
+int pciback_get_pcifront_dev(struct pci_dev *pcidev,
+ struct pciback_device *pdev,
+ unsigned int *domain, unsigned int *bus,
+ unsigned int *devfn);
int pciback_init_devices(struct pciback_device *pdev);
int pciback_publish_pci_roots(struct pciback_device *pdev,
publish_pci_root_cb cb);
@@ -106,17 +114,17 @@ void pciback_xenbus_unregister(void);
#ifdef CONFIG_PCI_MSI
int pciback_enable_msi(struct pciback_device *pdev,
- struct pci_dev *dev, struct xen_pci_op *op);
+ struct pci_dev *dev, struct xen_pci_op *op);
int pciback_disable_msi(struct pciback_device *pdev,
- struct pci_dev *dev, struct xen_pci_op *op);
+ struct pci_dev *dev, struct xen_pci_op *op);
int pciback_enable_msix(struct pciback_device *pdev,
- struct pci_dev *dev, struct xen_pci_op *op);
+ struct pci_dev *dev, struct xen_pci_op *op);
int pciback_disable_msix(struct pciback_device *pdev,
- struct pci_dev *dev, struct xen_pci_op *op);
+ struct pci_dev *dev, struct xen_pci_op *op);
#endif
extern int verbose_request;
diff --git a/drivers/xen/pciback/pciback_ops.c
b/drivers/xen/pciback/pciback_ops.c
index 6624faf..bf83dca 100644
--- a/drivers/xen/pciback/pciback_ops.c
+++ b/drivers/xen/pciback/pciback_ops.c
@@ -5,11 +5,11 @@
*/
#include <linux/module.h>
#include <linux/wait.h>
-#include <asm/bitops.h>
+#include <linux/bitops.h>
#include <xen/events.h>
#include "pciback.h"
-int verbose_request = 0;
+int verbose_request;
module_param(verbose_request, int, 0644);
/* Ensure a device is "turned off" and ready to be exported.
@@ -37,12 +37,10 @@ void pciback_reset_device(struct pci_dev *dev)
}
}
}
-extern wait_queue_head_t aer_wait_queue;
-extern struct workqueue_struct *pciback_wq;
/*
* Now the same evtchn is used for both pcifront conf_read_write request
* as well as pcie aer front end ack. We use a new work_queue to schedule
-* pciback conf_read_write service for avoiding confict with aer_core
+* pciback conf_read_write service for avoiding confict with aer_core
* do_recovery job which also use the system default work_queue
*/
void test_and_schedule_op(struct pciback_device *pdev)
@@ -50,14 +48,13 @@ void test_and_schedule_op(struct pciback_device *pdev)
/* Check that frontend is requesting an operation and that we are not
* already processing a request */
if (test_bit(_XEN_PCIF_active, (unsigned long *)&pdev->sh_info->flags)
- && !test_and_set_bit(_PDEVF_op_active, &pdev->flags))
- {
+ && !test_and_set_bit(_PDEVF_op_active, &pdev->flags)) {
queue_work(pciback_wq, &pdev->op_work);
}
/*_XEN_PCIB_active should have been cleared by pcifront. And also make
sure pciback is waiting for ack by checking _PCIB_op_pending*/
- if (!test_bit(_XEN_PCIB_active,(unsigned long *)&pdev->sh_info->flags)
- &&test_bit(_PCIB_op_pending, &pdev->flags)) {
+ if (!test_bit(_XEN_PCIB_active, (unsigned long *)&pdev->sh_info->flags)
+ && test_bit(_PCIB_op_pending, &pdev->flags)) {
wake_up(&aer_wait_queue);
}
}
@@ -69,7 +66,8 @@ void test_and_schedule_op(struct pciback_device *pdev)
void pciback_do_op(struct work_struct *data)
{
- struct pciback_device *pdev = container_of(data, struct pciback_device,
op_work);
+ struct pciback_device *pdev =
+ container_of(data, struct pciback_device, op_work);
struct pci_dev *dev;
struct xen_pci_op *op = &pdev->sh_info->op;
@@ -77,38 +75,36 @@ void pciback_do_op(struct work_struct *data)
if (dev == NULL)
op->err = XEN_PCI_ERR_dev_not_found;
- else
- {
- switch (op->cmd)
- {
- case XEN_PCI_OP_conf_read:
- op->err = pciback_config_read(dev,
- op->offset, op->size, &op->value);
- break;
- case XEN_PCI_OP_conf_write:
- op->err = pciback_config_write(dev,
- op->offset, op->size, op->value);
- break;
+ else {
+ switch (op->cmd) {
+ case XEN_PCI_OP_conf_read:
+ op->err = pciback_config_read(dev,
+ op->offset, op->size, &op->value);
+ break;
+ case XEN_PCI_OP_conf_write:
+ op->err = pciback_config_write(dev,
+ op->offset, op->size, op->value);
+ break;
#ifdef CONFIG_PCI_MSI
- case XEN_PCI_OP_enable_msi:
- op->err = pciback_enable_msi(pdev, dev, op);
- break;
- case XEN_PCI_OP_disable_msi:
- op->err = pciback_disable_msi(pdev, dev, op);
- break;
- case XEN_PCI_OP_enable_msix:
- op->err = pciback_enable_msix(pdev, dev, op);
- break;
- case XEN_PCI_OP_disable_msix:
- op->err = pciback_disable_msix(pdev, dev, op);
- break;
+ case XEN_PCI_OP_enable_msi:
+ op->err = pciback_enable_msi(pdev, dev, op);
+ break;
+ case XEN_PCI_OP_disable_msi:
+ op->err = pciback_disable_msi(pdev, dev, op);
+ break;
+ case XEN_PCI_OP_enable_msix:
+ op->err = pciback_enable_msix(pdev, dev, op);
+ break;
+ case XEN_PCI_OP_disable_msix:
+ op->err = pciback_disable_msix(pdev, dev, op);
+ break;
#endif
- default:
- op->err = XEN_PCI_ERR_not_implemented;
- break;
+ default:
+ op->err = XEN_PCI_ERR_not_implemented;
+ break;
}
}
- /* Tell the driver domain that we're done. */
+ /* Tell the driver domain that we're done. */
wmb();
clear_bit(_XEN_PCIF_active, (unsigned long *)&pdev->sh_info->flags);
notify_remote_via_irq(pdev->evtchn_irq);
@@ -119,7 +115,7 @@ void pciback_do_op(struct work_struct *data)
smp_mb__after_clear_bit(); /* /before/ final check for work */
/* Check to see if the driver domain tried to start another request in
- * between clearing _XEN_PCIF_active and clearing _PDEVF_op_active.
+ * between clearing _XEN_PCIF_active and clearing _PDEVF_op_active.
*/
test_and_schedule_op(pdev);
}
diff --git a/drivers/xen/pciback/slot.c b/drivers/xen/pciback/slot.c
index 105a8b6..efb922d 100644
--- a/drivers/xen/pciback/slot.c
+++ b/drivers/xen/pciback/slot.c
@@ -65,7 +65,8 @@ int pciback_add_pci_dev(struct pciback_device *pdev, struct
pci_dev *dev,
for (slot = 0; slot < PCI_SLOT_MAX; slot++) {
if (slot_dev->slots[bus][slot] == NULL) {
printk(KERN_INFO
- "pciback: slot: %s: assign to virtual
slot %d, bus %d\n",
+ "pciback: slot: %s: assign to virtual "
+ "slot %d, bus %d\n",
pci_name(dev), slot, bus);
slot_dev->slots[bus][slot] = dev;
goto unlock;
@@ -76,14 +77,14 @@ int pciback_add_pci_dev(struct pciback_device *pdev, struct
pci_dev *dev,
xenbus_dev_fatal(pdev->xdev, err,
"No more space on root virtual PCI bus");
- unlock:
+unlock:
spin_unlock_irqrestore(&slot_dev->lock, flags);
/* Publish this device. */
- if(!err)
+ if (!err)
err = publish_cb(pdev, 0, 0, PCI_DEVFN(slot, 0), devid);
- out:
+out:
return err;
}
@@ -105,7 +106,7 @@ void pciback_release_pci_dev(struct pciback_device *pdev,
struct pci_dev *dev)
}
}
- out:
+out:
spin_unlock_irqrestore(&slot_dev->lock, flags);
if (found_dev)
@@ -156,8 +157,10 @@ void pciback_release_devices(struct pciback_device *pdev)
pdev->pci_dev_data = NULL;
}
-int pciback_get_pcifront_dev(struct pci_dev *pcidev, struct pciback_device
*pdev,
- unsigned int *domain, unsigned int *bus, unsigned int *devfn)
+int pciback_get_pcifront_dev(struct pci_dev *pcidev,
+ struct pciback_device *pdev,
+ unsigned int *domain, unsigned int *bus,
+ unsigned int *devfn)
{
int slot, busnr;
struct slot_dev_data *slot_dev = pdev->pci_dev_data;
@@ -172,11 +175,12 @@ int pciback_get_pcifront_dev(struct pci_dev *pcidev,
struct pciback_device *pdev
dev = slot_dev->slots[busnr][slot];
if (dev && dev->bus->number == pcidev->bus->number
&& dev->devfn == pcidev->devfn
- && pci_domain_nr(dev->bus) ==
pci_domain_nr(pcidev->bus)) {
+ && pci_domain_nr(dev->bus) ==
+ pci_domain_nr(pcidev->bus)) {
found = 1;
*domain = 0;
*bus = busnr;
- *devfn = PCI_DEVFN(slot,0);
+ *devfn = PCI_DEVFN(slot, 0);
goto out;
}
}
diff --git a/drivers/xen/pciback/vpci.c b/drivers/xen/pciback/vpci.c
index a5b7ece..721b81b 100644
--- a/drivers/xen/pciback/vpci.c
+++ b/drivers/xen/pciback/vpci.c
@@ -125,14 +125,14 @@ int pciback_add_pci_dev(struct pciback_device *pdev,
struct pci_dev *dev,
xenbus_dev_fatal(pdev->xdev, err,
"No more space on root virtual PCI bus");
- unlock:
+unlock:
spin_unlock_irqrestore(&vpci_dev->lock, flags);
/* Publish this device. */
- if(!err)
+ if (!err)
err = publish_cb(pdev, 0, 0, PCI_DEVFN(slot, func), devid);
- out:
+out:
return err;
}
@@ -158,7 +158,7 @@ void pciback_release_pci_dev(struct pciback_device *pdev,
struct pci_dev *dev)
}
}
- out:
+out:
spin_unlock_irqrestore(&vpci_dev->lock, flags);
if (found_dev)
@@ -176,9 +176,8 @@ int pciback_init_devices(struct pciback_device *pdev)
spin_lock_init(&vpci_dev->lock);
- for (slot = 0; slot < PCI_SLOT_MAX; slot++) {
+ for (slot = 0; slot < PCI_SLOT_MAX; slot++)
INIT_LIST_HEAD(&vpci_dev->dev_list[slot]);
- }
pdev->pci_dev_data = vpci_dev;
@@ -211,8 +210,10 @@ void pciback_release_devices(struct pciback_device *pdev)
pdev->pci_dev_data = NULL;
}
-int pciback_get_pcifront_dev(struct pci_dev *pcidev, struct pciback_device
*pdev,
- unsigned int *domain, unsigned int *bus, unsigned int *devfn)
+int pciback_get_pcifront_dev(struct pci_dev *pcidev,
+ struct pciback_device *pdev,
+ unsigned int *domain, unsigned int *bus,
+ unsigned int *devfn)
{
struct pci_dev_entry *entry;
struct pci_dev *dev = NULL;
@@ -227,15 +228,16 @@ int pciback_get_pcifront_dev(struct pci_dev *pcidev,
struct pciback_device *pdev
list) {
dev = entry->dev;
if (dev && dev->bus->number == pcidev->bus->number
- && pci_domain_nr(dev->bus) ==
pci_domain_nr(pcidev->bus)
- && dev->devfn == pcidev->devfn)
- {
+ && pci_domain_nr(dev->bus) ==
+ pci_domain_nr(pcidev->bus)
+ && dev->devfn == pcidev->devfn) {
found = 1;
*domain = 0;
*bus = 0;
- *devfn = PCI_DEVFN(slot,
PCI_FUNC(pcidev->devfn));
+ *devfn = PCI_DEVFN(slot,
+ PCI_FUNC(pcidev->devfn));
}
- }
+ }
}
spin_unlock_irqrestore(&vpci_dev->lock, flags);
return found;
diff --git a/drivers/xen/pciback/xenbus.c b/drivers/xen/pciback/xenbus.c
index a85c413..efec585 100644
--- a/drivers/xen/pciback/xenbus.c
+++ b/drivers/xen/pciback/xenbus.c
@@ -40,7 +40,7 @@ static struct pciback_device *alloc_pdev(struct xenbus_device
*xdev)
kfree(pdev);
pdev = NULL;
}
- out:
+out:
return pdev;
}
@@ -111,7 +111,7 @@ static int pciback_do_attach(struct pciback_device *pdev,
int gnt_ref,
err = 0;
dev_dbg(&pdev->xdev->dev, "Attached!\n");
- out:
+out:
return err;
}
@@ -166,11 +166,10 @@ static int pciback_attach(struct pciback_device *pdev)
"Error switching to connected state!");
dev_dbg(&pdev->xdev->dev, "Connected? %d\n", err);
- out:
+out:
spin_unlock(&pdev->dev_lock);
- if (magic)
- kfree(magic);
+ kfree(magic);
return err;
}
@@ -193,7 +192,7 @@ static int pciback_publish_pci_dev(struct pciback_device
*pdev,
"%04x:%02x:%02x.%02x", domain, bus,
PCI_SLOT(devfn), PCI_FUNC(devfn));
- out:
+out:
return err;
}
@@ -230,7 +229,7 @@ static int pciback_export_device(struct pciback_device
*pdev,
* to other driver domains (as he who controls the bridge can disable
* it and stop the other devices from working).
*/
- out:
+out:
return err;
}
@@ -253,8 +252,8 @@ static int pciback_remove_device(struct pciback_device
*pdev,
}
pciback_release_pci_dev(pdev, dev);
-
- out:
+
+out:
return err;
}
@@ -314,7 +313,7 @@ static int pciback_publish_pci_root(struct pciback_device
*pdev,
err = xenbus_printf(XBT_NIL, pdev->xdev->nodename,
"root_num", "%d", (root_num + 1));
- out:
+out:
return err;
}
@@ -358,7 +357,7 @@ static int pciback_reconfigure(struct pciback_device *pdev)
}
err = xenbus_scanf(XBT_NIL, pdev->xdev->nodename, state_str,
"%d", &substate);
- if (err != 1)
+ if (err != 1)
substate = XenbusStateUnknown;
switch (substate) {
@@ -389,14 +388,15 @@ static int pciback_reconfigure(struct pciback_device
*pdev)
"configuration");
goto out;
}
-
+
err = pciback_export_device(pdev, domain, bus, slot,
func, i);
if (err)
goto out;
/* Publish pci roots. */
- err = pciback_publish_pci_roots(pdev,
pciback_publish_pci_root);
+ err = pciback_publish_pci_roots(pdev,
+ pciback_publish_pci_root);
if (err) {
xenbus_dev_fatal(pdev->xdev, err,
"Error while publish PCI root"
@@ -412,7 +412,7 @@ static int pciback_reconfigure(struct pciback_device *pdev)
"Error switching substate of "
"dev-%d\n", i);
goto out;
- }
+ }
break;
case XenbusStateClosing:
@@ -445,7 +445,7 @@ static int pciback_reconfigure(struct pciback_device *pdev)
err = pciback_remove_device(pdev, domain, bus, slot,
func);
- if(err)
+ if (err)
goto out;
/* TODO: If at some point we implement support for pci
@@ -466,8 +466,8 @@ static int pciback_reconfigure(struct pciback_device *pdev)
"Error switching to reconfigured state!");
goto out;
}
-
- out:
+
+out:
spin_unlock(&pdev->dev_lock);
return 0;
@@ -591,7 +591,7 @@ static int pciback_setup_backend(struct pciback_device
*pdev)
xenbus_dev_fatal(pdev->xdev, err, "Error switching "
"substate of dev-%d\n", i);
goto out;
- }
+ }
}
err = pciback_publish_pci_roots(pdev, pciback_publish_pci_root);
@@ -607,7 +607,7 @@ static int pciback_setup_backend(struct pciback_device
*pdev)
xenbus_dev_fatal(pdev->xdev, err,
"Error switching to initialised state!");
- out:
+out:
spin_unlock(&pdev->dev_lock);
if (!err)
@@ -663,7 +663,7 @@ static int pciback_xenbus_probe(struct xenbus_device *dev,
*/
pciback_be_watch(&pdev->be_watch, NULL, 0);
- out:
+out:
return err;
}
@@ -679,7 +679,7 @@ static int pciback_xenbus_remove(struct xenbus_device *dev)
static const struct xenbus_device_id xenpci_ids[] = {
{"pci"},
- {{0}},
+ {""},
};
static struct xenbus_driver xenbus_pciback_driver = {
--
1.6.2.5
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|