Skip to contentSkip to conversation

x86: cpuid.c fix style problems

PATCH Applied Jaswinder Singh Rajput 3 participants 4 messages Dec 31, 2008 – Jan 2, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: cpuid.c fix style problems

Impact: cleanup, fix style problems

Fixes style problems:
WARNING: Use #include <linux/uaccess.h> instead of <asm/uaccess.h>
ERROR: "foo * bar" should be "foo *bar"
ERROR: trailing whitespace
WARNING: usage of NR_CPUS is often wrong - consider using cpu_possible(), num_possible_cpus(), for_each_possible_cpu(), etc

total: 2 errors, 2 warnings

---
 arch/x86/kernel/cpuid.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
arch/x86/kernel/cpuid.c +4 -4
index 72cefd1..2b2dddb 100644
@@ -39,10 +39,10 @@
 #include <linux/device.h>
 #include <linux/cpu.h>
 #include <linux/notifier.h>
+#include <linux/uaccess.h>
 
 #include <asm/processor.h>
 #include <asm/msr.h>
-#include <asm/uaccess.h>
 #include <asm/system.h>
 
 static struct class *cpuid_class;
@@ -82,7 +82,7 @@ static loff_t cpuid_seek(struct file *file, loff_t offset, int orig)
 }
 
 static ssize_t cpuid_read(struct file *file, char __user *buf,
-			  size_t count, loff_t * ppos)
+			  size_t count, loff_t *ppos)
 {
 	char __user *tmp = buf;
 	struct cpuid_regs cmd;
@@ -117,11 +117,11 @@ static int cpuid_open(struct inode *inode, struct file *file)
 	unsigned int cpu;
 	struct cpuinfo_x86 *c;
 	int ret = 0;
-	
+
 	lock_kernel();
 
 	cpu = iminor(file->f_path.dentry->d_inode);
-	if (cpu >= NR_CPUS || !cpu_online(cpu)) {
+	if (cpu >= num_possible_cpus() || !cpu_online(cpu)) {
 		ret = -ENXIO;	/* No such CPU */
 		goto out;
 	}
Signature · 1 line
1.5.5.1
#1 lore raw

arch/x86/kernel/cpuid.c static int cpuid_open(struct inode *inode, struct file *file) · line 124

Quoted 3 lines · Jaswinder Singh Rajput
       cpu = iminor(file->f_path.dentry->d_inode);
arch/x86/kernel/cpuid.c +1 -1
-       if (cpu >= NR_CPUS || !cpu_online(cpu)) {
+       if (cpu >= num_possible_cpus() || !cpu_online(cpu)) {

How come you didn't convert the first part of the expression to use cpu_possible()?

Quoted 3 lines
               ret = -ENXIO;   /* No such CPU */
               goto out;
       }
#2 lore raw
Quoted 8 lines · Pekka Enberg

arch/x86/kernel/cpuid.c static int cpuid_open(struct inode *inode, struct file *file) · line 124

Quoted 3 lines · Jaswinder Singh Rajput
       cpu = iminor(file->f_path.dentry->d_inode);
arch/x86/kernel/cpuid.c +1 -1
-       if (cpu >= NR_CPUS || !cpu_online(cpu)) {
+       if (cpu >= num_possible_cpus() || !cpu_online(cpu)) {

How come you didn't convert the first part of the expression to use cpu_possible()?

i skipped this bit btw., as it got mooted by the cleanups in the cpumask and cpus4096 trees.

Ingo

Applied
#3 lore raw
In reply to Jaswinder Singh Rajput
Quoted 8 lines · Jaswinder Singh Rajput

Impact: cleanup, fix style problems

Fixes style problems:
WARNING: Use #include <linux/uaccess.h> instead of <asm/uaccess.h>
ERROR: "foo * bar" should be "foo *bar"
ERROR: trailing whitespace
WARNING: usage of NR_CPUS is often wrong - consider using cpu_possible(), num_possible_cpus(), for_each_possible_cpu(), etc

Quoted 6 lines

total: 2 errors, 2 warnings

---
 arch/x86/kernel/cpuid.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

applied to tip/x86/cleanups, thanks,

Ingo