Re: [PATCH v6 1/4] lib: new helper kstrtodev_t()

From: Andy Shevchenko
Date: Thu Feb 20 2020 - 06:57:10 EST

On Thu, Feb 20, 2020 at 1:46 PM Andy Shevchenko
<andy.shevchenko@xxxxxxxxx> wrote:
> On Thu, Feb 20, 2020 at 12:57 PM Uwe Kleine-KÃnig
> <u.kleine-koenig@xxxxxxxxxxxxxx> wrote:
> > On Thu, Feb 20, 2020 at 12:22:36PM +0200, Andy Shevchenko wrote:


> > Also I don't understand yet, what you want me to do.
> I have issues with kstrto() not playing with simple numbers (boolean

s/simple/simple and single/

> is a special case, but still a number at the end).
> I also don't feel good with too narrow usage of the newly introduced helper
> > Assume I'd be
> > willing to use simple_strtoul, I'd still want to have a function that
> > gives me a dev_t from a given string. Should I put this directly in my
> > led-trigger driver?
> I see the following possibilities:

(above doesn't imply the necessity of simple_strto*() use)

> a) put it inside the caller and forget about generic helper
> b) do a generic helper, but 1/ in string_*() namespace, 2/ with a
> delimiter parameter and 3/ possibility to take negative numbers
> In b) case, add to the commit message how many potential _existing_
> users may be converted to this.
> Also it would be good to have two versions strict (only \n at the end
> is allowed) and non-strict (based on the amount of users for each
> group).

And don't forget to extend lib/test_string.c accordingly.

With Best Regards,
Andy Shevchenko