public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iio: core: Use datasheet name as fallback for label
@ 2025-10-27 12:42 Chen-Yu Tsai
  2025-10-27 14:43 ` Jonathan Cameron
  0 siblings, 1 reply; 8+ messages in thread
From: Chen-Yu Tsai @ 2025-10-27 12:42 UTC (permalink / raw)
  To: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko
  Cc: Chen-Yu Tsai, linux-iio, linux-kernel

Some IIO drivers do not provide labels or extended names for their
channels. However they may provide datasheet names. axp20x-adc is
one such example.

Use the datasheet name as a fallback for the channel label. This mainly
benefits iio-hwmon by letting the produced hwmon sensors have more
meaningful names rather than in_voltageX.

Signed-off-by: Chen-Yu Tsai <wens@kernel.org>
---
 drivers/iio/industrialio-core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
index 88c3d585a1bd..d410ea2e7963 100644
--- a/drivers/iio/industrialio-core.c
+++ b/drivers/iio/industrialio-core.c
@@ -749,6 +749,9 @@ ssize_t do_iio_read_channel_label(struct iio_dev *indio_dev,
 	if (c->extend_name)
 		return sysfs_emit(buf, "%s\n", c->extend_name);
 
+	if (c->datasheet_name)
+		return sysfs_emit(buf, "%s\n", c->datasheet_name);
+
 	return -EINVAL;
 }
 
-- 
2.47.3


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

end of thread, other threads:[~2025-11-02 12:07 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-27 12:42 [PATCH] iio: core: Use datasheet name as fallback for label Chen-Yu Tsai
2025-10-27 14:43 ` Jonathan Cameron
2025-10-28  8:04   ` Andy Shevchenko
2025-10-28  9:22     ` Nuno Sá
2025-10-28 14:36       ` Chen-Yu Tsai
2025-10-28 14:51         ` Andy Shevchenko
2025-10-28 15:17         ` Nuno Sá
2025-11-02 12:07           ` Jonathan Cameron

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