Received: by 2002:a05:7412:7c14:b0:fa:6e18:a558 with SMTP id ii20csp390730rdb; Mon, 22 Jan 2024 07:23:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IFjwnSMUjjY4IxfQospY8Z0rd8bmDWGI6X/9btIhRVU9GCatsMw+hyQJ/zuFgx+MIU5avUF X-Received: by 2002:a05:6e02:103:b0:35f:b01c:3446 with SMTP id t3-20020a056e02010300b0035fb01c3446mr7423372ilm.33.1705937014535; Mon, 22 Jan 2024 07:23:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705937014; cv=pass; d=google.com; s=arc-20160816; b=jYifpyjVAhM8XfT4cKH9YP/SIo9t/y1il1Xf7NHwXmPP1gL3beziryvRWm7Wsgvi8R yXe4hy/uRoM+tZ2WO9ER8Z2kyIyBvOR/48o2zPnoby6BpLtyHw99MNgtYHlbY9kPvfAw cWDsPBlFc0f637zqagrXe5yfasqRIieL/5Rlnj+s1I8Dhi/EF0H7FvCWtVeeyy47neYy iUb/dwpDwOVBRxeUdQzVFquz1242PdqO9iwD323glpKe21J1qe6qgv2OCKvHsX9HXzp1 8d1KeGAud2GHPztpVQkchu+/ZoehCwEuRi/WJ0cEVK96iP+6/xotGkzABcUlNRx0MUMp GOzQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=j8ANXLdBBjvJ386htYGAGP5yQlNfEY/dQbD5gQBSgrM=; fh=fKuhP6ncisi/mzV+za1Jz7GBEI/fNhEMNLQAQS1DYiE=; b=oABdnggTfOZka6mhhLfDmhVxRTKCjsx0ud6NKTVP77TDpJE0fo50y21yu4mtdzvIyM t/v6nwMgN21SL4wu25uG+GH1SHWee/BWPJgOzJE0vpi3Rk4omsU0G4nW+aGuNaqiz6Fk z2hJHcxDwbbyF8WXyDz3tMyR/ettbIgwSC9qoGgj3P/z7TqOo9khEsRbaFP8L7o+VmEw g+cGYIBmcS/d/0TRC1Cif1l/Ra/1Y1IG1neqz2lckCpjRuRt6Z3fKrt5cG6ZsgHn1VAe YV7inOuZLvbOvD0XcuNJ0G1r5ElBdRgporzc6yW1oJnJyawMCigX9pVgQcINY63UNEAc znRA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=I3DUDupM; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-33259-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33259-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id y128-20020a636486000000b005cdfb578621si8243494pgb.112.2024.01.22.07.23.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 07:23:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-33259-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=I3DUDupM; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-33259-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33259-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 4D18A28B441 for ; Mon, 22 Jan 2024 15:15:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 73A305576B; Mon, 22 Jan 2024 14:58:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="I3DUDupM" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9F60654BF8; Mon, 22 Jan 2024 14:58:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705935511; cv=none; b=gWdAa7RXrKyqN8FZG6oECxveYkQyrxtGR3yD2JMg0t7IeAUyhZIoz0Zg1hgN+ftpiKmKNhrmOvrkQTBVNSf3jFIkqVDKz6G/cGL51LfTAaO8Ibz8uH6D/2V9ZtFLRET6cj8sTYc7cX3gVt9U32EAKa38a5N1Ktlr+drdmMe42RE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705935511; c=relaxed/simple; bh=rprisNEsC2uRiF1SxBvUy142ekeuxh+v3vglsrsRGUM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PoPuEUyJA/GkOLefQcbkcjjgMc6kpZmf4ZbDjtnhzWDsVEa320USK3f2J2Za7kXYMaKYS1x9x5zP1UfKWgC31ttaZiKhtcLPEjoL8wffgUzNG6uGaP2rJW+C+Y3k4KPsw0wNdxdUXs8tcPIwbKDD6pyjhBJQPfGQm/QBgs2pHUo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=I3DUDupM; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B39F1C43390; Mon, 22 Jan 2024 14:58:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705935510; bh=rprisNEsC2uRiF1SxBvUy142ekeuxh+v3vglsrsRGUM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I3DUDupMrM4hnvKBEqmmfDJ+e8ZH0AUdvalBrln5Ypfvv7yddMzrZ51B2YEBaAQcs rjvS00VAOTpXX8Pd1MeaIwSsruBsnVFEs+M7RrBHuwCcp2cfPtrN/oLjA4J7A07/H0 pI0ZPs3dxkNSglnoivCuZ8JXGIzYgz9RGOiS5c5S1+QcX8kkUrdy2LDUhqsv/Y5DVI nXc8CBa98ETyoillIPDRpAEQ7ZTTDChYI6s5Jry1lravBB2CjfbSh9bi+pE210v8Rm yVMSTExOEWFzLj5SCPnLH/aQoKNScNaDaRcofJPSAA1k96BKScUffFC1bTRJNZy3Zv MScHyL/y48dKQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Xing Tong Wu , Guenter Roeck , Sasha Levin , jdelvare@suse.com, linux-hwmon@vger.kernel.org Subject: [PATCH AUTOSEL 6.7 40/88] hwmon: (nct6775) Fix fan speed set failure in automatic mode Date: Mon, 22 Jan 2024 09:51:13 -0500 Message-ID: <20240122145608.990137-40-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240122145608.990137-1-sashal@kernel.org> References: <20240122145608.990137-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.7.1 Content-Transfer-Encoding: 8bit From: Xing Tong Wu [ Upstream commit 8b3800256abad20e91c2698607f9b28591407b19 ] 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 when attempting to set the fan speed in automatic mode. Signed-off-by: Xing Tong Wu Link: https://lore.kernel.org/r/20231121081604.2499-3-xingtong_wu@163.com Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin --- drivers/hwmon/nct6775-core.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/hwmon/nct6775-core.c b/drivers/hwmon/nct6775-core.c index d928eb8ae5a3..92a49fafe2c0 100644 --- a/drivers/hwmon/nct6775-core.c +++ b/drivers/hwmon/nct6775-core.c @@ -2553,6 +2553,13 @@ store_pwm(struct device *dev, struct device_attribute *attr, const char *buf, int err; u16 reg; + /* + * The fan control mode should be set to manual if the user wants to adjust + * the fan speed. Otherwise, it will fail to set. + */ + if (index == 0 && data->pwm_enable[nr] > manual) + return -EBUSY; + err = kstrtoul(buf, 10, &val); if (err < 0) return err; -- 2.43.0