Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1078374ybl; Wed, 14 Aug 2019 10:20:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqwB8wrH1Rbg1YYN8Wf1/X0FbFuXPBLURa4zQ6KNJ7QEwDGWfE/U2lnSI7FU7KTosJxBX2Wz X-Received: by 2002:a17:90a:8c06:: with SMTP id a6mr781883pjo.45.1565803228469; Wed, 14 Aug 2019 10:20:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565803228; cv=none; d=google.com; s=arc-20160816; b=mWSScX4LFsGS/3KN8++D/+e3DoSCg0c8jm1QOwyVWW4SlG6WGgKk/xRFDpJPwL+5x+ uOi+UvN+GfEVTtUsMiYlPY3vTZSADueaPxRvmWLpac4K4iJCa2nK3hSNcipyStGGTnX9 8XZ8Ja6rS3zlmQqDRUz484+77ifvNvmd5vfaNWdaV5cGd3c4LkoLMzP7A+a4GlIIG/8h wbr3OlQuteWYLO5A1JghofouyPoIv8y02GTLbWiXJXINlVCuki2kx/puuRfw7C/jQYrd TTWbYKyKO7DRtk15uGPFjB0rY/Sor2+e6KpR5npbm7Ztbamp2ptepMLossXYKhWLg8LK wQKw== 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=imEBpHZRX3/fMG/W4GSkDlUf76bKgtKbvJ7uRja4nfo=; b=QxqZ1kbJCxMlPyh/MQRh0VJp+BOha8Y4sEzoHWijKtHIe7KNvaTvn9n8pVuVtTfEAf 6pIxDiCX6092jBuPlxbfbXk0G8giPCk0VgqD78lhtjqNeJ8CRtz4QMzsSg+2Bv2qRb9t 073OXMVR8twP1tVpr3waMJjs+C9bInhVLBXkshVFDUs+xQN5jRwMdQtF0GS5SGIawTn+ fJ8Zt3/8eMEM4HT3LlAb66QWA+s7ykIhJlHlviPfwmD5jtPEb+hFtD/aAXFLHWe+QCnZ JWoYZEcRPGNqsiLqw/3gcWqdDpzSrRl4pv4McVLUxw7VFY7qd1hGO/ihjwpTpdT1q6LI YmAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=MNNsqKm1; 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 m32si244574pld.236.2019.08.14.10.20.13; Wed, 14 Aug 2019 10:20:28 -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; dkim=pass header.i=@kernel.org header.s=default header.b=MNNsqKm1; 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 S1730582AbfHNRLU (ORCPT + 99 others); Wed, 14 Aug 2019 13:11:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:34542 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730570AbfHNRLS (ORCPT ); Wed, 14 Aug 2019 13:11:18 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 CE899208C2; Wed, 14 Aug 2019 17:11:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565802677; bh=Z9vCoxmg1F0JBLGhQ5ys9J4j4m/T7XhF6spaclXJU8A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MNNsqKm1oZTFjANQmgFo33FLOoUExrkLi1YwWkh3uEPWJgTCqA4b3M1T3O7wk9Z1Z h5fyfj2/O2wMzEld4sriFz2qEjlST3U5fNjG9GxqdYq8w74kS2DVmZkmBxaCXuj3pC lBv5wxrABDDLiqPiuIDcF1KbHNeJeTnt1uZN5sFA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gilles Buloz , Guenter Roeck Subject: [PATCH 4.19 75/91] hwmon: (nct7802) Fix wrong detection of in4 presence Date: Wed, 14 Aug 2019 19:01:38 +0200 Message-Id: <20190814165752.972237085@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190814165748.991235624@linuxfoundation.org> References: <20190814165748.991235624@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Guenter Roeck commit 38ada2f406a9b81fb1249c5c9227fa657e7d5671 upstream. The code to detect if in4 is present is wrong; if in4 is not present, the in4_input sysfs attribute is still present. In detail: - Ihen RTD3_MD=11 (VSEN3 present), everything is as expected (no bug). - If we have RTD3_MD!=11 (no VSEN3), we unexpectedly have a in4_input file under /sys and the "sensors" command displays in4_input. But as expected, we have no in4_min, in4_max, in4_alarm, in4_beep. Fix is_visible function to detect and report in4_input visibility as expected. Reported-by: Gilles Buloz Cc: Gilles Buloz Cc: stable@vger.kernel.org Fixes: 3434f37835804 ("hwmon: Driver for Nuvoton NCT7802Y") Signed-off-by: Guenter Roeck Signed-off-by: Greg Kroah-Hartman --- drivers/hwmon/nct7802.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/drivers/hwmon/nct7802.c +++ b/drivers/hwmon/nct7802.c @@ -768,7 +768,7 @@ static struct attribute *nct7802_in_attr &sensor_dev_attr_in3_alarm.dev_attr.attr, &sensor_dev_attr_in3_beep.dev_attr.attr, - &sensor_dev_attr_in4_input.dev_attr.attr, /* 17 */ + &sensor_dev_attr_in4_input.dev_attr.attr, /* 16 */ &sensor_dev_attr_in4_min.dev_attr.attr, &sensor_dev_attr_in4_max.dev_attr.attr, &sensor_dev_attr_in4_alarm.dev_attr.attr, @@ -794,9 +794,9 @@ static umode_t nct7802_in_is_visible(str if (index >= 6 && index < 11 && (reg & 0x03) != 0x03) /* VSEN1 */ return 0; - if (index >= 11 && index < 17 && (reg & 0x0c) != 0x0c) /* VSEN2 */ + if (index >= 11 && index < 16 && (reg & 0x0c) != 0x0c) /* VSEN2 */ return 0; - if (index >= 17 && (reg & 0x30) != 0x30) /* VSEN3 */ + if (index >= 16 && (reg & 0x30) != 0x30) /* VSEN3 */ return 0; return attr->mode;