From: Andi Shyti <andi@etezian.org>
To: arnd@arndb.de, gregkh@linuxfoundation.org
Cc: linux-kernel@vger.kernel.org, pc@asdf.org, oatilla@gmail.com,
andi@etezian.org
Subject: [PATCH 10/19] bh1770glc: use kstrtoul instead of strict_strtoul
Date: Thu, 13 Jun 2013 20:20:44 +0200 [thread overview]
Message-ID: <1ced2fc1f90220249beb332801dcbbc34f8a251d.1371145891.git.andi@etezian.org> (raw)
In-Reply-To: <cover.1371145891.git.andi@etezian.org>
In-Reply-To: <cover.1371145891.git.andi@etezian.org>
kstrtoul() calls have been done by using base 0
up to now. This allowed hexadecimal and octal
entry on the sysfs interface.
Hexadecimal or octal entry is not required, nor
wanted for the proximity sensor.
The base is now changed to 10 in order to accept
only decimal numbers on the proximity sensor
sysfs interface.
Signed-off-by: Andi Shyti <andi@etezian.org>
Signed-off-by: Onur Atilla <oatilla@gmail.com>
---
drivers/misc/bh1770glc.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/drivers/misc/bh1770glc.c b/drivers/misc/bh1770glc.c
index bd90eaf..b5fc2b9 100644
--- a/drivers/misc/bh1770glc.c
+++ b/drivers/misc/bh1770glc.c
@@ -645,7 +645,7 @@ static ssize_t bh1770_power_state_store(struct device *dev,
unsigned long value;
ssize_t ret;
- if (strict_strtoul(buf, 0, &value))
+ if (kstrtoul(buf, 10, &value))
return -EINVAL;
mutex_lock(&chip->mutex);
@@ -744,7 +744,7 @@ static ssize_t bh1770_prox_enable_store(struct device *dev,
struct bh1770_chip *chip = dev_get_drvdata(dev);
unsigned long value;
- if (strict_strtoul(buf, 0, &value))
+ if (kstrtoul(buf, 10, &value))
return -EINVAL;
mutex_lock(&chip->mutex);
@@ -883,7 +883,7 @@ static ssize_t bh1770_set_prox_rate_above(struct device *dev,
struct bh1770_chip *chip = dev_get_drvdata(dev);
unsigned long value;
- if (strict_strtoul(buf, 0, &value))
+ if (kstrtoul(buf, 10, &value))
return -EINVAL;
mutex_lock(&chip->mutex);
@@ -899,7 +899,7 @@ static ssize_t bh1770_set_prox_rate_below(struct device *dev,
struct bh1770_chip *chip = dev_get_drvdata(dev);
unsigned long value;
- if (strict_strtoul(buf, 0, &value))
+ if (kstrtoul(buf, 10, &value))
return -EINVAL;
mutex_lock(&chip->mutex);
@@ -923,7 +923,7 @@ static ssize_t bh1770_set_prox_thres(struct device *dev,
unsigned long value;
int ret;
- if (strict_strtoul(buf, 0, &value))
+ if (kstrtoul(buf, 10, &value))
return -EINVAL;
if (value > BH1770_PROX_RANGE)
return -EINVAL;
@@ -952,7 +952,7 @@ static ssize_t bh1770_prox_persistence_store(struct device *dev,
struct bh1770_chip *chip = dev_get_drvdata(dev);
unsigned long value;
- if (strict_strtoul(buf, 0, &value))
+ if (kstrtoul(buf, 10, &value))
return -EINVAL;
if (value > BH1770_PROX_MAX_PERSISTENCE)
@@ -977,7 +977,7 @@ static ssize_t bh1770_prox_abs_thres_store(struct device *dev,
struct bh1770_chip *chip = dev_get_drvdata(dev);
unsigned long value;
- if (strict_strtoul(buf, 0, &value))
+ if (kstrtoul(buf, 0, &value))
return -EINVAL;
if (value > BH1770_PROX_RANGE)
@@ -1022,7 +1022,7 @@ static ssize_t bh1770_lux_calib_store(struct device *dev,
u32 old_calib;
u32 new_corr;
- if (strict_strtoul(buf, 0, &value))
+ if (kstrtoul(buf, 10, &value))
return -EINVAL;
mutex_lock(&chip->mutex);
@@ -1084,7 +1084,7 @@ static ssize_t bh1770_set_lux_rate(struct device *dev,
unsigned long rate_hz;
int ret, i;
- if (strict_strtoul(buf, 0, &rate_hz))
+ if (kstrtoul(buf, 10, &rate_hz))
return -EINVAL;
for (i = 0; i < ARRAY_SIZE(lux_rates_hz) - 1; i++)
@@ -1122,7 +1122,7 @@ static ssize_t bh1770_set_lux_thresh(struct bh1770_chip *chip, u16 *target,
int ret = 0;
unsigned long thresh;
- if (strict_strtoul(buf, 0, &thresh))
+ if (kstrtoul(buf, 10, &thresh))
return -EINVAL;
if (thresh > BH1770_LUX_RANGE)
--
1.7.10.4
next prev parent reply other threads:[~2013-06-13 18:34 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-13 18:20 [PATCH 00/19] misc: bh1770glc features and fixes Andi Shyti
2013-06-13 18:20 ` [PATCH 01/19] bh1770glc: added input device interface Andi Shyti
2013-06-17 22:52 ` Greg KH
2013-06-17 23:27 ` Andi Shyti
2013-06-17 23:36 ` Greg KH
2013-06-17 23:54 ` Andi Shyti
2013-06-17 23:55 ` Greg KH
2013-06-13 18:20 ` [PATCH 02/19] bh1770glc: different glass attenuation parameters Andi Shyti
2013-06-13 18:20 ` [PATCH 03/19] bh1770glc: lux0_glass_factor & lux0_comp_factor on sysfs Andi Shyti
2013-06-17 22:52 ` Greg KH
2013-06-17 23:28 ` Andi Shyti
2013-06-13 18:20 ` [PATCH 04/19] bh1770glc: Added raw lux output file for ALS to sysfs Andi Shyti
2013-06-13 18:20 ` [PATCH 05/19] bh1770glc: Removed obsolete offset settings from SFH7770 code Andi Shyti
2013-06-13 18:20 ` [PATCH 06/19] bh1770glc: removed proximity adjustement Andi Shyti
2013-06-13 18:20 ` [PATCH 07/19] bh1770glc: split read result function Andi Shyti
2013-06-13 18:20 ` [PATCH 08/19] bh1770glc: logic change in the proximity read Andi Shyti
2013-06-13 18:20 ` [PATCH 09/19] bh1770glc: use min_t instead of min Andi Shyti
2013-06-13 18:20 ` Andi Shyti [this message]
2013-06-13 18:20 ` [PATCH 11/19] bh1770glc: removed lux_read_raw_result() function Andi Shyti
2013-06-13 18:20 ` [PATCH 12/19] bh1770glc: Introduced dynamic threshold Andi Shyti
2013-06-13 18:20 ` [PATCH 13/19] bh1770glc: Code cleaning and aligning in source code Andi Shyti
2013-06-13 18:20 ` [PATCH 14/19] bh1770glc: Modified the neutral glass attenuation value Andi Shyti
2013-06-13 18:20 ` [PATCH 15/19] bh1770glc: Modified scaler variable Andi Shyti
2013-06-13 18:20 ` [PATCH 16/19] bh1770glc: Added sanity check for scf Andi Shyti
2013-06-13 18:20 ` [PATCH 17/19] bh1770glc: Implemented switch for interrupt operation Andi Shyti
2013-06-13 18:20 ` [PATCH 18/19] bh1770glc: Corrected proximity sensor rates Andi Shyti
2013-06-13 18:20 ` [PATCH 19/19] bh1770glc: Proximity sensor LED current update Andi Shyti
2013-06-17 22:54 ` [PATCH 00/19] misc: bh1770glc features and fixes Greg KH
2013-06-17 23:38 ` Andi Shyti
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=1ced2fc1f90220249beb332801dcbbc34f8a251d.1371145891.git.andi@etezian.org \
--to=andi@etezian.org \
--cc=arnd@arndb.de \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=oatilla@gmail.com \
--cc=pc@asdf.org \
/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®