mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] hwmon: (nct6683) Return -EBUSY if a fan curve is no longer supported
@ 2026-11-29 17:43 Tomasz Bojanowski
  2026-11-29 18:25 ` Guenter Roeck
  0 siblings, 1 reply; 2+ messages in thread
From: Tomasz Bojanowski @ 2026-11-29 17:43 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: linux-hwmon, Hamza Mahfooz, Jonathan Corbet, Shuah Khan,
	Randy Dunlap, linux-doc, linux-kernel

Before writing a point of a fan curve, the driver checks that it still
supports the curve which is set in the EC. If it does not, nothing is
written, so this is not an I/O error. Return -EBUSY instead of -EIO.

Writing pwmN_auto_channels_temp already returns -EBUSY if its check of the
current temperature source fails.

-EIO is still returned if the EC does not take the new curve. Document
both, and that the check includes whether the curve sets a duty cycle.

Compile tested.

Signed-off-by: Tomasz Bojanowski <tomasz@bojanowski.me>
---
Proposed in: https://lore.kernel.org/linux-hwmon/20261117071645.587863-1-tomasz@bojanowski.me/

I used an AI assistant (Claude Code) during development, including for
the test scripts and for comparing the EC register dumps. I reviewed all
of the changes and take responsibility for them.

 Documentation/hwmon/nct6683.rst | 11 ++++++-----
 drivers/hwmon/nct6683.c         |  2 +-
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/Documentation/hwmon/nct6683.rst b/Documentation/hwmon/nct6683.rst
index 1afdf4788d82..bbed349e03a3 100644
--- a/Documentation/hwmon/nct6683.rst
+++ b/Documentation/hwmon/nct6683.rst
@@ -89,11 +89,12 @@ temperatures and the duty cycles of the curve do not decrease and the
 temperatures are at most 127 degrees Celsius; otherwise they are
 read-only. They can be written in manual and in automatic mode. In manual
 mode, a new curve is used after switching to automatic mode. Writing a
-point returns -EIO if the curve no longer meets these conditions or if the
-EC does not take the new curve. Temperatures are clamped to 0-127 degrees
-Celsius and duty cycles to 0-255, and both to the values of the adjacent
-points, so the points have to be written from point 7 to point 1 to raise
-a curve and from point 1 to point 7 to lower it.
+point returns -EBUSY if the curve no longer sets a duty cycle or no longer
+meets these conditions, and -EIO if the EC does not take the new curve.
+Temperatures are clamped to 0-127 degrees Celsius and duty cycles to
+0-255, and both to the values of the adjacent points, so the points have
+to be written from point 7 to point 1 to raise a curve and from point 1 to
+point 7 to lower it.
 
 pwmN_auto_channels_temp is writable if, when the driver is loaded, the
 curve uses a single temperature which can be selected; otherwise it is
diff --git a/drivers/hwmon/nct6683.c b/drivers/hwmon/nct6683.c
index 36565afe8297..ac47cb9d7691 100644
--- a/drivers/hwmon/nct6683.c
+++ b/drivers/hwmon/nct6683.c
@@ -1342,7 +1342,7 @@ static int nct6687dr_curve_set_point(struct device *dev, int ch, int p,
 	/* Do not touch a curve which is no longer supported */
 	if (!nct6687dr_curve_read(data, ch, &old) ||
 	    !nct6687dr_curve_valid(&old)) {
-		err = -EIO;
+		err = -EBUSY;
 		goto unlock;
 	}
 

base-commit: 8d0f79f49fb10c9f07fee6720551113272a1812b
-- 
2.56.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-29 18:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-29 17:43 [PATCH] hwmon: (nct6683) Return -EBUSY if a fan curve is no longer supported Tomasz Bojanowski
2026-11-29 18:25 ` Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®