2020-07-13 13:26:10

by Saheed O. Bolarinwa

[permalink] [raw]
Subject: [RFC PATCH 16/35] hwmon: (sis5595) Change PCIBIOS_SUCCESSFUL to 0

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" <[email protected]>
---
drivers/hwmon/sis5595.c | 8 ++++----
drivers/hwmon/via686a.c | 8 ++++----
drivers/hwmon/vt8231.c | 8 ++++----
3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/hwmon/sis5595.c b/drivers/hwmon/sis5595.c
index 0c6741f949f5..0ea174fb3048 100644
--- a/drivers/hwmon/sis5595.c
+++ b/drivers/hwmon/sis5595.c
@@ -825,7 +825,7 @@ static int sis5595_pci_probe(struct pci_dev *dev,
pci_write_config_word(dev, SIS5595_BASE_REG, force_addr);
}

- if (PCIBIOS_SUCCESSFUL !=
+ if (0 !=
pci_read_config_word(dev, SIS5595_BASE_REG, &address)) {
dev_err(&dev->dev, "Failed to read ISA address\n");
return -ENODEV;
@@ -843,16 +843,16 @@ static int sis5595_pci_probe(struct pci_dev *dev,
return -ENODEV;
}

- if (PCIBIOS_SUCCESSFUL !=
+ if (0 !=
pci_read_config_byte(dev, SIS5595_ENABLE_REG, &enable)) {
dev_err(&dev->dev, "Failed to read enable register\n");
return -ENODEV;
}
if (!(enable & 0x80)) {
- if ((PCIBIOS_SUCCESSFUL !=
+ if ((0 !=
pci_write_config_byte(dev, SIS5595_ENABLE_REG,
enable | 0x80))
- || (PCIBIOS_SUCCESSFUL !=
+ || (0 !=
pci_read_config_byte(dev, SIS5595_ENABLE_REG, &enable))
|| (!(enable & 0x80))) {
/* doesn't work for some chips! */
diff --git a/drivers/hwmon/via686a.c b/drivers/hwmon/via686a.c
index a2eddd2c2538..cffea688878f 100644
--- a/drivers/hwmon/via686a.c
+++ b/drivers/hwmon/via686a.c
@@ -863,11 +863,11 @@ static int via686a_pci_probe(struct pci_dev *dev,
if (force_addr) {
address = force_addr & ~(VIA686A_EXTENT - 1);
dev_warn(&dev->dev, "Forcing ISA address 0x%x\n", address);
- if (PCIBIOS_SUCCESSFUL !=
+ if (0 !=
pci_write_config_word(dev, VIA686A_BASE_REG, address | 1))
return -ENODEV;
}
- if (PCIBIOS_SUCCESSFUL !=
+ if (0 !=
pci_read_config_word(dev, VIA686A_BASE_REG, &val))
return -ENODEV;

@@ -878,7 +878,7 @@ static int via686a_pci_probe(struct pci_dev *dev,
return -ENODEV;
}

- if (PCIBIOS_SUCCESSFUL !=
+ if (0 !=
pci_read_config_word(dev, VIA686A_ENABLE_REG, &val))
return -ENODEV;
if (!(val & 0x0001)) {
@@ -890,7 +890,7 @@ static int via686a_pci_probe(struct pci_dev *dev,
}

dev_warn(&dev->dev, "Enabling sensors\n");
- if (PCIBIOS_SUCCESSFUL !=
+ if (0 !=
pci_write_config_word(dev, VIA686A_ENABLE_REG,
val | 0x0001))
return -ENODEV;
diff --git a/drivers/hwmon/vt8231.c b/drivers/hwmon/vt8231.c
index 2335d440f72d..cc1d24c2a2c8 100644
--- a/drivers/hwmon/vt8231.c
+++ b/drivers/hwmon/vt8231.c
@@ -987,12 +987,12 @@ static int vt8231_pci_probe(struct pci_dev *dev,
dev_warn(&dev->dev, "Forcing ISA address 0x%x\n",
address);

- if (PCIBIOS_SUCCESSFUL !=
+ if (0 !=
pci_write_config_word(dev, VT8231_BASE_REG, address | 1))
return -ENODEV;
}

- if (PCIBIOS_SUCCESSFUL != pci_read_config_word(dev, VT8231_BASE_REG,
+ if (0 != pci_read_config_word(dev, VT8231_BASE_REG,
&val))
return -ENODEV;

@@ -1002,13 +1002,13 @@ static int vt8231_pci_probe(struct pci_dev *dev,
return -ENODEV;
}

- if (PCIBIOS_SUCCESSFUL != pci_read_config_word(dev, VT8231_ENABLE_REG,
+ if (0 != pci_read_config_word(dev, VT8231_ENABLE_REG,
&val))
return -ENODEV;

if (!(val & 0x0001)) {
dev_warn(&dev->dev, "enabling sensors\n");
- if (PCIBIOS_SUCCESSFUL !=
+ if (0 !=
pci_write_config_word(dev, VT8231_ENABLE_REG,
val | 0x0001))
return -ENODEV;
--
2.18.2


2020-07-14 05:03:43

by Guenter Roeck

[permalink] [raw]
Subject: Re: [RFC PATCH 16/35] hwmon: (sis5595) Change PCIBIOS_SUCCESSFUL to 0

On 7/13/20 5:22 AM, Saheed O. Bolarinwa wrote:
> 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" <[email protected]>
> ---
> drivers/hwmon/sis5595.c | 8 ++++----
> drivers/hwmon/via686a.c | 8 ++++----
> drivers/hwmon/vt8231.c | 8 ++++----
> 3 files changed, 12 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/hwmon/sis5595.c b/drivers/hwmon/sis5595.c
> index 0c6741f949f5..0ea174fb3048 100644
> --- a/drivers/hwmon/sis5595.c
> +++ b/drivers/hwmon/sis5595.c
> @@ -825,7 +825,7 @@ static int sis5595_pci_probe(struct pci_dev *dev,
> pci_write_config_word(dev, SIS5595_BASE_REG, force_addr);
> }
>
> - if (PCIBIOS_SUCCESSFUL !=
> + if (0 !=
> pci_read_config_word(dev, SIS5595_BASE_REG, &address)) {

Yoda programming already terrible is, but "0 !=" is even worse than that
(and completely unnecessary). If you want to clean this up, do it right
and drop those unnecessary comparisons.

Guenter