From: Alexey Dobriyan <adobriyan@gmail.com>
To: akpm@linux-foundation.org
Cc: linux-kernel@vger.kernel.org, Alexey Dobriyan <adobriyan@gmail.com>
Subject: [PATCH 02/45] kstrtox: convert arch/x86/
Date: Sun, 5 Dec 2010 19:48:59 +0200 [thread overview]
Message-ID: <1291571382-2719-2-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>
---
arch/x86/kernel/cpu/cpufreq/powernow-k8.c | 12 ++++++++----
arch/x86/kernel/cpu/intel_cacheinfo.c | 15 ++++++++-------
arch/x86/kernel/cpu/mcheck/mce.c | 25 ++++++++++++++-----------
arch/x86/kernel/cpu/mcheck/mce_amd.c | 12 ++++++++----
arch/x86/kvm/mmu_audit.c | 6 +++---
arch/x86/platform/uv/tlb_uv.c | 19 ++++++++++++-------
6 files changed, 53 insertions(+), 36 deletions(-)
diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
index 491977b..1b8380a 100644
--- a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
+++ b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
@@ -1451,11 +1451,15 @@ static void cpb_toggle(bool t)
static ssize_t store_cpb(struct cpufreq_policy *policy, const char *buf,
size_t count)
{
- int ret = -EINVAL;
- unsigned long val = 0;
+ int val;
+ int ret;
- ret = strict_strtoul(buf, 10, &val);
- if (!ret && (val == 0 || val == 1) && cpb_capable)
+ ret = kstrtoint(buf, 10, &val);
+ if (ret < 0)
+ return ret;
+ if (val != 0 && val != 1)
+ return -EINVAL;
+ if (cpb_capable)
cpb_toggle(val);
else
return -EINVAL;
diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c
index 17ad033..3647889 100644
--- a/arch/x86/kernel/cpu/intel_cacheinfo.c
+++ b/arch/x86/kernel/cpu/intel_cacheinfo.c
@@ -442,7 +442,7 @@ SHOW_CACHE_DISABLE(0)
SHOW_CACHE_DISABLE(1)
static void amd_l3_disable_index(struct amd_l3_cache *l3, int cpu,
- unsigned slot, unsigned long idx)
+ unsigned slot, u32 idx)
{
int i;
@@ -481,12 +481,12 @@ static void amd_l3_disable_index(struct amd_l3_cache *l3, int cpu,
*
* @return: 0 on success, error status on failure
*/
-int amd_set_l3_disable_slot(struct amd_l3_cache *l3, int cpu, unsigned slot,
- unsigned long index)
+static int amd_set_l3_disable_slot(struct amd_l3_cache *l3, int cpu,
+ unsigned slot, u32 index)
{
int ret = 0;
-#define SUBCACHE_MASK (3UL << 20)
+#define SUBCACHE_MASK (3U << 20)
#define SUBCACHE_INDEX 0xfff
/*
@@ -518,7 +518,7 @@ static ssize_t store_cache_disable(struct _cpuid4_info *this_leaf,
const char *buf, size_t count,
unsigned int slot)
{
- unsigned long val = 0;
+ u32 val;
int cpu, err = 0;
if (!capable(CAP_SYS_ADMIN))
@@ -529,8 +529,9 @@ static ssize_t store_cache_disable(struct _cpuid4_info *this_leaf,
cpu = cpumask_first(to_cpumask(this_leaf->shared_cpu_map));
- if (strict_strtoul(buf, 10, &val) < 0)
- return -EINVAL;
+ err = kstrtou32(buf, 10, &val);
+ if (err < 0)
+ return err;
err = amd_set_l3_disable_slot(this_leaf->l3, cpu, slot, val);
if (err) {
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index 7a35b72..f868f80 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -1833,12 +1833,11 @@ static ssize_t show_bank(struct sys_device *s, struct sysdev_attribute *attr,
static ssize_t set_bank(struct sys_device *s, struct sysdev_attribute *attr,
const char *buf, size_t size)
{
- u64 new;
+ int rv;
- if (strict_strtoull(buf, 0, &new) < 0)
- return -EINVAL;
-
- attr_to_bank(attr)->ctl = new;
+ rv = kstrtou64(buf, 0, &attr_to_bank(attr)->ctl);
+ if (rv < 0)
+ return rv;
mce_restart();
return size;
@@ -1871,10 +1870,12 @@ static ssize_t set_ignore_ce(struct sys_device *s,
struct sysdev_attribute *attr,
const char *buf, size_t size)
{
- u64 new;
+ unsigned long long new;
+ int rv;
- if (strict_strtoull(buf, 0, &new) < 0)
- return -EINVAL;
+ rv = kstrtoull(buf, 0, &new);
+ if (rv < 0)
+ return rv;
if (mce_ignore_ce ^ !!new) {
if (new) {
@@ -1894,10 +1895,12 @@ static ssize_t set_cmci_disabled(struct sys_device *s,
struct sysdev_attribute *attr,
const char *buf, size_t size)
{
- u64 new;
+ unsigned long long new;
+ int rv;
- if (strict_strtoull(buf, 0, &new) < 0)
- return -EINVAL;
+ rv = kstrtoull(buf, 0, &new);
+ if (rv < 0)
+ return rv;
if (mce_cmci_disabled ^ !!new) {
if (new) {
diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd.c b/arch/x86/kernel/cpu/mcheck/mce_amd.c
index 80c4823..27e1555 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_amd.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c
@@ -292,9 +292,11 @@ store_interrupt_enable(struct threshold_block *b, const char *buf, size_t size)
{
struct thresh_restart tr;
unsigned long new;
+ int rv;
- if (strict_strtoul(buf, 0, &new) < 0)
- return -EINVAL;
+ rv = kstrtoul(buf, 0, &new);
+ if (rv < 0)
+ return rv;
b->interrupt_enable = !!new;
@@ -312,9 +314,11 @@ store_threshold_limit(struct threshold_block *b, const char *buf, size_t size)
{
struct thresh_restart tr;
unsigned long new;
+ int rv;
- if (strict_strtoul(buf, 0, &new) < 0)
- return -EINVAL;
+ rv = kstrtoul(buf, 0, &new);
+ if (rv < 0)
+ return rv;
if (new > THRESHOLD_MAX)
new = THRESHOLD_MAX;
diff --git a/arch/x86/kvm/mmu_audit.c b/arch/x86/kvm/mmu_audit.c
index ba2bcdd..64ffde1 100644
--- a/arch/x86/kvm/mmu_audit.c
+++ b/arch/x86/kvm/mmu_audit.c
@@ -270,12 +270,12 @@ static void mmu_audit_disable(void)
static int mmu_audit_set(const char *val, const struct kernel_param *kp)
{
+ int enable;
int ret;
- unsigned long enable;
- ret = strict_strtoul(val, 10, &enable);
+ ret = kstrtoint(val, 10, &enable);
if (ret < 0)
- return -EINVAL;
+ return ret;
switch (enable) {
case 0:
diff --git a/arch/x86/platform/uv/tlb_uv.c b/arch/x86/platform/uv/tlb_uv.c
index ba9caa8..0fc13d3 100644
--- a/arch/x86/platform/uv/tlb_uv.c
+++ b/arch/x86/platform/uv/tlb_uv.c
@@ -1028,21 +1028,22 @@ static ssize_t uv_ptc_proc_write(struct file *file, const char __user *user,
size_t count, loff_t *data)
{
int cpu;
- long input_arg;
+ int input_arg;
char optstr[64];
struct ptc_stats *stat;
+ int rv;
if (count == 0 || count > sizeof(optstr))
return -EINVAL;
if (copy_from_user(optstr, user, count))
return -EFAULT;
optstr[count - 1] = '\0';
- if (strict_strtol(optstr, 10, &input_arg) < 0) {
- printk(KERN_DEBUG "%s is invalid\n", optstr);
- return -EINVAL;
- }
+ rv = kstrtoint(optstr, 10, &input_arg);
+ if (rv < 0)
+ return rv;
- if (input_arg == 0) {
+ switch (input_arg) {
+ case 0:
printk(KERN_DEBUG "# cpu: cpu number\n");
printk(KERN_DEBUG "Sender statistics:\n");
printk(KERN_DEBUG
@@ -1110,11 +1111,15 @@ static ssize_t uv_ptc_proc_write(struct file *file, const char __user *user,
"disable: number times use of the BAU was disabled\n");
printk(KERN_DEBUG
"enable: number times use of the BAU was re-enabled\n");
- } else if (input_arg == -1) {
+ break;
+ case -1:
for_each_present_cpu(cpu) {
stat = &per_cpu(ptcstats, cpu);
memset(stat, 0, sizeof(struct ptc_stats));
}
+ break;
+ default:
+ return -EINVAL;
}
return count;
--
1.7.2.2
next prev parent reply other threads:[~2010-12-05 17:50 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 ` Alexey Dobriyan [this message]
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 ` [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-2-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).