Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3441010imu; Sun, 11 Nov 2018 15:09:48 -0800 (PST) X-Google-Smtp-Source: AJdET5fhxTn6IXu/+IrcON67OD/pcIM5G9cue22qZrkOzR+5extuf5fpDvRoOtMA+V8f9aUFiVvJ X-Received: by 2002:a17:902:5a4:: with SMTP id f33-v6mr17302598plf.324.1541977787955; Sun, 11 Nov 2018 15:09:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541977787; cv=none; d=google.com; s=arc-20160816; b=F+ldozwJ6E2HAKzfS1hLUSG9bYlweE+yH5IjBNhOEm0pyMqmAFJ4TkboEXpfb5c/qp whmvMbNgj/mM62TzIsskcnBF+fw6J7VyGjYCzla7m/Ls94J5Ogrgti/IssON7UO84GHW +dBgpeBrhqmwU2t2QAOxDM0BwOWbm+rUXIJbI2Jap0uHD2jnJtI2GIoBKLB8RMYcYmb6 dZFnAbVaQYtFpwr7d6mFA1doHTk8YASp86MwLdmHNM0WxJ2Se28+ab9f9s0LSzEUEHI1 CIhEzbb1QOngsvXlWSqSRSo+BTE0uSlZjpz/hCDM1tpHPYU4JYaWBTXwrgAIBNlWdgck 7Izw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+4Uz32c0YmYXUdY2FXllkWDhTk4PyKrLTzVryDcjqUs=; b=eeVUxzqa9CZx326WOlqc24KhK+5EPfvG9mtTWBiswfHiuhsOAnAZJnb0ZbfFH8U9M9 qrvd1bOQi1ZNeyy1fLV4uxMjM+RND7DVVmRomNZa6dupsrV6umYDuvlslBWB4UEhSUyM xcNjqsq7KudtfZfLa0eTnkVp3EQ/Jnw5WAuvSNIflfCE5t7n5j7tCIpfGYB5HmgELS2N k3ykfHas4eswUHi7SllTlWt91fB0r9NfFBys8nHAkWytuiXvERy6OzFjHEC5/S+hSjwZ V6KDqISy/BdCVpJJSULsHcYXcnpjBBHotommQd1eXd79zmiSfG4EOeuNF4hyI14/zdq+ Uslg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bO0KhHod; 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 p1-v6si13280919pfa.120.2018.11.11.15.09.33; Sun, 11 Nov 2018 15:09:47 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b=bO0KhHod; 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 S2387600AbeKLI7Q (ORCPT + 99 others); Mon, 12 Nov 2018 03:59:16 -0500 Received: from mail.kernel.org ([198.145.29.99]:50044 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390209AbeKLIWD (ORCPT ); Mon, 12 Nov 2018 03:22:03 -0500 Received: from localhost (unknown [206.108.79.134]) (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 D544822353; Sun, 11 Nov 2018 22:32:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975526; bh=TEfD6+5dup8DumQYr9j7LRx7F8pDE17zjFDUrocR7ZU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bO0KhHodtI6jcUG8VY7fWD0jhMbEE9Fc4GP5rOplAuutBd7ooNBjZA+FgPvPHWPDN dO8ba1xWTIj4QjkujPzd1ndcJePx9c7S24Ca9rBjlG4c5ED3WO+cgmNU/f+4AztVpW TSyHzaUIT3onRPl0qXuuBcJKIgK/X4Xco2zGW/Ps= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Bazhenov , Guenter Roeck Subject: [PATCH 4.14 005/222] hwmon: (pmbus) Fix page count auto-detection. Date: Sun, 11 Nov 2018 14:21:42 -0800 Message-Id: <20181111221648.339509495@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221647.665769131@linuxfoundation.org> References: <20181111221647.665769131@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dmitry Bazhenov commit e7c6a55606b5c46b449d76588968b4d8caae903f upstream. Devices with compatible="pmbus" field have zero initial page count, and pmbus_clear_faults() being called before the page count auto- detection does not actually clear faults because it depends on the page count. Non-cleared faults in its turn may fail the subsequent page count auto-detection. This patch fixes this problem by calling pmbus_clear_fault_page() for currently set page and calling pmbus_clear_faults() after the page count was detected. Cc: stable@vger.kernel.org Signed-off-by: Dmitry Bazhenov Signed-off-by: Guenter Roeck Signed-off-by: Greg Kroah-Hartman --- drivers/hwmon/pmbus/pmbus.c | 2 ++ drivers/hwmon/pmbus/pmbus_core.c | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) --- a/drivers/hwmon/pmbus/pmbus.c +++ b/drivers/hwmon/pmbus/pmbus.c @@ -118,6 +118,8 @@ static int pmbus_identify(struct i2c_cli } else { info->pages = 1; } + + pmbus_clear_faults(client); } if (pmbus_check_byte_register(client, 0, PMBUS_VOUT_MODE)) { --- a/drivers/hwmon/pmbus/pmbus_core.c +++ b/drivers/hwmon/pmbus/pmbus_core.c @@ -1802,7 +1802,10 @@ static int pmbus_init_common(struct i2c_ if (ret >= 0 && (ret & PB_CAPABILITY_ERROR_CHECK)) client->flags |= I2C_CLIENT_PEC; - pmbus_clear_faults(client); + if (data->info->pages) + pmbus_clear_faults(client); + else + pmbus_clear_fault_page(client, -1); if (info->identify) { ret = (*info->identify)(client, info);