All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/6] PCI/treewide: Cleanup/streamline PCI error code handling
@ 2023-09-11 12:53 ` Ilpo Järvinen
  0 siblings, 0 replies; 27+ messages in thread
From: Ilpo Järvinen @ 2023-09-11 12:53 UTC (permalink / raw)
  To: Rob Herring, Bjorn Helgaas, linux-pci
  Cc: linux-kernel, 3chas3, brking, dalias, glaubitz, ink, jejb, kw,
	linux-alpha, linux-arm-kernel, linux-atm-general, linux-scsi,
	linux-sh, lpieralisi, martin.petersen, mattst88, netdev,
	richard.henderson, toan, ysato, Ilpo Järvinen

As the first step towards converting PCI accessor function return codes
into normal errnos this series cleans up related code paths which have
complicated multi-line construct to handle the PCI error checking.

I'd prefer these (the remaining ones) to be routed through PCI tree due
to PCI accessor function return code conversion being built on top of
them.

v3:
- Return pci_generic_config_read32()'s error code directly
- Removed already accepted patches

v2:
- Moved ret local var to the inner block (I2C: ali15x3)
- Removed already accepted patches


Ilpo Järvinen (6):
  alpha: Streamline convoluted PCI error handling
  sh: pci: Do PCI error check on own line
  atm: iphase: Do PCI error checks on own line
  PCI: Do error check on own line to split long if conditions
  PCI: xgene: Do PCI error check on own line & keep return value
  scsi: ipr: Do PCI error checks on own line

 arch/alpha/kernel/sys_miata.c      | 17 +++++++++--------
 arch/sh/drivers/pci/common.c       |  7 ++++---
 drivers/atm/iphase.c               | 20 +++++++++++---------
 drivers/pci/controller/pci-xgene.c |  7 ++++---
 drivers/pci/pci.c                  |  9 ++++++---
 drivers/pci/probe.c                |  6 +++---
 drivers/pci/quirks.c               |  6 +++---
 drivers/scsi/ipr.c                 | 12 ++++++++----
 8 files changed, 48 insertions(+), 36 deletions(-)

-- 
2.30.2


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH v3 0/6] PCI/treewide: Cleanup/streamline PCI error code handling
@ 2023-09-11 12:53 ` Ilpo Järvinen
  0 siblings, 0 replies; 27+ messages in thread
From: Ilpo Järvinen @ 2023-09-11 12:53 UTC (permalink / raw)
  To: Rob Herring, Bjorn Helgaas, linux-pci
  Cc: linux-kernel, 3chas3, brking, dalias, glaubitz, ink, jejb, kw,
	linux-alpha, linux-arm-kernel, linux-atm-general, linux-scsi,
	linux-sh, lpieralisi, martin.petersen, mattst88, netdev,
	richard.henderson, toan, ysato, Ilpo Järvinen

As the first step towards converting PCI accessor function return codes
into normal errnos this series cleans up related code paths which have
complicated multi-line construct to handle the PCI error checking.

I'd prefer these (the remaining ones) to be routed through PCI tree due
to PCI accessor function return code conversion being built on top of
them.

v3:
- Return pci_generic_config_read32()'s error code directly
- Removed already accepted patches

v2:
- Moved ret local var to the inner block (I2C: ali15x3)
- Removed already accepted patches


Ilpo Järvinen (6):
  alpha: Streamline convoluted PCI error handling
  sh: pci: Do PCI error check on own line
  atm: iphase: Do PCI error checks on own line
  PCI: Do error check on own line to split long if conditions
  PCI: xgene: Do PCI error check on own line & keep return value
  scsi: ipr: Do PCI error checks on own line

 arch/alpha/kernel/sys_miata.c      | 17 +++++++++--------
 arch/sh/drivers/pci/common.c       |  7 ++++---
 drivers/atm/iphase.c               | 20 +++++++++++---------
 drivers/pci/controller/pci-xgene.c |  7 ++++---
 drivers/pci/pci.c                  |  9 ++++++---
 drivers/pci/probe.c                |  6 +++---
 drivers/pci/quirks.c               |  6 +++---
 drivers/scsi/ipr.c                 | 12 ++++++++----
 8 files changed, 48 insertions(+), 36 deletions(-)

-- 
2.30.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH v3 0/6] PCI/treewide: Cleanup/streamline PCI error code handling
@ 2023-09-11 12:53 ` Ilpo Järvinen
  0 siblings, 0 replies; 27+ messages in thread
From: Ilpo Järvinen @ 2023-09-11 12:53 UTC (permalink / raw)
  To: Rob Herring, Bjorn Helgaas, linux-pci
  Cc: linux-kernel, 3chas3, brking, dalias, glaubitz, ink, jejb, kw,
	linux-alpha, linux-arm-kernel, linux-atm-general, linux-scsi,
	linux-sh, lpieralisi, martin.petersen, mattst88, netdev,
	richard.henderson, toan, ysato, Ilpo Järvinen

As the first step towards converting PCI accessor function return codes
into normal errnos this series cleans up related code paths which have
complicated multi-line construct to handle the PCI error checking.

I'd prefer these (the remaining ones) to be routed through PCI tree due
to PCI accessor function return code conversion being built on top of
them.

v3:
- Return pci_generic_config_read32()'s error code directly
- Removed already accepted patches

v2:
- Moved ret local var to the inner block (I2C: ali15x3)
- Removed already accepted patches


Ilpo Järvinen (6):
  alpha: Streamline convoluted PCI error handling
  sh: pci: Do PCI error check on own line
  atm: iphase: Do PCI error checks on own line
  PCI: Do error check on own line to split long if conditions
  PCI: xgene: Do PCI error check on own line & keep return value
  scsi: ipr: Do PCI error checks on own line

 arch/alpha/kernel/sys_miata.c      | 17 +++++++++--------
 arch/sh/drivers/pci/common.c       |  7 ++++---
 drivers/atm/iphase.c               | 20 +++++++++++---------
 drivers/pci/controller/pci-xgene.c |  7 ++++---
 drivers/pci/pci.c                  |  9 ++++++---
 drivers/pci/probe.c                |  6 +++---
 drivers/pci/quirks.c               |  6 +++---
 drivers/scsi/ipr.c                 | 12 ++++++++----
 8 files changed, 48 insertions(+), 36 deletions(-)

-- 
2.30.2


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH v3 1/6] alpha: Streamline convoluted PCI error handling
  2023-09-11 12:53 ` Ilpo Järvinen
  (?)
@ 2023-09-11 12:53   ` Ilpo Järvinen
  -1 siblings, 0 replies; 27+ messages in thread
From: Ilpo Järvinen @ 2023-09-11 12:53 UTC (permalink / raw)
  To: Rob Herring, Bjorn Helgaas, linux-pci, Richard Henderson,
	Ivan Kokshaysky, Matt Turner, linux-alpha, linux-kernel
  Cc: 3chas3, brking, dalias, glaubitz, jejb, kw, linux-arm-kernel,
	linux-atm-general, linux-scsi, linux-sh, lpieralisi,
	martin.petersen, netdev, toan, ysato, Ilpo Järvinen

miata_map_irq() handles PCI device and read config related errors in a
conditional block that is more complex than necessary.

Streamline the code flow and error handling.

No functional changes intended.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
 arch/alpha/kernel/sys_miata.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/arch/alpha/kernel/sys_miata.c b/arch/alpha/kernel/sys_miata.c
index e1bee8f84c58..33b2798de8fc 100644
--- a/arch/alpha/kernel/sys_miata.c
+++ b/arch/alpha/kernel/sys_miata.c
@@ -183,16 +183,17 @@ miata_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
            the 2nd 8259 controller. So we have to check for it first. */
 
 	if((slot == 7) && (PCI_FUNC(dev->devfn) == 3)) {
-		u8 irq=0;
 		struct pci_dev *pdev = pci_get_slot(dev->bus, dev->devfn & ~7);
-		if(pdev == NULL || pci_read_config_byte(pdev, 0x40,&irq) != PCIBIOS_SUCCESSFUL) {
-			pci_dev_put(pdev);
+		u8 irq = 0;
+		int ret;
+
+		if (!pdev)
 			return -1;
-		}
-		else	{
-			pci_dev_put(pdev);
-			return irq;
-		}
+
+		ret = pci_read_config_byte(pdev, 0x40, &irq);
+		pci_dev_put(pdev);
+
+		return ret == PCIBIOS_SUCCESSFUL ? irq : -1;
 	}
 
 	return COMMON_TABLE_LOOKUP;
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v3 1/6] alpha: Streamline convoluted PCI error handling
@ 2023-09-11 12:53   ` Ilpo Järvinen
  0 siblings, 0 replies; 27+ messages in thread
From: Ilpo Järvinen @ 2023-09-11 12:53 UTC (permalink / raw)
  To: Rob Herring, Bjorn Helgaas, linux-pci, Richard Henderson,
	Ivan Kokshaysky, Matt Turner, linux-alpha, linux-kernel
  Cc: 3chas3, brking, dalias, glaubitz, jejb, kw, linux-arm-kernel,
	linux-atm-general, linux-scsi, linux-sh, lpieralisi,
	martin.petersen, netdev, toan, ysato, Ilpo Järvinen

miata_map_irq() handles PCI device and read config related errors in a
conditional block that is more complex than necessary.

Streamline the code flow and error handling.

No functional changes intended.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
 arch/alpha/kernel/sys_miata.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/arch/alpha/kernel/sys_miata.c b/arch/alpha/kernel/sys_miata.c
index e1bee8f84c58..33b2798de8fc 100644
--- a/arch/alpha/kernel/sys_miata.c
+++ b/arch/alpha/kernel/sys_miata.c
@@ -183,16 +183,17 @@ miata_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
            the 2nd 8259 controller. So we have to check for it first. */
 
 	if((slot == 7) && (PCI_FUNC(dev->devfn) == 3)) {
-		u8 irq=0;
 		struct pci_dev *pdev = pci_get_slot(dev->bus, dev->devfn & ~7);
-		if(pdev == NULL || pci_read_config_byte(pdev, 0x40,&irq) != PCIBIOS_SUCCESSFUL) {
-			pci_dev_put(pdev);
+		u8 irq = 0;
+		int ret;
+
+		if (!pdev)
 			return -1;
-		}
-		else	{
-			pci_dev_put(pdev);
-			return irq;
-		}
+
+		ret = pci_read_config_byte(pdev, 0x40, &irq);
+		pci_dev_put(pdev);
+
+		return ret == PCIBIOS_SUCCESSFUL ? irq : -1;
 	}
 
 	return COMMON_TABLE_LOOKUP;
-- 
2.30.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v3 1/6] alpha: Streamline convoluted PCI error handling
@ 2023-09-11 12:53   ` Ilpo Järvinen
  0 siblings, 0 replies; 27+ messages in thread
From: Ilpo Järvinen @ 2023-09-11 12:53 UTC (permalink / raw)
  To: Rob Herring, Bjorn Helgaas, linux-pci, Richard Henderson,
	Ivan Kokshaysky, Matt Turner, linux-alpha, linux-kernel
  Cc: 3chas3, brking, dalias, glaubitz, jejb, kw, linux-arm-kernel,
	linux-atm-general, linux-scsi, linux-sh, lpieralisi,
	martin.petersen, netdev, toan, ysato, Ilpo Järvinen

miata_map_irq() handles PCI device and read config related errors in a
conditional block that is more complex than necessary.

Streamline the code flow and error handling.

No functional changes intended.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
 arch/alpha/kernel/sys_miata.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/arch/alpha/kernel/sys_miata.c b/arch/alpha/kernel/sys_miata.c
index e1bee8f84c58..33b2798de8fc 100644
--- a/arch/alpha/kernel/sys_miata.c
+++ b/arch/alpha/kernel/sys_miata.c
@@ -183,16 +183,17 @@ miata_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
            the 2nd 8259 controller. So we have to check for it first. */
 
 	if((slot == 7) && (PCI_FUNC(dev->devfn) == 3)) {
-		u8 irq=0;
 		struct pci_dev *pdev = pci_get_slot(dev->bus, dev->devfn & ~7);
-		if(pdev == NULL || pci_read_config_byte(pdev, 0x40,&irq) != PCIBIOS_SUCCESSFUL) {
-			pci_dev_put(pdev);
+		u8 irq = 0;
+		int ret;
+
+		if (!pdev)
 			return -1;
-		}
-		else	{
-			pci_dev_put(pdev);
-			return irq;
-		}
+
+		ret = pci_read_config_byte(pdev, 0x40, &irq);
+		pci_dev_put(pdev);
+
+		return ret == PCIBIOS_SUCCESSFUL ? irq : -1;
 	}
 
 	return COMMON_TABLE_LOOKUP;
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v3 2/6] sh: pci: Do PCI error check on own line
  2023-09-11 12:53 ` Ilpo Järvinen
  (?)
@ 2023-09-11 12:53   ` Ilpo Järvinen
  -1 siblings, 0 replies; 27+ messages in thread
From: Ilpo Järvinen @ 2023-09-11 12:53 UTC (permalink / raw)
  To: Rob Herring, Bjorn Helgaas, linux-pci, Yoshinori Sato,
	Rich Felker, John Paul Adrian Glaubitz, linux-sh, linux-kernel
  Cc: 3chas3, brking, ink, jejb, kw, linux-alpha, linux-arm-kernel,
	linux-atm-general, linux-scsi, lpieralisi, martin.petersen,
	mattst88, netdev, richard.henderson, toan, Ilpo Järvinen

Instead of a if condition with a line split, use the usual error
handling pattern with a separate variable to improve readability.

No functional changes intended.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Acked-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
---
 arch/sh/drivers/pci/common.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/sh/drivers/pci/common.c b/arch/sh/drivers/pci/common.c
index 2fd2b77e12ce..f59e5b9a6a80 100644
--- a/arch/sh/drivers/pci/common.c
+++ b/arch/sh/drivers/pci/common.c
@@ -53,15 +53,16 @@ int __init pci_is_66mhz_capable(struct pci_channel *hose,
 	unsigned short vid;
 	int cap66 = -1;
 	u16 stat;
+	int ret;
 
 	pr_info("PCI: Checking 66MHz capabilities...\n");
 
 	for (pci_devfn = 0; pci_devfn < 0xff; pci_devfn++) {
 		if (PCI_FUNC(pci_devfn))
 			continue;
-		if (early_read_config_word(hose, top_bus, current_bus,
-					   pci_devfn, PCI_VENDOR_ID, &vid) !=
-		    PCIBIOS_SUCCESSFUL)
+		ret = early_read_config_word(hose, top_bus, current_bus,
+					     pci_devfn, PCI_VENDOR_ID, &vid);
+		if (ret != PCIBIOS_SUCCESSFUL)
 			continue;
 		if (vid == 0xffff)
 			continue;
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v3 2/6] sh: pci: Do PCI error check on own line
@ 2023-09-11 12:53   ` Ilpo Järvinen
  0 siblings, 0 replies; 27+ messages in thread
From: Ilpo Järvinen @ 2023-09-11 12:53 UTC (permalink / raw)
  To: Rob Herring, Bjorn Helgaas, linux-pci, Yoshinori Sato,
	Rich Felker, John Paul Adrian Glaubitz, linux-sh, linux-kernel
  Cc: 3chas3, brking, ink, jejb, kw, linux-alpha, linux-arm-kernel,
	linux-atm-general, linux-scsi, lpieralisi, martin.petersen,
	mattst88, netdev, richard.henderson, toan, Ilpo Järvinen

Instead of a if condition with a line split, use the usual error
handling pattern with a separate variable to improve readability.

No functional changes intended.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Acked-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
---
 arch/sh/drivers/pci/common.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/sh/drivers/pci/common.c b/arch/sh/drivers/pci/common.c
index 2fd2b77e12ce..f59e5b9a6a80 100644
--- a/arch/sh/drivers/pci/common.c
+++ b/arch/sh/drivers/pci/common.c
@@ -53,15 +53,16 @@ int __init pci_is_66mhz_capable(struct pci_channel *hose,
 	unsigned short vid;
 	int cap66 = -1;
 	u16 stat;
+	int ret;
 
 	pr_info("PCI: Checking 66MHz capabilities...\n");
 
 	for (pci_devfn = 0; pci_devfn < 0xff; pci_devfn++) {
 		if (PCI_FUNC(pci_devfn))
 			continue;
-		if (early_read_config_word(hose, top_bus, current_bus,
-					   pci_devfn, PCI_VENDOR_ID, &vid) !=
-		    PCIBIOS_SUCCESSFUL)
+		ret = early_read_config_word(hose, top_bus, current_bus,
+					     pci_devfn, PCI_VENDOR_ID, &vid);
+		if (ret != PCIBIOS_SUCCESSFUL)
 			continue;
 		if (vid == 0xffff)
 			continue;
-- 
2.30.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v3 2/6] sh: pci: Do PCI error check on own line
@ 2023-09-11 12:53   ` Ilpo Järvinen
  0 siblings, 0 replies; 27+ messages in thread
From: Ilpo Järvinen @ 2023-09-11 12:53 UTC (permalink / raw)
  To: Rob Herring, Bjorn Helgaas, linux-pci, Yoshinori Sato,
	Rich Felker, John Paul Adrian Glaubitz, linux-sh, linux-kernel
  Cc: 3chas3, brking, ink, jejb, kw, linux-alpha, linux-arm-kernel,
	linux-atm-general, linux-scsi, lpieralisi, martin.petersen,
	mattst88, netdev, richard.henderson, toan, Ilpo Järvinen

Instead of a if condition with a line split, use the usual error
handling pattern with a separate variable to improve readability.

No functional changes intended.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Acked-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
---
 arch/sh/drivers/pci/common.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/sh/drivers/pci/common.c b/arch/sh/drivers/pci/common.c
index 2fd2b77e12ce..f59e5b9a6a80 100644
--- a/arch/sh/drivers/pci/common.c
+++ b/arch/sh/drivers/pci/common.c
@@ -53,15 +53,16 @@ int __init pci_is_66mhz_capable(struct pci_channel *hose,
 	unsigned short vid;
 	int cap66 = -1;
 	u16 stat;
+	int ret;
 
 	pr_info("PCI: Checking 66MHz capabilities...\n");
 
 	for (pci_devfn = 0; pci_devfn < 0xff; pci_devfn++) {
 		if (PCI_FUNC(pci_devfn))
 			continue;
-		if (early_read_config_word(hose, top_bus, current_bus,
-					   pci_devfn, PCI_VENDOR_ID, &vid) !=
-		    PCIBIOS_SUCCESSFUL)
+		ret = early_read_config_word(hose, top_bus, current_bus,
+					     pci_devfn, PCI_VENDOR_ID, &vid);
+		if (ret != PCIBIOS_SUCCESSFUL)
 			continue;
 		if (vid == 0xffff)
 			continue;
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v3 3/6] atm: iphase: Do PCI error checks on own line
  2023-09-11 12:53 ` Ilpo Järvinen
  (?)
@ 2023-09-11 12:53   ` Ilpo Järvinen
  -1 siblings, 0 replies; 27+ messages in thread
From: Ilpo Järvinen @ 2023-09-11 12:53 UTC (permalink / raw)
  To: Rob Herring, Bjorn Helgaas, linux-pci, Chas Williams,
	linux-atm-general, netdev, linux-kernel
  Cc: brking, dalias, glaubitz, ink, jejb, kw, linux-alpha,
	linux-arm-kernel, linux-scsi, linux-sh, lpieralisi,
	martin.petersen, mattst88, richard.henderson, toan, ysato,
	Ilpo Järvinen

In get_esi() PCI errors are checked inside line-split if conditions (in
addition to the file not following the coding style). To make the code
in get_esi() more readable, fix the coding style and use the usual
error handling pattern with a separate variable.

In addition, initialization of 'error' variable at declaration is not
needed.

No function changes intended.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
 drivers/atm/iphase.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/atm/iphase.c b/drivers/atm/iphase.c
index 324148686953..9bba8f280a4d 100644
--- a/drivers/atm/iphase.c
+++ b/drivers/atm/iphase.c
@@ -2291,19 +2291,21 @@ static int get_esi(struct atm_dev *dev)
 static int reset_sar(struct atm_dev *dev)  
 {  
 	IADEV *iadev;  
-	int i, error = 1;  
+	int i, error;
 	unsigned int pci[64];  
 	  
 	iadev = INPH_IA_DEV(dev);  
-	for(i=0; i<64; i++)  
-	  if ((error = pci_read_config_dword(iadev->pci,  
-				i*4, &pci[i])) != PCIBIOS_SUCCESSFUL)  
-  	      return error;  
+	for (i = 0; i < 64; i++) {
+		error = pci_read_config_dword(iadev->pci, i * 4, &pci[i]);
+		if (error != PCIBIOS_SUCCESSFUL)
+			return error;
+	}
 	writel(0, iadev->reg+IPHASE5575_EXT_RESET);  
-	for(i=0; i<64; i++)  
-	  if ((error = pci_write_config_dword(iadev->pci,  
-					i*4, pci[i])) != PCIBIOS_SUCCESSFUL)  
-	    return error;  
+	for (i = 0; i < 64; i++) {
+		error = pci_write_config_dword(iadev->pci, i * 4, pci[i]);
+		if (error != PCIBIOS_SUCCESSFUL)
+			return error;
+	}
 	udelay(5);  
 	return 0;  
 }  
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v3 3/6] atm: iphase: Do PCI error checks on own line
@ 2023-09-11 12:53   ` Ilpo Järvinen
  0 siblings, 0 replies; 27+ messages in thread
From: Ilpo Järvinen @ 2023-09-11 12:53 UTC (permalink / raw)
  To: Rob Herring, Bjorn Helgaas, linux-pci, Chas Williams,
	linux-atm-general, netdev, linux-kernel
  Cc: brking, dalias, glaubitz, ink, jejb, kw, linux-alpha,
	linux-arm-kernel, linux-scsi, linux-sh, lpieralisi,
	martin.petersen, mattst88, richard.henderson, toan, ysato,
	Ilpo Järvinen

In get_esi() PCI errors are checked inside line-split if conditions (in
addition to the file not following the coding style). To make the code
in get_esi() more readable, fix the coding style and use the usual
error handling pattern with a separate variable.

In addition, initialization of 'error' variable at declaration is not
needed.

No function changes intended.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
 drivers/atm/iphase.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/atm/iphase.c b/drivers/atm/iphase.c
index 324148686953..9bba8f280a4d 100644
--- a/drivers/atm/iphase.c
+++ b/drivers/atm/iphase.c
@@ -2291,19 +2291,21 @@ static int get_esi(struct atm_dev *dev)
 static int reset_sar(struct atm_dev *dev)  
 {  
 	IADEV *iadev;  
-	int i, error = 1;  
+	int i, error;
 	unsigned int pci[64];  
 	  
 	iadev = INPH_IA_DEV(dev);  
-	for(i=0; i<64; i++)  
-	  if ((error = pci_read_config_dword(iadev->pci,  
-				i*4, &pci[i])) != PCIBIOS_SUCCESSFUL)  
-  	      return error;  
+	for (i = 0; i < 64; i++) {
+		error = pci_read_config_dword(iadev->pci, i * 4, &pci[i]);
+		if (error != PCIBIOS_SUCCESSFUL)
+			return error;
+	}
 	writel(0, iadev->reg+IPHASE5575_EXT_RESET);  
-	for(i=0; i<64; i++)  
-	  if ((error = pci_write_config_dword(iadev->pci,  
-					i*4, pci[i])) != PCIBIOS_SUCCESSFUL)  
-	    return error;  
+	for (i = 0; i < 64; i++) {
+		error = pci_write_config_dword(iadev->pci, i * 4, pci[i]);
+		if (error != PCIBIOS_SUCCESSFUL)
+			return error;
+	}
 	udelay(5);  
 	return 0;  
 }  
-- 
2.30.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v3 3/6] atm: iphase: Do PCI error checks on own line
@ 2023-09-11 12:53   ` Ilpo Järvinen
  0 siblings, 0 replies; 27+ messages in thread
From: Ilpo Järvinen @ 2023-09-11 12:53 UTC (permalink / raw)
  To: Rob Herring, Bjorn Helgaas, linux-pci, Chas Williams,
	linux-atm-general, netdev, linux-kernel
  Cc: brking, dalias, glaubitz, ink, jejb, kw, linux-alpha,
	linux-arm-kernel, linux-scsi, linux-sh, lpieralisi,
	martin.petersen, mattst88, richard.henderson, toan, ysato,
	Ilpo Järvinen

In get_esi() PCI errors are checked inside line-split if conditions (in
addition to the file not following the coding style). To make the code
in get_esi() more readable, fix the coding style and use the usual
error handling pattern with a separate variable.

In addition, initialization of 'error' variable at declaration is not
needed.

No function changes intended.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
 drivers/atm/iphase.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/atm/iphase.c b/drivers/atm/iphase.c
index 324148686953..9bba8f280a4d 100644
--- a/drivers/atm/iphase.c
+++ b/drivers/atm/iphase.c
@@ -2291,19 +2291,21 @@ static int get_esi(struct atm_dev *dev)
 static int reset_sar(struct atm_dev *dev)  
 {  
 	IADEV *iadev;  
-	int i, error = 1;  
+	int i, error;
 	unsigned int pci[64];  
 	  
 	iadev = INPH_IA_DEV(dev);  
-	for(i=0; i<64; i++)  
-	  if ((error = pci_read_config_dword(iadev->pci,  
-				i*4, &pci[i])) != PCIBIOS_SUCCESSFUL)  
-  	      return error;  
+	for (i = 0; i < 64; i++) {
+		error = pci_read_config_dword(iadev->pci, i * 4, &pci[i]);
+		if (error != PCIBIOS_SUCCESSFUL)
+			return error;
+	}
 	writel(0, iadev->reg+IPHASE5575_EXT_RESET);  
-	for(i=0; i<64; i++)  
-	  if ((error = pci_write_config_dword(iadev->pci,  
-					i*4, pci[i])) != PCIBIOS_SUCCESSFUL)  
-	    return error;  
+	for (i = 0; i < 64; i++) {
+		error = pci_write_config_dword(iadev->pci, i * 4, pci[i]);
+		if (error != PCIBIOS_SUCCESSFUL)
+			return error;
+	}
 	udelay(5);  
 	return 0;  
 }  
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v3 4/6] PCI: Do error check on own line to split long if conditions
  2023-09-11 12:53 ` Ilpo Järvinen
  (?)
@ 2023-09-11 12:53   ` Ilpo Järvinen
  -1 siblings, 0 replies; 27+ messages in thread
From: Ilpo Järvinen @ 2023-09-11 12:53 UTC (permalink / raw)
  To: Rob Herring, Bjorn Helgaas, linux-pci, Bjorn Helgaas, linux-kernel
  Cc: 3chas3, brking, dalias, glaubitz, ink, jejb, kw, linux-alpha,
	linux-arm-kernel, linux-atm-general, linux-scsi, linux-sh,
	lpieralisi, martin.petersen, mattst88, netdev, richard.henderson,
	toan, ysato, Ilpo Järvinen

Placing PCI error code check inside if condition usually results in
need to split lines. Combined with additional conditions the if
condition becomes messy.

Convert to the usual error handling pattern with an additional variable
to improve code readability. In addition, reverse the logic in
pci_find_vsec_capability() to get rid of &&.

No functional changes intended.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
 drivers/pci/pci.c    | 9 ++++++---
 drivers/pci/probe.c  | 6 +++---
 drivers/pci/quirks.c | 6 +++---
 3 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 59c01d68c6d5..5e51e8bd5c13 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -732,15 +732,18 @@ u16 pci_find_vsec_capability(struct pci_dev *dev, u16 vendor, int cap)
 {
 	u16 vsec = 0;
 	u32 header;
+	int ret;
 
 	if (vendor != dev->vendor)
 		return 0;
 
 	while ((vsec = pci_find_next_ext_capability(dev, vsec,
 						     PCI_EXT_CAP_ID_VNDR))) {
-		if (pci_read_config_dword(dev, vsec + PCI_VNDR_HEADER,
-					  &header) == PCIBIOS_SUCCESSFUL &&
-		    PCI_VNDR_HEADER_ID(header) == cap)
+		ret = pci_read_config_dword(dev, vsec + PCI_VNDR_HEADER, &header);
+		if (ret != PCIBIOS_SUCCESSFUL)
+			continue;
+
+		if (PCI_VNDR_HEADER_ID(header) == cap)
 			return vsec;
 	}
 
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index ab2a4a3a4c06..0ad440190a32 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1651,15 +1651,15 @@ static void pci_set_removable(struct pci_dev *dev)
 static bool pci_ext_cfg_is_aliased(struct pci_dev *dev)
 {
 #ifdef CONFIG_PCI_QUIRKS
-	int pos;
+	int pos, ret;
 	u32 header, tmp;
 
 	pci_read_config_dword(dev, PCI_VENDOR_ID, &header);
 
 	for (pos = PCI_CFG_SPACE_SIZE;
 	     pos < PCI_CFG_SPACE_EXP_SIZE; pos += PCI_CFG_SPACE_SIZE) {
-		if (pci_read_config_dword(dev, pos, &tmp) != PCIBIOS_SUCCESSFUL
-		    || header != tmp)
+		ret = pci_read_config_dword(dev, pos, &tmp);
+		if ((ret != PCIBIOS_SUCCESSFUL) || (header != tmp))
 			return false;
 	}
 
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 5de09d2eb014..0d2e6b0f56cc 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -5383,7 +5383,7 @@ int pci_dev_specific_disable_acs_redir(struct pci_dev *dev)
  */
 static void quirk_intel_qat_vf_cap(struct pci_dev *pdev)
 {
-	int pos, i = 0;
+	int pos, i = 0, ret;
 	u8 next_cap;
 	u16 reg16, *cap;
 	struct pci_cap_saved_state *state;
@@ -5429,8 +5429,8 @@ static void quirk_intel_qat_vf_cap(struct pci_dev *pdev)
 		pdev->pcie_mpss = reg16 & PCI_EXP_DEVCAP_PAYLOAD;
 
 		pdev->cfg_size = PCI_CFG_SPACE_EXP_SIZE;
-		if (pci_read_config_dword(pdev, PCI_CFG_SPACE_SIZE, &status) !=
-		    PCIBIOS_SUCCESSFUL || (status == 0xffffffff))
+		ret = pci_read_config_dword(pdev, PCI_CFG_SPACE_SIZE, &status);
+		if ((ret != PCIBIOS_SUCCESSFUL) || (status == 0xffffffff))
 			pdev->cfg_size = PCI_CFG_SPACE_SIZE;
 
 		if (pci_find_saved_cap(pdev, PCI_CAP_ID_EXP))
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v3 4/6] PCI: Do error check on own line to split long if conditions
@ 2023-09-11 12:53   ` Ilpo Järvinen
  0 siblings, 0 replies; 27+ messages in thread
From: Ilpo Järvinen @ 2023-09-11 12:53 UTC (permalink / raw)
  To: Rob Herring, Bjorn Helgaas, linux-pci, Bjorn Helgaas, linux-kernel
  Cc: 3chas3, brking, dalias, glaubitz, ink, jejb, kw, linux-alpha,
	linux-arm-kernel, linux-atm-general, linux-scsi, linux-sh,
	lpieralisi, martin.petersen, mattst88, netdev, richard.henderson,
	toan, ysato, Ilpo Järvinen

Placing PCI error code check inside if condition usually results in
need to split lines. Combined with additional conditions the if
condition becomes messy.

Convert to the usual error handling pattern with an additional variable
to improve code readability. In addition, reverse the logic in
pci_find_vsec_capability() to get rid of &&.

No functional changes intended.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
 drivers/pci/pci.c    | 9 ++++++---
 drivers/pci/probe.c  | 6 +++---
 drivers/pci/quirks.c | 6 +++---
 3 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 59c01d68c6d5..5e51e8bd5c13 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -732,15 +732,18 @@ u16 pci_find_vsec_capability(struct pci_dev *dev, u16 vendor, int cap)
 {
 	u16 vsec = 0;
 	u32 header;
+	int ret;
 
 	if (vendor != dev->vendor)
 		return 0;
 
 	while ((vsec = pci_find_next_ext_capability(dev, vsec,
 						     PCI_EXT_CAP_ID_VNDR))) {
-		if (pci_read_config_dword(dev, vsec + PCI_VNDR_HEADER,
-					  &header) == PCIBIOS_SUCCESSFUL &&
-		    PCI_VNDR_HEADER_ID(header) == cap)
+		ret = pci_read_config_dword(dev, vsec + PCI_VNDR_HEADER, &header);
+		if (ret != PCIBIOS_SUCCESSFUL)
+			continue;
+
+		if (PCI_VNDR_HEADER_ID(header) == cap)
 			return vsec;
 	}
 
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index ab2a4a3a4c06..0ad440190a32 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1651,15 +1651,15 @@ static void pci_set_removable(struct pci_dev *dev)
 static bool pci_ext_cfg_is_aliased(struct pci_dev *dev)
 {
 #ifdef CONFIG_PCI_QUIRKS
-	int pos;
+	int pos, ret;
 	u32 header, tmp;
 
 	pci_read_config_dword(dev, PCI_VENDOR_ID, &header);
 
 	for (pos = PCI_CFG_SPACE_SIZE;
 	     pos < PCI_CFG_SPACE_EXP_SIZE; pos += PCI_CFG_SPACE_SIZE) {
-		if (pci_read_config_dword(dev, pos, &tmp) != PCIBIOS_SUCCESSFUL
-		    || header != tmp)
+		ret = pci_read_config_dword(dev, pos, &tmp);
+		if ((ret != PCIBIOS_SUCCESSFUL) || (header != tmp))
 			return false;
 	}
 
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 5de09d2eb014..0d2e6b0f56cc 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -5383,7 +5383,7 @@ int pci_dev_specific_disable_acs_redir(struct pci_dev *dev)
  */
 static void quirk_intel_qat_vf_cap(struct pci_dev *pdev)
 {
-	int pos, i = 0;
+	int pos, i = 0, ret;
 	u8 next_cap;
 	u16 reg16, *cap;
 	struct pci_cap_saved_state *state;
@@ -5429,8 +5429,8 @@ static void quirk_intel_qat_vf_cap(struct pci_dev *pdev)
 		pdev->pcie_mpss = reg16 & PCI_EXP_DEVCAP_PAYLOAD;
 
 		pdev->cfg_size = PCI_CFG_SPACE_EXP_SIZE;
-		if (pci_read_config_dword(pdev, PCI_CFG_SPACE_SIZE, &status) !=
-		    PCIBIOS_SUCCESSFUL || (status == 0xffffffff))
+		ret = pci_read_config_dword(pdev, PCI_CFG_SPACE_SIZE, &status);
+		if ((ret != PCIBIOS_SUCCESSFUL) || (status == 0xffffffff))
 			pdev->cfg_size = PCI_CFG_SPACE_SIZE;
 
 		if (pci_find_saved_cap(pdev, PCI_CAP_ID_EXP))
-- 
2.30.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v3 4/6] PCI: Do error check on own line to split long if conditions
@ 2023-09-11 12:53   ` Ilpo Järvinen
  0 siblings, 0 replies; 27+ messages in thread
From: Ilpo Järvinen @ 2023-09-11 12:53 UTC (permalink / raw)
  To: Rob Herring, Bjorn Helgaas, linux-pci, Bjorn Helgaas, linux-kernel
  Cc: 3chas3, brking, dalias, glaubitz, ink, jejb, kw, linux-alpha,
	linux-arm-kernel, linux-atm-general, linux-scsi, linux-sh,
	lpieralisi, martin.petersen, mattst88, netdev, richard.henderson,
	toan, ysato, Ilpo Järvinen

Placing PCI error code check inside if condition usually results in
need to split lines. Combined with additional conditions the if
condition becomes messy.

Convert to the usual error handling pattern with an additional variable
to improve code readability. In addition, reverse the logic in
pci_find_vsec_capability() to get rid of &&.

No functional changes intended.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
 drivers/pci/pci.c    | 9 ++++++---
 drivers/pci/probe.c  | 6 +++---
 drivers/pci/quirks.c | 6 +++---
 3 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 59c01d68c6d5..5e51e8bd5c13 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -732,15 +732,18 @@ u16 pci_find_vsec_capability(struct pci_dev *dev, u16 vendor, int cap)
 {
 	u16 vsec = 0;
 	u32 header;
+	int ret;
 
 	if (vendor != dev->vendor)
 		return 0;
 
 	while ((vsec = pci_find_next_ext_capability(dev, vsec,
 						     PCI_EXT_CAP_ID_VNDR))) {
-		if (pci_read_config_dword(dev, vsec + PCI_VNDR_HEADER,
-					  &header) == PCIBIOS_SUCCESSFUL &&
-		    PCI_VNDR_HEADER_ID(header) == cap)
+		ret = pci_read_config_dword(dev, vsec + PCI_VNDR_HEADER, &header);
+		if (ret != PCIBIOS_SUCCESSFUL)
+			continue;
+
+		if (PCI_VNDR_HEADER_ID(header) == cap)
 			return vsec;
 	}
 
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index ab2a4a3a4c06..0ad440190a32 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1651,15 +1651,15 @@ static void pci_set_removable(struct pci_dev *dev)
 static bool pci_ext_cfg_is_aliased(struct pci_dev *dev)
 {
 #ifdef CONFIG_PCI_QUIRKS
-	int pos;
+	int pos, ret;
 	u32 header, tmp;
 
 	pci_read_config_dword(dev, PCI_VENDOR_ID, &header);
 
 	for (pos = PCI_CFG_SPACE_SIZE;
 	     pos < PCI_CFG_SPACE_EXP_SIZE; pos += PCI_CFG_SPACE_SIZE) {
-		if (pci_read_config_dword(dev, pos, &tmp) != PCIBIOS_SUCCESSFUL
-		    || header != tmp)
+		ret = pci_read_config_dword(dev, pos, &tmp);
+		if ((ret != PCIBIOS_SUCCESSFUL) || (header != tmp))
 			return false;
 	}
 
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 5de09d2eb014..0d2e6b0f56cc 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -5383,7 +5383,7 @@ int pci_dev_specific_disable_acs_redir(struct pci_dev *dev)
  */
 static void quirk_intel_qat_vf_cap(struct pci_dev *pdev)
 {
-	int pos, i = 0;
+	int pos, i = 0, ret;
 	u8 next_cap;
 	u16 reg16, *cap;
 	struct pci_cap_saved_state *state;
@@ -5429,8 +5429,8 @@ static void quirk_intel_qat_vf_cap(struct pci_dev *pdev)
 		pdev->pcie_mpss = reg16 & PCI_EXP_DEVCAP_PAYLOAD;
 
 		pdev->cfg_size = PCI_CFG_SPACE_EXP_SIZE;
-		if (pci_read_config_dword(pdev, PCI_CFG_SPACE_SIZE, &status) !=
-		    PCIBIOS_SUCCESSFUL || (status == 0xffffffff))
+		ret = pci_read_config_dword(pdev, PCI_CFG_SPACE_SIZE, &status);
+		if ((ret != PCIBIOS_SUCCESSFUL) || (status == 0xffffffff))
 			pdev->cfg_size = PCI_CFG_SPACE_SIZE;
 
 		if (pci_find_saved_cap(pdev, PCI_CAP_ID_EXP))
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v3 5/6] PCI: xgene: Do PCI error check on own line & keep return value
  2023-09-11 12:53 ` Ilpo Järvinen
  (?)
@ 2023-09-11 12:53   ` Ilpo Järvinen
  -1 siblings, 0 replies; 27+ messages in thread
From: Ilpo Järvinen @ 2023-09-11 12:53 UTC (permalink / raw)
  To: Rob Herring, Bjorn Helgaas, linux-pci, Toan Le,
	Lorenzo Pieralisi, Krzysztof Wilczyński, Bjorn Helgaas,
	linux-arm-kernel, linux-kernel
  Cc: 3chas3, brking, dalias, glaubitz, ink, jejb, linux-alpha,
	linux-atm-general, linux-scsi, linux-sh, martin.petersen,
	mattst88, netdev, richard.henderson, ysato, Ilpo Järvinen

Instead of a if condition with a line split, use the usual error
handling pattern with a separate variable to improve readability.

pci_generic_config_read32() already returns either PCIBIOS_SUCCESSFUL
or PCIBIOS_DEVICE_NOT_FOUND so it is enough to simply return its
return value when ret != PCIBIOS_SUCCESSFUL.

No functional changes intended.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
 drivers/pci/controller/pci-xgene.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/controller/pci-xgene.c b/drivers/pci/controller/pci-xgene.c
index 887b4941ff32..8e457fa450a2 100644
--- a/drivers/pci/controller/pci-xgene.c
+++ b/drivers/pci/controller/pci-xgene.c
@@ -163,10 +163,11 @@ static int xgene_pcie_config_read32(struct pci_bus *bus, unsigned int devfn,
 				    int where, int size, u32 *val)
 {
 	struct xgene_pcie *port = pcie_bus_to_port(bus);
+	int ret;
 
-	if (pci_generic_config_read32(bus, devfn, where & ~0x3, 4, val) !=
-	    PCIBIOS_SUCCESSFUL)
-		return PCIBIOS_DEVICE_NOT_FOUND;
+	ret = pci_generic_config_read32(bus, devfn, where & ~0x3, 4, val);
+	if (ret != PCIBIOS_SUCCESSFUL)
+		return ret;
 
 	/*
 	 * The v1 controller has a bug in its Configuration Request Retry
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v3 5/6] PCI: xgene: Do PCI error check on own line & keep return value
@ 2023-09-11 12:53   ` Ilpo Järvinen
  0 siblings, 0 replies; 27+ messages in thread
From: Ilpo Järvinen @ 2023-09-11 12:53 UTC (permalink / raw)
  To: Rob Herring, Bjorn Helgaas, linux-pci, Toan Le,
	Lorenzo Pieralisi, Krzysztof Wilczyński, Bjorn Helgaas,
	linux-arm-kernel, linux-kernel
  Cc: 3chas3, brking, dalias, glaubitz, ink, jejb, linux-alpha,
	linux-atm-general, linux-scsi, linux-sh, martin.petersen,
	mattst88, netdev, richard.henderson, ysato, Ilpo Järvinen

Instead of a if condition with a line split, use the usual error
handling pattern with a separate variable to improve readability.

pci_generic_config_read32() already returns either PCIBIOS_SUCCESSFUL
or PCIBIOS_DEVICE_NOT_FOUND so it is enough to simply return its
return value when ret != PCIBIOS_SUCCESSFUL.

No functional changes intended.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
 drivers/pci/controller/pci-xgene.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/controller/pci-xgene.c b/drivers/pci/controller/pci-xgene.c
index 887b4941ff32..8e457fa450a2 100644
--- a/drivers/pci/controller/pci-xgene.c
+++ b/drivers/pci/controller/pci-xgene.c
@@ -163,10 +163,11 @@ static int xgene_pcie_config_read32(struct pci_bus *bus, unsigned int devfn,
 				    int where, int size, u32 *val)
 {
 	struct xgene_pcie *port = pcie_bus_to_port(bus);
+	int ret;
 
-	if (pci_generic_config_read32(bus, devfn, where & ~0x3, 4, val) !=
-	    PCIBIOS_SUCCESSFUL)
-		return PCIBIOS_DEVICE_NOT_FOUND;
+	ret = pci_generic_config_read32(bus, devfn, where & ~0x3, 4, val);
+	if (ret != PCIBIOS_SUCCESSFUL)
+		return ret;
 
 	/*
 	 * The v1 controller has a bug in its Configuration Request Retry
-- 
2.30.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v3 5/6] PCI: xgene: Do PCI error check on own line & keep return value
@ 2023-09-11 12:53   ` Ilpo Järvinen
  0 siblings, 0 replies; 27+ messages in thread
From: Ilpo Järvinen @ 2023-09-11 12:53 UTC (permalink / raw)
  To: Rob Herring, Bjorn Helgaas, linux-pci, Toan Le,
	Lorenzo Pieralisi, Krzysztof Wilczyński, Bjorn Helgaas,
	linux-arm-kernel, linux-kernel
  Cc: 3chas3, brking, dalias, glaubitz, ink, jejb, linux-alpha,
	linux-atm-general, linux-scsi, linux-sh, martin.petersen,
	mattst88, netdev, richard.henderson, ysato, Ilpo Järvinen

Instead of a if condition with a line split, use the usual error
handling pattern with a separate variable to improve readability.

pci_generic_config_read32() already returns either PCIBIOS_SUCCESSFUL
or PCIBIOS_DEVICE_NOT_FOUND so it is enough to simply return its
return value when ret != PCIBIOS_SUCCESSFUL.

No functional changes intended.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
 drivers/pci/controller/pci-xgene.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/controller/pci-xgene.c b/drivers/pci/controller/pci-xgene.c
index 887b4941ff32..8e457fa450a2 100644
--- a/drivers/pci/controller/pci-xgene.c
+++ b/drivers/pci/controller/pci-xgene.c
@@ -163,10 +163,11 @@ static int xgene_pcie_config_read32(struct pci_bus *bus, unsigned int devfn,
 				    int where, int size, u32 *val)
 {
 	struct xgene_pcie *port = pcie_bus_to_port(bus);
+	int ret;
 
-	if (pci_generic_config_read32(bus, devfn, where & ~0x3, 4, val) !=
-	    PCIBIOS_SUCCESSFUL)
-		return PCIBIOS_DEVICE_NOT_FOUND;
+	ret = pci_generic_config_read32(bus, devfn, where & ~0x3, 4, val);
+	if (ret != PCIBIOS_SUCCESSFUL)
+		return ret;
 
 	/*
 	 * The v1 controller has a bug in its Configuration Request Retry
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v3 6/6] scsi: ipr: Do PCI error checks on own line
  2023-09-11 12:53 ` Ilpo Järvinen
  (?)
@ 2023-09-11 12:53   ` Ilpo Järvinen
  -1 siblings, 0 replies; 27+ messages in thread
From: Ilpo Järvinen @ 2023-09-11 12:53 UTC (permalink / raw)
  To: Rob Herring, Bjorn Helgaas, linux-pci, Brian King,
	James E.J. Bottomley, Martin K. Petersen, linux-scsi,
	linux-kernel
  Cc: 3chas3, dalias, glaubitz, ink, kw, linux-alpha, linux-arm-kernel,
	linux-atm-general, linux-sh, lpieralisi, mattst88, netdev,
	richard.henderson, toan, ysato, Ilpo Järvinen

Instead of if conditions with line splits, use the usual error handling
pattern with a separate variable to improve readability.

No functional changes intended.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
 drivers/scsi/ipr.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index 4e13797b2a4a..81e3d464d1f6 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -761,12 +761,14 @@ static void ipr_mask_and_clear_interrupts(struct ipr_ioa_cfg *ioa_cfg,
 static int ipr_save_pcix_cmd_reg(struct ipr_ioa_cfg *ioa_cfg)
 {
 	int pcix_cmd_reg = pci_find_capability(ioa_cfg->pdev, PCI_CAP_ID_PCIX);
+	int rc;
 
 	if (pcix_cmd_reg == 0)
 		return 0;
 
-	if (pci_read_config_word(ioa_cfg->pdev, pcix_cmd_reg + PCI_X_CMD,
-				 &ioa_cfg->saved_pcix_cmd_reg) != PCIBIOS_SUCCESSFUL) {
+	rc = pci_read_config_word(ioa_cfg->pdev, pcix_cmd_reg + PCI_X_CMD,
+				  &ioa_cfg->saved_pcix_cmd_reg);
+	if (rc != PCIBIOS_SUCCESSFUL) {
 		dev_err(&ioa_cfg->pdev->dev, "Failed to save PCI-X command register\n");
 		return -EIO;
 	}
@@ -785,10 +787,12 @@ static int ipr_save_pcix_cmd_reg(struct ipr_ioa_cfg *ioa_cfg)
 static int ipr_set_pcix_cmd_reg(struct ipr_ioa_cfg *ioa_cfg)
 {
 	int pcix_cmd_reg = pci_find_capability(ioa_cfg->pdev, PCI_CAP_ID_PCIX);
+	int rc;
 
 	if (pcix_cmd_reg) {
-		if (pci_write_config_word(ioa_cfg->pdev, pcix_cmd_reg + PCI_X_CMD,
-					  ioa_cfg->saved_pcix_cmd_reg) != PCIBIOS_SUCCESSFUL) {
+		rc = pci_write_config_word(ioa_cfg->pdev, pcix_cmd_reg + PCI_X_CMD,
+					   ioa_cfg->saved_pcix_cmd_reg);
+		if (rc != PCIBIOS_SUCCESSFUL) {
 			dev_err(&ioa_cfg->pdev->dev, "Failed to setup PCI-X command register\n");
 			return -EIO;
 		}
-- 
2.30.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v3 6/6] scsi: ipr: Do PCI error checks on own line
@ 2023-09-11 12:53   ` Ilpo Järvinen
  0 siblings, 0 replies; 27+ messages in thread
From: Ilpo Järvinen @ 2023-09-11 12:53 UTC (permalink / raw)
  To: Rob Herring, Bjorn Helgaas, linux-pci, Brian King,
	James E.J. Bottomley, Martin K. Petersen, linux-scsi,
	linux-kernel
  Cc: 3chas3, dalias, glaubitz, ink, kw, linux-alpha, linux-arm-kernel,
	linux-atm-general, linux-sh, lpieralisi, mattst88, netdev,
	richard.henderson, toan, ysato, Ilpo Järvinen

Instead of if conditions with line splits, use the usual error handling
pattern with a separate variable to improve readability.

No functional changes intended.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
 drivers/scsi/ipr.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index 4e13797b2a4a..81e3d464d1f6 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -761,12 +761,14 @@ static void ipr_mask_and_clear_interrupts(struct ipr_ioa_cfg *ioa_cfg,
 static int ipr_save_pcix_cmd_reg(struct ipr_ioa_cfg *ioa_cfg)
 {
 	int pcix_cmd_reg = pci_find_capability(ioa_cfg->pdev, PCI_CAP_ID_PCIX);
+	int rc;
 
 	if (pcix_cmd_reg == 0)
 		return 0;
 
-	if (pci_read_config_word(ioa_cfg->pdev, pcix_cmd_reg + PCI_X_CMD,
-				 &ioa_cfg->saved_pcix_cmd_reg) != PCIBIOS_SUCCESSFUL) {
+	rc = pci_read_config_word(ioa_cfg->pdev, pcix_cmd_reg + PCI_X_CMD,
+				  &ioa_cfg->saved_pcix_cmd_reg);
+	if (rc != PCIBIOS_SUCCESSFUL) {
 		dev_err(&ioa_cfg->pdev->dev, "Failed to save PCI-X command register\n");
 		return -EIO;
 	}
@@ -785,10 +787,12 @@ static int ipr_save_pcix_cmd_reg(struct ipr_ioa_cfg *ioa_cfg)
 static int ipr_set_pcix_cmd_reg(struct ipr_ioa_cfg *ioa_cfg)
 {
 	int pcix_cmd_reg = pci_find_capability(ioa_cfg->pdev, PCI_CAP_ID_PCIX);
+	int rc;
 
 	if (pcix_cmd_reg) {
-		if (pci_write_config_word(ioa_cfg->pdev, pcix_cmd_reg + PCI_X_CMD,
-					  ioa_cfg->saved_pcix_cmd_reg) != PCIBIOS_SUCCESSFUL) {
+		rc = pci_write_config_word(ioa_cfg->pdev, pcix_cmd_reg + PCI_X_CMD,
+					   ioa_cfg->saved_pcix_cmd_reg);
+		if (rc != PCIBIOS_SUCCESSFUL) {
 			dev_err(&ioa_cfg->pdev->dev, "Failed to setup PCI-X command register\n");
 			return -EIO;
 		}
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v3 6/6] scsi: ipr: Do PCI error checks on own line
@ 2023-09-11 12:53   ` Ilpo Järvinen
  0 siblings, 0 replies; 27+ messages in thread
From: Ilpo Järvinen @ 2023-09-11 12:53 UTC (permalink / raw)
  To: Rob Herring, Bjorn Helgaas, linux-pci, Brian King,
	James E.J. Bottomley, Martin K. Petersen, linux-scsi,
	linux-kernel
  Cc: 3chas3, dalias, glaubitz, ink, kw, linux-alpha, linux-arm-kernel,
	linux-atm-general, linux-sh, lpieralisi, mattst88, netdev,
	richard.henderson, toan, ysato, Ilpo Järvinen

Instead of if conditions with line splits, use the usual error handling
pattern with a separate variable to improve readability.

No functional changes intended.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
 drivers/scsi/ipr.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index 4e13797b2a4a..81e3d464d1f6 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -761,12 +761,14 @@ static void ipr_mask_and_clear_interrupts(struct ipr_ioa_cfg *ioa_cfg,
 static int ipr_save_pcix_cmd_reg(struct ipr_ioa_cfg *ioa_cfg)
 {
 	int pcix_cmd_reg = pci_find_capability(ioa_cfg->pdev, PCI_CAP_ID_PCIX);
+	int rc;
 
 	if (pcix_cmd_reg == 0)
 		return 0;
 
-	if (pci_read_config_word(ioa_cfg->pdev, pcix_cmd_reg + PCI_X_CMD,
-				 &ioa_cfg->saved_pcix_cmd_reg) != PCIBIOS_SUCCESSFUL) {
+	rc = pci_read_config_word(ioa_cfg->pdev, pcix_cmd_reg + PCI_X_CMD,
+				  &ioa_cfg->saved_pcix_cmd_reg);
+	if (rc != PCIBIOS_SUCCESSFUL) {
 		dev_err(&ioa_cfg->pdev->dev, "Failed to save PCI-X command register\n");
 		return -EIO;
 	}
@@ -785,10 +787,12 @@ static int ipr_save_pcix_cmd_reg(struct ipr_ioa_cfg *ioa_cfg)
 static int ipr_set_pcix_cmd_reg(struct ipr_ioa_cfg *ioa_cfg)
 {
 	int pcix_cmd_reg = pci_find_capability(ioa_cfg->pdev, PCI_CAP_ID_PCIX);
+	int rc;
 
 	if (pcix_cmd_reg) {
-		if (pci_write_config_word(ioa_cfg->pdev, pcix_cmd_reg + PCI_X_CMD,
-					  ioa_cfg->saved_pcix_cmd_reg) != PCIBIOS_SUCCESSFUL) {
+		rc = pci_write_config_word(ioa_cfg->pdev, pcix_cmd_reg + PCI_X_CMD,
+					   ioa_cfg->saved_pcix_cmd_reg);
+		if (rc != PCIBIOS_SUCCESSFUL) {
 			dev_err(&ioa_cfg->pdev->dev, "Failed to setup PCI-X command register\n");
 			return -EIO;
 		}
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* Re: [PATCH v3 6/6] scsi: ipr: Do PCI error checks on own line
  2023-09-11 12:53   ` Ilpo Järvinen
@ 2023-09-14  1:00     ` Martin K. Petersen
  -1 siblings, 0 replies; 27+ messages in thread
From: Martin K. Petersen @ 2023-09-14  1:00 UTC (permalink / raw)
  To: Ilpo Järvinen
  Cc: Rob Herring, Bjorn Helgaas, linux-pci, Brian King,
	James E.J. Bottomley, Martin K. Petersen, linux-scsi,
	linux-kernel, 3chas3, dalias, glaubitz, ink, kw, linux-alpha,
	linux-arm-kernel, linux-atm-general, linux-sh, lpieralisi,
	mattst88, netdev, richard.henderson, toan, ysato


Ilpo,

> Instead of if conditions with line splits, use the usual error handling
> pattern with a separate variable to improve readability.
>
> No functional changes intended.

Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>

-- 
Martin K. Petersen	Oracle Linux Engineering

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v3 6/6] scsi: ipr: Do PCI error checks on own line
@ 2023-09-14  1:00     ` Martin K. Petersen
  0 siblings, 0 replies; 27+ messages in thread
From: Martin K. Petersen @ 2023-09-14  1:00 UTC (permalink / raw)
  To: Ilpo Järvinen
  Cc: Rob Herring, Bjorn Helgaas, linux-pci, Brian King,
	James E.J. Bottomley, Martin K. Petersen, linux-scsi,
	linux-kernel, 3chas3, dalias, glaubitz, ink, kw, linux-alpha,
	linux-arm-kernel, linux-atm-general, linux-sh, lpieralisi,
	mattst88, netdev, richard.henderson, toan, ysato


Ilpo,

> Instead of if conditions with line splits, use the usual error handling
> pattern with a separate variable to improve readability.
>
> No functional changes intended.

Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v3 0/6] PCI/treewide: Cleanup/streamline PCI error code handling
  2023-09-11 12:53 ` Ilpo Järvinen
@ 2023-10-10 22:35   ` Bjorn Helgaas
  -1 siblings, 0 replies; 27+ messages in thread
From: Bjorn Helgaas @ 2023-10-10 22:35 UTC (permalink / raw)
  To: Ilpo Järvinen
  Cc: Rob Herring, linux-pci, linux-kernel, 3chas3, brking, dalias,
	glaubitz, ink, jejb, kw, linux-alpha, linux-arm-kernel,
	linux-atm-general, linux-scsi, linux-sh, lpieralisi,
	martin.petersen, mattst88, netdev, richard.henderson, toan,
	ysato, Tadeusz Struk

[+cc Tadeusz; updates to quirk_intel_qat_vf_cap()]

On Mon, Sep 11, 2023 at 03:53:48PM +0300, Ilpo Järvinen wrote:
> As the first step towards converting PCI accessor function return codes
> into normal errnos this series cleans up related code paths which have
> complicated multi-line construct to handle the PCI error checking.
> 
> I'd prefer these (the remaining ones) to be routed through PCI tree due
> to PCI accessor function return code conversion being built on top of
> them.
> 
> v3:
> - Return pci_generic_config_read32()'s error code directly
> - Removed already accepted patches
> 
> v2:
> - Moved ret local var to the inner block (I2C: ali15x3)
> - Removed already accepted patches
> 
> 
> Ilpo Järvinen (6):
>   alpha: Streamline convoluted PCI error handling
>   sh: pci: Do PCI error check on own line
>   atm: iphase: Do PCI error checks on own line
>   PCI: Do error check on own line to split long if conditions
>   PCI: xgene: Do PCI error check on own line & keep return value
>   scsi: ipr: Do PCI error checks on own line
> 
>  arch/alpha/kernel/sys_miata.c      | 17 +++++++++--------
>  arch/sh/drivers/pci/common.c       |  7 ++++---
>  drivers/atm/iphase.c               | 20 +++++++++++---------
>  drivers/pci/controller/pci-xgene.c |  7 ++++---
>  drivers/pci/pci.c                  |  9 ++++++---
>  drivers/pci/probe.c                |  6 +++---
>  drivers/pci/quirks.c               |  6 +++---
>  drivers/scsi/ipr.c                 | 12 ++++++++----
>  8 files changed, 48 insertions(+), 36 deletions(-)

Applied all to pci/config-errs for v6.7, thanks!

I made the tweaks below; heads-up to John Paul and Tadeusz.

Oh, and weird experience applying these via b4, git am: the
Signed-off-by was corrupted on these patches:

  https://lore.kernel.org/r/20230911125354.25501-7-ilpo.jarvinen@linux.intel.com  https://lore.kernel.org/r/20230911125354.25501-6-ilpo.jarvinen@linux.intel.com  https://lore.kernel.org/r/20230911125354.25501-3-ilpo.jarvinen@linux.intel.com

It looked like this:

  Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

Not sure why this happened; maybe one of the mailing lists screwed it
up and the order of arrival determines which one b4 uses?  The ones
from linux-alpha look like:

  Signed-off-by: Ilpo J=C3=A4rvinen <ilpo.jarvinen@linux.intel.com>

which I think corresponds to the bad rendering.  I think I fixed them
all.

Bjorn

diff --git a/arch/sh/drivers/pci/common.c b/arch/sh/drivers/pci/common.c
index f59e5b9a6a80..ab9e791070b4 100644
--- a/arch/sh/drivers/pci/common.c
+++ b/arch/sh/drivers/pci/common.c
@@ -50,7 +50,7 @@ int __init pci_is_66mhz_capable(struct pci_channel *hose,
 				int top_bus, int current_bus)
 {
 	u32 pci_devfn;
-	unsigned short vid;
+	u16 vid;
 	int cap66 = -1;
 	u16 stat;
 	int ret;
@@ -64,7 +64,7 @@ int __init pci_is_66mhz_capable(struct pci_channel *hose,
 					     pci_devfn, PCI_VENDOR_ID, &vid);
 		if (ret != PCIBIOS_SUCCESSFUL)
 			continue;
-		if (vid == 0xffff)
+		if (PCI_POSSIBLE_ERROR(vid))
 			continue;
 
 		/* check 66MHz capability */
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 81f3da536a3c..f5fc92441194 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -5430,7 +5430,7 @@ static void quirk_intel_qat_vf_cap(struct pci_dev *pdev)
 
 		pdev->cfg_size = PCI_CFG_SPACE_EXP_SIZE;
 		ret = pci_read_config_dword(pdev, PCI_CFG_SPACE_SIZE, &status);
-		if ((ret != PCIBIOS_SUCCESSFUL) || (status == 0xffffffff))
+		if ((ret != PCIBIOS_SUCCESSFUL) || (PCI_POSSIBLE_ERROR(status)))
 			pdev->cfg_size = PCI_CFG_SPACE_SIZE;
 
 		if (pci_find_saved_cap(pdev, PCI_CAP_ID_EXP))

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* Re: [PATCH v3 0/6] PCI/treewide: Cleanup/streamline PCI error code handling
@ 2023-10-10 22:35   ` Bjorn Helgaas
  0 siblings, 0 replies; 27+ messages in thread
From: Bjorn Helgaas @ 2023-10-10 22:35 UTC (permalink / raw)
  To: Ilpo Järvinen
  Cc: Rob Herring, linux-pci, linux-kernel, 3chas3, brking, dalias,
	glaubitz, ink, jejb, kw, linux-alpha, linux-arm-kernel,
	linux-atm-general, linux-scsi, linux-sh, lpieralisi,
	martin.petersen, mattst88, netdev, richard.henderson, toan,
	ysato, Tadeusz Struk

[+cc Tadeusz; updates to quirk_intel_qat_vf_cap()]

On Mon, Sep 11, 2023 at 03:53:48PM +0300, Ilpo Järvinen wrote:
> As the first step towards converting PCI accessor function return codes
> into normal errnos this series cleans up related code paths which have
> complicated multi-line construct to handle the PCI error checking.
> 
> I'd prefer these (the remaining ones) to be routed through PCI tree due
> to PCI accessor function return code conversion being built on top of
> them.
> 
> v3:
> - Return pci_generic_config_read32()'s error code directly
> - Removed already accepted patches
> 
> v2:
> - Moved ret local var to the inner block (I2C: ali15x3)
> - Removed already accepted patches
> 
> 
> Ilpo Järvinen (6):
>   alpha: Streamline convoluted PCI error handling
>   sh: pci: Do PCI error check on own line
>   atm: iphase: Do PCI error checks on own line
>   PCI: Do error check on own line to split long if conditions
>   PCI: xgene: Do PCI error check on own line & keep return value
>   scsi: ipr: Do PCI error checks on own line
> 
>  arch/alpha/kernel/sys_miata.c      | 17 +++++++++--------
>  arch/sh/drivers/pci/common.c       |  7 ++++---
>  drivers/atm/iphase.c               | 20 +++++++++++---------
>  drivers/pci/controller/pci-xgene.c |  7 ++++---
>  drivers/pci/pci.c                  |  9 ++++++---
>  drivers/pci/probe.c                |  6 +++---
>  drivers/pci/quirks.c               |  6 +++---
>  drivers/scsi/ipr.c                 | 12 ++++++++----
>  8 files changed, 48 insertions(+), 36 deletions(-)

Applied all to pci/config-errs for v6.7, thanks!

I made the tweaks below; heads-up to John Paul and Tadeusz.

Oh, and weird experience applying these via b4, git am: the
Signed-off-by was corrupted on these patches:

  https://lore.kernel.org/r/20230911125354.25501-7-ilpo.jarvinen@linux.intel.com  https://lore.kernel.org/r/20230911125354.25501-6-ilpo.jarvinen@linux.intel.com  https://lore.kernel.org/r/20230911125354.25501-3-ilpo.jarvinen@linux.intel.com

It looked like this:

  Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

Not sure why this happened; maybe one of the mailing lists screwed it
up and the order of arrival determines which one b4 uses?  The ones
from linux-alpha look like:

  Signed-off-by: Ilpo J=C3=A4rvinen <ilpo.jarvinen@linux.intel.com>

which I think corresponds to the bad rendering.  I think I fixed them
all.

Bjorn

diff --git a/arch/sh/drivers/pci/common.c b/arch/sh/drivers/pci/common.c
index f59e5b9a6a80..ab9e791070b4 100644
--- a/arch/sh/drivers/pci/common.c
+++ b/arch/sh/drivers/pci/common.c
@@ -50,7 +50,7 @@ int __init pci_is_66mhz_capable(struct pci_channel *hose,
 				int top_bus, int current_bus)
 {
 	u32 pci_devfn;
-	unsigned short vid;
+	u16 vid;
 	int cap66 = -1;
 	u16 stat;
 	int ret;
@@ -64,7 +64,7 @@ int __init pci_is_66mhz_capable(struct pci_channel *hose,
 					     pci_devfn, PCI_VENDOR_ID, &vid);
 		if (ret != PCIBIOS_SUCCESSFUL)
 			continue;
-		if (vid == 0xffff)
+		if (PCI_POSSIBLE_ERROR(vid))
 			continue;
 
 		/* check 66MHz capability */
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 81f3da536a3c..f5fc92441194 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -5430,7 +5430,7 @@ static void quirk_intel_qat_vf_cap(struct pci_dev *pdev)
 
 		pdev->cfg_size = PCI_CFG_SPACE_EXP_SIZE;
 		ret = pci_read_config_dword(pdev, PCI_CFG_SPACE_SIZE, &status);
-		if ((ret != PCIBIOS_SUCCESSFUL) || (status == 0xffffffff))
+		if ((ret != PCIBIOS_SUCCESSFUL) || (PCI_POSSIBLE_ERROR(status)))
 			pdev->cfg_size = PCI_CFG_SPACE_SIZE;
 
 		if (pci_find_saved_cap(pdev, PCI_CAP_ID_EXP))

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* Re: [PATCH v3 0/6] PCI/treewide: Cleanup/streamline PCI error code handling
  2023-10-10 22:35   ` Bjorn Helgaas
@ 2023-10-11 11:07     ` Ilpo Järvinen
  -1 siblings, 0 replies; 27+ messages in thread
From: Ilpo Järvinen @ 2023-10-11 11:07 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Rob Herring, linux-pci, LKML, 3chas3, brking, dalias, glaubitz,
	ink, jejb, kw, linux-alpha, linux-arm-kernel, linux-atm-general,
	linux-scsi, linux-sh, lpieralisi, martin.petersen, mattst88,
	Netdev, richard.henderson, toan, ysato, Tadeusz Struk

[-- Attachment #1: Type: text/plain, Size: 2847 bytes --]

On Tue, 10 Oct 2023, Bjorn Helgaas wrote:

> [+cc Tadeusz; updates to quirk_intel_qat_vf_cap()]
> 
> On Mon, Sep 11, 2023 at 03:53:48PM +0300, Ilpo Järvinen wrote:
> > As the first step towards converting PCI accessor function return codes
> > into normal errnos this series cleans up related code paths which have
> > complicated multi-line construct to handle the PCI error checking.
> > 
> > I'd prefer these (the remaining ones) to be routed through PCI tree due
> > to PCI accessor function return code conversion being built on top of
> > them.
> > 
> > v3:
> > - Return pci_generic_config_read32()'s error code directly
> > - Removed already accepted patches
> > 
> > v2:
> > - Moved ret local var to the inner block (I2C: ali15x3)
> > - Removed already accepted patches
> > 
> > 
> > Ilpo Järvinen (6):
> >   alpha: Streamline convoluted PCI error handling
> >   sh: pci: Do PCI error check on own line
> >   atm: iphase: Do PCI error checks on own line
> >   PCI: Do error check on own line to split long if conditions
> >   PCI: xgene: Do PCI error check on own line & keep return value
> >   scsi: ipr: Do PCI error checks on own line
> > 
> >  arch/alpha/kernel/sys_miata.c      | 17 +++++++++--------
> >  arch/sh/drivers/pci/common.c       |  7 ++++---
> >  drivers/atm/iphase.c               | 20 +++++++++++---------
> >  drivers/pci/controller/pci-xgene.c |  7 ++++---
> >  drivers/pci/pci.c                  |  9 ++++++---
> >  drivers/pci/probe.c                |  6 +++---
> >  drivers/pci/quirks.c               |  6 +++---
> >  drivers/scsi/ipr.c                 | 12 ++++++++----
> >  8 files changed, 48 insertions(+), 36 deletions(-)
> 
> Applied all to pci/config-errs for v6.7, thanks!
> 
> I made the tweaks below; heads-up to John Paul and Tadeusz.
> 
> Oh, and weird experience applying these via b4, git am: the
> Signed-off-by was corrupted on these patches:
> 
>   https://lore.kernel.org/r/20230911125354.25501-7-ilpo.jarvinen@linux.intel.com  https://lore.kernel.org/r/20230911125354.25501-6-ilpo.jarvinen@linux.intel.com  https://lore.kernel.org/r/20230911125354.25501-3-ilpo.jarvinen@linux.intel.com
> 
> It looked like this:
> 
>   Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> 
> Not sure why this happened; maybe one of the mailing lists screwed it
> up and the order of arrival determines which one b4 uses?  The ones
> from linux-alpha look like:
> 
>   Signed-off-by: Ilpo J=C3=A4rvinen <ilpo.jarvinen@linux.intel.com>
> 
> which I think corresponds to the bad rendering.  I think I fixed them
> all.

Thanks for letting me know. It seems that copies of the same mail

https://lore.kernel.org/linux-alpha/...
https://lore.kernel.org/linux-pci/...

do indeed differ for some reason. I'll probably have to experiment to see 
if I can reproduce problem with the linux-alpha list.


-- 
 i.

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v3 0/6] PCI/treewide: Cleanup/streamline PCI error code handling
@ 2023-10-11 11:07     ` Ilpo Järvinen
  0 siblings, 0 replies; 27+ messages in thread
From: Ilpo Järvinen @ 2023-10-11 11:07 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Rob Herring, linux-pci, LKML, 3chas3, brking, dalias, glaubitz,
	ink, jejb, kw, linux-alpha, linux-arm-kernel, linux-atm-general,
	linux-scsi, linux-sh, lpieralisi, martin.petersen, mattst88,
	Netdev, richard.henderson, toan, ysato, Tadeusz Struk

[-- Attachment #1: Type: text/plain, Size: 2847 bytes --]

On Tue, 10 Oct 2023, Bjorn Helgaas wrote:

> [+cc Tadeusz; updates to quirk_intel_qat_vf_cap()]
> 
> On Mon, Sep 11, 2023 at 03:53:48PM +0300, Ilpo Järvinen wrote:
> > As the first step towards converting PCI accessor function return codes
> > into normal errnos this series cleans up related code paths which have
> > complicated multi-line construct to handle the PCI error checking.
> > 
> > I'd prefer these (the remaining ones) to be routed through PCI tree due
> > to PCI accessor function return code conversion being built on top of
> > them.
> > 
> > v3:
> > - Return pci_generic_config_read32()'s error code directly
> > - Removed already accepted patches
> > 
> > v2:
> > - Moved ret local var to the inner block (I2C: ali15x3)
> > - Removed already accepted patches
> > 
> > 
> > Ilpo Järvinen (6):
> >   alpha: Streamline convoluted PCI error handling
> >   sh: pci: Do PCI error check on own line
> >   atm: iphase: Do PCI error checks on own line
> >   PCI: Do error check on own line to split long if conditions
> >   PCI: xgene: Do PCI error check on own line & keep return value
> >   scsi: ipr: Do PCI error checks on own line
> > 
> >  arch/alpha/kernel/sys_miata.c      | 17 +++++++++--------
> >  arch/sh/drivers/pci/common.c       |  7 ++++---
> >  drivers/atm/iphase.c               | 20 +++++++++++---------
> >  drivers/pci/controller/pci-xgene.c |  7 ++++---
> >  drivers/pci/pci.c                  |  9 ++++++---
> >  drivers/pci/probe.c                |  6 +++---
> >  drivers/pci/quirks.c               |  6 +++---
> >  drivers/scsi/ipr.c                 | 12 ++++++++----
> >  8 files changed, 48 insertions(+), 36 deletions(-)
> 
> Applied all to pci/config-errs for v6.7, thanks!
> 
> I made the tweaks below; heads-up to John Paul and Tadeusz.
> 
> Oh, and weird experience applying these via b4, git am: the
> Signed-off-by was corrupted on these patches:
> 
>   https://lore.kernel.org/r/20230911125354.25501-7-ilpo.jarvinen@linux.intel.com  https://lore.kernel.org/r/20230911125354.25501-6-ilpo.jarvinen@linux.intel.com  https://lore.kernel.org/r/20230911125354.25501-3-ilpo.jarvinen@linux.intel.com
> 
> It looked like this:
> 
>   Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> 
> Not sure why this happened; maybe one of the mailing lists screwed it
> up and the order of arrival determines which one b4 uses?  The ones
> from linux-alpha look like:
> 
>   Signed-off-by: Ilpo J=C3=A4rvinen <ilpo.jarvinen@linux.intel.com>
> 
> which I think corresponds to the bad rendering.  I think I fixed them
> all.

Thanks for letting me know. It seems that copies of the same mail

https://lore.kernel.org/linux-alpha/...
https://lore.kernel.org/linux-pci/...

do indeed differ for some reason. I'll probably have to experiment to see 
if I can reproduce problem with the linux-alpha list.


-- 
 i.

^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2023-10-11 11:10 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-11 12:53 [PATCH v3 0/6] PCI/treewide: Cleanup/streamline PCI error code handling Ilpo Järvinen
2023-09-11 12:53 ` Ilpo Järvinen
2023-09-11 12:53 ` Ilpo Järvinen
2023-09-11 12:53 ` [PATCH v3 1/6] alpha: Streamline convoluted PCI error handling Ilpo Järvinen
2023-09-11 12:53   ` Ilpo Järvinen
2023-09-11 12:53   ` Ilpo Järvinen
2023-09-11 12:53 ` [PATCH v3 2/6] sh: pci: Do PCI error check on own line Ilpo Järvinen
2023-09-11 12:53   ` Ilpo Järvinen
2023-09-11 12:53   ` Ilpo Järvinen
2023-09-11 12:53 ` [PATCH v3 3/6] atm: iphase: Do PCI error checks " Ilpo Järvinen
2023-09-11 12:53   ` Ilpo Järvinen
2023-09-11 12:53   ` Ilpo Järvinen
2023-09-11 12:53 ` [PATCH v3 4/6] PCI: Do error check on own line to split long if conditions Ilpo Järvinen
2023-09-11 12:53   ` Ilpo Järvinen
2023-09-11 12:53   ` Ilpo Järvinen
2023-09-11 12:53 ` [PATCH v3 5/6] PCI: xgene: Do PCI error check on own line & keep return value Ilpo Järvinen
2023-09-11 12:53   ` Ilpo Järvinen
2023-09-11 12:53   ` Ilpo Järvinen
2023-09-11 12:53 ` [PATCH v3 6/6] scsi: ipr: Do PCI error checks on own line Ilpo Järvinen
2023-09-11 12:53   ` Ilpo Järvinen
2023-09-11 12:53   ` Ilpo Järvinen
2023-09-14  1:00   ` Martin K. Petersen
2023-09-14  1:00     ` Martin K. Petersen
2023-10-10 22:35 ` [PATCH v3 0/6] PCI/treewide: Cleanup/streamline PCI error code handling Bjorn Helgaas
2023-10-10 22:35   ` Bjorn Helgaas
2023-10-11 11:07   ` Ilpo Järvinen
2023-10-11 11:07     ` Ilpo Järvinen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.