From ca6107528e5b5c986b64297ae62f706b5b391b0c Mon Sep 17 00:00:00 2001
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Date: Wed, 1 Apr 2015 17:01:26 -0400
Subject: [PATCH] xen/pcifront/pciback: Update pciif.h with ->err and ->result
 values.

The '->err' should contain only the XEN_PCI_ERR_* type values.
The '->result' may contain -EXX values or any other value
that the XEN_PCI_OP_* deems appropiate.

As such update the header and also the implementations.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>

Details in this thread:
https://patchwork.kernel.org/patch/8258431/
---
 drivers/pci/xen-pcifront.c            | 2 +-
 drivers/xen/xen-pciback/pciback_ops.c | 2 +-
 include/xen/interface/io/pciif.h      | 6 ++++--
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
index eba6e33147a2..cc6dcb13f1a8 100644
--- a/drivers/pci/xen-pcifront.c
+++ b/drivers/pci/xen-pcifront.c
@@ -298,7 +298,7 @@ static int pci_frontend_enable_msix(struct pci_dev *dev,
 	} else {
 		pci_err(dev, "enable msix get err %x\n", err);
 	}
-	return err;
+	return err ? -EINVAL : 0;
 }
 
 static void pci_frontend_disable_msix(struct pci_dev *dev)
diff --git a/drivers/xen/xen-pciback/pciback_ops.c b/drivers/xen/xen-pciback/pciback_ops.c
index ea4a08b83fa0..2d63aa2946a3 100644
--- a/drivers/xen/xen-pciback/pciback_ops.c
+++ b/drivers/xen/xen-pciback/pciback_ops.c
@@ -268,7 +268,7 @@ int xen_pcibk_enable_msix(struct xen_pcibk_device *pdev,
 	if (dev_data)
 		dev_data->ack_intr = 0;
 
-	return result > 0 ? 0 : result;
+	return result >= 0 ? 0 : XEN_PCI_ERR_op_failed;
 }
 
 static
diff --git a/include/xen/interface/io/pciif.h b/include/xen/interface/io/pciif.h
index d9922ae36eb5..c8b674fd2455 100644
--- a/include/xen/interface/io/pciif.h
+++ b/include/xen/interface/io/pciif.h
@@ -70,7 +70,7 @@ struct xen_pci_op {
 	/* IN: what action to perform: XEN_PCI_OP_* */
 	uint32_t cmd;
 
-	/* OUT: will contain an error number (if any) from errno.h */
+	/* OUT: will contain an XEN_PCI_ERR_* number. */
 	int32_t err;
 
 	/* IN: which device to touch */
@@ -82,7 +82,9 @@ struct xen_pci_op {
 	int32_t offset;
 	int32_t size;
 
-	/* IN/OUT: Contains the result after a READ or the value to WRITE */
+	/* IN/OUT: Contains the result after a READ or the value to WRITE.
+	 * If the err does not have XEN_PCI_ERR_success, depending on
+	 * XEN_PCI_OP_* might have the errno value. */
 	uint32_t value;
 	/* IN: Contains extra infor for this operation */
 	uint32_t info;
-- 
2.17.1