mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chen-Yu Tsai <wens@kernel.org>
To: "Jonathan Cameron" <jic23@kernel.org>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>
Cc: Chen-Yu Tsai <wens@kernel.org>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] iio: core: Use datasheet name as fallback for label
Date: Mon, 27 Oct 2025 20:42:09 +0800	[thread overview]
Message-ID: <20251027124210.788962-1-wens@kernel.org> (raw)

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


             reply	other threads:[~2025-10-27 12:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-27 12:42 Chen-Yu Tsai [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251027124210.788962-1-wens@kernel.org \
    --to=wens@kernel.org \
    --cc=andy@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®