i2c: i801: Don't read back cleared status in i801_check_pre()
authorHeiner Kallweit <hkallweit1@gmail.com>
Thu, 2 Dec 2021 09:53:05 +0000 (10:53 +0100)
committerWolfram Sang <wsa@kernel.org>
Thu, 9 Dec 2021 14:51:16 +0000 (15:51 +0100)
I see no need to read back the registers to verify that the bits
have actually been cleared. I can't imagine any scenario where
the bits would remain set after a write to them.

Whilst at it, change involved syslog messages to use pci_dbg() et al.
to simplify them.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Tested-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
drivers/i2c/busses/i2c-i801.c

index 930c6ed..b452f36 100644 (file)
@@ -328,22 +328,14 @@ static int i801_check_pre(struct i801_priv *priv)
 
        status = inb_p(SMBHSTSTS(priv));
        if (status & SMBHSTSTS_HOST_BUSY) {
-               dev_err(&priv->pci_dev->dev, "SMBus is busy, can't use it!\n");
+               pci_err(priv->pci_dev, "SMBus is busy, can't use it!\n");
                return -EBUSY;
        }
 
        status &= STATUS_FLAGS;
        if (status) {
-               dev_dbg(&priv->pci_dev->dev, "Clearing status flags (%02x)\n",
-                       status);
+               pci_dbg(priv->pci_dev, "Clearing status flags (%02x)\n", status);
                outb_p(status, SMBHSTSTS(priv));
-               status = inb_p(SMBHSTSTS(priv)) & STATUS_FLAGS;
-               if (status) {
-                       dev_err(&priv->pci_dev->dev,
-                               "Failed clearing status flags (%02x)\n",
-                               status);
-                       return -EBUSY;
-               }
        }
 
        /*
@@ -356,16 +348,8 @@ static int i801_check_pre(struct i801_priv *priv)
        if (priv->features & FEATURE_SMBUS_PEC) {
                status = inb_p(SMBAUXSTS(priv)) & SMBAUXSTS_CRCE;
                if (status) {
-                       dev_dbg(&priv->pci_dev->dev,
-                               "Clearing aux status flags (%02x)\n", status);
+                       pci_dbg(priv->pci_dev, "Clearing aux status flags (%02x)\n", status);
                        outb_p(status, SMBAUXSTS(priv));
-                       status = inb_p(SMBAUXSTS(priv)) & SMBAUXSTS_CRCE;
-                       if (status) {
-                               dev_err(&priv->pci_dev->dev,
-                                       "Failed clearing aux status flags (%02x)\n",
-                                       status);
-                               return -EBUSY;
-                       }
                }
        }