i2c: i801: Save register SMBSLVCMD value only once
authorJean Delvare <jdelvare@suse.de>
Wed, 11 Apr 2018 16:03:31 +0000 (18:03 +0200)
committerWolfram Sang <wsa@the-dreams.de>
Wed, 11 Apr 2018 21:07:14 +0000 (23:07 +0200)
Saving the original value of register SMBSLVCMD in
i801_enable_host_notify() doesn't work, because this function is
called not only at probe time but also at resume time. Do it in
i801_probe() instead, so that the saved value is not overwritten at
resume time.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Fixes: 22e94bd6779e ("i2c: i801: store and restore the SLVCMD register at load and unload")
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Tested-by: Jason Andryuk <jandryuk@gmail.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Cc: stable@vger.kernel.org # v4.10+
drivers/i2c/busses/i2c-i801.c

index 692b341258667493a4eb0ae1996528d5fee52c3b..17aa20a55642d40b51d673df7f51770179672b28 100644 (file)
@@ -966,8 +966,6 @@ static void i801_enable_host_notify(struct i2c_adapter *adapter)
        if (!(priv->features & FEATURE_HOST_NOTIFY))
                return;
 
-       priv->original_slvcmd = inb_p(SMBSLVCMD(priv));
-
        if (!(SMBSLVCMD_HST_NTFY_INTREN & priv->original_slvcmd))
                outb_p(SMBSLVCMD_HST_NTFY_INTREN | priv->original_slvcmd,
                       SMBSLVCMD(priv));
@@ -1615,6 +1613,10 @@ static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id)
                outb_p(inb_p(SMBAUXCTL(priv)) &
                       ~(SMBAUXCTL_CRC | SMBAUXCTL_E32B), SMBAUXCTL(priv));
 
+       /* Remember original Host Notify setting */
+       if (priv->features & FEATURE_HOST_NOTIFY)
+               priv->original_slvcmd = inb_p(SMBSLVCMD(priv));
+
        /* Default timeout in interrupt mode: 200 ms */
        priv->adapter.timeout = HZ / 5;