Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3493920imu; Sun, 11 Nov 2018 16:21:47 -0800 (PST) X-Google-Smtp-Source: AJdET5fBeGLbvlyIGHa2koH13SB4McCyIiXxyPmCvBMfh7nMVghO/CUnKbu7tiLT5c6bgziCQ6xK X-Received: by 2002:a63:ca44:: with SMTP id o4mr15708698pgi.258.1541982107537; Sun, 11 Nov 2018 16:21:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541982107; cv=none; d=google.com; s=arc-20160816; b=sjT0Coo4avj/oyGUcxFBOkIA8NsL33T1KwTGpFF86F5IIy0bGhI8vFI/cbLZj6ttmM ZQVmVwZjJB0Y3CgcLpWik3noJDyBN8A9OymNuQrYLJ+SnUde1dR/hjweeZbIt7cz5cMg 7Iq2IknyWI4F+vCgwkLmBh9rSwVhLFil7RQza3CHbcuyEZGnE+WNSSPq6DwY0BSmjZp4 ZW91wIY9D6hjZBQmBwpflYvnUQP0zHK4nYL5MiOnELCCnb20nj0pesIoTiEnZkGBQhpV j8B+f/n2ZT/T4uhtSLBSjEsA/igwXPX1np9D8oeU1Wxcx64UEvMyEIiES5xuKqKnDJvJ Wq8w== 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=vULsCbEjeJ3jPL3sWkaNTlXuE+sJ0ipZl5+HW7IY6A8=; b=d5aK79aLuDo8J8hE/EJRKDKziRMuv307YjW4gHadgstqC4uvscEvug8yQMpEWGJlLX fP9GljwTlm045ChgSV2FqHNXMZ5BRq4n8nJQrwbWbM6i5YuMU/lofB0HHWFYo4RxGXXq i0v5Fn+VaWVk3+3jFLUsF98EVj692914PYLIiHo2o5Uyh5HLfEQTvQtMv4pcXgEEC4M1 db1kVvLMl2C9bvxfvlukUJrbs+UJQFGVUYxorL9RWhUV4j3/yE3R1N0CA5K2nDxAqpyw AdtATNDAFa9+MQeXLuSddGtTmCMg4UzJD4cIIOti2ZXB0k05ZTXCtGto5yoFw+MIeTUm EOEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="t7/Y6G1u"; 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 13-v6si14603888pgv.104.2018.11.11.16.21.32; Sun, 11 Nov 2018 16:21: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="t7/Y6G1u"; 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 S1729822AbeKLIQx (ORCPT + 99 others); Mon, 12 Nov 2018 03:16:53 -0500 Received: from mail.kernel.org ([198.145.29.99]:58420 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729768AbeKLIQx (ORCPT ); Mon, 12 Nov 2018 03:16:53 -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 8B7DE215EA; Sun, 11 Nov 2018 22:26:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975217; bh=CS3g+duK6uu1nnMal4Bs0lWsPC8MvyL+S9oCxg/8tvA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t7/Y6G1ukjWBZqEf8TcKe6I90mu8HSNaEGTJ2+I+MWe8xdvD7CM0blRWYesyq3c/P nqadsyCVLtjRbsulmLBUvcROSPk8sdu8esNbvfjmOBvTOUiieLQALjt1lBBbYW4e4g Pbo2ABsKG570/C0diSJ1HQJPaprDLf5U5WWjRspg= 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.19 016/361] hwmon: (pmbus) Fix page count auto-detection. Date: Sun, 11 Nov 2018 14:16:03 -0800 Message-Id: <20181111221622.133006668@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221619.915519183@linuxfoundation.org> References: <20181111221619.915519183@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.19-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 @@ -2015,7 +2015,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);