public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86: cpuid.c fix style problems
@ 2008-12-31 10:59 Jaswinder Singh Rajput
  2008-12-31 13:01 ` Pekka Enberg
  2009-01-02 16:46 ` Ingo Molnar
  0 siblings, 2 replies; 4+ messages in thread
From: Jaswinder Singh Rajput @ 2008-12-31 10:59 UTC (permalink / raw)
  To: Ingo Molnar, hpa, x86 maintainers, LKML

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

Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
---
 arch/x86/kernel/cpuid.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kernel/cpuid.c b/arch/x86/kernel/cpuid.c
index 72cefd1..2b2dddb 100644
--- a/arch/x86/kernel/cpuid.c
+++ b/arch/x86/kernel/cpuid.c
@@ -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;
 	}
-- 
1.5.5.1




^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] x86: cpuid.c fix style problems
  2008-12-31 10:59 [PATCH] x86: cpuid.c fix style problems Jaswinder Singh Rajput
@ 2008-12-31 13:01 ` Pekka Enberg
  2009-01-02 18:58   ` Ingo Molnar
  2009-01-02 16:46 ` Ingo Molnar
  1 sibling, 1 reply; 4+ messages in thread
From: Pekka Enberg @ 2008-12-31 13:01 UTC (permalink / raw)
  To: Jaswinder Singh Rajput; +Cc: Ingo Molnar, hpa, x86 maintainers, LKML

On Wed, Dec 31, 2008 at 12:59 PM, Jaswinder Singh Rajput
<jaswinder@infradead.org> wrote:
>        cpu = iminor(file->f_path.dentry->d_inode);
> -       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()?

>                ret = -ENXIO;   /* No such CPU */
>                goto out;
>        }

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] x86: cpuid.c fix style problems
  2008-12-31 10:59 [PATCH] x86: cpuid.c fix style problems Jaswinder Singh Rajput
  2008-12-31 13:01 ` Pekka Enberg
@ 2009-01-02 16:46 ` Ingo Molnar
  1 sibling, 0 replies; 4+ messages in thread
From: Ingo Molnar @ 2009-01-02 16:46 UTC (permalink / raw)
  To: Jaswinder Singh Rajput; +Cc: hpa, x86 maintainers, LKML


* Jaswinder Singh Rajput <jaswinder@infradead.org> wrote:

> 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
> 
> Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
> ---
>  arch/x86/kernel/cpuid.c |    8 ++++----
>  1 files changed, 4 insertions(+), 4 deletions(-)

applied to tip/x86/cleanups, thanks,

	Ingo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] x86: cpuid.c fix style problems
  2008-12-31 13:01 ` Pekka Enberg
@ 2009-01-02 18:58   ` Ingo Molnar
  0 siblings, 0 replies; 4+ messages in thread
From: Ingo Molnar @ 2009-01-02 18:58 UTC (permalink / raw)
  To: Pekka Enberg, Rusty Russell, Mike Travis
  Cc: Jaswinder Singh Rajput, hpa, x86 maintainers, LKML


* Pekka Enberg <penberg@cs.helsinki.fi> wrote:

> On Wed, Dec 31, 2008 at 12:59 PM, Jaswinder Singh Rajput
> <jaswinder@infradead.org> wrote:
> >        cpu = iminor(file->f_path.dentry->d_inode);
> > -       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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-01-02 18:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-31 10:59 [PATCH] x86: cpuid.c fix style problems Jaswinder Singh Rajput
2008-12-31 13:01 ` Pekka Enberg
2009-01-02 18:58   ` Ingo Molnar
2009-01-02 16:46 ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox