mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Andy Shevchenko <andriy.shevchenko@intel.com>
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 v5 1/7] lib: kstrtox: support E notation in kstrtoudec64() and kstrtodec64()
Date: Sat, 7 Nov 2026 23:46:33 +0000	[thread overview]
Message-ID: <20261107234633.280c9296@jic23-hlaptop> (raw)
In-Reply-To: <auofLF8TivwJiMwT@ashevche-desk.local>

On Tue, 3 Nov 2026 19:51:40 +0200
Andy Shevchenko <andriy.shevchenko@intel.com> wrote:

> On Mon, Nov 02, 2026 at 07:40:59AM -0300, Rodrigo Alencar via B4 Relay wrote:
> > 
> > Allow decimal strings to carry an exponent suffix, such as "2.7e10" or
> > "271828e-5", in kstrtoudec64() and kstrtodec64(). The exponent is added
> > to the requested scale to work out how many integer and fractional digits
> > are consumed. A negative effective exponent drops integer digits.
> > 
> > The digits are now scanned first and the string termination is checked
> > before any conversion. A missing or malformed exponent ("1e", "1e+")
> > returns -EINVAL. An exponent that overflows when added to the scale, or
> > that makes the result exceed 64 bits, returns -ERANGE.  
> 
> ...
> 
> > +static int skip_digits(const char **s)  
> 
> In case we need a new version, the skip_and_count_digits() fits better.
> 
Agreed. Given we aren't pressed for time this cycle, let us
do that change and add the bit of extra commit message to patch 2.

This is really nice feature, so worth a bit of extra polishing!

Jonathan

> > +{
> > +	const char *start = *s;
> > +
> > +	while (isdigit(**s))
> > +		(*s)++;
> > +
> > +	return *s - start;
> > +}  
> 


  reply	other threads:[~2026-11-07 23:46 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-02 10:40 [PATCH v5 0/7] Add E notation support to kstrtodec64() and IIO sysfs writes Rodrigo Alencar via B4 Relay
2026-11-02 10:40 ` [PATCH v5 1/7] lib: kstrtox: support E notation in kstrtoudec64() and kstrtodec64() Rodrigo Alencar via B4 Relay
2026-11-03 17:51   ` Andy Shevchenko
2026-11-07 23:46     ` Jonathan Cameron [this message]
2026-11-02 10:41 ` [PATCH v5 2/7] lib: kstrtox: round to nearest, ties to even in kstrto[u]dec64() Rodrigo Alencar via B4 Relay
2026-11-03 17:55   ` Andy Shevchenko
2026-11-04  9:04     ` Rodrigo Alencar
2026-11-04 10:56       ` Andy Shevchenko
2026-11-02 10:41 ` [PATCH v5 3/7] lib: kstrtox: allow a negative scale " Rodrigo Alencar via B4 Relay
2026-11-02 10:41 ` [PATCH v5 4/7] lib: test-kstrtox: add E notation tests for kstrto[u]dec64() Rodrigo Alencar via B4 Relay
2026-11-02 10:41 ` [PATCH v5 5/7] iio: test: rescale: compare scales against the precision of the output Rodrigo Alencar via B4 Relay
2026-11-02 10:41 ` [PATCH v5 6/7] iio: core: use kstrtodec64() to parse fixed-point values Rodrigo Alencar via B4 Relay
2026-11-02 10:41 ` [PATCH v5 7/7] iio: test: add kunit tests for channel info writes Rodrigo Alencar via B4 Relay

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=20261107234633.280c9296@jic23-hlaptop \
    --to=jic23@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=andriy.shevchenko@intel.com \
    --cc=andy@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®