Received: by 10.192.165.148 with SMTP id m20csp838808imm; Fri, 27 Apr 2018 08:18:34 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpfj+GMNCFdvGf2ORmWnmGQx2TLwxrpH+YEZSwdx/+kjuYBpRbELUYEOwS/jtUNNSDKxdjD X-Received: by 10.167.129.154 with SMTP id g26mr2585765pfi.169.1524842314556; Fri, 27 Apr 2018 08:18:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524842314; cv=none; d=google.com; s=arc-20160816; b=DYafH82FdVRxM79AQNDynhrf4WRlLPhBxr8xWeiDLxYsB3EU6YdKzwuaoI1pNI6Pht XYqZ1COXqJj/byong7aPuG/bRvikoDZZRUW73Xfmo8pBnlL+AR2hk86jfesKB/9MN351 CeDH8Jy7xMcPLqSLqff5y6S16JeUWlYXNZ3nmDxL9eZ2fJK1xFjvAy42m/MHnnJP33MF 4qOSgHMd5VYq7CNkoIOpFCUwPKpCmWG0j1heL7TibbqGlQ4KoJB0FjtYg50lNLXOa/21 H6u1/ZFks74VxBjP4a5508XcCmO5QrDEuzBQoBAdtrcxzbhYxPPJsSXARJudf46WwgiA tQkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dmarc-filter :arc-authentication-results; bh=QpAIJzE0aqrPaptJ0ydabaTVOOccPhlc0NdlESawe7c=; b=OtpbxyXUPzhJsH08CMXYg7s/VuLOu4dZEwaNOyMbknB8SrF8RMKXJknIgIedYkUq73 hD5ya1kAZU/9vtrhty1KRkhuWcXnbESFv4krehShgYnpg2o7n0Mz1nKEq85XQ85VJVZb qVAm0uQKRZYrr25y99UwEaSGkzIwT6/PsInh7XIdpJQ1t5bO8sRBAgpR5pZM+76s+bFU 5zdSPo41IABTBVxBaNB8fzRx3En34pYKDFwt1JG/NaJMQZgSvUWGc1+WeFnQW1RCdN97 m6J0XD9bvoIcHbfmz4V080p40rBcjGyEDwizCGGR9lDE3ZM/RfNRx9mcU7wM4nDowO5c iztA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j197-v6si1374029pgc.552.2018.04.27.08.18.20; Fri, 27 Apr 2018 08:18:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933476AbeD0ODK (ORCPT + 99 others); Fri, 27 Apr 2018 10:03:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:49666 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933446AbeD0ODD (ORCPT ); Fri, 27 Apr 2018 10:03:03 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 52B01218A3; Fri, 27 Apr 2018 14:03:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 52B01218A3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=fail smtp.mailfrom=gregkh@linuxfoundation.org From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Benjamin Tissoires , Wolfram Sang , Jean Delvare Subject: [PATCH 4.9 05/74] i2c: i801: store and restore the SLVCMD register at load and unload Date: Fri, 27 Apr 2018 15:57:55 +0200 Message-Id: <20180427135710.123455520@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180427135709.899303463@linuxfoundation.org> References: <20180427135709.899303463@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Benjamin Tissoires commit 22e94bd6779e1140350c0792e85c79552ec43673 upstream. Also do not override any other configuration in this register. Signed-off-by: Benjamin Tissoires Signed-off-by: Wolfram Sang Cc: Jean Delvare Signed-off-by: Greg Kroah-Hartman --- drivers/i2c/busses/i2c-i801.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c @@ -243,6 +243,7 @@ struct i801_priv { struct i2c_adapter adapter; unsigned long smba; unsigned char original_hstcfg; + unsigned char original_slvcmd; struct pci_dev *pci_dev; unsigned int features; @@ -962,13 +963,26 @@ static int i801_enable_host_notify(struc if (!priv->host_notify) return -ENOMEM; - outb_p(SMBSLVCMD_HST_NTFY_INTREN, SMBSLVCMD(priv)); + 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)); + /* clear Host Notify bit to allow a new notification */ outb_p(SMBSLVSTS_HST_NTFY_STS, SMBSLVSTS(priv)); return 0; } +static void i801_disable_host_notify(struct i801_priv *priv) +{ + if (!(priv->features & FEATURE_HOST_NOTIFY)) + return; + + outb_p(priv->original_slvcmd, SMBSLVCMD(priv)); +} + static const struct i2c_algorithm smbus_algorithm = { .smbus_xfer = i801_access, .functionality = i801_func, @@ -1666,6 +1680,7 @@ static void i801_remove(struct pci_dev * pm_runtime_forbid(&dev->dev); pm_runtime_get_noresume(&dev->dev); + i801_disable_host_notify(priv); i801_del_mux(priv); i2c_del_adapter(&priv->adapter); i801_acpi_remove(priv);