mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Rodrigo Alencar via B4 Relay
	<devnull+rodrigo.alencar.analog.com@kernel.org>
Cc: rodrigo.alencar@analog.com, linux-kernel@vger.kernel.org,
	linux-iio@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	David Lechner <dlechner@baylibre.com>,
	Andy Shevchenko <andy@kernel.org>
Subject: Re: [PATCH RFC v2 4/4] iio: test: add kunit tests for channel info writes
Date: Sat, 17 Oct 2026 23:55:07 +0100	[thread overview]
Message-ID: <20261017235507.2ea30ee3@jic23-hlaptop> (raw)
In-Reply-To: <20261013-e-notation-v2-4-d4adb5e193fc@analog.com>

On Tue, 13 Oct 2026 10:36:47 -0300
Rodrigo Alencar via B4 Relay <devnull+rodrigo.alencar.analog.com@kernel.org> wrote:

> From: Rodrigo Alencar <rodrigo.alencar@analog.com>
> 
> Add a KUnit test suite covering iio_write_channel_info(), the sysfs
> store handler that parses a channel info value according to the format
> reported by write_raw_get_fmt() and hands it to write_raw(). The
> function is made visible to KUnit through VISIBLE_IF_KUNIT and
> EXPORT_SYMBOL_IF_KUNIT, so it stays static in regular builds.
> 
> The suite uses an unregistered iio_dev allocated on a KUnit device,
> with stub write_raw_get_fmt() and write_raw() callbacks that select
> the format under test and capture the parsed values. Cases are grouped
> by format:
> 
>   - IIO_VAL_INT: decimal, hex and octal input, decimal fallback with
>     truncation and E notation, and 32-bit range checks.
>   - IIO_VAL_INT_PLUS_MICRO / IIO_VAL_INT_PLUS_NANO: sign handling,
>     truncation of extra digits, E notation and malformed input.
>   - IIO_VAL_INT_PLUS_MICRO_DB: optional "dB" / " dB" suffix.
>   - IIO_VAL_CHAR: single character input.
>   - IIO_VAL_INT_64 and IIO_VAL_DECIMAL64_*: 64-bit values split into
>     val/val2, including the S64_MAX / S64_MIN boundaries.
> 
> Further cases cover unsupported formats, the default micro precision
> used when write_raw_get_fmt() is absent, a missing write_raw(), and
> error propagation from write_raw().
> 
> Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com>
Very pleased to see these given our still somewhat complex
parsers!

Thanks for doing this.
Note I mostly defer to Andy for review of parsing code
as I've messed it up far too many times in the past ;)

Jonathan

  parent reply	other threads:[~2026-10-17 22:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-13 13:36 [PATCH RFC v2 0/4] Add E notation support to kstrtodec64() and IIO sysfs writes Rodrigo Alencar via B4 Relay
2026-10-13 13:36 ` [PATCH RFC v2 1/4] lib: kstrtox: support E notation in kstrtoudec64() and kstrtodec64() Rodrigo Alencar via B4 Relay
2026-10-13 18:48   ` Andy Shevchenko
2026-10-13 13:36 ` [PATCH RFC v2 2/4] lib: test-kstrtox: add E notation tests for kstrto[u]dec64() Rodrigo Alencar via B4 Relay
2026-10-13 18:49   ` Andy Shevchenko
2026-10-13 13:36 ` [PATCH RFC v2 3/4] iio: core: use kstrtodec64() to parse fixed-point values Rodrigo Alencar via B4 Relay
2026-10-13 19:08   ` Andy Shevchenko
2026-10-14 10:46     ` Rodrigo Alencar
2026-10-13 13:36 ` [PATCH RFC v2 4/4] iio: test: add kunit tests for channel info writes Rodrigo Alencar via B4 Relay
2026-10-13 19:10   ` Andy Shevchenko
2026-10-17 22:55   ` Jonathan Cameron [this message]
2026-10-17 22:50 ` [PATCH RFC v2 0/4] Add E notation support to kstrtodec64() and IIO sysfs writes 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=20261017235507.2ea30ee3@jic23-hlaptop \
    --to=jic23@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=andy@kernel.org \
    --cc=devnull+rodrigo.alencar.analog.com@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rodrigo.alencar@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®