From: Alexey Dobriyan <adobriyan@gmail.com>
To: akpm@linux-foundation.org
Cc: linux-kernel@vger.kernel.org, Alexey Dobriyan <adobriyan@gmail.com>
Subject: [PATCH 21/45] kstrtox: convert drivers/hid/
Date: Sun, 5 Dec 2010 19:49:18 +0200 [thread overview]
Message-ID: <1291571382-2719-21-git-send-email-adobriyan@gmail.com> (raw)
In-Reply-To: <1291571382-2719-1-git-send-email-adobriyan@gmail.com>
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---
drivers/hid/hid-magicmouse.c | 14 ++++++++--
drivers/hid/hid-ntrig.c | 54 ++++++++++++++++++++++------------------
drivers/hid/hid-roccat-kone.c | 8 +++---
3 files changed, 45 insertions(+), 31 deletions(-)
diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c
index e6dc151..5107ee5 100644
--- a/drivers/hid/hid-magicmouse.c
+++ b/drivers/hid/hid-magicmouse.c
@@ -32,9 +32,17 @@ module_param(emulate_scroll_wheel, bool, 0644);
MODULE_PARM_DESC(emulate_scroll_wheel, "Emulate a scroll wheel");
static unsigned int scroll_speed = 32;
-static int param_set_scroll_speed(const char *val, struct kernel_param *kp) {
- unsigned long speed;
- if (!val || strict_strtoul(val, 0, &speed) || speed > 63)
+static int param_set_scroll_speed(const char *val, struct kernel_param *kp)
+{
+ unsigned int speed;
+ int rv;
+
+ if (!val)
+ return -EINVAL;
+ rv = kstrtouint(val, 0, &speed);
+ if (rv < 0)
+ return rv;
+ if (speed > 63)
return -EINVAL;
scroll_speed = speed;
return 0;
diff --git a/drivers/hid/hid-ntrig.c b/drivers/hid/hid-ntrig.c
index 69169ef..6128531 100644
--- a/drivers/hid/hid-ntrig.c
+++ b/drivers/hid/hid-ntrig.c
@@ -206,11 +206,12 @@ static ssize_t set_min_width(struct device *dev,
struct hid_device *hdev = container_of(dev, struct hid_device, dev);
struct ntrig_data *nd = hid_get_drvdata(hdev);
- unsigned long val;
-
- if (strict_strtoul(buf, 0, &val))
- return -EINVAL;
+ u16 val;
+ int rv;
+ rv = kstrtou16(buf, 0, &val);
+ if (rv < 0)
+ return rv;
if (val > nd->sensor_physical_width)
return -EINVAL;
@@ -241,11 +242,12 @@ static ssize_t set_min_height(struct device *dev,
struct hid_device *hdev = container_of(dev, struct hid_device, dev);
struct ntrig_data *nd = hid_get_drvdata(hdev);
- unsigned long val;
-
- if (strict_strtoul(buf, 0, &val))
- return -EINVAL;
+ u16 val;
+ int rv;
+ rv = kstrtou16(buf, 0, &val);
+ if (rv < 0)
+ return rv;
if (val > nd->sensor_physical_height)
return -EINVAL;
@@ -275,11 +277,12 @@ static ssize_t set_activate_slack(struct device *dev,
struct hid_device *hdev = container_of(dev, struct hid_device, dev);
struct ntrig_data *nd = hid_get_drvdata(hdev);
- unsigned long val;
-
- if (strict_strtoul(buf, 0, &val))
- return -EINVAL;
+ u8 val;
+ int rv;
+ rv = kstrtou8(buf, 0, &val);
+ if (rv < 0)
+ return rv;
if (val > 0x7f)
return -EINVAL;
@@ -310,11 +313,12 @@ static ssize_t set_activation_width(struct device *dev,
struct hid_device *hdev = container_of(dev, struct hid_device, dev);
struct ntrig_data *nd = hid_get_drvdata(hdev);
- unsigned long val;
-
- if (strict_strtoul(buf, 0, &val))
- return -EINVAL;
+ u16 val;
+ int rv;
+ rv = kstrtou16(buf, 0, &val);
+ if (rv < 0)
+ return rv;
if (val > nd->sensor_physical_width)
return -EINVAL;
@@ -346,11 +350,12 @@ static ssize_t set_activation_height(struct device *dev,
struct hid_device *hdev = container_of(dev, struct hid_device, dev);
struct ntrig_data *nd = hid_get_drvdata(hdev);
- unsigned long val;
-
- if (strict_strtoul(buf, 0, &val))
- return -EINVAL;
+ u16 val;
+ int rv;
+ rv = kstrtou16(buf, 0, &val);
+ if (rv < 0)
+ return rv;
if (val > nd->sensor_physical_height)
return -EINVAL;
@@ -380,11 +385,12 @@ static ssize_t set_deactivate_slack(struct device *dev,
struct hid_device *hdev = container_of(dev, struct hid_device, dev);
struct ntrig_data *nd = hid_get_drvdata(hdev);
- unsigned long val;
-
- if (strict_strtoul(buf, 0, &val))
- return -EINVAL;
+ u8 val;
+ int rv;
+ rv = kstrtou8(buf, 0, &val);
+ if (rv < 0)
+ return rv;
/*
* No more than 8 terminal frames have been observed so far
* and higher slack is highly likely to leave the single
diff --git a/drivers/hid/hid-roccat-kone.c b/drivers/hid/hid-roccat-kone.c
index f776957..e0dd8f9 100644
--- a/drivers/hid/hid-roccat-kone.c
+++ b/drivers/hid/hid-roccat-kone.c
@@ -507,9 +507,9 @@ static ssize_t kone_sysfs_set_tcu(struct device *dev,
struct kone_device *kone = hid_get_drvdata(dev_get_drvdata(dev));
struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev));
int retval;
- unsigned long state;
+ int state;
- retval = strict_strtoul(buf, 10, &state);
+ retval = kstrtoint(buf, 10, &state);
if (retval)
return retval;
@@ -589,9 +589,9 @@ static ssize_t kone_sysfs_set_startup_profile(struct device *dev,
struct kone_device *kone = hid_get_drvdata(dev_get_drvdata(dev));
struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev));
int retval;
- unsigned long new_startup_profile;
+ int new_startup_profile;
- retval = strict_strtoul(buf, 10, &new_startup_profile);
+ retval = kstrtoint(buf, 10, &new_startup_profile);
if (retval)
return retval;
--
1.7.2.2
next prev parent reply other threads:[~2010-12-05 17:56 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-05 17:48 [PATCH 01/45] kstrtox: converting strings to integers done (hopefully) right Alexey Dobriyan
2010-12-05 17:48 ` [PATCH 02/45] kstrtox: convert arch/x86/ Alexey Dobriyan
2010-12-05 17:49 ` [PATCH 03/45] kstrtox: convert arch/arm/ Alexey Dobriyan
2010-12-05 17:49 ` [PATCH 04/45] kstrtox: convert kernel/ Alexey Dobriyan
2010-12-05 17:49 ` [PATCH 05/45] kstrtox: kernel/trace/ Alexey Dobriyan
2010-12-05 17:49 ` [PATCH 06/45] kstrtox: convert mm/ Alexey Dobriyan
2010-12-05 17:49 ` [PATCH 07/45] kstrtox: convert fs/fuse/ Alexey Dobriyan
2010-12-05 17:49 ` [PATCH 08/45] kstrtox: convert fs/nfs/ Alexey Dobriyan
2010-12-05 17:49 ` [PATCH 09/45] kstrtox: convert fs/proc/ Alexey Dobriyan
2010-12-05 17:49 ` [PATCH 10/45] kstrtox: convert security/ Alexey Dobriyan
2010-12-05 17:49 ` [PATCH 11/45] kstrtox: convert block/ Alexey Dobriyan
2010-12-05 17:49 ` [PATCH 12/45] kstrtox: convert drivers/acpi/ Alexey Dobriyan
2010-12-05 17:49 ` [PATCH 13/45] kstrtox: convert drivers/ata/ Alexey Dobriyan
2010-12-05 17:49 ` [PATCH 14/45] kstrtox: convert drivers/base/ Alexey Dobriyan
2010-12-05 17:49 ` [PATCH 15/45] kstrtox: convert drivers/block/ Alexey Dobriyan
2010-12-05 17:49 ` [PATCH 16/45] kstrtox: convert drivers/bluetooth/ Alexey Dobriyan
2010-12-05 17:49 ` [PATCH 17/45] kstrtox: convert drivers/clocksource/ Alexey Dobriyan
2010-12-05 17:49 ` [PATCH 18/45] kstrtox: convert drivers/edac/ Alexey Dobriyan
2010-12-05 17:49 ` [PATCH 19/45] kstrtox: convert drivers/gpio/ Alexey Dobriyan
2010-12-05 17:49 ` [PATCH 20/45] kstrtox: convert drivers/gpu/drm/nouveau/ Alexey Dobriyan
2010-12-05 17:49 ` Alexey Dobriyan [this message]
2010-12-05 17:49 ` [PATCH 22/45] kstrtox: convert drivers/hwmon/ Alexey Dobriyan
2010-12-05 17:49 ` [PATCH 23/45] kstrtox: convert drivers/ide/ Alexey Dobriyan
2010-12-05 17:49 ` [PATCH 24/45] kstrtox: convert drivers/infiniband/ Alexey Dobriyan
2010-12-05 17:49 ` [PATCH 25/45] kstrtox: convert drivers/input/ Alexey Dobriyan
2010-12-05 17:49 ` [PATCH 26/45] kstrtox: convert drivers/isdn/ Alexey Dobriyan
2010-12-06 0:10 ` Tilman Schmidt
2010-12-06 20:10 ` Alexey Dobriyan
2010-12-07 10:06 ` Tilman Schmidt
2010-12-05 17:49 ` [PATCH 27/45] kstrtox: convert drivers/leds/ Alexey Dobriyan
2010-12-05 17:49 ` [PATCH 28/45] kstrtox: convert drivers/md/ Alexey Dobriyan
2010-12-05 17:49 ` [PATCH 29/45] kstrtox: convert drivers/mfd/ Alexey Dobriyan
2010-12-05 17:49 ` [PATCH 30/45] kstrtox: convert drivers/misc/ Alexey Dobriyan
2010-12-05 17:49 ` [PATCH 31/45] kstrtox: convert drivers/mmc/ Alexey Dobriyan
2010-12-05 17:49 ` [PATCH 32/45] kstrtox: convert drivers/net/ Alexey Dobriyan
2010-12-05 17:49 ` [PATCH 33/45] kstrtox: convert drivers/net/wireless/ Alexey Dobriyan
2010-12-05 17:49 ` [PATCH 34/45] kstrtox: convert drivers/pci/ Alexey Dobriyan
2010-12-05 17:49 ` [PATCH 35/45] kstrtox: convert drivers/platform/x86/ Alexey Dobriyan
2010-12-05 17:49 ` [PATCH 36/45] kstrtox: convert drivers/power/ Alexey Dobriyan
2010-12-05 17:49 ` [PATCH 37/45] kstrtox: convert drivers/regulator/ Alexey Dobriyan
2010-12-05 17:49 ` [PATCH 38/45] kstrtox: convert drivers/rtc/ Alexey Dobriyan
2010-12-05 17:49 ` [PATCH 39/45] kstrtox: convert drivers/scsi/ Alexey Dobriyan
2010-12-05 17:49 ` [PATCH 40/45] kstrtox: convert drivers/ssb/ Alexey Dobriyan
2010-12-05 17:49 ` [PATCH 41/45] kstrtox: convert drivers/usb/ Alexey Dobriyan
2010-12-05 17:49 ` [PATCH 42/45] kstrtox: convert drivers/video/ Alexey Dobriyan
2010-12-05 17:49 ` [PATCH 43/45] kstrtox: convert drivers/w1/ Alexey Dobriyan
2010-12-05 17:49 ` [PATCH 44/45] kstrtox: convert sound/ Alexey Dobriyan
2010-12-05 17:49 ` [PATCH 45/45] kstrtox: convert net/ Alexey Dobriyan
2010-12-06 0:25 ` [PATCH 01/45] kstrtox: converting strings to integers done (hopefully) right Jesper Juhl
2010-12-06 15:16 ` Alexey Dobriyan
2010-12-07 9:04 ` Arnd Bergmann
2010-12-07 9:32 ` Alexey Dobriyan
2010-12-07 9:45 ` Arnd Bergmann
2010-12-08 8:51 ` Alexey Dobriyan
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=1291571382-2719-21-git-send-email-adobriyan@gmail.com \
--to=adobriyan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.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
Powered by JetHome