From: Jingoo Han <jg1.han@samsung.com>
To: "'Andy Shevchenko'" <andy.shevchenko@gmail.com>
Cc: "'Samuel Ortiz'" <sameo@linux.intel.com>,
linux-kernel@vger.kernel.org,
"'Lee Jones'" <lee.jones@linaro.org>,
"'Linus Walleij'" <linus.walleij@linaro.org>,
"'Srinidhi Kasagar'" <srinidhi.kasagar@stericsson.com>,
Jingoo Han <jg1.han@samsung.com>
Subject: Re: [PATCH] mfd: replace strict_strtoul() with kstrtoul()
Date: Mon, 03 Jun 2013 16:02:35 +0900 [thread overview]
Message-ID: <000001ce6028$537025a0$fa5070e0$@samsung.com> (raw)
In-Reply-To: <CAHp75VeUzyURf=fpzW2nW-BYio06GE7C_9BXyxsrjEdQhzGQgg@mail.gmail.com>
On Sunday, June 02, 2013 7:51 PM, Andy Shevchenko wrote:
> On Sat, Jun 1, 2013 at 10:13 AM, Jingoo Han <jg1.han@samsung.com> wrote:
> > The usage of strict_strtoul() is not preferred, because
> > strict_strtoul() is obsolete. Thus, kstrtoul() should be
> > used.
>
> > --- a/drivers/mfd/aat2870-core.c
> > +++ b/drivers/mfd/aat2870-core.c
> > @@ -312,7 +312,7 @@ static ssize_t aat2870_reg_write_file(struct file *file,
> > while (*start == ' ')
> > start++;
> >
> > - if (strict_strtoul(start, 16, &val))
> > + if (kstrtoul(start, 16, &val))
> > return -EINVAL;
>
> ret = kstrtoul(...);
> if (ret)
> return ret;
>
> > --- a/drivers/mfd/ab3100-core.c
> > +++ b/drivers/mfd/ab3100-core.c
> > @@ -514,13 +514,13 @@ static ssize_t ab3100_get_set_reg(struct file *file,
> > /*
> > * Advance pointer to end of string then terminate
> > * the register string. This is needed to satisfy
> > - * the strict_strtoul() function.
> > + * the kstrtoul() function.
> > */
> > while ((i < buf_size) && (buf[i] != ' '))
> > i++;
> > buf[i] = '\0';
> >
> > - err = strict_strtoul(&buf[regp], 16, &user_reg);
> > + err = kstrtoul(&buf[regp], 16, &user_reg);
> > if (err)
> > return err;
> > if (user_reg > 0xff)
>
> user_reg couldn't be more than byte.
> So, you may change its definition to u8 and use here kstrtou8() and
> remove later check.
OK, I will change kstrtoul() to kstrtou8().
Best regards,
Jingoo Han
>
> But on first glance on that function it could be optimized a lot
> (there are so many custom stuff like skip_space() and like that).
>
> > @@ -557,7 +557,7 @@ static ssize_t ab3100_get_set_reg(struct file *file,
> > i++;
> > buf[i] = '\0';
> >
> > - err = strict_strtoul(&buf[valp], 16, &user_value);
> > + err = kstrtoul(&buf[valp], 16, &user_value);
> > if (err)
> > return err;
> > if (user_reg > 0xff)
>
> Same idea here.
>
> --
> With Best Regards,
> Andy Shevchenko
next prev parent reply other threads:[~2013-06-03 7:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-01 7:13 [PATCH] mfd: replace strict_strtoul() with kstrtoul() Jingoo Han
2013-06-02 10:51 ` Andy Shevchenko
2013-06-03 7:02 ` Jingoo Han [this message]
-- strict thread matches above, loose matches on Subject: below --
2013-06-03 9:01 Jingoo Han
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='000001ce6028$537025a0$fa5070e0$@samsung.com' \
--to=jg1.han@samsung.com \
--cc=andy.shevchenko@gmail.com \
--cc=lee.jones@linaro.org \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sameo@linux.intel.com \
--cc=srinidhi.kasagar@stericsson.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