* [PATCH V2] power: replace strict_strtoul() with kstrtoul()
@ 2013-06-03 9:05 Jingoo Han
2013-06-03 10:49 ` Andy Shevchenko
0 siblings, 1 reply; 3+ messages in thread
From: Jingoo Han @ 2013-06-03 9:05 UTC (permalink / raw)
To: 'Anton Vorontsov'
Cc: Anton Vorontsov, 'David Woodhouse',
linux-kernel, Jingoo Han, 'Andy Shevchenko'
The usage of strict_strtoul() is not preferred, because
strict_strtoul() is obsolete. Thus, kstrtoul() should be
used.
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
Changes since v1:
- Used return code from kstrtoul().
drivers/power/ab8500_fg.c | 6 +++---
drivers/power/pcf50633-charger.c | 8 ++++----
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/power/ab8500_fg.c b/drivers/power/ab8500_fg.c
index c5391f5..308e511 100644
--- a/drivers/power/ab8500_fg.c
+++ b/drivers/power/ab8500_fg.c
@@ -2465,9 +2465,9 @@ static ssize_t charge_full_store(struct ab8500_fg *di, const char *buf,
size_t count)
{
unsigned long charge_full;
- ssize_t ret = -EINVAL;
+ ssize_t ret;
- ret = strict_strtoul(buf, 10, &charge_full);
+ ret = kstrtoul(buf, 10, &charge_full);
dev_dbg(di->dev, "Ret %zd charge_full %lu", ret, charge_full);
@@ -2489,7 +2489,7 @@ static ssize_t charge_now_store(struct ab8500_fg *di, const char *buf,
unsigned long charge_now;
ssize_t ret;
- ret = strict_strtoul(buf, 10, &charge_now);
+ ret = kstrtoul(buf, 10, &charge_now);
dev_dbg(di->dev, "Ret %zd charge_now %lu was %d",
ret, charge_now, di->bat_cap.prev_mah);
diff --git a/drivers/power/pcf50633-charger.c b/drivers/power/pcf50633-charger.c
index 17fd77f..771c4f0 100644
--- a/drivers/power/pcf50633-charger.c
+++ b/drivers/power/pcf50633-charger.c
@@ -191,9 +191,9 @@ static ssize_t set_usblim(struct device *dev,
unsigned long ma;
int ret;
- ret = strict_strtoul(buf, 10, &ma);
+ ret = kstrtoul(buf, 10, &ma);
if (ret)
- return -EINVAL;
+ return ret;
pcf50633_mbc_usb_curlim_set(mbc->pcf, ma);
@@ -228,9 +228,9 @@ static ssize_t set_chglim(struct device *dev,
if (!mbc->pcf->pdata->charger_reference_current_ma)
return -ENODEV;
- ret = strict_strtoul(buf, 10, &ma);
+ ret = kstrtoul(buf, 10, &ma);
if (ret)
- return -EINVAL;
+ return ret;
mbcc5 = (ma << 8) / mbc->pcf->pdata->charger_reference_current_ma;
if (mbcc5 > 255)
--
1.7.10.4
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH V2] power: replace strict_strtoul() with kstrtoul()
2013-06-03 9:05 [PATCH V2] power: replace strict_strtoul() with kstrtoul() Jingoo Han
@ 2013-06-03 10:49 ` Andy Shevchenko
2013-06-07 0:36 ` Anton Vorontsov
0 siblings, 1 reply; 3+ messages in thread
From: Andy Shevchenko @ 2013-06-03 10:49 UTC (permalink / raw)
To: Jingoo Han
Cc: Anton Vorontsov, Anton Vorontsov, David Woodhouse, linux-kernel
On Mon, Jun 3, 2013 at 12:05 PM, 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.
>
> Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Looks better.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> Changes since v1:
> - Used return code from kstrtoul().
>
> drivers/power/ab8500_fg.c | 6 +++---
> drivers/power/pcf50633-charger.c | 8 ++++----
> 2 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/power/ab8500_fg.c b/drivers/power/ab8500_fg.c
> index c5391f5..308e511 100644
> --- a/drivers/power/ab8500_fg.c
> +++ b/drivers/power/ab8500_fg.c
> @@ -2465,9 +2465,9 @@ static ssize_t charge_full_store(struct ab8500_fg *di, const char *buf,
> size_t count)
> {
> unsigned long charge_full;
> - ssize_t ret = -EINVAL;
> + ssize_t ret;
>
> - ret = strict_strtoul(buf, 10, &charge_full);
> + ret = kstrtoul(buf, 10, &charge_full);
>
> dev_dbg(di->dev, "Ret %zd charge_full %lu", ret, charge_full);
>
> @@ -2489,7 +2489,7 @@ static ssize_t charge_now_store(struct ab8500_fg *di, const char *buf,
> unsigned long charge_now;
> ssize_t ret;
>
> - ret = strict_strtoul(buf, 10, &charge_now);
> + ret = kstrtoul(buf, 10, &charge_now);
>
> dev_dbg(di->dev, "Ret %zd charge_now %lu was %d",
> ret, charge_now, di->bat_cap.prev_mah);
> diff --git a/drivers/power/pcf50633-charger.c b/drivers/power/pcf50633-charger.c
> index 17fd77f..771c4f0 100644
> --- a/drivers/power/pcf50633-charger.c
> +++ b/drivers/power/pcf50633-charger.c
> @@ -191,9 +191,9 @@ static ssize_t set_usblim(struct device *dev,
> unsigned long ma;
> int ret;
>
> - ret = strict_strtoul(buf, 10, &ma);
> + ret = kstrtoul(buf, 10, &ma);
> if (ret)
> - return -EINVAL;
> + return ret;
>
> pcf50633_mbc_usb_curlim_set(mbc->pcf, ma);
>
> @@ -228,9 +228,9 @@ static ssize_t set_chglim(struct device *dev,
> if (!mbc->pcf->pdata->charger_reference_current_ma)
> return -ENODEV;
>
> - ret = strict_strtoul(buf, 10, &ma);
> + ret = kstrtoul(buf, 10, &ma);
> if (ret)
> - return -EINVAL;
> + return ret;
>
> mbcc5 = (ma << 8) / mbc->pcf->pdata->charger_reference_current_ma;
> if (mbcc5 > 255)
> --
> 1.7.10.4
>
>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH V2] power: replace strict_strtoul() with kstrtoul()
2013-06-03 10:49 ` Andy Shevchenko
@ 2013-06-07 0:36 ` Anton Vorontsov
0 siblings, 0 replies; 3+ messages in thread
From: Anton Vorontsov @ 2013-06-07 0:36 UTC (permalink / raw)
To: Andy Shevchenko; +Cc: Jingoo Han, David Woodhouse, linux-kernel
On Mon, Jun 03, 2013 at 01:49:49PM +0300, Andy Shevchenko wrote:
> On Mon, Jun 3, 2013 at 12:05 PM, 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.
> >
> > Signed-off-by: Jingoo Han <jg1.han@samsung.com>
>
> Looks better.
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Applied, thanks a lot!
Anton
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-06-07 0:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-03 9:05 [PATCH V2] power: replace strict_strtoul() with kstrtoul() Jingoo Han
2013-06-03 10:49 ` Andy Shevchenko
2013-06-07 0:36 ` Anton Vorontsov
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®