rtc: rtc-pcf2123: replace strict_strtoul() with kstrtoul()
PATCH 1/1 rtc: rtc-pcf2123: replace strict_strtoul() with kstrtoul()
The usage of strict_strtoul() is not preferred, because strict_strtoul() is obsolete. Thus, kstrtoul() should be used.
--- drivers/rtc/rtc-pcf2123.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/rtc/rtc-pcf2123.c +2 -3
@@ -94,7 +94,7 @@ static ssize_t pcf2123_show(struct device *dev, struct device_attribute *attr, r = container_of(attr, struct pcf2123_sysfs_reg, attr); -if (strict_strtoul (r->name,16 , ®)) +if (kstrtoul (r->name,16 , ®))return -EINVAL ; txbuf[0 ] =PCF2123_READ | reg;
@@ -117,8 +117,7 @@ static ssize_t pcf2123_store(struct device *dev, struct device_attribute *attr, r = container_of(attr, struct pcf2123_sysfs_reg, attr); -if (strict_strtoul (r->name,16 , ®) - ||strict_strtoul (buffer,10 , &val)) +if (kstrtoul (r->name,16 , ®) ||kstrtoul (buffer,10 , &val))return -EINVAL ; txbuf[0 ] =PCF2123_WRITE | reg;
Signature · 1 line
1.7.10.4
drivers/rtc/rtc-pcf2123.c static ssize_t pcf2123_show(struct device *dev, struct device_attribute *attr, · line 98
Quoted 13 lines · Jingoo Han
The usage of
strict_strtoul()is not preferred, becausestrict_strtoul()is obsolete. Thus,kstrtoul()should be used.drivers/rtc/rtc-pcf2123.c +1
-1@@ -94,7 +94,7 @@ static ssize_t pcf2123_show(struct device *dev, struct device_attribute *attr, r = container_of(attr, struct pcf2123_sysfs_reg, attr); -if (strict_strtoul (r->name,16 , ®)) +if (kstrtoul (r->name,16 , ®))return -EINVAL ;
ret = kstrtoul(...);
if (ret)
return ret;
drivers/rtc/rtc-pcf2123.c static ssize_t pcf2123_store(struct device *dev, struct device_attribute *attr, · line 121
Quoted 8 lines
drivers/rtc/rtc-pcf2123.c +1
-2@@ -117,8 +117,7 @@ static ssize_t pcf2123_store(struct device *dev, struct device_attribute *attr, r = container_of(attr, struct pcf2123_sysfs_reg, attr); -if (strict_strtoul (r->name,16 , ®) - ||strict_strtoul (buffer,10 , &val)) +if (kstrtoul (r->name,16 , ®) ||kstrtoul (buffer,10 , &val))return -EINVAL ;
I see no harm to allow user to write octal values as well. Thus, just
ret = kstrtoul(r->name, 0, ®);
if (ret)
return ret;
Alessandro, what do you think?
--
With Best Regards,
Andy Shevchenko
Quoted 23 lines · Andy Shevchenko
drivers/rtc/rtc-pcf2123.c static ssize_t pcf2123_show(struct device *dev, struct device_attribute *attr, · line 98
Quoted 13 lines · Jingoo Han
The usage of
strict_strtoul()is not preferred, becausestrict_strtoul()is obsolete. Thus,kstrtoul()should be used.drivers/rtc/rtc-pcf2123.c +1
-1@@ -94,7 +94,7 @@ static ssize_t pcf2123_show(struct device *dev, struct device_attribute *attr, r = container_of(attr, struct pcf2123_sysfs_reg, attr); -if (strict_strtoul (r->name,16 , ®)) +if (kstrtoul (r->name,16 , ®))return -EINVAL ;ret = kstrtoul(...);
if (ret)
return ret;Quoted 4 lines
drivers/rtc/rtc-pcf2123.c +0
-0@@ -117,8 +117,7 @@ static ssize_t pcf2123_store(struct device *dev, struct device_attribute *attr, r = container_of(attr, struct pcf2123_sysfs_reg, attr);
Quoted 8 lines
drivers/rtc/rtc-pcf2123.c static ssize_t pcf2123_store(struct device *dev, struct device_attribute *attr, · line 121
Quoted 4 lines
drivers/rtc/rtc-pcf2123.c +1
-2-if (strict_strtoul (r->name,16 , ®) - ||strict_strtoul (buffer,10 , &val)) +if (kstrtoul (r->name,16 , ®) ||kstrtoul (buffer,10 , &val))return -EINVAL ;I see no harm to allow user to write octal values as well. Thus, just
ret =kstrtoul(r->name, 0, ®);
If you want to do this, please send another patch later, on top of this patch. I just want to address the replacing strict_strtoul() with kstrtoul().
Best regards,
Jingoo Han
Quoted 8 lines
if (ret)
return ret;Alessandro, what do you think?
--
With Best Regards,
Andy Shevchenko