From: Alexey Dobriyan <adobriyan@gmail.com>
To: akpm@linux-foundation.org
Cc: linux-kernel@vger.kernel.org, Alexey Dobriyan <adobriyan@gmail.com>
Subject: [PATCH 41/45] kstrtox: convert drivers/usb/
Date: Sun, 5 Dec 2010 19:49:38 +0200 [thread overview]
Message-ID: <1291571382-2719-41-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/usb/gadget/storage_common.c | 7 ++++---
drivers/usb/host/ehci-dbg.c | 6 +++---
drivers/usb/serial/iuu_phoenix.c | 27 ++++++++++-----------------
3 files changed, 17 insertions(+), 23 deletions(-)
diff --git a/drivers/usb/gadget/storage_common.c b/drivers/usb/gadget/storage_common.c
index 3b513ba..b7c7df9 100644
--- a/drivers/usb/gadget/storage_common.c
+++ b/drivers/usb/gadget/storage_common.c
@@ -716,8 +716,9 @@ static ssize_t fsg_store_ro(struct device *dev, struct device_attribute *attr,
struct rw_semaphore *filesem = dev_get_drvdata(dev);
unsigned long ro;
- if (strict_strtoul(buf, 2, &ro))
- return -EINVAL;
+ rc = kstrtoul(buf, 2, &ro);
+ if (rc < 0)
+ return rc;
/*
* Allow the write-enable status to change only while the
@@ -743,7 +744,7 @@ static ssize_t fsg_store_nofua(struct device *dev,
struct fsg_lun *curlun = fsg_lun_from_dev(dev);
unsigned long nofua;
- if (strict_strtoul(buf, 2, &nofua))
+ if (kstrtoul(buf, 2, &nofua))
return -EINVAL;
/* Sync data when switching from async mode to sync */
diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index 6e25996..34e263b 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -1000,7 +1000,7 @@ static ssize_t debug_lpm_write(struct file *file, const char __user *user_buf,
buf[len - 1] = '\0';
if (strncmp(buf, "enable", 5) == 0) {
- if (strict_strtoul(buf + 7, 10, &port))
+ if (kstrtoul(buf + 7, 10, &port))
return -EINVAL;
params = ehci_readl(ehci, &ehci->caps->hcs_params);
if (port > HCS_N_PORTS(params)) {
@@ -1018,7 +1018,7 @@ static ssize_t debug_lpm_write(struct file *file, const char __user *user_buf,
printk(KERN_INFO "force enable LPM for port %lu\n", port);
} else if (strncmp(buf, "hird=", 5) == 0) {
unsigned long hird;
- if (strict_strtoul(buf + 5, 16, &hird))
+ if (kstrtoul(buf + 5, 16, &hird))
return -EINVAL;
printk(KERN_INFO "setting hird %s %lu\n", buf + 6, hird);
temp = ehci_readl(ehci, &ehci->regs->command);
@@ -1026,7 +1026,7 @@ static ssize_t debug_lpm_write(struct file *file, const char __user *user_buf,
temp |= hird << 24;
ehci_writel(ehci, temp, &ehci->regs->command);
} else if (strncmp(buf, "disable", 7) == 0) {
- if (strict_strtoul(buf + 8, 10, &port))
+ if (kstrtoul(buf + 8, 10, &port))
return -EINVAL;
params = ehci_readl(ehci, &ehci->caps->hcs_params);
if (port > HCS_N_PORTS(params)) {
diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c
index 12ed594..0d23f3d 100644
--- a/drivers/usb/serial/iuu_phoenix.c
+++ b/drivers/usb/serial/iuu_phoenix.c
@@ -1227,23 +1227,16 @@ static ssize_t store_vcc_mode(struct device *dev,
{
struct usb_serial_port *port = to_usb_serial_port(dev);
struct iuu_private *priv = usb_get_serial_port_data(port);
- unsigned long v;
-
- if (strict_strtoul(buf, 10, &v)) {
- dev_err(dev, "%s - vcc_mode: %s is not a unsigned long\n",
- __func__, buf);
- goto fail_store_vcc_mode;
- }
-
- dbg("%s: setting vcc_mode = %ld", __func__, v);
-
- if ((v != 3) && (v != 5)) {
- dev_err(dev, "%s - vcc_mode %ld is invalid\n", __func__, v);
- } else {
- iuu_vcc_set(port, v);
- priv->vcc = v;
- }
-fail_store_vcc_mode:
+ int v;
+ int rv;
+
+ rv = kstrtoint(buf, 10, &v);
+ if (rv < 0)
+ return rv;
+ if (v != 3 && v != 5)
+ return -EINVAL;
+ iuu_vcc_set(port, v);
+ priv->vcc = v;
return count;
}
--
1.7.2.2
next prev parent reply other threads:[~2010-12-05 17:52 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 ` [PATCH 21/45] kstrtox: convert drivers/hid/ Alexey Dobriyan
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 ` Alexey Dobriyan [this message]
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-41-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;
as well as URLs for NNTP newsgroup(s).