diff mbox series

[1/2,v2] i2c: i801: Save register SMBSLVCMD value only once

Message ID 20180411180331.0a2cb718@endymion
State Accepted
Headers show
Series i2c: i801: Fix hard hang on reboot on HP EliteBook G3 850 | expand

Commit Message

Jean Delvare April 11, 2018, 4:03 p.m. UTC
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>
Cc: Wolfram Sang <wsa@the-dreams.de>
Cc: stable@vger.kernel.org	# v4.10+
---
Changes since v1:
 * Added Benjamin's tag.
 * Added stable tag.

 drivers/i2c/busses/i2c-i801.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Wolfram Sang April 11, 2018, 9:13 p.m. UTC | #1
On Wed, Apr 11, 2018 at 06:03:31PM +0200, Jean Delvare wrote:
> 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>
> Cc: Wolfram Sang <wsa@the-dreams.de>
> Cc: stable@vger.kernel.org	# v4.10+

Applied to for-current, thanks!
diff mbox series

Patch

--- linux-4.16.orig/drivers/i2c/busses/i2c-i801.c	2018-04-10 12:44:09.917815431 +0200
+++ linux-4.16/drivers/i2c/busses/i2c-i801.c	2018-04-11 17:52:34.340485371 +0200
@@ -966,8 +966,6 @@  static void i801_enable_host_notify(stru
 	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 *de
 		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;