[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1291571382-2719-34-git-send-email-adobriyan@gmail.com>
Date: Sun, 5 Dec 2010 19:49:31 +0200
From: Alexey Dobriyan <adobriyan@...il.com>
To: akpm@...ux-foundation.org
Cc: linux-kernel@...r.kernel.org, Alexey Dobriyan <adobriyan@...il.com>
Subject: [PATCH 34/45] kstrtox: convert drivers/pci/
Signed-off-by: Alexey Dobriyan <adobriyan@...il.com>
---
drivers/pci/hotplug/fakephp.c | 2 +-
drivers/pci/pci-sysfs.c | 45 ++++++++++++++++++++++------------------
2 files changed, 26 insertions(+), 21 deletions(-)
diff --git a/drivers/pci/hotplug/fakephp.c b/drivers/pci/hotplug/fakephp.c
index 17d10e2..aaf2529 100644
--- a/drivers/pci/hotplug/fakephp.c
+++ b/drivers/pci/hotplug/fakephp.c
@@ -49,7 +49,7 @@ static ssize_t legacy_store(struct kobject *kobj, struct attribute *attr,
struct legacy_slot *slot = container_of(kobj, typeof(*slot), kobj);
unsigned long val;
- if (strict_strtoul(buf, 0, &val) < 0)
+ if (kstrtoul(buf, 0, &val) < 0)
return -EINVAL;
if (val)
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index 63d5042..1105790 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -61,9 +61,11 @@ static ssize_t broken_parity_status_store(struct device *dev,
{
struct pci_dev *pdev = to_pci_dev(dev);
unsigned long val;
+ int rv;
- if (strict_strtoul(buf, 0, &val) < 0)
- return -EINVAL;
+ rv = kstrtoul(buf, 0, &val);
+ if (rv < 0)
+ return rv;
pdev->broken_parity_status = !!val;
@@ -150,15 +152,16 @@ static ssize_t is_enabled_store(struct device *dev,
{
struct pci_dev *pdev = to_pci_dev(dev);
unsigned long val;
- ssize_t result = strict_strtoul(buf, 0, &val);
-
- if (result < 0)
- return result;
+ int result;
/* this can crash the machine when done on the "wrong" device */
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
+ result = kstrtoul(buf, 0, &val);
+ if (result < 0)
+ return result;
+
if (!val) {
if (pci_is_enabled(pdev))
pci_disable_device(pdev);
@@ -221,14 +224,14 @@ msi_bus_store(struct device *dev, struct device_attribute *attr,
struct pci_dev *pdev = to_pci_dev(dev);
unsigned long val;
- if (strict_strtoul(buf, 0, &val) < 0)
- return -EINVAL;
-
/* bad things may happen if the no_msi flag is changed
* while some drivers are loaded */
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
+ if (kstrtoul(buf, 0, &val) < 0)
+ return -EINVAL;
+
/* Maybe pci devices without subordinate busses shouldn't even have this
* attribute in the first place? */
if (!pdev->subordinate)
@@ -254,7 +257,7 @@ static ssize_t bus_rescan_store(struct bus_type *bus, const char *buf,
unsigned long val;
struct pci_bus *b = NULL;
- if (strict_strtoul(buf, 0, &val) < 0)
+ if (kstrtoul(buf, 0, &val) < 0)
return -EINVAL;
if (val) {
@@ -278,7 +281,7 @@ dev_rescan_store(struct device *dev, struct device_attribute *attr,
unsigned long val;
struct pci_dev *pdev = to_pci_dev(dev);
- if (strict_strtoul(buf, 0, &val) < 0)
+ if (kstrtoul(buf, 0, &val) < 0)
return -EINVAL;
if (val) {
@@ -302,19 +305,21 @@ static ssize_t
remove_store(struct device *dev, struct device_attribute *dummy,
const char *buf, size_t count)
{
- int ret = 0;
unsigned long val;
+ int ret;
- if (strict_strtoul(buf, 0, &val) < 0)
- return -EINVAL;
+ ret = kstrtoul(buf, 0, &val);
+ if (ret < 0)
+ return ret;
/* An attribute cannot be unregistered by one of its own methods,
* so we have to use this roundabout approach.
*/
- if (val)
+ if (val) {
ret = device_schedule_callback(dev, remove_callback);
- if (ret)
- count = ret;
+ if (ret < 0)
+ return ret;
+ }
return count;
}
#endif
@@ -1050,12 +1055,12 @@ static ssize_t reset_store(struct device *dev,
size_t count)
{
struct pci_dev *pdev = to_pci_dev(dev);
- unsigned long val;
- ssize_t result = strict_strtoul(buf, 0, &val);
+ int val;
+ int result;
+ result = kstrtoint(buf, 0, &val);
if (result < 0)
return result;
-
if (val != 1)
return -EINVAL;
--
1.7.2.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists