Received: by 2002:a05:7412:b101:b0:e2:908c:2ebd with SMTP id az1csp3005451rdb; Wed, 15 Nov 2023 18:26:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IENBox2jy3BYvcTj6OmsfHYAFamtDhF5GRPb/lbsG/01ePY4h+d3UgEx1vX44DEyVR0n1qo X-Received: by 2002:a05:6808:2017:b0:3ad:fcd5:3dd6 with SMTP id q23-20020a056808201700b003adfcd53dd6mr20716542oiw.13.1700101579114; Wed, 15 Nov 2023 18:26:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700101579; cv=none; d=google.com; s=arc-20160816; b=nsOSUj3SeqSv0CoHAHxsAX0IVzr9xnPTQJfrcPQz5WeJP6R3sc7J37nUh0v+NoHqam VaNYXTWM2QtTKgdbC1yLSY4EABz9ccWkAzVUAFveMuSkAVPbY8BMVVPd2ZfrU9+H7c9F s2eziiupZbhLorclg2fR0ImaD/34ChUTuBzE5j34YfIt3/3qKY6X86v0kDos+Xc6JMKt GCSAtuNs7sGRFHYOqCn8RjrK2VBP3UlP5K8fPK8esnYTslOeSF+OHc4VdbpNJIS3KWf1 /M0ynzXV32GNk7QfPLLgBbDK2uGVqfx/mCCC0+CZLEQrIayHuu2FgQwVX9PyxybHwJUj FCBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=S3N+UnTP8NAOW5Vw5F6SLjig+wZLk03Ej/o8rB18V/A=; fh=brTD9uWwHSBEuDMsNSIyrWZVEeJXt4Ae/wkRCvfJiZk=; b=gp6NABXt2zmdF1F7kigNJgVCjMyfy7JLrhIZpQGCSrp+tg4cchmAbzwBwV8oI5wBMv jpxsFVDE9Er7IUNQ5FhEeFMYqIQZAS1My1222ReCga7Y0uAb2amD4SNJ4WfghyQNlBpE RrEE3HU/YP8Eqe+zMQVF1ZkwCXQdBAh3ThrpP5xlqJlRKRjjr2nedUUTn44JMaNwqzGO K2SB3Ag01t1fX/il4zhsN0MWvzCnMuw15VaGOeA8pvO/UBVCF2oij/70TDyTnk32iWC1 dlEP9KAmrhyLUykJq60AZydi6oTvXekyTUmZFYmYeqsCBNyZ2BULpGhQPJqXzpJjil/G mkwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=LYczdvfh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id bw22-20020a056a02049600b00578f23273a3si13137199pgb.738.2023.11.15.18.26.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 18:26:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=LYczdvfh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 69405807321A; Wed, 15 Nov 2023 18:26:13 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344846AbjKPCZ2 (ORCPT + 99 others); Wed, 15 Nov 2023 21:25:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344893AbjKPCZO (ORCPT ); Wed, 15 Nov 2023 21:25:14 -0500 Received: from m12.mail.163.com (m12.mail.163.com [220.181.12.215]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EDC391BFC; Wed, 15 Nov 2023 18:24:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=S3N+U nTP8NAOW5Vw5F6SLjig+wZLk03Ej/o8rB18V/A=; b=LYczdvfh/HrdJWsUUPgi/ FcdQ/VKr6Vd9UcLGnCFuTmCQfcr9nJV4RHMV7hqaICCvNrrKUBNP8/XvKSLLK1jA 5Gy1FDlsgY8IxHVffbhGWMV0ltJJIjNCYPXnKG6VZQ9ND1tzq9kWN5l8pHVzZEvX VF1DoCeQlfXDtMOf/MHC4M= Received: from localhost.localdomain (unknown [39.144.137.125]) by zwqz-smtp-mta-g4-4 (Coremail) with SMTP id _____wD3H2U+fVVl5bnXDA--.19779S5; Thu, 16 Nov 2023 10:24:13 +0800 (CST) From: Xing Tong Wu To: Guenter Roeck , Jean Delvare , linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org Cc: xingtong.wu@siemens.com, tobias.schaffner@siemens.com, gerd.haeussler.ext@siemens.com Subject: [PATCH 3/3] hwmon: (nct6775) Fix fan speed set failure in automatic mode Date: Thu, 16 Nov 2023 10:23:30 +0800 Message-Id: <20231116022330.2696-4-xingtong_wu@163.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231116022330.2696-1-xingtong_wu@163.com> References: <20231116022330.2696-1-xingtong_wu@163.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: _____wD3H2U+fVVl5bnXDA--.19779S5 X-Coremail-Antispam: 1Uf129KBjvdXoWrtFWDWr4UWryUtFy5Ar4UXFb_yoWDZrb_uw 4F939rAwnYqF43Aa4DCFWSqFyUtF48WF48XFn2ga98ta4UZw1DXF1kXryaqw12vrWIvFyD Xw4UWrWI9ry7CjkaLaAFLSUrUUUUjb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IUet8nUUUUUU== X-Originating-IP: [39.144.137.125] X-CM-SenderInfo: p0lqw35rqjs4rx6rljoofrz/xtbBnBMq0FghlXwhQwAAsH X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 15 Nov 2023 18:26:13 -0800 (PST) From: Xing Tong Wu Setting the fan speed is only valid in manual mode; it is not possible to set the fan's speed in automatic mode. Return error and show error message when attempting to set the fan speed in automatic mode. Signed-off-by: Xing Tong Wu --- drivers/hwmon/nct6775-core.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/hwmon/nct6775-core.c b/drivers/hwmon/nct6775-core.c index 575db6cb96e9..3fb9896c61ce 100644 --- a/drivers/hwmon/nct6775-core.c +++ b/drivers/hwmon/nct6775-core.c @@ -2551,6 +2551,14 @@ store_pwm(struct device *dev, struct device_attribute *attr, const char *buf, int err; u16 reg; + if (index == 0 && data->pwm_enable[nr] != manual) { + dev_err(dev, + "The pwm%d doesn't support manual fan speed control in automatic mode.\n", + nr + 1); + dev_err(dev, "Please set pwm%d_enable to manual mode.\n", nr + 1); + return -EOPNOTSUPP; + } + err = kstrtoul(buf, 10, &val); if (err < 0) return err; -- 2.25.1