netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 11/35] r8169: Change PCIBIOS_SUCCESSFUL to 0
       [not found] <20200713122247.10985-1-refactormyself@gmail.com>
@ 2020-07-13 12:22 ` Saheed O. Bolarinwa
  2020-07-13 12:22 ` [RFC PATCH 12/35] r8169: Tidy Success/Failure checks Saheed O. Bolarinwa
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Saheed O. Bolarinwa @ 2020-07-13 12:22 UTC (permalink / raw)
  To: helgaas, Realtek linux nic maintainers, Heiner Kallweit,
	David S. Miller, Jakub Kicinski, Russell King
  Cc: Saheed O. Bolarinwa, bjorn, skhan, linux-pci,
	linux-kernel-mentees, linux-kernel, netdev

In reference to the PCI spec (Chapter 2), PCIBIOS* is an x86 concept.
Their scope should be limited within arch/x86.

Change all PCIBIOS_SUCCESSFUL to 0

Signed-off-by: "Saheed O. Bolarinwa" <refactormyself@gmail.com>
---
 drivers/net/ethernet/realtek/r8169_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
index b660ddbe4025..206dac958cb2 100644
--- a/drivers/net/ethernet/realtek/r8169_main.c
+++ b/drivers/net/ethernet/realtek/r8169_main.c
@@ -2656,7 +2656,7 @@ static void rtl_csi_access_enable(struct rtl8169_private *tp, u8 val)
 	 * first and if it fails fall back to CSI.
 	 */
 	if (pdev->cfg_size > 0x070f &&
-	    pci_write_config_byte(pdev, 0x070f, val) == PCIBIOS_SUCCESSFUL)
+	    pci_write_config_byte(pdev, 0x070f, val) == 0)
 		return;
 
 	netdev_notice_once(tp->dev,
-- 
2.18.2


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

* [RFC PATCH 12/35] r8169: Tidy Success/Failure checks
       [not found] <20200713122247.10985-1-refactormyself@gmail.com>
  2020-07-13 12:22 ` [RFC PATCH 11/35] r8169: Change PCIBIOS_SUCCESSFUL to 0 Saheed O. Bolarinwa
@ 2020-07-13 12:22 ` Saheed O. Bolarinwa
  2020-07-13 13:45   ` Heiner Kallweit
  2020-07-13 12:22 ` [RFC PATCH 19/35] atm: Change PCIBIOS_SUCCESSFUL to 0 Saheed O. Bolarinwa
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 7+ messages in thread
From: Saheed O. Bolarinwa @ 2020-07-13 12:22 UTC (permalink / raw)
  To: helgaas, Realtek linux nic maintainers, Heiner Kallweit,
	David S. Miller, Jakub Kicinski, Russell King
  Cc: Saheed O. Bolarinwa, bjorn, skhan, linux-pci,
	linux-kernel-mentees, linux-kernel, netdev

Remove unnecessary check for 0.

Signed-off-by: "Saheed O. Bolarinwa" <refactormyself@gmail.com>
---
This patch depends on PATCH 11/35

 drivers/net/ethernet/realtek/r8169_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
index 206dac958cb2..79edbc0c4476 100644
--- a/drivers/net/ethernet/realtek/r8169_main.c
+++ b/drivers/net/ethernet/realtek/r8169_main.c
@@ -2656,7 +2656,7 @@ static void rtl_csi_access_enable(struct rtl8169_private *tp, u8 val)
 	 * first and if it fails fall back to CSI.
 	 */
 	if (pdev->cfg_size > 0x070f &&
-	    pci_write_config_byte(pdev, 0x070f, val) == 0)
+	    !pci_write_config_byte(pdev, 0x070f, val))
 		return;
 
 	netdev_notice_once(tp->dev,
-- 
2.18.2


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

* [RFC PATCH 19/35] atm: Change PCIBIOS_SUCCESSFUL to 0
       [not found] <20200713122247.10985-1-refactormyself@gmail.com>
  2020-07-13 12:22 ` [RFC PATCH 11/35] r8169: Change PCIBIOS_SUCCESSFUL to 0 Saheed O. Bolarinwa
  2020-07-13 12:22 ` [RFC PATCH 12/35] r8169: Tidy Success/Failure checks Saheed O. Bolarinwa
@ 2020-07-13 12:22 ` Saheed O. Bolarinwa
  2020-07-13 12:22 ` [RFC PATCH 20/35] atm: Tidy Success/Failure checks Saheed O. Bolarinwa
  2020-07-13 12:22 ` [RFC PATCH 21/35] atm: Fix Style ERROR- assignment in if condition Saheed O. Bolarinwa
  4 siblings, 0 replies; 7+ messages in thread
From: Saheed O. Bolarinwa @ 2020-07-13 12:22 UTC (permalink / raw)
  To: helgaas, Chas Williams
  Cc: Saheed O. Bolarinwa, bjorn, skhan, linux-pci,
	linux-kernel-mentees, linux-kernel, linux-atm-general, netdev

In reference to the PCI spec (Chapter 2), PCIBIOS* is an x86 concept.
Their scope should be limited within arch/x86.

Change all PCIBIOS_SUCCESSFUL to 0

Signed-off-by: "Saheed O. Bolarinwa" <refactormyself@gmail.com>
---
 drivers/atm/iphase.c | 4 ++--
 drivers/atm/lanai.c  | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/atm/iphase.c b/drivers/atm/iphase.c
index 8c7a996d1f16..b01cc491540d 100644
--- a/drivers/atm/iphase.c
+++ b/drivers/atm/iphase.c
@@ -2296,12 +2296,12 @@ static int reset_sar(struct atm_dev *dev)
 	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)  
+				i*4, &pci[i])) != 0)
   	      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)  
+					i*4, pci[i])) != 0)
 	    return error;  
 	udelay(5);  
 	return 0;  
diff --git a/drivers/atm/lanai.c b/drivers/atm/lanai.c
index 645a6bc1df88..2b82ae30dd74 100644
--- a/drivers/atm/lanai.c
+++ b/drivers/atm/lanai.c
@@ -1098,7 +1098,7 @@ static void pcistatus_check(struct lanai_dev *lanai, int clearonly)
 	u16 s;
 	int result;
 	result = pci_read_config_word(lanai->pci, PCI_STATUS, &s);
-	if (result != PCIBIOS_SUCCESSFUL) {
+	if (result != 0) {
 		printk(KERN_ERR DEV_LABEL "(itf %d): can't read PCI_STATUS: "
 		    "%d\n", lanai->number, result);
 		return;
@@ -1109,7 +1109,7 @@ static void pcistatus_check(struct lanai_dev *lanai, int clearonly)
 	if (s == 0)
 		return;
 	result = pci_write_config_word(lanai->pci, PCI_STATUS, s);
-	if (result != PCIBIOS_SUCCESSFUL)
+	if (result != 0)
 		printk(KERN_ERR DEV_LABEL "(itf %d): can't write PCI_STATUS: "
 		    "%d\n", lanai->number, result);
 	if (clearonly)
@@ -1949,7 +1949,7 @@ static int lanai_pci_start(struct lanai_dev *lanai)
 		return result;
 	/* Set latency timer to zero as per lanai docs */
 	result = pci_write_config_byte(pci, PCI_LATENCY_TIMER, 0);
-	if (result != PCIBIOS_SUCCESSFUL) {
+	if (result != 0) {
 		printk(KERN_ERR DEV_LABEL "(itf %d): can't write "
 		    "PCI_LATENCY_TIMER: %d\n", lanai->number, result);
 		return -EINVAL;
-- 
2.18.2


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

* [RFC PATCH 20/35] atm: Tidy Success/Failure checks
       [not found] <20200713122247.10985-1-refactormyself@gmail.com>
                   ` (2 preceding siblings ...)
  2020-07-13 12:22 ` [RFC PATCH 19/35] atm: Change PCIBIOS_SUCCESSFUL to 0 Saheed O. Bolarinwa
@ 2020-07-13 12:22 ` Saheed O. Bolarinwa
  2020-07-13 12:22 ` [RFC PATCH 21/35] atm: Fix Style ERROR- assignment in if condition Saheed O. Bolarinwa
  4 siblings, 0 replies; 7+ messages in thread
From: Saheed O. Bolarinwa @ 2020-07-13 12:22 UTC (permalink / raw)
  To: helgaas, Chas Williams
  Cc: Saheed O. Bolarinwa, bjorn, skhan, linux-pci,
	linux-kernel-mentees, linux-kernel, linux-atm-general, netdev

Remove unnecessary check for 0.

Signed-off-by: "Saheed O. Bolarinwa" <refactormyself@gmail.com>
---
This patch depends on PATCH 19/35

 drivers/atm/iphase.c | 10 ++++------
 drivers/atm/lanai.c  |  6 +++---
 2 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/atm/iphase.c b/drivers/atm/iphase.c
index b01cc491540d..2c75b82b4e7f 100644
--- a/drivers/atm/iphase.c
+++ b/drivers/atm/iphase.c
@@ -2295,14 +2295,12 @@ static int reset_sar(struct atm_dev *dev)
 	  
 	iadev = INPH_IA_DEV(dev);  
 	for(i=0; i<64; i++)  
-	  if ((error = pci_read_config_dword(iadev->pci,  
-				i*4, &pci[i])) != 0)
-  	      return error;  
+		if ((error = pci_read_config_dword(iadev->pci, i*4, &pci[i])))
+			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])) != 0)
-	    return error;  
+		if ((error = pci_write_config_dword(iadev->pci, i*4, pci[i])))
+			return error;
 	udelay(5);  
 	return 0;  
 }  
diff --git a/drivers/atm/lanai.c b/drivers/atm/lanai.c
index 2b82ae30dd74..5852b8cc0cc4 100644
--- a/drivers/atm/lanai.c
+++ b/drivers/atm/lanai.c
@@ -1098,7 +1098,7 @@ static void pcistatus_check(struct lanai_dev *lanai, int clearonly)
 	u16 s;
 	int result;
 	result = pci_read_config_word(lanai->pci, PCI_STATUS, &s);
-	if (result != 0) {
+	if (result) {
 		printk(KERN_ERR DEV_LABEL "(itf %d): can't read PCI_STATUS: "
 		    "%d\n", lanai->number, result);
 		return;
@@ -1109,7 +1109,7 @@ static void pcistatus_check(struct lanai_dev *lanai, int clearonly)
 	if (s == 0)
 		return;
 	result = pci_write_config_word(lanai->pci, PCI_STATUS, s);
-	if (result != 0)
+	if (result)
 		printk(KERN_ERR DEV_LABEL "(itf %d): can't write PCI_STATUS: "
 		    "%d\n", lanai->number, result);
 	if (clearonly)
@@ -1945,7 +1945,7 @@ static int lanai_pci_start(struct lanai_dev *lanai)
 		return -EBUSY;
 	}
 	result = check_board_id_and_rev("PCI", pci->subsystem_device, NULL);
-	if (result != 0)
+	if (result)
 		return result;
 	/* Set latency timer to zero as per lanai docs */
 	result = pci_write_config_byte(pci, PCI_LATENCY_TIMER, 0);
-- 
2.18.2


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

* [RFC PATCH 21/35] atm: Fix Style ERROR- assignment in if condition
       [not found] <20200713122247.10985-1-refactormyself@gmail.com>
                   ` (3 preceding siblings ...)
  2020-07-13 12:22 ` [RFC PATCH 20/35] atm: Tidy Success/Failure checks Saheed O. Bolarinwa
@ 2020-07-13 12:22 ` Saheed O. Bolarinwa
  4 siblings, 0 replies; 7+ messages in thread
From: Saheed O. Bolarinwa @ 2020-07-13 12:22 UTC (permalink / raw)
  To: helgaas, Chas Williams
  Cc: Saheed O. Bolarinwa, bjorn, skhan, linux-pci,
	linux-kernel-mentees, linux-kernel, linux-atm-general, netdev

Move assignment out of the if condition
Fix style issues in the for-loop

Signed-off-by: "Saheed O. Bolarinwa" <refactormyself@gmail.com>
---
This patch depends on PATCH 20/35

 drivers/atm/iphase.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/atm/iphase.c b/drivers/atm/iphase.c
index 2c75b82b4e7f..584d9be5fa73 100644
--- a/drivers/atm/iphase.c
+++ b/drivers/atm/iphase.c
@@ -2294,13 +2294,19 @@ static int reset_sar(struct atm_dev *dev)
 	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])))
+	for (i = 0; i < 64; i++) {
+		error = pci_read_config_dword(iadev->pci, i*4, &pci[i]);
+		if (error)
 			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])))
+	for (i = 0; i < 64; i++) {
+		error = pci_write_config_dword(iadev->pci, i*4, pci[i]);
+		if (error)
 			return error;
+	}
+
 	udelay(5);  
 	return 0;  
 }  
-- 
2.18.2


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

* Re: [RFC PATCH 12/35] r8169: Tidy Success/Failure checks
  2020-07-13 13:45   ` Heiner Kallweit
@ 2020-07-13 13:09     ` Saheed Bolarinwa
  0 siblings, 0 replies; 7+ messages in thread
From: Saheed Bolarinwa @ 2020-07-13 13:09 UTC (permalink / raw)
  To: Heiner Kallweit, helgaas, Realtek linux nic maintainers,
	David S. Miller, Jakub Kicinski, Russell King
  Cc: bjorn, skhan, linux-pci, linux-kernel-mentees, linux-kernel,
	netdev

Thank you for the review.

On 7/13/20 3:45 PM, Heiner Kallweit wrote:
>
> Patches 11 and 12 are both trivial, wouldn't it make sense to merge them?
> Apart from that: Acked-by: Heiner Kallweit <hkallweit1@gmail.com>

I separated them for easy review, I will merge them in the next version.

- Saheed


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

* Re: [RFC PATCH 12/35] r8169: Tidy Success/Failure checks
  2020-07-13 12:22 ` [RFC PATCH 12/35] r8169: Tidy Success/Failure checks Saheed O. Bolarinwa
@ 2020-07-13 13:45   ` Heiner Kallweit
  2020-07-13 13:09     ` Saheed Bolarinwa
  0 siblings, 1 reply; 7+ messages in thread
From: Heiner Kallweit @ 2020-07-13 13:45 UTC (permalink / raw)
  To: Saheed O. Bolarinwa, helgaas, Realtek linux nic maintainers,
	David S. Miller, Jakub Kicinski, Russell King
  Cc: bjorn, skhan, linux-pci, linux-kernel-mentees, linux-kernel,
	netdev

On 13.07.2020 14:22, Saheed O. Bolarinwa wrote:
> Remove unnecessary check for 0.
> 
> Signed-off-by: "Saheed O. Bolarinwa" <refactormyself@gmail.com>
> ---
> This patch depends on PATCH 11/35
> 
>  drivers/net/ethernet/realtek/r8169_main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
> index 206dac958cb2..79edbc0c4476 100644
> --- a/drivers/net/ethernet/realtek/r8169_main.c
> +++ b/drivers/net/ethernet/realtek/r8169_main.c
> @@ -2656,7 +2656,7 @@ static void rtl_csi_access_enable(struct rtl8169_private *tp, u8 val)
>  	 * first and if it fails fall back to CSI.
>  	 */
>  	if (pdev->cfg_size > 0x070f &&
> -	    pci_write_config_byte(pdev, 0x070f, val) == 0)
> +	    !pci_write_config_byte(pdev, 0x070f, val))
>  		return;
>  
>  	netdev_notice_once(tp->dev,
> 
Patches 11 and 12 are both trivial, wouldn't it make sense to merge them?
Apart from that: Acked-by: Heiner Kallweit <hkallweit1@gmail.com>

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

end of thread, other threads:[~2020-07-13 14:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20200713122247.10985-1-refactormyself@gmail.com>
2020-07-13 12:22 ` [RFC PATCH 11/35] r8169: Change PCIBIOS_SUCCESSFUL to 0 Saheed O. Bolarinwa
2020-07-13 12:22 ` [RFC PATCH 12/35] r8169: Tidy Success/Failure checks Saheed O. Bolarinwa
2020-07-13 13:45   ` Heiner Kallweit
2020-07-13 13:09     ` Saheed Bolarinwa
2020-07-13 12:22 ` [RFC PATCH 19/35] atm: Change PCIBIOS_SUCCESSFUL to 0 Saheed O. Bolarinwa
2020-07-13 12:22 ` [RFC PATCH 20/35] atm: Tidy Success/Failure checks Saheed O. Bolarinwa
2020-07-13 12:22 ` [RFC PATCH 21/35] atm: Fix Style ERROR- assignment in if condition Saheed O. Bolarinwa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).