[PATCH] Remove the macro get_personality

2008-02-24 Thread WANG Cong

From: WANG Cong <[EMAIL PROTECTED]>
Date: Sun, 24 Feb 2008 12:09:03 +0800
Subject: [PATCH] Remove the macro get_personality

Remove the macro get_personality, use ->personality instead.

Cc: Ingo Molnar <[EMAIL PROTECTED]>
Cc: Christoph Hellwig <[EMAIL PROTECTED]
Cc: Alexey Dobriyan <[EMAIL PROTECTED]>
Cc: David Howells <[EMAIL PROTECTED]>
Cc: Bryan Wu <[EMAIL PROTECTED]>
Signed-off-by: WANG Cong <[EMAIL PROTECTED]>
---
 arch/blackfin/kernel/signal.c |2 +-
 arch/frv/kernel/signal.c  |4 ++--
 include/linux/personality.h   |4 
 3 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/arch/blackfin/kernel/signal.c b/arch/blackfin/kernel/signal.c
index 5564c95..e8d3869 100644
--- a/arch/blackfin/kernel/signal.c
+++ b/arch/blackfin/kernel/signal.c
@@ -224,7 +224,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t * 
info,
 
/* Set up registers for signal handler */
wrusp((unsigned long)frame);
-   if (get_personality & FDPIC_FUNCPTRS) {
+   if (current->personality & FDPIC_FUNCPTRS) {
struct fdpic_func_descriptor __user *funcptr =
(struct fdpic_func_descriptor *) ka->sa.sa_handler;
__get_user(regs->pc, >text);
diff --git a/arch/frv/kernel/signal.c b/arch/frv/kernel/signal.c
index d64bcaf..3bdb368 100644
--- a/arch/frv/kernel/signal.c
+++ b/arch/frv/kernel/signal.c
@@ -297,7 +297,7 @@ static int setup_frame(int sig, struct k_sigaction *ka, 
sigset_t *set)
__frame->lr   = (unsigned long) >retcode;
__frame->gr8  = sig;
 
-   if (get_personality & FDPIC_FUNCPTRS) {
+   if (current->personality & FDPIC_FUNCPTRS) {
struct fdpic_func_descriptor __user *funcptr =
(struct fdpic_func_descriptor __user *) 
ka->sa.sa_handler;
__get_user(__frame->pc, >text);
@@ -396,7 +396,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, 
siginfo_t *info,
__frame->gr8 = sig;
__frame->gr9 = (unsigned long) >info;
 
-   if (get_personality & FDPIC_FUNCPTRS) {
+   if (current->personality & FDPIC_FUNCPTRS) {
struct fdpic_func_descriptor __user *funcptr =
(struct fdpic_func_descriptor __user *) 
ka->sa.sa_handler;
__get_user(__frame->pc, >text);
diff --git a/include/linux/personality.h b/include/linux/personality.h
index 012cd55..a84e9ff 100644
--- a/include/linux/personality.h
+++ b/include/linux/personality.h
@@ -105,10 +105,6 @@ struct exec_domain {
  */
 #define personality(pers)  (pers & PER_MASK)
 
-/*
- * Personality of the currently running process.
- */
-#define get_personality(current->personality)
 
 /*
  * Change personality of the currently running process.
-- 
1.5.3.8

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] Remove the macro get_personality

2008-02-24 Thread WANG Cong

From: WANG Cong [EMAIL PROTECTED]
Date: Sun, 24 Feb 2008 12:09:03 +0800
Subject: [PATCH] Remove the macro get_personality

Remove the macro get_personality, use -personality instead.

Cc: Ingo Molnar [EMAIL PROTECTED]
Cc: Christoph Hellwig [EMAIL PROTECTED]
Cc: Alexey Dobriyan [EMAIL PROTECTED]
Cc: David Howells [EMAIL PROTECTED]
Cc: Bryan Wu [EMAIL PROTECTED]
Signed-off-by: WANG Cong [EMAIL PROTECTED]
---
 arch/blackfin/kernel/signal.c |2 +-
 arch/frv/kernel/signal.c  |4 ++--
 include/linux/personality.h   |4 
 3 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/arch/blackfin/kernel/signal.c b/arch/blackfin/kernel/signal.c
index 5564c95..e8d3869 100644
--- a/arch/blackfin/kernel/signal.c
+++ b/arch/blackfin/kernel/signal.c
@@ -224,7 +224,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t * 
info,
 
/* Set up registers for signal handler */
wrusp((unsigned long)frame);
-   if (get_personality  FDPIC_FUNCPTRS) {
+   if (current-personality  FDPIC_FUNCPTRS) {
struct fdpic_func_descriptor __user *funcptr =
(struct fdpic_func_descriptor *) ka-sa.sa_handler;
__get_user(regs-pc, funcptr-text);
diff --git a/arch/frv/kernel/signal.c b/arch/frv/kernel/signal.c
index d64bcaf..3bdb368 100644
--- a/arch/frv/kernel/signal.c
+++ b/arch/frv/kernel/signal.c
@@ -297,7 +297,7 @@ static int setup_frame(int sig, struct k_sigaction *ka, 
sigset_t *set)
__frame-lr   = (unsigned long) frame-retcode;
__frame-gr8  = sig;
 
-   if (get_personality  FDPIC_FUNCPTRS) {
+   if (current-personality  FDPIC_FUNCPTRS) {
struct fdpic_func_descriptor __user *funcptr =
(struct fdpic_func_descriptor __user *) 
ka-sa.sa_handler;
__get_user(__frame-pc, funcptr-text);
@@ -396,7 +396,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, 
siginfo_t *info,
__frame-gr8 = sig;
__frame-gr9 = (unsigned long) frame-info;
 
-   if (get_personality  FDPIC_FUNCPTRS) {
+   if (current-personality  FDPIC_FUNCPTRS) {
struct fdpic_func_descriptor __user *funcptr =
(struct fdpic_func_descriptor __user *) 
ka-sa.sa_handler;
__get_user(__frame-pc, funcptr-text);
diff --git a/include/linux/personality.h b/include/linux/personality.h
index 012cd55..a84e9ff 100644
--- a/include/linux/personality.h
+++ b/include/linux/personality.h
@@ -105,10 +105,6 @@ struct exec_domain {
  */
 #define personality(pers)  (pers  PER_MASK)
 
-/*
- * Personality of the currently running process.
- */
-#define get_personality(current-personality)
 
 /*
  * Change personality of the currently running process.
-- 
1.5.3.8

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 00/16] (Resend) Use get_personality()

2008-02-23 Thread WANG Cong
From: Andrew Morton <[EMAIL PROTECTED]>
Subject: Re: [PATCH 00/16] (Resend) Use get_personality()
Date: Sat, 23 Feb 2008 11:16:29 -0800
Message-ID: <[EMAIL PROTECTED]>

> On Sat, 23 Feb 2008 13:37:31 -0500 Christoph Hellwig <[EMAIL PROTECTED]> 
> wrote:
> 
> > On Sat, Feb 23, 2008 at 12:27:10PM +0300, Alexey Dobriyan wrote:
> > > > Use get_personality() can hide the task_struct internals a bit.
> > > 
> > > ->personality is going to become something less trivial?
> > > Sorry, but you sound like C++ people writing tons of pointless get/set
> > > wrappers. And your get_personality() is worse -- C++ would write it as
> > > 
> > >   current->personality()
> > > 
> > > and again, even here, it's immediately visible that current task is
> > > involved, not some other task.
> > 
> > Yes, completely agreement.  While I might have introduced this gem
> > back then it is entirely stupid if you think about it.  Please send
> > patches to kill get_personality and just use current->personality
> > instead.
> > 
> 
> yup.
> 
> We'll generally only add wrappers of this form if we need to provide
> alternative implementations, or if we expect that we shall do so in the
> future.
> 

Ok. I will send a patch to remove it.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 08/16] x86: use get_personality()

2008-02-23 Thread WANG Cong
From: Ingo Molnar <[EMAIL PROTECTED]>
Subject: Re: [PATCH 08/16] x86: use get_personality()
Date: Sat, 23 Feb 2008 11:19:54 +0100
Message-ID: <[EMAIL PROTECTED]>

> 
> * Ingo Molnar <[EMAIL PROTECTED]> wrote:
> 
> > * WANG Cong <[EMAIL PROTECTED]> wrote:
> > 
> > > Use get_personality() macro instead of explicit reference for x86 
> > > code.
> > 
> > thanks, applied.
> 
> randconfig testing found the following build failures:
> 
>   arch/x86/kernel/process_64.c: In function 'do_arch_prctl':
>   arch/x86/kernel/process_64.c:836: error: called object 
> 'get_current()->personality' is not a function
>   arch/x86/kernel/process_64.c:862: error: called object 
> 'get_current()->personality' is not a function
> 
> so i dropped the patch again. Config attached.
> 
>   Ingo

Sorry that I didn't mention that this patch should be applied
_after_ [patch 01/16], since in [patch 01/16] I made the macro
get_personality like a function.

Sorry for this. Just wait after [patch 01/16] is applied.

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 00/16] (Resend) Use get_personality()

2008-02-23 Thread WANG Cong
From: Alexey Dobriyan <[EMAIL PROTECTED]>
Subject: Re: [PATCH 00/16] (Resend) Use get_personality()
Date: Sat, 23 Feb 2008 12:27:10 +0300
Message-ID: <[EMAIL PROTECTED]>

> On Sat, Feb 23, 2008 at 04:59:44PM +0800, WANG Cong wrote:
> > From: Alexey Dobriyan <[EMAIL PROTECTED]>
> > Subject: Re: [PATCH 00/16] (Resend) Use get_personality()
> 
> > > On Sat, Feb 23, 2008 at 04:14:03PM +0800, WANG Cong wrote:
> > > > This patchset makes the macro get_personality function alike
> > > > and teaches code to use get_personality() instead of explicit
> > > > reference.
> > > > 
> > > > [I am sorry if you've received multiple copied of this, since
> > > >  my git-send-email doesn't work well. ]
> > > 
> > > Yes, but why? "current->personality" is way more understandable than
> > > your macro because task subject to dereference is very visible.
> > 
> > Use get_personality() can hide the task_struct internals a bit.
> 
> ->personality is going to become something less trivial?
> Sorry, but you sound like C++ people writing tons of pointless get/set
> wrappers. And your get_personality() is worse -- C++ would write it as
> 
>   current->personality()
> 
> and again, even here, it's immediately visible that current task is
> involved, not some other task.
> 

Can't get_personality() mean getting the personality of current task?

Or you want a more generic macro like this?

#define get_task_personality(tsk) ((tsk)->personality)

No, that is _too_ generic. Look at the code, (nearly) all references to
'personality' are via 'current'. So get_personality() is enough.

I am not a fan of C++, I know that sometimes the get/set method in C++
is really a bit pointless, but, of course, *not* all the times.

Regards.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 00/16] (Resend) Use get_personality()

2008-02-23 Thread WANG Cong
From: Alexey Dobriyan <[EMAIL PROTECTED]>
Subject: Re: [PATCH 00/16] (Resend) Use get_personality()
Date: Sat, 23 Feb 2008 11:51:01 +0300
Message-ID: <[EMAIL PROTECTED]>

> On Sat, Feb 23, 2008 at 04:14:03PM +0800, WANG Cong wrote:
> > This patchset makes the macro get_personality function alike
> > and teaches code to use get_personality() instead of explicit
> > reference.
> > 
> > [I am sorry if you've received multiple copied of this, since
> >  my git-send-email doesn't work well. ]
> 
> Yes, but why? "current->personality" is way more understandable than
> your macro because task subject to dereference is very visible.

Use get_personality() can hide the task_struct internals a bit.

And I don't think using the macro to access it is less understandable.
Since 'current' won't be NULL, whether the dereference is visible is
not important.

Regards.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 15/16] mn10300: use get_personality()

2008-02-23 Thread WANG Cong
Use get_personality() macro instead of explicit reference
for mn10300 code.

Signed-off-by: WANG Cong <[EMAIL PROTECTED]>
Cc: David Howells <[EMAIL PROTECTED]>
Cc: [EMAIL PROTECTED]

---
 include/asm-mn10300/page.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/asm-mn10300/page.h b/include/asm-mn10300/page.h
index 124971b..fc6e9fb 100644
--- a/include/asm-mn10300/page.h
+++ b/include/asm-mn10300/page.h
@@ -123,7 +123,7 @@ static inline int get_order(unsigned long size)
 
 #define VM_DATA_DEFAULT_FLAGS \
(VM_READ | VM_WRITE | \
-   ((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0) | \
+   ((get_personality() & READ_IMPLIES_EXEC) ? VM_EXEC : 0) | \
 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
 
 #endif /* __KERNEL__ */
-- 
1.5.3.8

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 16/16] kernel: use get_personality()

2008-02-23 Thread WANG Cong
Use get_personality() macro instead of explicit reference.

Signed-off-by: WANG Cong <[EMAIL PROTECTED]>
Cc: Christoph Hellwig <[EMAIL PROTECTED]>

---
 kernel/exec_domain.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/exec_domain.c b/kernel/exec_domain.c
index a9e6bad..056ba23 100644
--- a/kernel/exec_domain.c
+++ b/kernel/exec_domain.c
@@ -192,11 +192,11 @@ get_exec_domain_list(char *page)
 asmlinkage long
 sys_personality(u_long personality)
 {
-   u_long old = current->personality;
+   u_long old = get_personality();
 
if (personality != 0x) {
set_personality(personality);
-   if (current->personality != personality)
+   if (get_personality() != personality)
return -EINVAL;
}
 
-- 
1.5.3.8

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 13/16] alpha: use get_personality()

2008-02-23 Thread WANG Cong
Use get_personality() macro instead of explicit reference
for alpha code.

Signed-off-by: WANG Cong <[EMAIL PROTECTED]>
Cc: Richard Henderson <[EMAIL PROTECTED]>

---
 arch/alpha/kernel/osf_sys.c   |6 +++---
 include/asm-alpha/processor.h |4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c
index 8c71daf..df825a4 100644
--- a/arch/alpha/kernel/osf_sys.c
+++ b/arch/alpha/kernel/osf_sys.c
@@ -1266,7 +1266,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long 
addr,
unsigned long limit;
 
/* "32 bit" actually means 31 bit, since pointers sign extend.  */
-   if (current->personality & ADDR_LIMIT_32BIT)
+   if (get_personality() & ADDR_LIMIT_32BIT)
limit = 0x8000;
else
limit = TASK_SIZE;
@@ -1327,7 +1327,7 @@ osf_fix_iov_len(const struct iovec __user *iov, unsigned 
long count)
 asmlinkage ssize_t
 osf_readv(unsigned long fd, const struct iovec __user * vector, unsigned long 
count)
 {
-   if (unlikely(personality(current->personality) == PER_OSF4))
+   if (unlikely(personality(get_personality()) == PER_OSF4))
if (osf_fix_iov_len(vector, count))
return -EFAULT;
return sys_readv(fd, vector, count);
@@ -1336,7 +1336,7 @@ osf_readv(unsigned long fd, const struct iovec __user * 
vector, unsigned long co
 asmlinkage ssize_t
 osf_writev(unsigned long fd, const struct iovec __user * vector, unsigned long 
count)
 {
-   if (unlikely(personality(current->personality) == PER_OSF4))
+   if (unlikely(personality(get_personality()) == PER_OSF4))
if (osf_fix_iov_len(vector, count))
return -EFAULT;
return sys_writev(fd, vector, count);
diff --git a/include/asm-alpha/processor.h b/include/asm-alpha/processor.h
index 94afe58..6c164b9 100644
--- a/include/asm-alpha/processor.h
+++ b/include/asm-alpha/processor.h
@@ -21,7 +21,7 @@
 #define TASK_SIZE (0x400UL)
 
 #define STACK_TOP \
-  (current->personality & ADDR_LIMIT_32BIT ? 0x8000 : 0x0012000UL)
+  (get_personality() & ADDR_LIMIT_32BIT ? 0x8000 : 0x0012000UL)
 
 #define STACK_TOP_MAX  0x0012000UL
 
@@ -29,7 +29,7 @@
  * space during mmap's.
  */
 #define TASK_UNMAPPED_BASE \
-  ((current->personality & ADDR_LIMIT_32BIT) ? 0x4000 : TASK_SIZE / 2)
+  ((get_personality() & ADDR_LIMIT_32BIT) ? 0x4000 : TASK_SIZE / 2)
 
 typedef struct {
unsigned long seg;
-- 
1.5.3.8

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 14/16] frv: use get_personality()

2008-02-23 Thread WANG Cong
Use get_personality() macro instead of explicit reference
for frv code.

Signed-off-by: WANG Cong <[EMAIL PROTECTED]>
Cc: David Howells <[EMAIL PROTECTED]>

---
 include/asm-frv/page.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/asm-frv/page.h b/include/asm-frv/page.h
index c2c1e89..6c5c4db 100644
--- a/include/asm-frv/page.h
+++ b/include/asm-frv/page.h
@@ -69,7 +69,7 @@ extern unsigned long max_pfn;
 #ifdef CONFIG_MMU
 #define VM_DATA_DEFAULT_FLAGS \
(VM_READ | VM_WRITE | \
-   ((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \
+   ((get_personality() & READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \
 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
 #endif
 
-- 
1.5.3.8

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 11/16] mips: use get_personality()

2008-02-23 Thread WANG Cong
Use get_personality() macro instead of explicit reference
for mips code.

Signed-off-by: WANG Cong <[EMAIL PROTECTED]>
Cc:  Ralf Baechle <[EMAIL PROTECTED]>

---
 arch/mips/kernel/linux32.c |4 ++--
 arch/mips/kernel/process.c |4 ++--
 include/asm-mips/elf.h |2 +-
 include/asm-mips/namei.h   |2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c
index 65af3cc..e5b7671 100644
--- a/arch/mips/kernel/linux32.c
+++ b/arch/mips/kernel/linux32.c
@@ -446,7 +446,7 @@ asmlinkage long sys32_newuname(struct new_utsname __user * 
name)
ret = -EFAULT;
up_read(_sem);
 
-   if (current->personality == PER_LINUX32 && !ret)
+   if (get_personality() == PER_LINUX32 && !ret)
if (copy_to_user(name->machine, "mips\0\0\0", 8))
ret = -EFAULT;
 
@@ -457,7 +457,7 @@ asmlinkage int sys32_personality(unsigned long personality)
 {
int ret;
personality &= 0x;
-   if (personality(current->personality) == PER_LINUX32 &&
+   if (personality(get_personality()) == PER_LINUX32 &&
personality == PER_LINUX)
personality = PER_LINUX32;
ret = sys_personality(personality);
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
index 2c09a44..dc7486c 100644
--- a/arch/mips/kernel/process.c
+++ b/arch/mips/kernel/process.c
@@ -126,7 +126,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned 
long usp,
childregs->regs[7] = 0; /* Clear error flag */
 
 #if defined(CONFIG_BINFMT_IRIX)
-   if (current->personality != PER_LINUX) {
+   if (get_personality() != PER_LINUX) {
/* Under IRIX things are a little different. */
childregs->regs[3] = 1;
regs->regs[3] = 0;
@@ -471,7 +471,7 @@ out:
  */
 unsigned long arch_align_stack(unsigned long sp)
 {
-   if (!(current->personality & ADDR_NO_RANDOMIZE) && randomize_va_space)
+   if (!(get_personality() & ADDR_NO_RANDOMIZE) && randomize_va_space)
sp -= get_random_int() & ~PAGE_MASK;
 
return sp & ALMASK;
diff --git a/include/asm-mips/elf.h b/include/asm-mips/elf.h
index f69f7ac..c07f464 100644
--- a/include/asm-mips/elf.h
+++ b/include/asm-mips/elf.h
@@ -308,7 +308,7 @@ do {
\
\
if (ibcs2)  \
set_personality(PER_SVR4);  \
-   else if (current->personality != PER_LINUX32)   \
+   else if (get_personality() != PER_LINUX32)  \
set_personality(PER_LINUX); \
 } while (0)
 
diff --git a/include/asm-mips/namei.h b/include/asm-mips/namei.h
index c94d12d..18ab9eb 100644
--- a/include/asm-mips/namei.h
+++ b/include/asm-mips/namei.h
@@ -9,7 +9,7 @@
 
 static inline char *__emul_prefix(void)
 {
-   switch (current->personality) {
+   switch (get_personality()) {
case PER_IRIX32:
case PER_IRIXN32:
case PER_IRIX64:
-- 
1.5.3.8

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 12/16] ia64: use get_personality()

2008-02-23 Thread WANG Cong
Use get_personality() macro instead of explicit reference
for ia64 code.

Signed-off-by: WANG Cong <[EMAIL PROTECTED]>
Cc: Tony Luck <[EMAIL PROTECTED]>

---
 arch/ia64/ia32/sys_ia32.c |2 +-
 arch/ia64/mm/init.c   |2 +-
 include/asm-ia64/fcntl.h  |2 +-
 include/asm-ia64/namei.h  |2 +-
 include/asm-ia64/page.h   |2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/ia64/ia32/sys_ia32.c b/arch/ia64/ia32/sys_ia32.c
index d025a22..a91273f 100644
--- a/arch/ia64/ia32/sys_ia32.c
+++ b/arch/ia64/ia32/sys_ia32.c
@@ -2265,7 +2265,7 @@ sys32_personality (unsigned int personality)
 {
long ret;
 
-   if (current->personality == PER_LINUX32 && personality == PER_LINUX)
+   if (get_personality() == PER_LINUX32 && personality == PER_LINUX)
personality = PER_LINUX32;
ret = sys_personality(personality);
if (ret == PER_LINUX32)
diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
index 25aef62..f5641bb 100644
--- a/arch/ia64/mm/init.c
+++ b/arch/ia64/mm/init.c
@@ -139,7 +139,7 @@ ia64_init_addr_space (void)
}
 
/* map NaT-page at address zero to speed up speculative dereferencing 
of NULL: */
-   if (!(current->personality & MMAP_PAGE_ZERO)) {
+   if (!(get_personality() & MMAP_PAGE_ZERO)) {
vma = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL);
if (vma) {
vma->vm_mm = current->mm;
diff --git a/include/asm-ia64/fcntl.h b/include/asm-ia64/fcntl.h
index 1dd275d..e8acf85 100644
--- a/include/asm-ia64/fcntl.h
+++ b/include/asm-ia64/fcntl.h
@@ -6,7 +6,7 @@
  */
 
 #define force_o_largefile()\
-   (personality(current->personality) != PER_LINUX32)
+   (personality(get_personality()) != PER_LINUX32)
 
 #include 
 
diff --git a/include/asm-ia64/namei.h b/include/asm-ia64/namei.h
index 78e7680..da38e5c 100644
--- a/include/asm-ia64/namei.h
+++ b/include/asm-ia64/namei.h
@@ -14,7 +14,7 @@
 static inline char *
 __emul_prefix (void)
 {
-   switch (current->personality) {
+   switch (get_personality()) {
  case PER_LINUX32:
return EMUL_PREFIX_LINUX_IA32;
  default:
diff --git a/include/asm-ia64/page.h b/include/asm-ia64/page.h
index 4999a6c..287e53b 100644
--- a/include/asm-ia64/page.h
+++ b/include/asm-ia64/page.h
@@ -224,7 +224,7 @@ get_order (unsigned long size)
 
 #define VM_DATA_DEFAULT_FLAGS  (VM_READ | VM_WRITE |   
\
 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC 
|\
-(((current->personality & 
READ_IMPLIES_EXEC) != 0) \
+(((get_personality() & 
READ_IMPLIES_EXEC) != 0)\
  ? VM_EXEC : 0))
 
 #endif /* _ASM_IA64_PAGE_H */
-- 
1.5.3.8

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 10/16] s390: use get_personality()

2008-02-23 Thread WANG Cong
Use get_personality() macro instead of explicit reference
for s390 code.

Signed-off-by: WANG Cong <[EMAIL PROTECTED]>
Cc: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]

---
 arch/s390/kernel/binfmt_elf32.c |2 +-
 arch/s390/kernel/sys_s390.c |4 ++--
 arch/s390/mm/mmap.c |2 +-
 include/asm-s390/elf.h  |2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/s390/kernel/binfmt_elf32.c b/arch/s390/kernel/binfmt_elf32.c
index 3e1c315..6a55911 100644
--- a/arch/s390/kernel/binfmt_elf32.c
+++ b/arch/s390/kernel/binfmt_elf32.c
@@ -78,7 +78,7 @@
 do {   \
if (ibcs2)  \
set_personality(PER_SVR4);  \
-   else if (current->personality != PER_LINUX32)   \
+   else if (get_personality() != PER_LINUX32)   \
set_personality(PER_LINUX); \
set_thread_flag(TIF_31BIT); \
 } while (0)
diff --git a/arch/s390/kernel/sys_s390.c b/arch/s390/kernel/sys_s390.c
index fefee99..f8371fe 100644
--- a/arch/s390/kernel/sys_s390.c
+++ b/arch/s390/kernel/sys_s390.c
@@ -215,7 +215,7 @@ asmlinkage long s390x_newuname(struct new_utsname __user 
*name)
 {
int ret = sys_newuname(name);
 
-   if (current->personality == PER_LINUX32 && !ret) {
+   if (get_personality() == PER_LINUX32 && !ret) {
ret = copy_to_user(name->machine, "s390\0\0\0\0", 8);
if (ret) ret = -EFAULT;
}
@@ -226,7 +226,7 @@ asmlinkage long s390x_personality(unsigned long personality)
 {
int ret;
 
-   if (current->personality == PER_LINUX32 && personality == PER_LINUX)
+   if (get_personality() == PER_LINUX32 && personality == PER_LINUX)
personality = PER_LINUX32;
ret = sys_personality(personality);
if (ret == PER_LINUX32)
diff --git a/arch/s390/mm/mmap.c b/arch/s390/mm/mmap.c
index 5932a82..f5bf304 100644
--- a/arch/s390/mm/mmap.c
+++ b/arch/s390/mm/mmap.c
@@ -59,7 +59,7 @@ static inline int mmap_is_legacy(void)
return 1;
 #endif
return sysctl_legacy_va_layout ||
-   (current->personality & ADDR_COMPAT_LAYOUT) ||
+   (get_personality() & ADDR_COMPAT_LAYOUT) ||
current->signal->rlim[RLIMIT_STACK].rlim_cur == RLIM_INFINITY;
 }
 
diff --git a/include/asm-s390/elf.h b/include/asm-s390/elf.h
index b3ac262..18482d3 100644
--- a/include/asm-s390/elf.h
+++ b/include/asm-s390/elf.h
@@ -202,7 +202,7 @@ extern char elf_platform[];
 do {   \
if (ibcs2)  \
set_personality(PER_SVR4);  \
-   else if (current->personality != PER_LINUX32)   \
+   else if (get_personality() != PER_LINUX32)  \
set_personality(PER_LINUX); \
clear_thread_flag(TIF_31BIT);   \
 } while (0)
-- 
1.5.3.8

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 08/16] x86: use get_personality()

2008-02-23 Thread WANG Cong
Use get_personality() macro instead of explicit reference
for x86 code.

Signed-off-by: WANG Cong <[EMAIL PROTECTED]>
Cc:  Ingo Molnar <[EMAIL PROTECTED]>

---
 arch/x86/ia32/sys_ia32.c |6 +++---
 arch/x86/kernel/process_32.c |2 +-
 arch/x86/kernel/process_64.c |2 +-
 arch/x86/kernel/sys_x86_64.c |2 +-
 arch/x86/mm/mmap.c   |2 +-
 include/asm-x86/page.h   |2 +-
 include/asm-x86/processor.h  |2 +-
 7 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/arch/x86/ia32/sys_ia32.c b/arch/x86/ia32/sys_ia32.c
index abf71d2..80e7431 100644
--- a/arch/x86/ia32/sys_ia32.c
+++ b/arch/x86/ia32/sys_ia32.c
@@ -666,7 +666,7 @@ asmlinkage long sys32_personality(unsigned long personality)
 {
int ret;
 
-   if (personality(current->personality) == PER_LINUX32 &&
+   if (personality(get_personality()) == PER_LINUX32 &&
personality == PER_LINUX)
personality = PER_LINUX32;
ret = sys_personality(personality);
@@ -744,7 +744,7 @@ asmlinkage long sys32_olduname(struct oldold_utsname __user 
*name)
  __OLD_UTS_LEN);
err |= __put_user(0, name->version+__OLD_UTS_LEN);
 
-   if (personality(current->personality) == PER_LINUX32)
+   if (personality(get_personality()) == PER_LINUX32)
arch = "i686";
 
err |= __copy_to_user(>machine, arch, strlen(arch) + 1);
@@ -765,7 +765,7 @@ long sys32_uname(struct old_utsname __user *name)
down_read(_sem);
err = copy_to_user(name, utsname(), sizeof(*name));
up_read(_sem);
-   if (personality(current->personality) == PER_LINUX32)
+   if (personality(get_personality()) == PER_LINUX32)
err |= copy_to_user(>machine, "i686", 5);
 
return err ? -EFAULT : 0;
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
index a7d50a5..c4992fc 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -837,7 +837,7 @@ unsigned long get_wchan(struct task_struct *p)
 
 unsigned long arch_align_stack(unsigned long sp)
 {
-   if (!(current->personality & ADDR_NO_RANDOMIZE) && randomize_va_space)
+   if (!(get_personality() & ADDR_NO_RANDOMIZE) && randomize_va_space)
sp -= get_random_int() % 8192;
return sp & ~0xf;
 }
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index b0cc8f0..8223f3f 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -915,7 +915,7 @@ long sys_arch_prctl(int code, unsigned long addr)
 
 unsigned long arch_align_stack(unsigned long sp)
 {
-   if (!(current->personality & ADDR_NO_RANDOMIZE) && randomize_va_space)
+   if (!(get_personality() & ADDR_NO_RANDOMIZE) && randomize_va_space)
sp -= get_random_int() % 8192;
return sp & ~0xf;
 }
diff --git a/arch/x86/kernel/sys_x86_64.c b/arch/x86/kernel/sys_x86_64.c
index bd802a5..0b7548b 100644
--- a/arch/x86/kernel/sys_x86_64.c
+++ b/arch/x86/kernel/sys_x86_64.c
@@ -247,7 +247,7 @@ asmlinkage long sys_uname(struct new_utsname __user * name)
down_read(_sem);
err = copy_to_user(name, utsname(), sizeof (*name));
up_read(_sem);
-   if (personality(current->personality) == PER_LINUX32) 
+   if (personality(get_personality()) == PER_LINUX32) 
err |= copy_to_user(>machine, "i686", 5); 
return err ? -EFAULT : 0;
 }
diff --git a/arch/x86/mm/mmap.c b/arch/x86/mm/mmap.c
index 56fe712..f299d64 100644
--- a/arch/x86/mm/mmap.c
+++ b/arch/x86/mm/mmap.c
@@ -55,7 +55,7 @@ static int mmap_is_ia32(void)
 
 static int mmap_is_legacy(void)
 {
-   if (current->personality & ADDR_COMPAT_LAYOUT)
+   if (get_personality() & ADDR_COMPAT_LAYOUT)
return 1;
 
if (current->signal->rlim[RLIMIT_STACK].rlim_cur == RLIM_INFINITY)
diff --git a/include/asm-x86/page.h b/include/asm-x86/page.h
index 1cb7c51..fd90c7a 100644
--- a/include/asm-x86/page.h
+++ b/include/asm-x86/page.h
@@ -42,7 +42,7 @@
 #define PAGE_OFFSET((unsigned long)__PAGE_OFFSET)
 
 #define VM_DATA_DEFAULT_FLAGS \
-   (((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \
+   (((get_personality() & READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \
 VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
 
 
diff --git a/include/asm-x86/processor.h b/include/asm-x86/processor.h
index 45a2f0a..c426dc1 100644
--- a/include/asm-x86/processor.h
+++ b/include/asm-x86/processor.h
@@ -791,7 +791,7 @@ extern unsigned long thread_saved_pc(struct task_struct 
*tsk);
 /* This decides where the kernel will search for a free chunk of vm
  * space during mmap's.
  */
-#define IA32_PAGE_OFFSET ((current->personality & ADDR_LIMIT_3GB) ? \
+#define IA32_PAGE

[PATCH 09/16] um: use get_personality()

2008-02-23 Thread WANG Cong
Use get_personality() macro instead of explicit reference for
uml code.

Signed-off-by: WANG Cong <[EMAIL PROTECTED]>
Cc: Jeff Dike <[EMAIL PROTECTED]>

---
 arch/um/kernel/process.c   |2 +-
 arch/um/sys-x86_64/syscalls.c  |2 +-
 include/asm-um/vm-flags-i386.h |2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c
index fc50d2f..91e0a84 100644
--- a/arch/um/kernel/process.c
+++ b/arch/um/kernel/process.c
@@ -405,7 +405,7 @@ int singlestepping(void * t)
 #ifndef arch_align_stack
 unsigned long arch_align_stack(unsigned long sp)
 {
-   if (!(current->personality & ADDR_NO_RANDOMIZE) && randomize_va_space)
+   if (!(get_personality() & ADDR_NO_RANDOMIZE) && randomize_va_space)
sp -= get_random_int() % 8192;
return sp & ~0xf;
 }
diff --git a/arch/um/sys-x86_64/syscalls.c b/arch/um/sys-x86_64/syscalls.c
index f1199fd..cf7b61e 100644
--- a/arch/um/sys-x86_64/syscalls.c
+++ b/arch/um/sys-x86_64/syscalls.c
@@ -20,7 +20,7 @@ asmlinkage long sys_uname64(struct new_utsname __user * name)
err = copy_to_user(name, utsname(), sizeof (*name));
up_read(_sem);
 
-   if (personality(current->personality) == PER_LINUX32)
+   if (personality(get_personality()) == PER_LINUX32)
err |= copy_to_user(>machine, "i686", 5);
 
return err ? -EFAULT : 0;
diff --git a/include/asm-um/vm-flags-i386.h b/include/asm-um/vm-flags-i386.h
index e0d24c5..c30e0f6 100644
--- a/include/asm-um/vm-flags-i386.h
+++ b/include/asm-um/vm-flags-i386.h
@@ -8,7 +8,7 @@
 
 #define VM_DATA_DEFAULT_FLAGS \
(VM_READ | VM_WRITE | \
-   ((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \
+   ((get_personality() & READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \
 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
 
 #endif
-- 
1.5.3.8

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 06/16] sparc(64): use get_personality()

2008-02-23 Thread WANG Cong
Use get_personality() macro and other two tiny improvements.

Signed-off-by: WANG Cong <[EMAIL PROTECTED]>
Cc: David Miller <[EMAIL PROTECTED]>
Cc: William L. Irwin <[EMAIL PROTECTED]>
Cc: [EMAIL PROTECTED]

---
 arch/sparc/kernel/signal.c  |2 +-
 arch/sparc64/kernel/signal32.c  |2 +-
 arch/sparc64/kernel/sys_sparc.c |6 +++---
 include/asm-sparc/namei.h   |2 +-
 include/asm-sparc64/elf.h   |2 +-
 include/asm-sparc64/namei.h |2 +-
 6 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/arch/sparc/kernel/signal.c b/arch/sparc/kernel/signal.c
index 9994cac..0464874 100644
--- a/arch/sparc/kernel/signal.c
+++ b/arch/sparc/kernel/signal.c
@@ -1010,7 +1010,7 @@ asmlinkage void do_signal(struct pt_regs * regs, unsigned 
long orig_i0, int rest
 #ifdef SVR4_SIGNAL_BROKEN
int svr4_signal = 0;
 #else
-   int svr4_signal = current->personality == PER_SVR4;
+   int svr4_signal = (get_personality() == PER_SVR4);
 #endif
 
cookie.restart_syscall = restart_syscall;
diff --git a/arch/sparc64/kernel/signal32.c b/arch/sparc64/kernel/signal32.c
index 8c1c121..e3bc993 100644
--- a/arch/sparc64/kernel/signal32.c
+++ b/arch/sparc64/kernel/signal32.c
@@ -1270,7 +1270,7 @@ void do_signal32(sigset_t *oldset, struct pt_regs * regs,
struct signal_deliver_cookie cookie;
struct k_sigaction ka;
int signr;
-   int svr4_signal = current->personality == PER_SVR4;
+   int svr4_signal = (get_personality() == PER_SVR4);

cookie.restart_syscall = restart_syscall;
cookie.orig_i0 = orig_i0;
diff --git a/arch/sparc64/kernel/sys_sparc.c b/arch/sparc64/kernel/sys_sparc.c
index 134d801..3813ec7 100644
--- a/arch/sparc64/kernel/sys_sparc.c
+++ b/arch/sparc64/kernel/sys_sparc.c
@@ -372,7 +372,7 @@ void arch_pick_mmap_layout(struct mm_struct *mm)
 * bit is set, or if the expected stack growth is unlimited:
 */
if (!test_thread_flag(TIF_32BIT) ||
-   (current->personality & ADDR_COMPAT_LAYOUT) ||
+   (get_personality() & ADDR_COMPAT_LAYOUT) ||
current->signal->rlim[RLIMIT_STACK].rlim_cur == RLIM_INFINITY ||
sysctl_legacy_va_layout) {
mm->mmap_base = TASK_UNMAPPED_BASE + random_factor;
@@ -518,7 +518,7 @@ asmlinkage long sparc64_newuname(struct new_utsname __user 
*name)
 {
int ret = sys_newuname(name);

-   if (current->personality == PER_LINUX32 && !ret) {
+   if (get_personality() == PER_LINUX32 && !ret) {
ret = (copy_to_user(name->machine, "sparc\0\0", 8)
   ? -EFAULT : 0);
}
@@ -529,7 +529,7 @@ asmlinkage long sparc64_personality(unsigned long 
personality)
 {
int ret;
 
-   if (current->personality == PER_LINUX32 &&
+   if (get_personality() == PER_LINUX32 &&
personality == PER_LINUX)
personality = PER_LINUX32;
ret = sys_personality(personality);
diff --git a/include/asm-sparc/namei.h b/include/asm-sparc/namei.h
index f2461e8..b87f621 100644
--- a/include/asm-sparc/namei.h
+++ b/include/asm-sparc/namei.h
@@ -13,7 +13,7 @@
 
 static inline char * __emul_prefix(void)
 {
-   switch (current->personality) {
+   switch (get_personality()) {
case PER_SUNOS:
return SPARC_BSD_EMUL;
case PER_SVR4:
diff --git a/include/asm-sparc64/elf.h b/include/asm-sparc64/elf.h
index 11c8e68..2140dbe 100644
--- a/include/asm-sparc64/elf.h
+++ b/include/asm-sparc64/elf.h
@@ -211,7 +211,7 @@ do {unsigned long new_flags = 
current_thread_info()->flags; \
/* flush_thread will update pgd cache */\
if (ibcs2)  \
set_personality(PER_SVR4);  \
-   else if (current->personality != PER_LINUX32)   \
+   else if (get_personality() != PER_LINUX32)  \
set_personality(PER_LINUX); \
 } while (0)
 
diff --git a/include/asm-sparc64/namei.h b/include/asm-sparc64/namei.h
index ccda19e..e6a1dd9 100644
--- a/include/asm-sparc64/namei.h
+++ b/include/asm-sparc64/namei.h
@@ -13,7 +13,7 @@
 
 static inline char * __emul_prefix(void)
 {
-   switch (current->personality) {
+   switch (get_personality()) {
case PER_SUNOS:
return SPARC_BSD_EMUL;
case PER_SVR4:
-- 
1.5.3.8

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 07/16] arm: use get_personality()

2008-02-23 Thread WANG Cong
Use get_personality() macro instead of explicit reference
for arm code.

Signed-off-by: WANG Cong <[EMAIL PROTECTED]>
Cc: Russell King <[EMAIL PROTECTED]>

---
 arch/arm/kernel/traps.c |4 ++--
 include/asm-arm/namei.h |2 +-
 include/asm-arm/processor.h |4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
index 5595fdd..975faaf 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -381,8 +381,8 @@ static int bad_syscall(int n, struct pt_regs *regs)
struct thread_info *thread = current_thread_info();
siginfo_t info;
 
-   if (current->personality != PER_LINUX &&
-   current->personality != PER_LINUX_32BIT &&
+   if (get_personality() != PER_LINUX &&
+   get_personality() != PER_LINUX_32BIT &&
thread->exec_domain->handler) {
thread->exec_domain->handler(n, regs);
return regs->ARM_r0;
diff --git a/include/asm-arm/namei.h b/include/asm-arm/namei.h
index a402d3b..c55dc87 100644
--- a/include/asm-arm/namei.h
+++ b/include/asm-arm/namei.h
@@ -14,7 +14,7 @@
 
 static inline char *__emul_prefix(void)
 {
-   switch (current->personality) {
+   switch (get_personality()) {
case PER_BSD:
return ARM_BSD_EMUL;
default:
diff --git a/include/asm-arm/processor.h b/include/asm-arm/processor.h
index bd8029e..7f040b4 100644
--- a/include/asm-arm/processor.h
+++ b/include/asm-arm/processor.h
@@ -23,7 +23,7 @@
 #include 
 
 #ifdef __KERNEL__
-#define STACK_TOP  ((current->personality == PER_LINUX_32BIT) ? \
+#define STACK_TOP  ((get_personality() == PER_LINUX_32BIT) ? \
 TASK_SIZE : TASK_SIZE_26)
 #define STACK_TOP_MAX  TASK_SIZE
 #endif
@@ -65,7 +65,7 @@ struct thread_struct {
unsigned long *stack = (unsigned long *)sp; \
set_fs(USER_DS);\
memzero(regs->uregs, sizeof(regs->uregs));  \
-   if (current->personality & ADDR_LIMIT_32BIT)\
+   if (get_personality() & ADDR_LIMIT_32BIT)   \
regs->ARM_cpsr = USR_MODE;  \
else\
regs->ARM_cpsr = USR26_MODE;\
-- 
1.5.3.8

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 05/16] parisc: use get_personality()

2008-02-23 Thread WANG Cong
Use get_personality() macro instead of explicit reference
for parisc code.

Signed-off-by: WANG Cong <[EMAIL PROTECTED]>
Cc: Kyle McMartin <[EMAIL PROTECTED]>
Cc: Matthew Wilcox <[EMAIL PROTECTED]>

---
 arch/parisc/kernel/sys_parisc.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/parisc/kernel/sys_parisc.c b/arch/parisc/kernel/sys_parisc.c
index 4f58921..1515ced 100644
--- a/arch/parisc/kernel/sys_parisc.c
+++ b/arch/parisc/kernel/sys_parisc.c
@@ -259,7 +259,7 @@ long parisc_personality(unsigned long personality)
 {
long err;
 
-   if (personality(current->personality) == PER_LINUX32
+   if (personality(get_personality()) == PER_LINUX32
&& personality == PER_LINUX)
personality = PER_LINUX32;
 
@@ -275,7 +275,7 @@ long parisc_newuname(struct new_utsname __user *name)
int err = sys_newuname(name);
 
 #ifdef CONFIG_COMPAT
-   if (!err && personality(current->personality) == PER_LINUX32) {
+   if (!err && personality(get_personality()) == PER_LINUX32) {
if (__put_user(0, name->machine + 6) ||
__put_user(0, name->machine + 7))
err = -EFAULT;
-- 
1.5.3.8

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 03/16] fs: use get_personality()

2008-02-23 Thread WANG Cong
Use get_personality() macro instead of explicit reference.

Signed-off-by: WANG Cong <[EMAIL PROTECTED]>
Cc: Alexander Viro <[EMAIL PROTECTED]>

---
 fs/binfmt_elf.c |6 +++---
 fs/compat.c |6 +++---
 fs/select.c |6 +++---
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index 41a958a..1b5803f 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -516,7 +516,7 @@ static unsigned long randomize_stack_top(unsigned long 
stack_top)
unsigned int random_variable = 0;
 
if ((current->flags & PF_RANDOMIZE) &&
-   !(current->personality & ADDR_NO_RANDOMIZE)) {
+   !(get_personality() & ADDR_NO_RANDOMIZE)) {
random_variable = get_random_int() & STACK_RND_MASK;
random_variable <<= PAGE_SHIFT;
}
@@ -744,7 +744,7 @@ static int load_elf_binary(struct linux_binprm *bprm, 
struct pt_regs *regs)
if (elf_read_implies_exec(loc->elf_ex, executable_stack))
current->personality |= READ_IMPLIES_EXEC;
 
-   if (!(current->personality & ADDR_NO_RANDOMIZE) && randomize_va_space)
+   if (!(get_personality() & ADDR_NO_RANDOMIZE) && randomize_va_space)
current->flags |= PF_RANDOMIZE;
arch_pick_mmap_layout(current->mm);
 
@@ -969,7 +969,7 @@ static int load_elf_binary(struct linux_binprm *bprm, 
struct pt_regs *regs)
arch_randomize_brk(current->mm);
 #endif
 
-   if (current->personality & MMAP_PAGE_ZERO) {
+   if (get_personality() & MMAP_PAGE_ZERO) {
/* Why this, you ask???  Well SVr4 maps page 0 as read-only,
   and some applications "depend" upon this behavior.
   Since we do not have the power to recompile these, we
diff --git a/fs/compat.c b/fs/compat.c
index 2ce4456..eefe23b 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -1610,7 +1610,7 @@ asmlinkage long compat_sys_select(int n, compat_ulong_t 
__user *inp,
if (tvp) {
struct compat_timeval rtv;
 
-   if (current->personality & STICKY_TIMEOUTS)
+   if (get_personality() & STICKY_TIMEOUTS)
goto sticky;
rtv.tv_usec = jiffies_to_usecs(do_div((*(u64*)), HZ));
rtv.tv_sec = timeout;
@@ -1685,7 +1685,7 @@ asmlinkage long compat_sys_pselect7(int n, compat_ulong_t 
__user *inp,
if (tsp) {
struct compat_timespec rts;
 
-   if (current->personality & STICKY_TIMEOUTS)
+   if (get_personality() & STICKY_TIMEOUTS)
goto sticky;
 
rts.tv_sec = timeout / HZ;
@@ -1800,7 +1800,7 @@ asmlinkage long compat_sys_ppoll(struct pollfd __user 
*ufds,
if (tsp && timeout >= 0) {
struct compat_timespec rts;
 
-   if (current->personality & STICKY_TIMEOUTS)
+   if (get_personality() & STICKY_TIMEOUTS)
goto sticky;
/* Yes, we know it's actually an s64, but it's also positive. */
rts.tv_nsec = jiffies_to_usecs(do_div((*(u64*)), HZ)) *
diff --git a/fs/select.c b/fs/select.c
index 5633fe9..6041e24 100644
--- a/fs/select.c
+++ b/fs/select.c
@@ -401,7 +401,7 @@ asmlinkage long sys_select(int n, fd_set __user *inp, 
fd_set __user *outp,
if (tvp) {
struct timeval rtv;
 
-   if (current->personality & STICKY_TIMEOUTS)
+   if (get_personality() & STICKY_TIMEOUTS)
goto sticky;
rtv.tv_usec = jiffies_to_usecs(do_div((*(u64*)), HZ));
rtv.tv_sec = timeout;
@@ -467,7 +467,7 @@ asmlinkage long sys_pselect7(int n, fd_set __user *inp, 
fd_set __user *outp,
if (tsp) {
struct timespec rts;
 
-   if (current->personality & STICKY_TIMEOUTS)
+   if (get_personality() & STICKY_TIMEOUTS)
goto sticky;
rts.tv_nsec = jiffies_to_usecs(do_div((*(u64*)), HZ)) *
1000;
@@ -814,7 +814,7 @@ asmlinkage long sys_ppoll(struct pollfd __user *ufds, 
unsigned int nfds,
if (tsp && timeout >= 0) {
struct timespec rts;
 
-   if (current->personality & STICKY_TIMEOUTS)
+   if (get_personality() & STICKY_TIMEOUTS)
goto sticky;
/* Yes, we know it's actually an s64, but it's also positive. */
rts.tv_nsec = jiffies_to_usecs(do_div((*(u64*)), HZ)) *
-- 
1.5.3.8

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 04/16] powerpc: use get_personality()

2008-02-23 Thread WANG Cong
Use get_personality() macro instead of explicit reference
for powerpc code.

Signed-off-by: WANG Cong <[EMAIL PROTECTED]>
Cc: Christoph Hellwig <[EMAIL PROTECTED]>
Cc: Paul Mackerras <[EMAIL PROTECTED]>

---
 arch/powerpc/kernel/syscalls.c |4 ++--
 arch/powerpc/mm/mmap.c |2 +-
 include/asm-powerpc/elf.h  |2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/kernel/syscalls.c b/arch/powerpc/kernel/syscalls.c
index 3b1d5dd..4b910b8 100644
--- a/arch/powerpc/kernel/syscalls.c
+++ b/arch/powerpc/kernel/syscalls.c
@@ -228,7 +228,7 @@ long ppc64_personality(unsigned long personality)
 {
long ret;
 
-   if (personality(current->personality) == PER_LINUX32
+   if (personality(get_personality()) == PER_LINUX32
&& personality == PER_LINUX)
personality = PER_LINUX32;
ret = sys_personality(personality);
@@ -239,7 +239,7 @@ long ppc64_personality(unsigned long personality)
 #endif
 
 #ifdef CONFIG_PPC64
-#define OVERRIDE_MACHINE(personality(current->personality) == PER_LINUX32)
+#define OVERRIDE_MACHINE(personality(get_personality()) == PER_LINUX32)
 #else
 #define OVERRIDE_MACHINE0
 #endif
diff --git a/arch/powerpc/mm/mmap.c b/arch/powerpc/mm/mmap.c
index 86010fc..92a9e45 100644
--- a/arch/powerpc/mm/mmap.c
+++ b/arch/powerpc/mm/mmap.c
@@ -54,7 +54,7 @@ static inline int mmap_is_legacy(void)
if (!test_thread_flag(TIF_32BIT))
return 1;
 
-   if (current->personality & ADDR_COMPAT_LAYOUT)
+   if (get_personality() & ADDR_COMPAT_LAYOUT)
return 1;
 
if (current->signal->rlim[RLIMIT_STACK].rlim_cur == RLIM_INFINITY)
diff --git a/include/asm-powerpc/elf.h b/include/asm-powerpc/elf.h
index 9080d85..d9e7bff 100644
--- a/include/asm-powerpc/elf.h
+++ b/include/asm-powerpc/elf.h
@@ -256,7 +256,7 @@ do {
\
set_thread_flag(TIF_ABI_PENDING);   \
else\
clear_thread_flag(TIF_ABI_PENDING); \
-   if (personality(current->personality) != PER_LINUX32)   \
+   if (personality(get_personality()) != PER_LINUX32)  \
set_personality(PER_LINUX); \
 } while (0)
 /*
-- 
1.5.3.8

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 02/16] mm: use get_personality()

2008-02-23 Thread WANG Cong
Use get_personality() macro instead of explicit reference
for mm/ code.

Signed-off-by: WANG Cong <[EMAIL PROTECTED]>
Cc: Christoph Hellwig <[EMAIL PROTECTED]>
Cc: Christoph Lameter <[EMAIL PROTECTED]> 

---
 mm/mmap.c |2 +-
 mm/mprotect.c |2 +-
 mm/nommu.c|4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/mm/mmap.c b/mm/mmap.c
index a32d28c..42d647f 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -910,7 +910,7 @@ unsigned long do_mmap_pgoff(struct file * file, unsigned 
long addr,
 * (the exception is when the underlying filesystem is noexec
 *  mounted, in which case we dont add PROT_EXEC.)
 */
-   if ((prot & PROT_READ) && (current->personality & READ_IMPLIES_EXEC))
+   if ((prot & PROT_READ) && (get_personality() & READ_IMPLIES_EXEC))
if (!(file && (file->f_path.mnt->mnt_flags & MNT_NOEXEC)))
prot |= PROT_EXEC;
 
diff --git a/mm/mprotect.c b/mm/mprotect.c
index 4de5468..620b8db 100644
--- a/mm/mprotect.c
+++ b/mm/mprotect.c
@@ -237,7 +237,7 @@ sys_mprotect(unsigned long start, size_t len, unsigned long 
prot)
/*
 * Does the application expect PROT_READ to imply PROT_EXEC:
 */
-   if ((prot & PROT_READ) && (current->personality & READ_IMPLIES_EXEC))
+   if ((prot & PROT_READ) && (get_personality() & READ_IMPLIES_EXEC))
prot |= PROT_EXEC;
 
vm_flags = calc_vm_prot_bits(prot);
diff --git a/mm/nommu.c b/mm/nommu.c
index 5d8ae08..a1c6162 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -665,7 +665,7 @@ static int validate_mmap_request(struct file *file,
}
else if ((prot & PROT_READ) && !(prot & PROT_EXEC)) {
/* handle implication of PROT_EXEC by PROT_READ */
-   if (current->personality & READ_IMPLIES_EXEC) {
+   if (get_personality() & READ_IMPLIES_EXEC) {
if (capabilities & BDI_CAP_EXEC_MAP)
prot |= PROT_EXEC;
}
@@ -686,7 +686,7 @@ static int validate_mmap_request(struct file *file,
 
/* handle PROT_EXEC implication by PROT_READ */
if ((prot & PROT_READ) &&
-   (current->personality & READ_IMPLIES_EXEC))
+   (get_personality() & READ_IMPLIES_EXEC))
prot |= PROT_EXEC;
}
 
-- 
1.5.3.8

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 01/16] Make the macro get_personality function-like.

2008-02-23 Thread WANG Cong
This patch makes the macro get_personality function-like.

Signed-off-by: WANG Cong <[EMAIL PROTECTED]>
Cc: Christoph Hellwig <[EMAIL PROTECTED]>
Cc: Bryan Wu <[EMAIL PROTECTED]>
Cc: David Howells <[EMAIL PROTECTED]>

---
 arch/blackfin/kernel/signal.c |2 +-
 arch/frv/kernel/signal.c  |4 ++--
 include/linux/personality.h   |2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/blackfin/kernel/signal.c b/arch/blackfin/kernel/signal.c
index 5564c95..f3ef4ee 100644
--- a/arch/blackfin/kernel/signal.c
+++ b/arch/blackfin/kernel/signal.c
@@ -224,7 +224,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t * 
info,
 
/* Set up registers for signal handler */
wrusp((unsigned long)frame);
-   if (get_personality & FDPIC_FUNCPTRS) {
+   if (get_personality() & FDPIC_FUNCPTRS) {
struct fdpic_func_descriptor __user *funcptr =
(struct fdpic_func_descriptor *) ka->sa.sa_handler;
__get_user(regs->pc, >text);
diff --git a/arch/frv/kernel/signal.c b/arch/frv/kernel/signal.c
index d64bcaf..7e4405d 100644
--- a/arch/frv/kernel/signal.c
+++ b/arch/frv/kernel/signal.c
@@ -297,7 +297,7 @@ static int setup_frame(int sig, struct k_sigaction *ka, 
sigset_t *set)
__frame->lr   = (unsigned long) >retcode;
__frame->gr8  = sig;
 
-   if (get_personality & FDPIC_FUNCPTRS) {
+   if (get_personality() & FDPIC_FUNCPTRS) {
struct fdpic_func_descriptor __user *funcptr =
(struct fdpic_func_descriptor __user *) 
ka->sa.sa_handler;
__get_user(__frame->pc, >text);
@@ -396,7 +396,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, 
siginfo_t *info,
__frame->gr8 = sig;
__frame->gr9 = (unsigned long) >info;
 
-   if (get_personality & FDPIC_FUNCPTRS) {
+   if (get_personality() & FDPIC_FUNCPTRS) {
struct fdpic_func_descriptor __user *funcptr =
(struct fdpic_func_descriptor __user *) 
ka->sa.sa_handler;
__get_user(__frame->pc, >text);
diff --git a/include/linux/personality.h b/include/linux/personality.h
index 012cd55..1891b31 100644
--- a/include/linux/personality.h
+++ b/include/linux/personality.h
@@ -108,7 +108,7 @@ struct exec_domain {
 /*
  * Personality of the currently running process.
  */
-#define get_personality(current->personality)
+#define get_personality()  (current->personality)
 
 /*
  * Change personality of the currently running process.
-- 
1.5.3.8

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 00/16] (Resend) Use get_personality()

2008-02-23 Thread WANG Cong
This patchset makes the macro get_personality function alike
and teaches code to use get_personality() instead of explicit
reference.

[I am sorry if you've received multiple copied of this, since
 my git-send-email doesn't work well. ]

Signed-off-by: WANG Cong <[EMAIL PROTECTED]>


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 00/16] (Resend) Use get_personality()

2008-02-23 Thread WANG Cong
This patchset makes the macro get_personality function alike
and teaches code to use get_personality() instead of explicit
reference.

[I am sorry if you've received multiple copied of this, since
 my git-send-email doesn't work well. ]

Signed-off-by: WANG Cong [EMAIL PROTECTED]


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 01/16] Make the macro get_personality function-like.

2008-02-23 Thread WANG Cong
This patch makes the macro get_personality function-like.

Signed-off-by: WANG Cong [EMAIL PROTECTED]
Cc: Christoph Hellwig [EMAIL PROTECTED]
Cc: Bryan Wu [EMAIL PROTECTED]
Cc: David Howells [EMAIL PROTECTED]

---
 arch/blackfin/kernel/signal.c |2 +-
 arch/frv/kernel/signal.c  |4 ++--
 include/linux/personality.h   |2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/blackfin/kernel/signal.c b/arch/blackfin/kernel/signal.c
index 5564c95..f3ef4ee 100644
--- a/arch/blackfin/kernel/signal.c
+++ b/arch/blackfin/kernel/signal.c
@@ -224,7 +224,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t * 
info,
 
/* Set up registers for signal handler */
wrusp((unsigned long)frame);
-   if (get_personality  FDPIC_FUNCPTRS) {
+   if (get_personality()  FDPIC_FUNCPTRS) {
struct fdpic_func_descriptor __user *funcptr =
(struct fdpic_func_descriptor *) ka-sa.sa_handler;
__get_user(regs-pc, funcptr-text);
diff --git a/arch/frv/kernel/signal.c b/arch/frv/kernel/signal.c
index d64bcaf..7e4405d 100644
--- a/arch/frv/kernel/signal.c
+++ b/arch/frv/kernel/signal.c
@@ -297,7 +297,7 @@ static int setup_frame(int sig, struct k_sigaction *ka, 
sigset_t *set)
__frame-lr   = (unsigned long) frame-retcode;
__frame-gr8  = sig;
 
-   if (get_personality  FDPIC_FUNCPTRS) {
+   if (get_personality()  FDPIC_FUNCPTRS) {
struct fdpic_func_descriptor __user *funcptr =
(struct fdpic_func_descriptor __user *) 
ka-sa.sa_handler;
__get_user(__frame-pc, funcptr-text);
@@ -396,7 +396,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, 
siginfo_t *info,
__frame-gr8 = sig;
__frame-gr9 = (unsigned long) frame-info;
 
-   if (get_personality  FDPIC_FUNCPTRS) {
+   if (get_personality()  FDPIC_FUNCPTRS) {
struct fdpic_func_descriptor __user *funcptr =
(struct fdpic_func_descriptor __user *) 
ka-sa.sa_handler;
__get_user(__frame-pc, funcptr-text);
diff --git a/include/linux/personality.h b/include/linux/personality.h
index 012cd55..1891b31 100644
--- a/include/linux/personality.h
+++ b/include/linux/personality.h
@@ -108,7 +108,7 @@ struct exec_domain {
 /*
  * Personality of the currently running process.
  */
-#define get_personality(current-personality)
+#define get_personality()  (current-personality)
 
 /*
  * Change personality of the currently running process.
-- 
1.5.3.8

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 02/16] mm: use get_personality()

2008-02-23 Thread WANG Cong
Use get_personality() macro instead of explicit reference
for mm/ code.

Signed-off-by: WANG Cong [EMAIL PROTECTED]
Cc: Christoph Hellwig [EMAIL PROTECTED]
Cc: Christoph Lameter [EMAIL PROTECTED] 

---
 mm/mmap.c |2 +-
 mm/mprotect.c |2 +-
 mm/nommu.c|4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/mm/mmap.c b/mm/mmap.c
index a32d28c..42d647f 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -910,7 +910,7 @@ unsigned long do_mmap_pgoff(struct file * file, unsigned 
long addr,
 * (the exception is when the underlying filesystem is noexec
 *  mounted, in which case we dont add PROT_EXEC.)
 */
-   if ((prot  PROT_READ)  (current-personality  READ_IMPLIES_EXEC))
+   if ((prot  PROT_READ)  (get_personality()  READ_IMPLIES_EXEC))
if (!(file  (file-f_path.mnt-mnt_flags  MNT_NOEXEC)))
prot |= PROT_EXEC;
 
diff --git a/mm/mprotect.c b/mm/mprotect.c
index 4de5468..620b8db 100644
--- a/mm/mprotect.c
+++ b/mm/mprotect.c
@@ -237,7 +237,7 @@ sys_mprotect(unsigned long start, size_t len, unsigned long 
prot)
/*
 * Does the application expect PROT_READ to imply PROT_EXEC:
 */
-   if ((prot  PROT_READ)  (current-personality  READ_IMPLIES_EXEC))
+   if ((prot  PROT_READ)  (get_personality()  READ_IMPLIES_EXEC))
prot |= PROT_EXEC;
 
vm_flags = calc_vm_prot_bits(prot);
diff --git a/mm/nommu.c b/mm/nommu.c
index 5d8ae08..a1c6162 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -665,7 +665,7 @@ static int validate_mmap_request(struct file *file,
}
else if ((prot  PROT_READ)  !(prot  PROT_EXEC)) {
/* handle implication of PROT_EXEC by PROT_READ */
-   if (current-personality  READ_IMPLIES_EXEC) {
+   if (get_personality()  READ_IMPLIES_EXEC) {
if (capabilities  BDI_CAP_EXEC_MAP)
prot |= PROT_EXEC;
}
@@ -686,7 +686,7 @@ static int validate_mmap_request(struct file *file,
 
/* handle PROT_EXEC implication by PROT_READ */
if ((prot  PROT_READ) 
-   (current-personality  READ_IMPLIES_EXEC))
+   (get_personality()  READ_IMPLIES_EXEC))
prot |= PROT_EXEC;
}
 
-- 
1.5.3.8

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 03/16] fs: use get_personality()

2008-02-23 Thread WANG Cong
Use get_personality() macro instead of explicit reference.

Signed-off-by: WANG Cong [EMAIL PROTECTED]
Cc: Alexander Viro [EMAIL PROTECTED]

---
 fs/binfmt_elf.c |6 +++---
 fs/compat.c |6 +++---
 fs/select.c |6 +++---
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index 41a958a..1b5803f 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -516,7 +516,7 @@ static unsigned long randomize_stack_top(unsigned long 
stack_top)
unsigned int random_variable = 0;
 
if ((current-flags  PF_RANDOMIZE) 
-   !(current-personality  ADDR_NO_RANDOMIZE)) {
+   !(get_personality()  ADDR_NO_RANDOMIZE)) {
random_variable = get_random_int()  STACK_RND_MASK;
random_variable = PAGE_SHIFT;
}
@@ -744,7 +744,7 @@ static int load_elf_binary(struct linux_binprm *bprm, 
struct pt_regs *regs)
if (elf_read_implies_exec(loc-elf_ex, executable_stack))
current-personality |= READ_IMPLIES_EXEC;
 
-   if (!(current-personality  ADDR_NO_RANDOMIZE)  randomize_va_space)
+   if (!(get_personality()  ADDR_NO_RANDOMIZE)  randomize_va_space)
current-flags |= PF_RANDOMIZE;
arch_pick_mmap_layout(current-mm);
 
@@ -969,7 +969,7 @@ static int load_elf_binary(struct linux_binprm *bprm, 
struct pt_regs *regs)
arch_randomize_brk(current-mm);
 #endif
 
-   if (current-personality  MMAP_PAGE_ZERO) {
+   if (get_personality()  MMAP_PAGE_ZERO) {
/* Why this, you ask???  Well SVr4 maps page 0 as read-only,
   and some applications depend upon this behavior.
   Since we do not have the power to recompile these, we
diff --git a/fs/compat.c b/fs/compat.c
index 2ce4456..eefe23b 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -1610,7 +1610,7 @@ asmlinkage long compat_sys_select(int n, compat_ulong_t 
__user *inp,
if (tvp) {
struct compat_timeval rtv;
 
-   if (current-personality  STICKY_TIMEOUTS)
+   if (get_personality()  STICKY_TIMEOUTS)
goto sticky;
rtv.tv_usec = jiffies_to_usecs(do_div((*(u64*)timeout), HZ));
rtv.tv_sec = timeout;
@@ -1685,7 +1685,7 @@ asmlinkage long compat_sys_pselect7(int n, compat_ulong_t 
__user *inp,
if (tsp) {
struct compat_timespec rts;
 
-   if (current-personality  STICKY_TIMEOUTS)
+   if (get_personality()  STICKY_TIMEOUTS)
goto sticky;
 
rts.tv_sec = timeout / HZ;
@@ -1800,7 +1800,7 @@ asmlinkage long compat_sys_ppoll(struct pollfd __user 
*ufds,
if (tsp  timeout = 0) {
struct compat_timespec rts;
 
-   if (current-personality  STICKY_TIMEOUTS)
+   if (get_personality()  STICKY_TIMEOUTS)
goto sticky;
/* Yes, we know it's actually an s64, but it's also positive. */
rts.tv_nsec = jiffies_to_usecs(do_div((*(u64*)timeout), HZ)) *
diff --git a/fs/select.c b/fs/select.c
index 5633fe9..6041e24 100644
--- a/fs/select.c
+++ b/fs/select.c
@@ -401,7 +401,7 @@ asmlinkage long sys_select(int n, fd_set __user *inp, 
fd_set __user *outp,
if (tvp) {
struct timeval rtv;
 
-   if (current-personality  STICKY_TIMEOUTS)
+   if (get_personality()  STICKY_TIMEOUTS)
goto sticky;
rtv.tv_usec = jiffies_to_usecs(do_div((*(u64*)timeout), HZ));
rtv.tv_sec = timeout;
@@ -467,7 +467,7 @@ asmlinkage long sys_pselect7(int n, fd_set __user *inp, 
fd_set __user *outp,
if (tsp) {
struct timespec rts;
 
-   if (current-personality  STICKY_TIMEOUTS)
+   if (get_personality()  STICKY_TIMEOUTS)
goto sticky;
rts.tv_nsec = jiffies_to_usecs(do_div((*(u64*)timeout), HZ)) *
1000;
@@ -814,7 +814,7 @@ asmlinkage long sys_ppoll(struct pollfd __user *ufds, 
unsigned int nfds,
if (tsp  timeout = 0) {
struct timespec rts;
 
-   if (current-personality  STICKY_TIMEOUTS)
+   if (get_personality()  STICKY_TIMEOUTS)
goto sticky;
/* Yes, we know it's actually an s64, but it's also positive. */
rts.tv_nsec = jiffies_to_usecs(do_div((*(u64*)timeout), HZ)) *
-- 
1.5.3.8

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 04/16] powerpc: use get_personality()

2008-02-23 Thread WANG Cong
Use get_personality() macro instead of explicit reference
for powerpc code.

Signed-off-by: WANG Cong [EMAIL PROTECTED]
Cc: Christoph Hellwig [EMAIL PROTECTED]
Cc: Paul Mackerras [EMAIL PROTECTED]

---
 arch/powerpc/kernel/syscalls.c |4 ++--
 arch/powerpc/mm/mmap.c |2 +-
 include/asm-powerpc/elf.h  |2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/kernel/syscalls.c b/arch/powerpc/kernel/syscalls.c
index 3b1d5dd..4b910b8 100644
--- a/arch/powerpc/kernel/syscalls.c
+++ b/arch/powerpc/kernel/syscalls.c
@@ -228,7 +228,7 @@ long ppc64_personality(unsigned long personality)
 {
long ret;
 
-   if (personality(current-personality) == PER_LINUX32
+   if (personality(get_personality()) == PER_LINUX32
 personality == PER_LINUX)
personality = PER_LINUX32;
ret = sys_personality(personality);
@@ -239,7 +239,7 @@ long ppc64_personality(unsigned long personality)
 #endif
 
 #ifdef CONFIG_PPC64
-#define OVERRIDE_MACHINE(personality(current-personality) == PER_LINUX32)
+#define OVERRIDE_MACHINE(personality(get_personality()) == PER_LINUX32)
 #else
 #define OVERRIDE_MACHINE0
 #endif
diff --git a/arch/powerpc/mm/mmap.c b/arch/powerpc/mm/mmap.c
index 86010fc..92a9e45 100644
--- a/arch/powerpc/mm/mmap.c
+++ b/arch/powerpc/mm/mmap.c
@@ -54,7 +54,7 @@ static inline int mmap_is_legacy(void)
if (!test_thread_flag(TIF_32BIT))
return 1;
 
-   if (current-personality  ADDR_COMPAT_LAYOUT)
+   if (get_personality()  ADDR_COMPAT_LAYOUT)
return 1;
 
if (current-signal-rlim[RLIMIT_STACK].rlim_cur == RLIM_INFINITY)
diff --git a/include/asm-powerpc/elf.h b/include/asm-powerpc/elf.h
index 9080d85..d9e7bff 100644
--- a/include/asm-powerpc/elf.h
+++ b/include/asm-powerpc/elf.h
@@ -256,7 +256,7 @@ do {
\
set_thread_flag(TIF_ABI_PENDING);   \
else\
clear_thread_flag(TIF_ABI_PENDING); \
-   if (personality(current-personality) != PER_LINUX32)   \
+   if (personality(get_personality()) != PER_LINUX32)  \
set_personality(PER_LINUX); \
 } while (0)
 /*
-- 
1.5.3.8

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 05/16] parisc: use get_personality()

2008-02-23 Thread WANG Cong
Use get_personality() macro instead of explicit reference
for parisc code.

Signed-off-by: WANG Cong [EMAIL PROTECTED]
Cc: Kyle McMartin [EMAIL PROTECTED]
Cc: Matthew Wilcox [EMAIL PROTECTED]

---
 arch/parisc/kernel/sys_parisc.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/parisc/kernel/sys_parisc.c b/arch/parisc/kernel/sys_parisc.c
index 4f58921..1515ced 100644
--- a/arch/parisc/kernel/sys_parisc.c
+++ b/arch/parisc/kernel/sys_parisc.c
@@ -259,7 +259,7 @@ long parisc_personality(unsigned long personality)
 {
long err;
 
-   if (personality(current-personality) == PER_LINUX32
+   if (personality(get_personality()) == PER_LINUX32
 personality == PER_LINUX)
personality = PER_LINUX32;
 
@@ -275,7 +275,7 @@ long parisc_newuname(struct new_utsname __user *name)
int err = sys_newuname(name);
 
 #ifdef CONFIG_COMPAT
-   if (!err  personality(current-personality) == PER_LINUX32) {
+   if (!err  personality(get_personality()) == PER_LINUX32) {
if (__put_user(0, name-machine + 6) ||
__put_user(0, name-machine + 7))
err = -EFAULT;
-- 
1.5.3.8

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 06/16] sparc(64): use get_personality()

2008-02-23 Thread WANG Cong
Use get_personality() macro and other two tiny improvements.

Signed-off-by: WANG Cong [EMAIL PROTECTED]
Cc: David Miller [EMAIL PROTECTED]
Cc: William L. Irwin [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]

---
 arch/sparc/kernel/signal.c  |2 +-
 arch/sparc64/kernel/signal32.c  |2 +-
 arch/sparc64/kernel/sys_sparc.c |6 +++---
 include/asm-sparc/namei.h   |2 +-
 include/asm-sparc64/elf.h   |2 +-
 include/asm-sparc64/namei.h |2 +-
 6 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/arch/sparc/kernel/signal.c b/arch/sparc/kernel/signal.c
index 9994cac..0464874 100644
--- a/arch/sparc/kernel/signal.c
+++ b/arch/sparc/kernel/signal.c
@@ -1010,7 +1010,7 @@ asmlinkage void do_signal(struct pt_regs * regs, unsigned 
long orig_i0, int rest
 #ifdef SVR4_SIGNAL_BROKEN
int svr4_signal = 0;
 #else
-   int svr4_signal = current-personality == PER_SVR4;
+   int svr4_signal = (get_personality() == PER_SVR4);
 #endif
 
cookie.restart_syscall = restart_syscall;
diff --git a/arch/sparc64/kernel/signal32.c b/arch/sparc64/kernel/signal32.c
index 8c1c121..e3bc993 100644
--- a/arch/sparc64/kernel/signal32.c
+++ b/arch/sparc64/kernel/signal32.c
@@ -1270,7 +1270,7 @@ void do_signal32(sigset_t *oldset, struct pt_regs * regs,
struct signal_deliver_cookie cookie;
struct k_sigaction ka;
int signr;
-   int svr4_signal = current-personality == PER_SVR4;
+   int svr4_signal = (get_personality() == PER_SVR4);

cookie.restart_syscall = restart_syscall;
cookie.orig_i0 = orig_i0;
diff --git a/arch/sparc64/kernel/sys_sparc.c b/arch/sparc64/kernel/sys_sparc.c
index 134d801..3813ec7 100644
--- a/arch/sparc64/kernel/sys_sparc.c
+++ b/arch/sparc64/kernel/sys_sparc.c
@@ -372,7 +372,7 @@ void arch_pick_mmap_layout(struct mm_struct *mm)
 * bit is set, or if the expected stack growth is unlimited:
 */
if (!test_thread_flag(TIF_32BIT) ||
-   (current-personality  ADDR_COMPAT_LAYOUT) ||
+   (get_personality()  ADDR_COMPAT_LAYOUT) ||
current-signal-rlim[RLIMIT_STACK].rlim_cur == RLIM_INFINITY ||
sysctl_legacy_va_layout) {
mm-mmap_base = TASK_UNMAPPED_BASE + random_factor;
@@ -518,7 +518,7 @@ asmlinkage long sparc64_newuname(struct new_utsname __user 
*name)
 {
int ret = sys_newuname(name);

-   if (current-personality == PER_LINUX32  !ret) {
+   if (get_personality() == PER_LINUX32  !ret) {
ret = (copy_to_user(name-machine, sparc\0\0, 8)
   ? -EFAULT : 0);
}
@@ -529,7 +529,7 @@ asmlinkage long sparc64_personality(unsigned long 
personality)
 {
int ret;
 
-   if (current-personality == PER_LINUX32 
+   if (get_personality() == PER_LINUX32 
personality == PER_LINUX)
personality = PER_LINUX32;
ret = sys_personality(personality);
diff --git a/include/asm-sparc/namei.h b/include/asm-sparc/namei.h
index f2461e8..b87f621 100644
--- a/include/asm-sparc/namei.h
+++ b/include/asm-sparc/namei.h
@@ -13,7 +13,7 @@
 
 static inline char * __emul_prefix(void)
 {
-   switch (current-personality) {
+   switch (get_personality()) {
case PER_SUNOS:
return SPARC_BSD_EMUL;
case PER_SVR4:
diff --git a/include/asm-sparc64/elf.h b/include/asm-sparc64/elf.h
index 11c8e68..2140dbe 100644
--- a/include/asm-sparc64/elf.h
+++ b/include/asm-sparc64/elf.h
@@ -211,7 +211,7 @@ do {unsigned long new_flags = 
current_thread_info()-flags; \
/* flush_thread will update pgd cache */\
if (ibcs2)  \
set_personality(PER_SVR4);  \
-   else if (current-personality != PER_LINUX32)   \
+   else if (get_personality() != PER_LINUX32)  \
set_personality(PER_LINUX); \
 } while (0)
 
diff --git a/include/asm-sparc64/namei.h b/include/asm-sparc64/namei.h
index ccda19e..e6a1dd9 100644
--- a/include/asm-sparc64/namei.h
+++ b/include/asm-sparc64/namei.h
@@ -13,7 +13,7 @@
 
 static inline char * __emul_prefix(void)
 {
-   switch (current-personality) {
+   switch (get_personality()) {
case PER_SUNOS:
return SPARC_BSD_EMUL;
case PER_SVR4:
-- 
1.5.3.8

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 07/16] arm: use get_personality()

2008-02-23 Thread WANG Cong
Use get_personality() macro instead of explicit reference
for arm code.

Signed-off-by: WANG Cong [EMAIL PROTECTED]
Cc: Russell King [EMAIL PROTECTED]

---
 arch/arm/kernel/traps.c |4 ++--
 include/asm-arm/namei.h |2 +-
 include/asm-arm/processor.h |4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
index 5595fdd..975faaf 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -381,8 +381,8 @@ static int bad_syscall(int n, struct pt_regs *regs)
struct thread_info *thread = current_thread_info();
siginfo_t info;
 
-   if (current-personality != PER_LINUX 
-   current-personality != PER_LINUX_32BIT 
+   if (get_personality() != PER_LINUX 
+   get_personality() != PER_LINUX_32BIT 
thread-exec_domain-handler) {
thread-exec_domain-handler(n, regs);
return regs-ARM_r0;
diff --git a/include/asm-arm/namei.h b/include/asm-arm/namei.h
index a402d3b..c55dc87 100644
--- a/include/asm-arm/namei.h
+++ b/include/asm-arm/namei.h
@@ -14,7 +14,7 @@
 
 static inline char *__emul_prefix(void)
 {
-   switch (current-personality) {
+   switch (get_personality()) {
case PER_BSD:
return ARM_BSD_EMUL;
default:
diff --git a/include/asm-arm/processor.h b/include/asm-arm/processor.h
index bd8029e..7f040b4 100644
--- a/include/asm-arm/processor.h
+++ b/include/asm-arm/processor.h
@@ -23,7 +23,7 @@
 #include asm/types.h
 
 #ifdef __KERNEL__
-#define STACK_TOP  ((current-personality == PER_LINUX_32BIT) ? \
+#define STACK_TOP  ((get_personality() == PER_LINUX_32BIT) ? \
 TASK_SIZE : TASK_SIZE_26)
 #define STACK_TOP_MAX  TASK_SIZE
 #endif
@@ -65,7 +65,7 @@ struct thread_struct {
unsigned long *stack = (unsigned long *)sp; \
set_fs(USER_DS);\
memzero(regs-uregs, sizeof(regs-uregs));  \
-   if (current-personality  ADDR_LIMIT_32BIT)\
+   if (get_personality()  ADDR_LIMIT_32BIT)   \
regs-ARM_cpsr = USR_MODE;  \
else\
regs-ARM_cpsr = USR26_MODE;\
-- 
1.5.3.8

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 08/16] x86: use get_personality()

2008-02-23 Thread WANG Cong
Use get_personality() macro instead of explicit reference
for x86 code.

Signed-off-by: WANG Cong [EMAIL PROTECTED]
Cc:  Ingo Molnar [EMAIL PROTECTED]

---
 arch/x86/ia32/sys_ia32.c |6 +++---
 arch/x86/kernel/process_32.c |2 +-
 arch/x86/kernel/process_64.c |2 +-
 arch/x86/kernel/sys_x86_64.c |2 +-
 arch/x86/mm/mmap.c   |2 +-
 include/asm-x86/page.h   |2 +-
 include/asm-x86/processor.h  |2 +-
 7 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/arch/x86/ia32/sys_ia32.c b/arch/x86/ia32/sys_ia32.c
index abf71d2..80e7431 100644
--- a/arch/x86/ia32/sys_ia32.c
+++ b/arch/x86/ia32/sys_ia32.c
@@ -666,7 +666,7 @@ asmlinkage long sys32_personality(unsigned long personality)
 {
int ret;
 
-   if (personality(current-personality) == PER_LINUX32 
+   if (personality(get_personality()) == PER_LINUX32 
personality == PER_LINUX)
personality = PER_LINUX32;
ret = sys_personality(personality);
@@ -744,7 +744,7 @@ asmlinkage long sys32_olduname(struct oldold_utsname __user 
*name)
  __OLD_UTS_LEN);
err |= __put_user(0, name-version+__OLD_UTS_LEN);
 
-   if (personality(current-personality) == PER_LINUX32)
+   if (personality(get_personality()) == PER_LINUX32)
arch = i686;
 
err |= __copy_to_user(name-machine, arch, strlen(arch) + 1);
@@ -765,7 +765,7 @@ long sys32_uname(struct old_utsname __user *name)
down_read(uts_sem);
err = copy_to_user(name, utsname(), sizeof(*name));
up_read(uts_sem);
-   if (personality(current-personality) == PER_LINUX32)
+   if (personality(get_personality()) == PER_LINUX32)
err |= copy_to_user(name-machine, i686, 5);
 
return err ? -EFAULT : 0;
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
index a7d50a5..c4992fc 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -837,7 +837,7 @@ unsigned long get_wchan(struct task_struct *p)
 
 unsigned long arch_align_stack(unsigned long sp)
 {
-   if (!(current-personality  ADDR_NO_RANDOMIZE)  randomize_va_space)
+   if (!(get_personality()  ADDR_NO_RANDOMIZE)  randomize_va_space)
sp -= get_random_int() % 8192;
return sp  ~0xf;
 }
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index b0cc8f0..8223f3f 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -915,7 +915,7 @@ long sys_arch_prctl(int code, unsigned long addr)
 
 unsigned long arch_align_stack(unsigned long sp)
 {
-   if (!(current-personality  ADDR_NO_RANDOMIZE)  randomize_va_space)
+   if (!(get_personality()  ADDR_NO_RANDOMIZE)  randomize_va_space)
sp -= get_random_int() % 8192;
return sp  ~0xf;
 }
diff --git a/arch/x86/kernel/sys_x86_64.c b/arch/x86/kernel/sys_x86_64.c
index bd802a5..0b7548b 100644
--- a/arch/x86/kernel/sys_x86_64.c
+++ b/arch/x86/kernel/sys_x86_64.c
@@ -247,7 +247,7 @@ asmlinkage long sys_uname(struct new_utsname __user * name)
down_read(uts_sem);
err = copy_to_user(name, utsname(), sizeof (*name));
up_read(uts_sem);
-   if (personality(current-personality) == PER_LINUX32) 
+   if (personality(get_personality()) == PER_LINUX32) 
err |= copy_to_user(name-machine, i686, 5); 
return err ? -EFAULT : 0;
 }
diff --git a/arch/x86/mm/mmap.c b/arch/x86/mm/mmap.c
index 56fe712..f299d64 100644
--- a/arch/x86/mm/mmap.c
+++ b/arch/x86/mm/mmap.c
@@ -55,7 +55,7 @@ static int mmap_is_ia32(void)
 
 static int mmap_is_legacy(void)
 {
-   if (current-personality  ADDR_COMPAT_LAYOUT)
+   if (get_personality()  ADDR_COMPAT_LAYOUT)
return 1;
 
if (current-signal-rlim[RLIMIT_STACK].rlim_cur == RLIM_INFINITY)
diff --git a/include/asm-x86/page.h b/include/asm-x86/page.h
index 1cb7c51..fd90c7a 100644
--- a/include/asm-x86/page.h
+++ b/include/asm-x86/page.h
@@ -42,7 +42,7 @@
 #define PAGE_OFFSET((unsigned long)__PAGE_OFFSET)
 
 #define VM_DATA_DEFAULT_FLAGS \
-   (((current-personality  READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \
+   (((get_personality()  READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \
 VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
 
 
diff --git a/include/asm-x86/processor.h b/include/asm-x86/processor.h
index 45a2f0a..c426dc1 100644
--- a/include/asm-x86/processor.h
+++ b/include/asm-x86/processor.h
@@ -791,7 +791,7 @@ extern unsigned long thread_saved_pc(struct task_struct 
*tsk);
 /* This decides where the kernel will search for a free chunk of vm
  * space during mmap's.
  */
-#define IA32_PAGE_OFFSET ((current-personality  ADDR_LIMIT_3GB) ? \
+#define IA32_PAGE_OFFSET ((get_personality()  ADDR_LIMIT_3GB) ? \
   0xc000 : 0xe000)
 
 #define TASK_SIZE  (test_thread_flag(TIF_IA32) ? \
-- 
1.5.3.8

--
To unsubscribe

[PATCH 09/16] um: use get_personality()

2008-02-23 Thread WANG Cong
Use get_personality() macro instead of explicit reference for
uml code.

Signed-off-by: WANG Cong [EMAIL PROTECTED]
Cc: Jeff Dike [EMAIL PROTECTED]

---
 arch/um/kernel/process.c   |2 +-
 arch/um/sys-x86_64/syscalls.c  |2 +-
 include/asm-um/vm-flags-i386.h |2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c
index fc50d2f..91e0a84 100644
--- a/arch/um/kernel/process.c
+++ b/arch/um/kernel/process.c
@@ -405,7 +405,7 @@ int singlestepping(void * t)
 #ifndef arch_align_stack
 unsigned long arch_align_stack(unsigned long sp)
 {
-   if (!(current-personality  ADDR_NO_RANDOMIZE)  randomize_va_space)
+   if (!(get_personality()  ADDR_NO_RANDOMIZE)  randomize_va_space)
sp -= get_random_int() % 8192;
return sp  ~0xf;
 }
diff --git a/arch/um/sys-x86_64/syscalls.c b/arch/um/sys-x86_64/syscalls.c
index f1199fd..cf7b61e 100644
--- a/arch/um/sys-x86_64/syscalls.c
+++ b/arch/um/sys-x86_64/syscalls.c
@@ -20,7 +20,7 @@ asmlinkage long sys_uname64(struct new_utsname __user * name)
err = copy_to_user(name, utsname(), sizeof (*name));
up_read(uts_sem);
 
-   if (personality(current-personality) == PER_LINUX32)
+   if (personality(get_personality()) == PER_LINUX32)
err |= copy_to_user(name-machine, i686, 5);
 
return err ? -EFAULT : 0;
diff --git a/include/asm-um/vm-flags-i386.h b/include/asm-um/vm-flags-i386.h
index e0d24c5..c30e0f6 100644
--- a/include/asm-um/vm-flags-i386.h
+++ b/include/asm-um/vm-flags-i386.h
@@ -8,7 +8,7 @@
 
 #define VM_DATA_DEFAULT_FLAGS \
(VM_READ | VM_WRITE | \
-   ((current-personality  READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \
+   ((get_personality()  READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \
 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
 
 #endif
-- 
1.5.3.8

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 10/16] s390: use get_personality()

2008-02-23 Thread WANG Cong
Use get_personality() macro instead of explicit reference
for s390 code.

Signed-off-by: WANG Cong [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]

---
 arch/s390/kernel/binfmt_elf32.c |2 +-
 arch/s390/kernel/sys_s390.c |4 ++--
 arch/s390/mm/mmap.c |2 +-
 include/asm-s390/elf.h  |2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/s390/kernel/binfmt_elf32.c b/arch/s390/kernel/binfmt_elf32.c
index 3e1c315..6a55911 100644
--- a/arch/s390/kernel/binfmt_elf32.c
+++ b/arch/s390/kernel/binfmt_elf32.c
@@ -78,7 +78,7 @@
 do {   \
if (ibcs2)  \
set_personality(PER_SVR4);  \
-   else if (current-personality != PER_LINUX32)   \
+   else if (get_personality() != PER_LINUX32)   \
set_personality(PER_LINUX); \
set_thread_flag(TIF_31BIT); \
 } while (0)
diff --git a/arch/s390/kernel/sys_s390.c b/arch/s390/kernel/sys_s390.c
index fefee99..f8371fe 100644
--- a/arch/s390/kernel/sys_s390.c
+++ b/arch/s390/kernel/sys_s390.c
@@ -215,7 +215,7 @@ asmlinkage long s390x_newuname(struct new_utsname __user 
*name)
 {
int ret = sys_newuname(name);
 
-   if (current-personality == PER_LINUX32  !ret) {
+   if (get_personality() == PER_LINUX32  !ret) {
ret = copy_to_user(name-machine, s390\0\0\0\0, 8);
if (ret) ret = -EFAULT;
}
@@ -226,7 +226,7 @@ asmlinkage long s390x_personality(unsigned long personality)
 {
int ret;
 
-   if (current-personality == PER_LINUX32  personality == PER_LINUX)
+   if (get_personality() == PER_LINUX32  personality == PER_LINUX)
personality = PER_LINUX32;
ret = sys_personality(personality);
if (ret == PER_LINUX32)
diff --git a/arch/s390/mm/mmap.c b/arch/s390/mm/mmap.c
index 5932a82..f5bf304 100644
--- a/arch/s390/mm/mmap.c
+++ b/arch/s390/mm/mmap.c
@@ -59,7 +59,7 @@ static inline int mmap_is_legacy(void)
return 1;
 #endif
return sysctl_legacy_va_layout ||
-   (current-personality  ADDR_COMPAT_LAYOUT) ||
+   (get_personality()  ADDR_COMPAT_LAYOUT) ||
current-signal-rlim[RLIMIT_STACK].rlim_cur == RLIM_INFINITY;
 }
 
diff --git a/include/asm-s390/elf.h b/include/asm-s390/elf.h
index b3ac262..18482d3 100644
--- a/include/asm-s390/elf.h
+++ b/include/asm-s390/elf.h
@@ -202,7 +202,7 @@ extern char elf_platform[];
 do {   \
if (ibcs2)  \
set_personality(PER_SVR4);  \
-   else if (current-personality != PER_LINUX32)   \
+   else if (get_personality() != PER_LINUX32)  \
set_personality(PER_LINUX); \
clear_thread_flag(TIF_31BIT);   \
 } while (0)
-- 
1.5.3.8

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 11/16] mips: use get_personality()

2008-02-23 Thread WANG Cong
Use get_personality() macro instead of explicit reference
for mips code.

Signed-off-by: WANG Cong [EMAIL PROTECTED]
Cc:  Ralf Baechle [EMAIL PROTECTED]

---
 arch/mips/kernel/linux32.c |4 ++--
 arch/mips/kernel/process.c |4 ++--
 include/asm-mips/elf.h |2 +-
 include/asm-mips/namei.h   |2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c
index 65af3cc..e5b7671 100644
--- a/arch/mips/kernel/linux32.c
+++ b/arch/mips/kernel/linux32.c
@@ -446,7 +446,7 @@ asmlinkage long sys32_newuname(struct new_utsname __user * 
name)
ret = -EFAULT;
up_read(uts_sem);
 
-   if (current-personality == PER_LINUX32  !ret)
+   if (get_personality() == PER_LINUX32  !ret)
if (copy_to_user(name-machine, mips\0\0\0, 8))
ret = -EFAULT;
 
@@ -457,7 +457,7 @@ asmlinkage int sys32_personality(unsigned long personality)
 {
int ret;
personality = 0x;
-   if (personality(current-personality) == PER_LINUX32 
+   if (personality(get_personality()) == PER_LINUX32 
personality == PER_LINUX)
personality = PER_LINUX32;
ret = sys_personality(personality);
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
index 2c09a44..dc7486c 100644
--- a/arch/mips/kernel/process.c
+++ b/arch/mips/kernel/process.c
@@ -126,7 +126,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned 
long usp,
childregs-regs[7] = 0; /* Clear error flag */
 
 #if defined(CONFIG_BINFMT_IRIX)
-   if (current-personality != PER_LINUX) {
+   if (get_personality() != PER_LINUX) {
/* Under IRIX things are a little different. */
childregs-regs[3] = 1;
regs-regs[3] = 0;
@@ -471,7 +471,7 @@ out:
  */
 unsigned long arch_align_stack(unsigned long sp)
 {
-   if (!(current-personality  ADDR_NO_RANDOMIZE)  randomize_va_space)
+   if (!(get_personality()  ADDR_NO_RANDOMIZE)  randomize_va_space)
sp -= get_random_int()  ~PAGE_MASK;
 
return sp  ALMASK;
diff --git a/include/asm-mips/elf.h b/include/asm-mips/elf.h
index f69f7ac..c07f464 100644
--- a/include/asm-mips/elf.h
+++ b/include/asm-mips/elf.h
@@ -308,7 +308,7 @@ do {
\
\
if (ibcs2)  \
set_personality(PER_SVR4);  \
-   else if (current-personality != PER_LINUX32)   \
+   else if (get_personality() != PER_LINUX32)  \
set_personality(PER_LINUX); \
 } while (0)
 
diff --git a/include/asm-mips/namei.h b/include/asm-mips/namei.h
index c94d12d..18ab9eb 100644
--- a/include/asm-mips/namei.h
+++ b/include/asm-mips/namei.h
@@ -9,7 +9,7 @@
 
 static inline char *__emul_prefix(void)
 {
-   switch (current-personality) {
+   switch (get_personality()) {
case PER_IRIX32:
case PER_IRIXN32:
case PER_IRIX64:
-- 
1.5.3.8

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 12/16] ia64: use get_personality()

2008-02-23 Thread WANG Cong
Use get_personality() macro instead of explicit reference
for ia64 code.

Signed-off-by: WANG Cong [EMAIL PROTECTED]
Cc: Tony Luck [EMAIL PROTECTED]

---
 arch/ia64/ia32/sys_ia32.c |2 +-
 arch/ia64/mm/init.c   |2 +-
 include/asm-ia64/fcntl.h  |2 +-
 include/asm-ia64/namei.h  |2 +-
 include/asm-ia64/page.h   |2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/ia64/ia32/sys_ia32.c b/arch/ia64/ia32/sys_ia32.c
index d025a22..a91273f 100644
--- a/arch/ia64/ia32/sys_ia32.c
+++ b/arch/ia64/ia32/sys_ia32.c
@@ -2265,7 +2265,7 @@ sys32_personality (unsigned int personality)
 {
long ret;
 
-   if (current-personality == PER_LINUX32  personality == PER_LINUX)
+   if (get_personality() == PER_LINUX32  personality == PER_LINUX)
personality = PER_LINUX32;
ret = sys_personality(personality);
if (ret == PER_LINUX32)
diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
index 25aef62..f5641bb 100644
--- a/arch/ia64/mm/init.c
+++ b/arch/ia64/mm/init.c
@@ -139,7 +139,7 @@ ia64_init_addr_space (void)
}
 
/* map NaT-page at address zero to speed up speculative dereferencing 
of NULL: */
-   if (!(current-personality  MMAP_PAGE_ZERO)) {
+   if (!(get_personality()  MMAP_PAGE_ZERO)) {
vma = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL);
if (vma) {
vma-vm_mm = current-mm;
diff --git a/include/asm-ia64/fcntl.h b/include/asm-ia64/fcntl.h
index 1dd275d..e8acf85 100644
--- a/include/asm-ia64/fcntl.h
+++ b/include/asm-ia64/fcntl.h
@@ -6,7 +6,7 @@
  */
 
 #define force_o_largefile()\
-   (personality(current-personality) != PER_LINUX32)
+   (personality(get_personality()) != PER_LINUX32)
 
 #include asm-generic/fcntl.h
 
diff --git a/include/asm-ia64/namei.h b/include/asm-ia64/namei.h
index 78e7680..da38e5c 100644
--- a/include/asm-ia64/namei.h
+++ b/include/asm-ia64/namei.h
@@ -14,7 +14,7 @@
 static inline char *
 __emul_prefix (void)
 {
-   switch (current-personality) {
+   switch (get_personality()) {
  case PER_LINUX32:
return EMUL_PREFIX_LINUX_IA32;
  default:
diff --git a/include/asm-ia64/page.h b/include/asm-ia64/page.h
index 4999a6c..287e53b 100644
--- a/include/asm-ia64/page.h
+++ b/include/asm-ia64/page.h
@@ -224,7 +224,7 @@ get_order (unsigned long size)
 
 #define VM_DATA_DEFAULT_FLAGS  (VM_READ | VM_WRITE |   
\
 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC 
|\
-(((current-personality  
READ_IMPLIES_EXEC) != 0) \
+(((get_personality()  
READ_IMPLIES_EXEC) != 0)\
  ? VM_EXEC : 0))
 
 #endif /* _ASM_IA64_PAGE_H */
-- 
1.5.3.8

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 13/16] alpha: use get_personality()

2008-02-23 Thread WANG Cong
Use get_personality() macro instead of explicit reference
for alpha code.

Signed-off-by: WANG Cong [EMAIL PROTECTED]
Cc: Richard Henderson [EMAIL PROTECTED]

---
 arch/alpha/kernel/osf_sys.c   |6 +++---
 include/asm-alpha/processor.h |4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c
index 8c71daf..df825a4 100644
--- a/arch/alpha/kernel/osf_sys.c
+++ b/arch/alpha/kernel/osf_sys.c
@@ -1266,7 +1266,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long 
addr,
unsigned long limit;
 
/* 32 bit actually means 31 bit, since pointers sign extend.  */
-   if (current-personality  ADDR_LIMIT_32BIT)
+   if (get_personality()  ADDR_LIMIT_32BIT)
limit = 0x8000;
else
limit = TASK_SIZE;
@@ -1327,7 +1327,7 @@ osf_fix_iov_len(const struct iovec __user *iov, unsigned 
long count)
 asmlinkage ssize_t
 osf_readv(unsigned long fd, const struct iovec __user * vector, unsigned long 
count)
 {
-   if (unlikely(personality(current-personality) == PER_OSF4))
+   if (unlikely(personality(get_personality()) == PER_OSF4))
if (osf_fix_iov_len(vector, count))
return -EFAULT;
return sys_readv(fd, vector, count);
@@ -1336,7 +1336,7 @@ osf_readv(unsigned long fd, const struct iovec __user * 
vector, unsigned long co
 asmlinkage ssize_t
 osf_writev(unsigned long fd, const struct iovec __user * vector, unsigned long 
count)
 {
-   if (unlikely(personality(current-personality) == PER_OSF4))
+   if (unlikely(personality(get_personality()) == PER_OSF4))
if (osf_fix_iov_len(vector, count))
return -EFAULT;
return sys_writev(fd, vector, count);
diff --git a/include/asm-alpha/processor.h b/include/asm-alpha/processor.h
index 94afe58..6c164b9 100644
--- a/include/asm-alpha/processor.h
+++ b/include/asm-alpha/processor.h
@@ -21,7 +21,7 @@
 #define TASK_SIZE (0x400UL)
 
 #define STACK_TOP \
-  (current-personality  ADDR_LIMIT_32BIT ? 0x8000 : 0x0012000UL)
+  (get_personality()  ADDR_LIMIT_32BIT ? 0x8000 : 0x0012000UL)
 
 #define STACK_TOP_MAX  0x0012000UL
 
@@ -29,7 +29,7 @@
  * space during mmap's.
  */
 #define TASK_UNMAPPED_BASE \
-  ((current-personality  ADDR_LIMIT_32BIT) ? 0x4000 : TASK_SIZE / 2)
+  ((get_personality()  ADDR_LIMIT_32BIT) ? 0x4000 : TASK_SIZE / 2)
 
 typedef struct {
unsigned long seg;
-- 
1.5.3.8

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 14/16] frv: use get_personality()

2008-02-23 Thread WANG Cong
Use get_personality() macro instead of explicit reference
for frv code.

Signed-off-by: WANG Cong [EMAIL PROTECTED]
Cc: David Howells [EMAIL PROTECTED]

---
 include/asm-frv/page.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/asm-frv/page.h b/include/asm-frv/page.h
index c2c1e89..6c5c4db 100644
--- a/include/asm-frv/page.h
+++ b/include/asm-frv/page.h
@@ -69,7 +69,7 @@ extern unsigned long max_pfn;
 #ifdef CONFIG_MMU
 #define VM_DATA_DEFAULT_FLAGS \
(VM_READ | VM_WRITE | \
-   ((current-personality  READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \
+   ((get_personality()  READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \
 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
 #endif
 
-- 
1.5.3.8

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 15/16] mn10300: use get_personality()

2008-02-23 Thread WANG Cong
Use get_personality() macro instead of explicit reference
for mn10300 code.

Signed-off-by: WANG Cong [EMAIL PROTECTED]
Cc: David Howells [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]

---
 include/asm-mn10300/page.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/asm-mn10300/page.h b/include/asm-mn10300/page.h
index 124971b..fc6e9fb 100644
--- a/include/asm-mn10300/page.h
+++ b/include/asm-mn10300/page.h
@@ -123,7 +123,7 @@ static inline int get_order(unsigned long size)
 
 #define VM_DATA_DEFAULT_FLAGS \
(VM_READ | VM_WRITE | \
-   ((current-personality  READ_IMPLIES_EXEC) ? VM_EXEC : 0) | \
+   ((get_personality()  READ_IMPLIES_EXEC) ? VM_EXEC : 0) | \
 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
 
 #endif /* __KERNEL__ */
-- 
1.5.3.8

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 16/16] kernel: use get_personality()

2008-02-23 Thread WANG Cong
Use get_personality() macro instead of explicit reference.

Signed-off-by: WANG Cong [EMAIL PROTECTED]
Cc: Christoph Hellwig [EMAIL PROTECTED]

---
 kernel/exec_domain.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/exec_domain.c b/kernel/exec_domain.c
index a9e6bad..056ba23 100644
--- a/kernel/exec_domain.c
+++ b/kernel/exec_domain.c
@@ -192,11 +192,11 @@ get_exec_domain_list(char *page)
 asmlinkage long
 sys_personality(u_long personality)
 {
-   u_long old = current-personality;
+   u_long old = get_personality();
 
if (personality != 0x) {
set_personality(personality);
-   if (current-personality != personality)
+   if (get_personality() != personality)
return -EINVAL;
}
 
-- 
1.5.3.8

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 00/16] (Resend) Use get_personality()

2008-02-23 Thread WANG Cong
From: Alexey Dobriyan [EMAIL PROTECTED]
Subject: Re: [PATCH 00/16] (Resend) Use get_personality()
Date: Sat, 23 Feb 2008 11:51:01 +0300
Message-ID: [EMAIL PROTECTED]

 On Sat, Feb 23, 2008 at 04:14:03PM +0800, WANG Cong wrote:
  This patchset makes the macro get_personality function alike
  and teaches code to use get_personality() instead of explicit
  reference.
  
  [I am sorry if you've received multiple copied of this, since
   my git-send-email doesn't work well. ]
 
 Yes, but why? current-personality is way more understandable than
 your macro because task subject to dereference is very visible.

Use get_personality() can hide the task_struct internals a bit.

And I don't think using the macro to access it is less understandable.
Since 'current' won't be NULL, whether the dereference is visible is
not important.

Regards.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 00/16] (Resend) Use get_personality()

2008-02-23 Thread WANG Cong
From: Alexey Dobriyan [EMAIL PROTECTED]
Subject: Re: [PATCH 00/16] (Resend) Use get_personality()
Date: Sat, 23 Feb 2008 12:27:10 +0300
Message-ID: [EMAIL PROTECTED]

 On Sat, Feb 23, 2008 at 04:59:44PM +0800, WANG Cong wrote:
  From: Alexey Dobriyan [EMAIL PROTECTED]
  Subject: Re: [PATCH 00/16] (Resend) Use get_personality()
 
   On Sat, Feb 23, 2008 at 04:14:03PM +0800, WANG Cong wrote:
This patchset makes the macro get_personality function alike
and teaches code to use get_personality() instead of explicit
reference.

[I am sorry if you've received multiple copied of this, since
 my git-send-email doesn't work well. ]
   
   Yes, but why? current-personality is way more understandable than
   your macro because task subject to dereference is very visible.
  
  Use get_personality() can hide the task_struct internals a bit.
 
 -personality is going to become something less trivial?
 Sorry, but you sound like C++ people writing tons of pointless get/set
 wrappers. And your get_personality() is worse -- C++ would write it as
 
   current-personality()
 
 and again, even here, it's immediately visible that current task is
 involved, not some other task.
 

Can't get_personality() mean getting the personality of current task?

Or you want a more generic macro like this?

#define get_task_personality(tsk) ((tsk)-personality)

No, that is _too_ generic. Look at the code, (nearly) all references to
'personality' are via 'current'. So get_personality() is enough.

I am not a fan of C++, I know that sometimes the get/set method in C++
is really a bit pointless, but, of course, *not* all the times.

Regards.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 08/16] x86: use get_personality()

2008-02-23 Thread WANG Cong
From: Ingo Molnar [EMAIL PROTECTED]
Subject: Re: [PATCH 08/16] x86: use get_personality()
Date: Sat, 23 Feb 2008 11:19:54 +0100
Message-ID: [EMAIL PROTECTED]

 
 * Ingo Molnar [EMAIL PROTECTED] wrote:
 
  * WANG Cong [EMAIL PROTECTED] wrote:
  
   Use get_personality() macro instead of explicit reference for x86 
   code.
  
  thanks, applied.
 
 randconfig testing found the following build failures:
 
   arch/x86/kernel/process_64.c: In function 'do_arch_prctl':
   arch/x86/kernel/process_64.c:836: error: called object 
 'get_current()-personality' is not a function
   arch/x86/kernel/process_64.c:862: error: called object 
 'get_current()-personality' is not a function
 
 so i dropped the patch again. Config attached.
 
   Ingo

Sorry that I didn't mention that this patch should be applied
_after_ [patch 01/16], since in [patch 01/16] I made the macro
get_personality like a function.

Sorry for this. Just wait after [patch 01/16] is applied.

Thanks.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 00/16] (Resend) Use get_personality()

2008-02-23 Thread WANG Cong
From: Andrew Morton [EMAIL PROTECTED]
Subject: Re: [PATCH 00/16] (Resend) Use get_personality()
Date: Sat, 23 Feb 2008 11:16:29 -0800
Message-ID: [EMAIL PROTECTED]

 On Sat, 23 Feb 2008 13:37:31 -0500 Christoph Hellwig [EMAIL PROTECTED] 
 wrote:
 
  On Sat, Feb 23, 2008 at 12:27:10PM +0300, Alexey Dobriyan wrote:
Use get_personality() can hide the task_struct internals a bit.
   
   -personality is going to become something less trivial?
   Sorry, but you sound like C++ people writing tons of pointless get/set
   wrappers. And your get_personality() is worse -- C++ would write it as
   
 current-personality()
   
   and again, even here, it's immediately visible that current task is
   involved, not some other task.
  
  Yes, completely agreement.  While I might have introduced this gem
  back then it is entirely stupid if you think about it.  Please send
  patches to kill get_personality and just use current-personality
  instead.
  
 
 yup.
 
 We'll generally only add wrappers of this form if we need to provide
 alternative implementations, or if we expect that we shall do so in the
 future.
 

Ok. I will send a patch to remove it.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 09/16] um: use get_personality()

2008-02-22 Thread WANG Cong
From: Jeff Dike <[EMAIL PROTECTED]>
Subject: Re: [PATCH 09/16] um: use get_personality()
Date: Wed, 20 Feb 2008 11:27:34 -0500
Message-ID: <[EMAIL PROTECTED]>

> On Wed, Feb 20, 2008 at 07:19:13PM +0800, WANG Cong wrote:
> > Signed-off-by: WANG Cong <[EMAIL PROTECTED]>
> 
> Looks good - you should add some sort of changelog though.
> 

Thanks, Jeff.

It seems that you're the only one who received this patchset of mine.
And I found that lkml.org didn't receive these neither. ;(

I don't know if Andrew received all of them, if not, I must resend.

Regards.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 09/16] um: use get_personality()

2008-02-22 Thread WANG Cong
From: Jeff Dike [EMAIL PROTECTED]
Subject: Re: [PATCH 09/16] um: use get_personality()
Date: Wed, 20 Feb 2008 11:27:34 -0500
Message-ID: [EMAIL PROTECTED]

 On Wed, Feb 20, 2008 at 07:19:13PM +0800, WANG Cong wrote:
  Signed-off-by: WANG Cong [EMAIL PROTECTED]
 
 Looks good - you should add some sort of changelog though.
 

Thanks, Jeff.

It seems that you're the only one who received this patchset of mine.
And I found that lkml.org didn't receive these neither. ;(

I don't know if Andrew received all of them, if not, I must resend.

Regards.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[Patch]net/xfrm/xfrm_state.c: replace timer with delayed_work

2008-02-16 Thread WANG Cong

Also suggested by Herbert Xu, using workqueue is better than timer
for net/xfrm/xfrm_state.c, so replace them with delayed_work.

Note that, this patch is not fully tested, just compile and
run as a whole on an Intel Core Duo matchine. So should be
in -mm first.

Signed-off-by: WANG Cong <[EMAIL PROTECTED]>
Cc: Herbert Xu <[EMAIL PROTECTED]>
Cc: David Miller <[EMAIL PROTECTED]>

---
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index ac72116..ff718b4 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -188,14 +188,14 @@ struct xfrm_state
u32 replay_maxage;
u32 replay_maxdiff;
 
-   /* Replay detection notification timer */
-   struct timer_list   rtimer;
+   /* Replay detection notification delayed work */
+   struct delayed_work rwork;
 
/* Statistics */
struct xfrm_stats   stats;
 
struct xfrm_lifetime_cur curlft;
-   struct timer_list   timer;
+   struct delayed_work work;
 
/* Last used time */
unsigned long   lastused;
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index 7ba65e8..e0511c9 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -379,8 +379,8 @@ static void xfrm_put_mode(struct xfrm_mode *mode)
 
 static void xfrm_state_gc_destroy(struct xfrm_state *x)
 {
-   del_timer_sync(>timer);
-   del_timer_sync(>rtimer);
+   cancel_delayed_work_sync(>work);
+   cancel_delayed_work_sync(>rwork);
kfree(x->aalg);
kfree(x->ealg);
kfree(x->calg);
@@ -423,9 +423,10 @@ static inline unsigned long make_jiffies(long secs)
return secs*HZ;
 }
 
-static void xfrm_timer_handler(unsigned long data)
+static void xfrm_work_handler(struct work_struct *w)
 {
-   struct xfrm_state *x = (struct xfrm_state*)data;
+   struct xfrm_state *x =
+   container_of((struct delayed_work *)w, struct xfrm_state, work);
unsigned long now = get_seconds();
long next = LONG_MAX;
int warn = 0;
@@ -476,7 +477,7 @@ static void xfrm_timer_handler(unsigned long data)
km_state_expired(x, 0, 0);
 resched:
if (next != LONG_MAX)
-   mod_timer(>timer, jiffies + make_jiffies(next));
+   schedule_delayed_work(>work, make_jiffies(next));
 
goto out;
 
@@ -499,7 +500,7 @@ out:
spin_unlock(>lock);
 }
 
-static void xfrm_replay_timer_handler(unsigned long data);
+static void xfrm_replay_work_handler(struct work_struct *);
 
 struct xfrm_state *xfrm_state_alloc(void)
 {
@@ -513,9 +514,8 @@ struct xfrm_state *xfrm_state_alloc(void)
INIT_HLIST_NODE(>bydst);
INIT_HLIST_NODE(>bysrc);
INIT_HLIST_NODE(>byspi);
-   setup_timer(>timer, xfrm_timer_handler, (unsigned long)x);
-   setup_timer(>rtimer, xfrm_replay_timer_handler,
-   (unsigned long)x);
+   INIT_DELAYED_WORK(>work, xfrm_work_handler);
+   INIT_DELAYED_WORK(>rwork, xfrm_replay_work_handler);
x->curlft.add_time = get_seconds();
x->lft.soft_byte_limit = XFRM_INF;
x->lft.soft_packet_limit = XFRM_INF;
@@ -851,8 +851,7 @@ xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t 
*saddr,
hlist_add_head(>byspi, xfrm_state_byspi+h);
}
x->lft.hard_add_expires_seconds = 
sysctl_xfrm_acq_expires;
-   x->timer.expires = jiffies + sysctl_xfrm_acq_expires*HZ;
-   add_timer(>timer);
+   schedule_delayed_work(>work, 
sysctl_xfrm_acq_expires*HZ);
xfrm_state_num++;
xfrm_hash_grow_check(x->bydst.next != NULL);
} else {
@@ -923,9 +922,9 @@ static void __xfrm_state_insert(struct xfrm_state *x)
hlist_add_head(>byspi, xfrm_state_byspi+h);
}
 
-   mod_timer(>timer, jiffies + HZ);
+   schedule_delayed_work(>work, HZ);
if (x->replay_maxage)
-   mod_timer(>rtimer, jiffies + x->replay_maxage);
+   schedule_delayed_work(>rwork, x->replay_maxage);
 
wake_up(_waitq);
 
@@ -1034,8 +1033,7 @@ static struct xfrm_state *__find_acq_core(unsigned short 
family, u8 mode, u32 re
x->props.reqid = reqid;
x->lft.hard_add_expires_seconds = sysctl_xfrm_acq_expires;
xfrm_state_hold(x);
-   x->timer.expires = jiffies + sysctl_xfrm_acq_expires*HZ;
-   add_timer(>timer);
+   schedule_delayed_work(>work, sysctl_xfrm_acq_expires*HZ);
hlist_add_head(>bydst, xfrm_state_bydst+h);
h = xfrm_src_hash(daddr, saddr, family)

[Patch]net/xfrm/xfrm_policy.c: replace timer with delayed_work

2008-02-16 Thread WANG Cong

As suggested by Herbert, using workqueue is better than timer
for net/xfrm/xfrm_policy.c, so replace them with delayed_work.

Note that, this patch is not fully tested, just compile and
run as a whole on an Intel Core Duo matchine. So should be
in -mm first.

Signed-off-by: WANG Cong <[EMAIL PROTECTED]>
Cc: Herbert Xu <[EMAIL PROTECTED]>
Cc: David Miller <[EMAIL PROTECTED]>

---
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index ac72116..53f4794 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -430,7 +430,7 @@ struct xfrm_policy
/* This lock only affects elements except for entry. */
rwlock_tlock;
atomic_trefcnt;
-   struct timer_list   timer;
+   struct delayed_work work;
 
u32 priority;
u32 index;
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 47219f9..58066f0 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -126,9 +126,10 @@ static inline unsigned long make_jiffies(long secs)
return secs*HZ;
 }
 
-static void xfrm_policy_timer(unsigned long data)
+static void xfrm_policy_worker(struct work_struct *w)
 {
-   struct xfrm_policy *xp = (struct xfrm_policy*)data;
+   struct xfrm_policy *xp =
+   container_of((struct delayed_work *)w, struct xfrm_policy, 
work);
unsigned long now = get_seconds();
long next = LONG_MAX;
int warn = 0;
@@ -181,7 +182,7 @@ static void xfrm_policy_timer(unsigned long data)
if (warn)
km_policy_expired(xp, dir, 0, 0);
if (next != LONG_MAX &&
-   !mod_timer(>timer, jiffies + make_jiffies(next)))
+   !schedule_delayed_work(>work, make_jiffies(next)))
xfrm_pol_hold(xp);
 
 out:
@@ -208,12 +209,11 @@ struct xfrm_policy *xfrm_policy_alloc(gfp_t gfp)
policy = kzalloc(sizeof(struct xfrm_policy), gfp);
 
if (policy) {
+   INIT_DELAYED_WORK(>work, xfrm_policy_worker);
INIT_HLIST_NODE(>bydst);
INIT_HLIST_NODE(>byidx);
rwlock_init(>lock);
atomic_set(>refcnt, 1);
-   setup_timer(>timer, xfrm_policy_timer,
-   (unsigned long)policy);
}
return policy;
 }
@@ -227,7 +227,7 @@ void xfrm_policy_destroy(struct xfrm_policy *policy)
 
BUG_ON(policy->bundles);
 
-   if (del_timer(>timer))
+   if (cancel_delayed_work(>work))
BUG();
 
security_xfrm_policy_free(policy);
@@ -244,7 +244,7 @@ static void xfrm_policy_gc_kill(struct xfrm_policy *policy)
dst_free(dst);
}
 
-   if (del_timer(>timer))
+   if (cancel_delayed_work(>work))
atomic_dec(>refcnt);
 
if (atomic_read(>refcnt) > 1)
@@ -566,7 +566,7 @@ int xfrm_policy_insert(int dir, struct xfrm_policy *policy, 
int excl)
hlist_add_head(>byidx, 
xfrm_policy_byidx+idx_hash(policy->index));
policy->curlft.add_time = get_seconds();
policy->curlft.use_time = 0;
-   if (!mod_timer(>timer, jiffies + HZ))
+   if (!schedule_delayed_work(>work, HZ))
xfrm_pol_hold(policy);
write_unlock_bh(_policy_lock);
 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Patch] Fix shadowed variables in fs/binfmt_elf.c

2008-02-16 Thread WANG Cong
From: Andrew Morton <[EMAIL PROTECTED]>
Subject: Re: [Patch] Fix shadowed variables in fs/binfmt_elf.c
Date: Fri, 15 Feb 2008 12:34:59 -0800
Message-ID: <[EMAIL PROTECTED]>

> On Fri, 15 Feb 2008 21:58:02 +0800 (CST)
> WANG Cong <[EMAIL PROTECTED]> wrote:
> 
> > 
> > Fix these sparse warings:
> > fs/binfmt_elf.c:1749:29: warning: symbol 'tmp' shadows an earlier one
> > fs/binfmt_elf.c:1734:28: originally declared here
> > fs/binfmt_elf.c:2009:26: warning: symbol 'vma' shadows an earlier one
> > fs/binfmt_elf.c:1892:24: originally declared here
> > 
> > Signed-off-by: WANG Cong <[EMAIL PROTECTED]>
> > 
> > ---
> > diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
> > index 41a958a..6562563 100644
> > --- a/fs/binfmt_elf.c
> > +++ b/fs/binfmt_elf.c
> > @@ -1746,11 +1746,11 @@ static int fill_note_info(struct elfhdr *elf, int 
> > phdrs,
> > while_each_thread(g, p);
> > rcu_read_unlock();
> > list_for_each(t, >thread_list) {
> > -   struct elf_thread_status *tmp;
> > +   struct elf_thread_status *temp;
> > int sz;
> >  
> > -   tmp = list_entry(t, struct elf_thread_status, list);
> > -   sz = elf_dump_thread_status(signr, tmp);
> > +   temp = list_entry(t, struct elf_thread_status, list);
> > +   sz = elf_dump_thread_status(signr, temp);
> > info->thread_status_size += sz;
> > }
> > }
> 
> `tmp' is an awful identifier, and renaming it to "temp" hardly improves it.
> Please take any opportunity to fix this sort of thing.
> 
> I chose "ets" which is a bit weird but once one understand what it means,
> it makes the code much easier to follow.
> 
> Also used the same local for both loops.  There seems little point in
> instantiating a second one.

I agree. The first 'tmp' you showed is really not good, 'ets' is better.

Thanks, Andrew!
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Patch] Fix shadowed variables in fs/binfmt_elf.c

2008-02-16 Thread WANG Cong
From: Andrew Morton [EMAIL PROTECTED]
Subject: Re: [Patch] Fix shadowed variables in fs/binfmt_elf.c
Date: Fri, 15 Feb 2008 12:34:59 -0800
Message-ID: [EMAIL PROTECTED]

 On Fri, 15 Feb 2008 21:58:02 +0800 (CST)
 WANG Cong [EMAIL PROTECTED] wrote:
 
  
  Fix these sparse warings:
  fs/binfmt_elf.c:1749:29: warning: symbol 'tmp' shadows an earlier one
  fs/binfmt_elf.c:1734:28: originally declared here
  fs/binfmt_elf.c:2009:26: warning: symbol 'vma' shadows an earlier one
  fs/binfmt_elf.c:1892:24: originally declared here
  
  Signed-off-by: WANG Cong [EMAIL PROTECTED]
  
  ---
  diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
  index 41a958a..6562563 100644
  --- a/fs/binfmt_elf.c
  +++ b/fs/binfmt_elf.c
  @@ -1746,11 +1746,11 @@ static int fill_note_info(struct elfhdr *elf, int 
  phdrs,
  while_each_thread(g, p);
  rcu_read_unlock();
  list_for_each(t, info-thread_list) {
  -   struct elf_thread_status *tmp;
  +   struct elf_thread_status *temp;
  int sz;
   
  -   tmp = list_entry(t, struct elf_thread_status, list);
  -   sz = elf_dump_thread_status(signr, tmp);
  +   temp = list_entry(t, struct elf_thread_status, list);
  +   sz = elf_dump_thread_status(signr, temp);
  info-thread_status_size += sz;
  }
  }
 
 `tmp' is an awful identifier, and renaming it to temp hardly improves it.
 Please take any opportunity to fix this sort of thing.
 
 I chose ets which is a bit weird but once one understand what it means,
 it makes the code much easier to follow.
 
 Also used the same local for both loops.  There seems little point in
 instantiating a second one.

I agree. The first 'tmp' you showed is really not good, 'ets' is better.

Thanks, Andrew!
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[Patch]net/xfrm/xfrm_state.c: replace timer with delayed_work

2008-02-16 Thread WANG Cong

Also suggested by Herbert Xu, using workqueue is better than timer
for net/xfrm/xfrm_state.c, so replace them with delayed_work.

Note that, this patch is not fully tested, just compile and
run as a whole on an Intel Core Duo matchine. So should be
in -mm first.

Signed-off-by: WANG Cong [EMAIL PROTECTED]
Cc: Herbert Xu [EMAIL PROTECTED]
Cc: David Miller [EMAIL PROTECTED]

---
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index ac72116..ff718b4 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -188,14 +188,14 @@ struct xfrm_state
u32 replay_maxage;
u32 replay_maxdiff;
 
-   /* Replay detection notification timer */
-   struct timer_list   rtimer;
+   /* Replay detection notification delayed work */
+   struct delayed_work rwork;
 
/* Statistics */
struct xfrm_stats   stats;
 
struct xfrm_lifetime_cur curlft;
-   struct timer_list   timer;
+   struct delayed_work work;
 
/* Last used time */
unsigned long   lastused;
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index 7ba65e8..e0511c9 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -379,8 +379,8 @@ static void xfrm_put_mode(struct xfrm_mode *mode)
 
 static void xfrm_state_gc_destroy(struct xfrm_state *x)
 {
-   del_timer_sync(x-timer);
-   del_timer_sync(x-rtimer);
+   cancel_delayed_work_sync(x-work);
+   cancel_delayed_work_sync(x-rwork);
kfree(x-aalg);
kfree(x-ealg);
kfree(x-calg);
@@ -423,9 +423,10 @@ static inline unsigned long make_jiffies(long secs)
return secs*HZ;
 }
 
-static void xfrm_timer_handler(unsigned long data)
+static void xfrm_work_handler(struct work_struct *w)
 {
-   struct xfrm_state *x = (struct xfrm_state*)data;
+   struct xfrm_state *x =
+   container_of((struct delayed_work *)w, struct xfrm_state, work);
unsigned long now = get_seconds();
long next = LONG_MAX;
int warn = 0;
@@ -476,7 +477,7 @@ static void xfrm_timer_handler(unsigned long data)
km_state_expired(x, 0, 0);
 resched:
if (next != LONG_MAX)
-   mod_timer(x-timer, jiffies + make_jiffies(next));
+   schedule_delayed_work(x-work, make_jiffies(next));
 
goto out;
 
@@ -499,7 +500,7 @@ out:
spin_unlock(x-lock);
 }
 
-static void xfrm_replay_timer_handler(unsigned long data);
+static void xfrm_replay_work_handler(struct work_struct *);
 
 struct xfrm_state *xfrm_state_alloc(void)
 {
@@ -513,9 +514,8 @@ struct xfrm_state *xfrm_state_alloc(void)
INIT_HLIST_NODE(x-bydst);
INIT_HLIST_NODE(x-bysrc);
INIT_HLIST_NODE(x-byspi);
-   setup_timer(x-timer, xfrm_timer_handler, (unsigned long)x);
-   setup_timer(x-rtimer, xfrm_replay_timer_handler,
-   (unsigned long)x);
+   INIT_DELAYED_WORK(x-work, xfrm_work_handler);
+   INIT_DELAYED_WORK(x-rwork, xfrm_replay_work_handler);
x-curlft.add_time = get_seconds();
x-lft.soft_byte_limit = XFRM_INF;
x-lft.soft_packet_limit = XFRM_INF;
@@ -851,8 +851,7 @@ xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t 
*saddr,
hlist_add_head(x-byspi, xfrm_state_byspi+h);
}
x-lft.hard_add_expires_seconds = 
sysctl_xfrm_acq_expires;
-   x-timer.expires = jiffies + sysctl_xfrm_acq_expires*HZ;
-   add_timer(x-timer);
+   schedule_delayed_work(x-work, 
sysctl_xfrm_acq_expires*HZ);
xfrm_state_num++;
xfrm_hash_grow_check(x-bydst.next != NULL);
} else {
@@ -923,9 +922,9 @@ static void __xfrm_state_insert(struct xfrm_state *x)
hlist_add_head(x-byspi, xfrm_state_byspi+h);
}
 
-   mod_timer(x-timer, jiffies + HZ);
+   schedule_delayed_work(x-work, HZ);
if (x-replay_maxage)
-   mod_timer(x-rtimer, jiffies + x-replay_maxage);
+   schedule_delayed_work(x-rwork, x-replay_maxage);
 
wake_up(km_waitq);
 
@@ -1034,8 +1033,7 @@ static struct xfrm_state *__find_acq_core(unsigned short 
family, u8 mode, u32 re
x-props.reqid = reqid;
x-lft.hard_add_expires_seconds = sysctl_xfrm_acq_expires;
xfrm_state_hold(x);
-   x-timer.expires = jiffies + sysctl_xfrm_acq_expires*HZ;
-   add_timer(x-timer);
+   schedule_delayed_work(x-work, sysctl_xfrm_acq_expires*HZ);
hlist_add_head(x-bydst, xfrm_state_bydst+h);
h = xfrm_src_hash(daddr, saddr, family);
hlist_add_head(x-bysrc, xfrm_state_bysrc+h);
@@ -1302,7 +1300,7 @@ out:
memcpy(x1-lft, x-lft, sizeof

[Patch]net/xfrm/xfrm_policy.c: replace timer with delayed_work

2008-02-16 Thread WANG Cong

As suggested by Herbert, using workqueue is better than timer
for net/xfrm/xfrm_policy.c, so replace them with delayed_work.

Note that, this patch is not fully tested, just compile and
run as a whole on an Intel Core Duo matchine. So should be
in -mm first.

Signed-off-by: WANG Cong [EMAIL PROTECTED]
Cc: Herbert Xu [EMAIL PROTECTED]
Cc: David Miller [EMAIL PROTECTED]

---
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index ac72116..53f4794 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -430,7 +430,7 @@ struct xfrm_policy
/* This lock only affects elements except for entry. */
rwlock_tlock;
atomic_trefcnt;
-   struct timer_list   timer;
+   struct delayed_work work;
 
u32 priority;
u32 index;
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 47219f9..58066f0 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -126,9 +126,10 @@ static inline unsigned long make_jiffies(long secs)
return secs*HZ;
 }
 
-static void xfrm_policy_timer(unsigned long data)
+static void xfrm_policy_worker(struct work_struct *w)
 {
-   struct xfrm_policy *xp = (struct xfrm_policy*)data;
+   struct xfrm_policy *xp =
+   container_of((struct delayed_work *)w, struct xfrm_policy, 
work);
unsigned long now = get_seconds();
long next = LONG_MAX;
int warn = 0;
@@ -181,7 +182,7 @@ static void xfrm_policy_timer(unsigned long data)
if (warn)
km_policy_expired(xp, dir, 0, 0);
if (next != LONG_MAX 
-   !mod_timer(xp-timer, jiffies + make_jiffies(next)))
+   !schedule_delayed_work(xp-work, make_jiffies(next)))
xfrm_pol_hold(xp);
 
 out:
@@ -208,12 +209,11 @@ struct xfrm_policy *xfrm_policy_alloc(gfp_t gfp)
policy = kzalloc(sizeof(struct xfrm_policy), gfp);
 
if (policy) {
+   INIT_DELAYED_WORK(policy-work, xfrm_policy_worker);
INIT_HLIST_NODE(policy-bydst);
INIT_HLIST_NODE(policy-byidx);
rwlock_init(policy-lock);
atomic_set(policy-refcnt, 1);
-   setup_timer(policy-timer, xfrm_policy_timer,
-   (unsigned long)policy);
}
return policy;
 }
@@ -227,7 +227,7 @@ void xfrm_policy_destroy(struct xfrm_policy *policy)
 
BUG_ON(policy-bundles);
 
-   if (del_timer(policy-timer))
+   if (cancel_delayed_work(policy-work))
BUG();
 
security_xfrm_policy_free(policy);
@@ -244,7 +244,7 @@ static void xfrm_policy_gc_kill(struct xfrm_policy *policy)
dst_free(dst);
}
 
-   if (del_timer(policy-timer))
+   if (cancel_delayed_work(policy-work))
atomic_dec(policy-refcnt);
 
if (atomic_read(policy-refcnt)  1)
@@ -566,7 +566,7 @@ int xfrm_policy_insert(int dir, struct xfrm_policy *policy, 
int excl)
hlist_add_head(policy-byidx, 
xfrm_policy_byidx+idx_hash(policy-index));
policy-curlft.add_time = get_seconds();
policy-curlft.use_time = 0;
-   if (!mod_timer(policy-timer, jiffies + HZ))
+   if (!schedule_delayed_work(policy-work, HZ))
xfrm_pol_hold(policy);
write_unlock_bh(xfrm_policy_lock);
 
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[Patch] arch/um/kernel/um_arch.c: some small improvements

2008-02-15 Thread WANG Cong

Make some small improvements for arch/um/kernel/um_arch.c.

Signed-off-by: WANG Cong <[EMAIL PROTECTED]>
Cc: Jeff Dike <[EMAIL PROTECTED]>

---
diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c
index a6c1dd1..56deed6 100644
--- a/arch/um/kernel/um_arch.c
+++ b/arch/um/kernel/um_arch.c
@@ -115,7 +115,7 @@ static int have_root __initdata = 0;
 /* Set in uml_mem_setup and modified in linux_main */
 long long physmem_size = 32 * 1024 * 1024;
 
-static char *usage_string =
+static const char *usage_string =
 "User Mode Linux v%s\n"
 "  available at http://user-mode-linux.sourceforge.net/\n\n;;
 
@@ -202,7 +202,7 @@ static void __init uml_checksetup(char *line, int *add)
 
p = &__uml_setup_start;
while (p < &__uml_setup_end) {
-   int n;
+   size_t n;
 
n = strlen(p->str);
if (!strncmp(line, p->str, n) && p->setup_func(line + n, add))
@@ -258,7 +258,8 @@ int __init linux_main(int argc, char **argv)
 {
unsigned long avail, diff;
unsigned long virtmem_size, max_physmem;
-   unsigned int i, add;
+   unsigned int i;
+   int add;
char * mode;
 
for (i = 1; i < argc; i++) {
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[Patch] Fix shadowed variables in fs/binfmt_elf.c

2008-02-15 Thread WANG Cong

Fix these sparse warings:
fs/binfmt_elf.c:1749:29: warning: symbol 'tmp' shadows an earlier one
fs/binfmt_elf.c:1734:28: originally declared here
fs/binfmt_elf.c:2009:26: warning: symbol 'vma' shadows an earlier one
fs/binfmt_elf.c:1892:24: originally declared here

Signed-off-by: WANG Cong <[EMAIL PROTECTED]>

---
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index 41a958a..6562563 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -1746,11 +1746,11 @@ static int fill_note_info(struct elfhdr *elf, int phdrs,
while_each_thread(g, p);
rcu_read_unlock();
list_for_each(t, >thread_list) {
-   struct elf_thread_status *tmp;
+   struct elf_thread_status *temp;
int sz;
 
-   tmp = list_entry(t, struct elf_thread_status, list);
-   sz = elf_dump_thread_status(signr, tmp);
+   temp = list_entry(t, struct elf_thread_status, list);
+   sz = elf_dump_thread_status(signr, temp);
info->thread_status_size += sz;
}
}
@@ -2006,10 +2006,10 @@ static int elf_core_dump(long signr, struct pt_regs 
*regs, struct file *file, un
 
for (addr = vma->vm_start; addr < end; addr += PAGE_SIZE) {
struct page *page;
-   struct vm_area_struct *vma;
+   struct vm_area_struct *tmp_vma;
 
if (get_user_pages(current, current->mm, addr, 1, 0, 1,
-   , ) <= 0) {
+   , _vma) <= 0) {
DUMP_SEEK(PAGE_SIZE);
} else {
if (page == ZERO_PAGE(0)) {
@@ -2019,7 +2019,7 @@ static int elf_core_dump(long signr, struct pt_regs 
*regs, struct file *file, un
}
} else {
void *kaddr;
-   flush_cache_page(vma, addr,
+   flush_cache_page(tmp_vma, addr,
 page_to_pfn(page));
kaddr = kmap(page);
if ((size += PAGE_SIZE) > limit ||
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[Patch] Fix shadowed variables in kernel/posix-cpu-timers.c

2008-02-15 Thread WANG Cong

Fix sparse warnings like this:
kernel/posix-cpu-timers.c:1090:25: warning: symbol 't' shadows an earlier one
kernel/posix-cpu-timers.c:1058:21: originally declared here

Signed-off-by: WANG Cong <[EMAIL PROTECTED]>
Cc: Thomas Gleixner <[EMAIL PROTECTED]>

---
diff --git a/kernel/posix-cpu-timers.c b/kernel/posix-cpu-timers.c
index 2eae91f..ae5c6c1 100644
--- a/kernel/posix-cpu-timers.c
+++ b/kernel/posix-cpu-timers.c
@@ -1087,45 +1087,45 @@ static void check_process_timers(struct task_struct 
*tsk,
maxfire = 20;
prof_expires = cputime_zero;
while (!list_empty(timers)) {
-   struct cpu_timer_list *t = list_first_entry(timers,
+   struct cpu_timer_list *tl = list_first_entry(timers,
  struct cpu_timer_list,
  entry);
-   if (!--maxfire || cputime_lt(ptime, t->expires.cpu)) {
-   prof_expires = t->expires.cpu;
+   if (!--maxfire || cputime_lt(ptime, tl->expires.cpu)) {
+   prof_expires = tl->expires.cpu;
break;
}
-   t->firing = 1;
-   list_move_tail(>entry, firing);
+   tl->firing = 1;
+   list_move_tail(>entry, firing);
}
 
++timers;
maxfire = 20;
virt_expires = cputime_zero;
while (!list_empty(timers)) {
-   struct cpu_timer_list *t = list_first_entry(timers,
+   struct cpu_timer_list *tl = list_first_entry(timers,
  struct cpu_timer_list,
  entry);
-   if (!--maxfire || cputime_lt(utime, t->expires.cpu)) {
-   virt_expires = t->expires.cpu;
+   if (!--maxfire || cputime_lt(utime, tl->expires.cpu)) {
+   virt_expires = tl->expires.cpu;
break;
}
-   t->firing = 1;
-   list_move_tail(>entry, firing);
+   tl->firing = 1;
+   list_move_tail(>entry, firing);
}
 
++timers;
maxfire = 20;
sched_expires = 0;
while (!list_empty(timers)) {
-   struct cpu_timer_list *t = list_first_entry(timers,
+   struct cpu_timer_list *tl = list_first_entry(timers,
  struct cpu_timer_list,
  entry);
-   if (!--maxfire || sum_sched_runtime < t->expires.sched) {
-   sched_expires = t->expires.sched;
+   if (!--maxfire || sum_sched_runtime < tl->expires.sched) {
+   sched_expires = tl->expires.sched;
break;
}
-   t->firing = 1;
-   list_move_tail(>entry, firing);
+   tl->firing = 1;
+   list_move_tail(>entry, firing);
}
 
/*
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[Patch] Fix shadowed variables in kernel/posix-cpu-timers.c

2008-02-15 Thread WANG Cong

Fix sparse warnings like this:
kernel/posix-cpu-timers.c:1090:25: warning: symbol 't' shadows an earlier one
kernel/posix-cpu-timers.c:1058:21: originally declared here

Signed-off-by: WANG Cong [EMAIL PROTECTED]
Cc: Thomas Gleixner [EMAIL PROTECTED]

---
diff --git a/kernel/posix-cpu-timers.c b/kernel/posix-cpu-timers.c
index 2eae91f..ae5c6c1 100644
--- a/kernel/posix-cpu-timers.c
+++ b/kernel/posix-cpu-timers.c
@@ -1087,45 +1087,45 @@ static void check_process_timers(struct task_struct 
*tsk,
maxfire = 20;
prof_expires = cputime_zero;
while (!list_empty(timers)) {
-   struct cpu_timer_list *t = list_first_entry(timers,
+   struct cpu_timer_list *tl = list_first_entry(timers,
  struct cpu_timer_list,
  entry);
-   if (!--maxfire || cputime_lt(ptime, t-expires.cpu)) {
-   prof_expires = t-expires.cpu;
+   if (!--maxfire || cputime_lt(ptime, tl-expires.cpu)) {
+   prof_expires = tl-expires.cpu;
break;
}
-   t-firing = 1;
-   list_move_tail(t-entry, firing);
+   tl-firing = 1;
+   list_move_tail(tl-entry, firing);
}
 
++timers;
maxfire = 20;
virt_expires = cputime_zero;
while (!list_empty(timers)) {
-   struct cpu_timer_list *t = list_first_entry(timers,
+   struct cpu_timer_list *tl = list_first_entry(timers,
  struct cpu_timer_list,
  entry);
-   if (!--maxfire || cputime_lt(utime, t-expires.cpu)) {
-   virt_expires = t-expires.cpu;
+   if (!--maxfire || cputime_lt(utime, tl-expires.cpu)) {
+   virt_expires = tl-expires.cpu;
break;
}
-   t-firing = 1;
-   list_move_tail(t-entry, firing);
+   tl-firing = 1;
+   list_move_tail(tl-entry, firing);
}
 
++timers;
maxfire = 20;
sched_expires = 0;
while (!list_empty(timers)) {
-   struct cpu_timer_list *t = list_first_entry(timers,
+   struct cpu_timer_list *tl = list_first_entry(timers,
  struct cpu_timer_list,
  entry);
-   if (!--maxfire || sum_sched_runtime  t-expires.sched) {
-   sched_expires = t-expires.sched;
+   if (!--maxfire || sum_sched_runtime  tl-expires.sched) {
+   sched_expires = tl-expires.sched;
break;
}
-   t-firing = 1;
-   list_move_tail(t-entry, firing);
+   tl-firing = 1;
+   list_move_tail(tl-entry, firing);
}
 
/*
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[Patch] Fix shadowed variables in fs/binfmt_elf.c

2008-02-15 Thread WANG Cong

Fix these sparse warings:
fs/binfmt_elf.c:1749:29: warning: symbol 'tmp' shadows an earlier one
fs/binfmt_elf.c:1734:28: originally declared here
fs/binfmt_elf.c:2009:26: warning: symbol 'vma' shadows an earlier one
fs/binfmt_elf.c:1892:24: originally declared here

Signed-off-by: WANG Cong [EMAIL PROTECTED]

---
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index 41a958a..6562563 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -1746,11 +1746,11 @@ static int fill_note_info(struct elfhdr *elf, int phdrs,
while_each_thread(g, p);
rcu_read_unlock();
list_for_each(t, info-thread_list) {
-   struct elf_thread_status *tmp;
+   struct elf_thread_status *temp;
int sz;
 
-   tmp = list_entry(t, struct elf_thread_status, list);
-   sz = elf_dump_thread_status(signr, tmp);
+   temp = list_entry(t, struct elf_thread_status, list);
+   sz = elf_dump_thread_status(signr, temp);
info-thread_status_size += sz;
}
}
@@ -2006,10 +2006,10 @@ static int elf_core_dump(long signr, struct pt_regs 
*regs, struct file *file, un
 
for (addr = vma-vm_start; addr  end; addr += PAGE_SIZE) {
struct page *page;
-   struct vm_area_struct *vma;
+   struct vm_area_struct *tmp_vma;
 
if (get_user_pages(current, current-mm, addr, 1, 0, 1,
-   page, vma) = 0) {
+   page, tmp_vma) = 0) {
DUMP_SEEK(PAGE_SIZE);
} else {
if (page == ZERO_PAGE(0)) {
@@ -2019,7 +2019,7 @@ static int elf_core_dump(long signr, struct pt_regs 
*regs, struct file *file, un
}
} else {
void *kaddr;
-   flush_cache_page(vma, addr,
+   flush_cache_page(tmp_vma, addr,
 page_to_pfn(page));
kaddr = kmap(page);
if ((size += PAGE_SIZE)  limit ||
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[Patch] arch/um/kernel/um_arch.c: some small improvements

2008-02-15 Thread WANG Cong

Make some small improvements for arch/um/kernel/um_arch.c.

Signed-off-by: WANG Cong [EMAIL PROTECTED]
Cc: Jeff Dike [EMAIL PROTECTED]

---
diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c
index a6c1dd1..56deed6 100644
--- a/arch/um/kernel/um_arch.c
+++ b/arch/um/kernel/um_arch.c
@@ -115,7 +115,7 @@ static int have_root __initdata = 0;
 /* Set in uml_mem_setup and modified in linux_main */
 long long physmem_size = 32 * 1024 * 1024;
 
-static char *usage_string =
+static const char *usage_string =
 User Mode Linux v%s\n
   available at http://user-mode-linux.sourceforge.net/\n\n;;
 
@@ -202,7 +202,7 @@ static void __init uml_checksetup(char *line, int *add)
 
p = __uml_setup_start;
while (p  __uml_setup_end) {
-   int n;
+   size_t n;
 
n = strlen(p-str);
if (!strncmp(line, p-str, n)  p-setup_func(line + n, add))
@@ -258,7 +258,8 @@ int __init linux_main(int argc, char **argv)
 {
unsigned long avail, diff;
unsigned long virtmem_size, max_physmem;
-   unsigned int i, add;
+   unsigned int i;
+   int add;
char * mode;
 
for (i = 1; i  argc; i++) {
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[-mm Patch] arch/um/kernel/initrd.c: fix a missed conversion specifier

2008-02-05 Thread WANG Cong

Fix a missed conversion specifier of a printk in
arch/um/kernel/initrd.c.

Signed-off-by: WANG Cong <[EMAIL PROTECTED]>
Cc: Jeff Dike <[EMAIL PROTECTED]>

---

Index: linux/arch/um/kernel/initrd.c
===
--- linux.orig/arch/um/kernel/initrd.c
+++ linux/arch/um/kernel/initrd.c
@@ -32,7 +32,7 @@ static int __init read_initrd(void)
 * ask for no memory.
 */
if (size == 0) {
-   printk(KERN_ERR "\"%\" is a zero-size initrd\n");
+   printk(KERN_ERR "\"%s\" is a zero-size initrd\n", initrd);
return 0;
}
 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[-mm Patch] arch/um/kernel/mem.c: fix a shadowed variable

2008-02-05 Thread WANG Cong

Fix a shadowed variable in arch/um/kernel/mem.c,
since there is a global variable has the same name.

Cc: Jeff Dike <[EMAIL PROTECTED]>
Signed-off-by: WANG Cong <[EMAIL PROTECTED]>

---

Index: linux/arch/um/kernel/mem.c
===
--- linux.orig/arch/um/kernel/mem.c
+++ linux/arch/um/kernel/mem.c
@@ -299,7 +299,7 @@ void show_mem(void)
 {
int pfn, total = 0, reserved = 0;
int shared = 0, cached = 0;
-   int highmem = 0;
+   int high_mem = 0;
struct page *page;
 
printk(KERN_INFO "Mem-info:\n");
@@ -311,7 +311,7 @@ void show_mem(void)
page = pfn_to_page(pfn);
total++;
if (PageHighMem(page))
-   highmem++;
+   high_mem++;
if (PageReserved(page))
reserved++;
else if (PageSwapCache(page))
@@ -320,7 +320,7 @@ void show_mem(void)
shared += page_count(page) - 1;
}
printk(KERN_INFO "%d pages of RAM\n", total);
-   printk(KERN_INFO "%d pages of HIGHMEM\n", highmem);
+   printk(KERN_INFO "%d pages of HIGHMEM\n", high_mem);
printk(KERN_INFO "%d reserved pages\n", reserved);
printk(KERN_INFO "%d pages shared\n", shared);
printk(KERN_INFO "%d pages swap cached\n", cached);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[-mm Patch] arch/um/kernel/mem.c: fix a shadowed variable

2008-02-05 Thread WANG Cong

Fix a shadowed variable in arch/um/kernel/mem.c,
since there is a global variable has the same name.

Cc: Jeff Dike [EMAIL PROTECTED]
Signed-off-by: WANG Cong [EMAIL PROTECTED]

---

Index: linux/arch/um/kernel/mem.c
===
--- linux.orig/arch/um/kernel/mem.c
+++ linux/arch/um/kernel/mem.c
@@ -299,7 +299,7 @@ void show_mem(void)
 {
int pfn, total = 0, reserved = 0;
int shared = 0, cached = 0;
-   int highmem = 0;
+   int high_mem = 0;
struct page *page;
 
printk(KERN_INFO Mem-info:\n);
@@ -311,7 +311,7 @@ void show_mem(void)
page = pfn_to_page(pfn);
total++;
if (PageHighMem(page))
-   highmem++;
+   high_mem++;
if (PageReserved(page))
reserved++;
else if (PageSwapCache(page))
@@ -320,7 +320,7 @@ void show_mem(void)
shared += page_count(page) - 1;
}
printk(KERN_INFO %d pages of RAM\n, total);
-   printk(KERN_INFO %d pages of HIGHMEM\n, highmem);
+   printk(KERN_INFO %d pages of HIGHMEM\n, high_mem);
printk(KERN_INFO %d reserved pages\n, reserved);
printk(KERN_INFO %d pages shared\n, shared);
printk(KERN_INFO %d pages swap cached\n, cached);
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[-mm Patch] arch/um/kernel/initrd.c: fix a missed conversion specifier

2008-02-05 Thread WANG Cong

Fix a missed conversion specifier of a printk in
arch/um/kernel/initrd.c.

Signed-off-by: WANG Cong [EMAIL PROTECTED]
Cc: Jeff Dike [EMAIL PROTECTED]

---

Index: linux/arch/um/kernel/initrd.c
===
--- linux.orig/arch/um/kernel/initrd.c
+++ linux/arch/um/kernel/initrd.c
@@ -32,7 +32,7 @@ static int __init read_initrd(void)
 * ask for no memory.
 */
if (size == 0) {
-   printk(KERN_ERR \%\ is a zero-size initrd\n);
+   printk(KERN_ERR \%s\ is a zero-size initrd\n, initrd);
return 0;
}
 
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Patch] mm: fix a section mismatch warning

2008-02-01 Thread WANG Cong
On Thu, Jan 31, 2008 at 07:38:53PM +0100, Sam Ravnborg wrote:
>Hi WANG.
>
>On Fri, Feb 01, 2008 at 01:25:17AM +0800, WANG Cong wrote:
>> 
>> This patch fix this mismatch warning from mm:
>> 
>> WARNING: vmlinux.o(.meminit.text+0x37f): Section mismatch in reference from 
>> the function free_area_init_core() to the function .init.text:setup_usemap()
>> modpost: Found 1 section mismatch(es).
>> 
>> Cc: Sam Ravnborg <[EMAIL PROTECTED]>
>> Signed-off-by: WANG Cong <[EMAIL PROTECTED]>
>> 
>> ---
>> 
>> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
>> index b2838c2..8a9ae3c 100644
>> --- a/mm/page_alloc.c
>> +++ b/mm/page_alloc.c
>> @@ -3321,7 +3321,7 @@ static inline int pageblock_default_order(unsigned int 
>> order)
>>   *   - mark all memory queues empty
>>   *   - clear the memory bitmaps
>>   */
>> -static void __meminit free_area_init_core(struct pglist_data *pgdat,
>> +static void __init free_area_init_core(struct pglist_data *pgdat,
>>  unsigned long *zones_size, unsigned long *zholes_size)
>>  {
>>  enum zone_type j;
>> @@ -3445,7 +3445,7 @@ static void __init_refok alloc_node_mem_map(struct 
>> pglist_data *pgdat)
>>  #endif /* CONFIG_FLAT_NODE_MEM_MAP */
>>  }
>>  
>> -void __meminit free_area_init_node(int nid, struct pglist_data *pgdat,
>> +void __init free_area_init_node(int nid, struct pglist_data *pgdat,
>This change make me a bit unnerved. HAve you checked all callers?
>I simple grep shows 46 hits in the tree.

I use cscope to do the check. ;)

free_area_init_node is the only caller of free_area_init_core,
but free_area_init_node has more than one callers that didn't
mark __init/__meminit.

>
>It is always good to explain why the change you do is OK,
>for no other reasons than to show you really thought it through.

OK. Thanks.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Patch] mm: fix a section mismatch warning

2008-02-01 Thread WANG Cong
On Thu, Jan 31, 2008 at 07:38:53PM +0100, Sam Ravnborg wrote:
Hi WANG.

On Fri, Feb 01, 2008 at 01:25:17AM +0800, WANG Cong wrote:
 
 This patch fix this mismatch warning from mm:
 
 WARNING: vmlinux.o(.meminit.text+0x37f): Section mismatch in reference from 
 the function free_area_init_core() to the function .init.text:setup_usemap()
 modpost: Found 1 section mismatch(es).
 
 Cc: Sam Ravnborg [EMAIL PROTECTED]
 Signed-off-by: WANG Cong [EMAIL PROTECTED]
 
 ---
 
 diff --git a/mm/page_alloc.c b/mm/page_alloc.c
 index b2838c2..8a9ae3c 100644
 --- a/mm/page_alloc.c
 +++ b/mm/page_alloc.c
 @@ -3321,7 +3321,7 @@ static inline int pageblock_default_order(unsigned int 
 order)
   *   - mark all memory queues empty
   *   - clear the memory bitmaps
   */
 -static void __meminit free_area_init_core(struct pglist_data *pgdat,
 +static void __init free_area_init_core(struct pglist_data *pgdat,
  unsigned long *zones_size, unsigned long *zholes_size)
  {
  enum zone_type j;
 @@ -3445,7 +3445,7 @@ static void __init_refok alloc_node_mem_map(struct 
 pglist_data *pgdat)
  #endif /* CONFIG_FLAT_NODE_MEM_MAP */
  }
  
 -void __meminit free_area_init_node(int nid, struct pglist_data *pgdat,
 +void __init free_area_init_node(int nid, struct pglist_data *pgdat,
This change make me a bit unnerved. HAve you checked all callers?
I simple grep shows 46 hits in the tree.

I use cscope to do the check. ;)

free_area_init_node is the only caller of free_area_init_core,
but free_area_init_node has more than one callers that didn't
mark __init/__meminit.


It is always good to explain why the change you do is OK,
for no other reasons than to show you really thought it through.

OK. Thanks.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Patch] include/asm-generic/tlb.h: fix a missing header

2008-01-31 Thread WANG Cong
On Thu, Jan 31, 2008 at 02:08:31PM -0800, Christoph Lameter wrote:
>On Thu, 31 Jan 2008, WANG Cong wrote:
>
>> index 6ce9f3a..4ebbe15 100644
>> --- a/include/asm-generic/tlb.h
>> +++ b/include/asm-generic/tlb.h
>> @@ -16,6 +16,7 @@
>>  #include 
>>  #include 
>>  #include 
>> +#include 
>
>Please also remove the #include . It should have been 
>part of 
>a patch 
>reversal.

Please ignore this patch, since Ingo already had the same one.

Thanks!

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[Patch] mm: fix a section mismatch warning

2008-01-31 Thread WANG Cong

This patch fix this mismatch warning from mm:

WARNING: vmlinux.o(.meminit.text+0x37f): Section mismatch in reference from the 
function free_area_init_core() to the function .init.text:setup_usemap()
modpost: Found 1 section mismatch(es).

Cc: Sam Ravnborg <[EMAIL PROTECTED]>
Signed-off-by: WANG Cong <[EMAIL PROTECTED]>

---

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index b2838c2..8a9ae3c 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3321,7 +3321,7 @@ static inline int pageblock_default_order(unsigned int 
order)
  *   - mark all memory queues empty
  *   - clear the memory bitmaps
  */
-static void __meminit free_area_init_core(struct pglist_data *pgdat,
+static void __init free_area_init_core(struct pglist_data *pgdat,
unsigned long *zones_size, unsigned long *zholes_size)
 {
enum zone_type j;
@@ -3445,7 +3445,7 @@ static void __init_refok alloc_node_mem_map(struct 
pglist_data *pgdat)
 #endif /* CONFIG_FLAT_NODE_MEM_MAP */
 }
 
-void __meminit free_area_init_node(int nid, struct pglist_data *pgdat,
+void __init free_area_init_node(int nid, struct pglist_data *pgdat,
unsigned long *zones_size, unsigned long node_start_pfn,
unsigned long *zholes_size)
 {
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [git pull] x86 arch updates for v2.6.25

2008-01-31 Thread WANG Cong
On Thu, Jan 31, 2008 at 05:15:23PM +0100, Ingo Molnar wrote:
>
>* Adrian Bunk <[EMAIL PROTECTED]> wrote:
>
>> On Thu, Jan 31, 2008 at 05:00:33PM +0100, Ingo Molnar wrote:
>> > 
>> > * Adrian Bunk <[EMAIL PROTECTED]> wrote:
>> > 
>> > > You tested x86 but broke more than half a dozen other archtectures, 
>> > > with at least 3 different commits breaking other architectures.
>> > 
>> > Note that all known breakages are fixed in current -git, except for the 
>> > s390 problem that Martin/Nick posted the fix.
>> 
>> What about the breakages caused by commit 
>> a5a19c63f4e55e32dc0bc3d936d7f94793d8b380 (this commit broke the 
>> defconfig compilation on at least avr32, blackfin, sh, sparc and uml)?
>
>the patch below fixes that.
>

I just send the same patch[1] minutes ago. ;-)

1. http://lkml.org/lkml/2008/1/31/223

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[git Patch] UML: a build error fix

2008-01-31 Thread WANG Cong

This patch fixed this error:

arch/um/kernel/skas/syscall.c: In function 'handle_syscall':
arch/um/kernel/skas/syscall.c:33: error: 'NR_syscalls' undeclared (first use in 
this function)
arch/um/kernel/skas/syscall.c:33: error: (Each undeclared identifier is 
reported only once
arch/um/kernel/skas/syscall.c:33: error: for each function it appears in.)
make[2]: *** [arch/um/kernel/skas/syscall.o] Error 1
make[1]: *** [arch/um/kernel/skas] Error 2
make: *** [arch/um/kernel] Error 2


Cc: Jeff Dike <[EMAIL PROTECTED]>
Signed-off-by: WANG Cong <[EMAIL PROTECTED]>

---

diff --git a/arch/um/include/sysdep-i386/kernel-offsets.h 
b/arch/um/include/sysdep-i386/kernel-offsets.h
index 5868526..da820d2 100644
--- a/arch/um/include/sysdep-i386/kernel-offsets.h
+++ b/arch/um/include/sysdep-i386/kernel-offsets.h
@@ -15,7 +15,11 @@
 #define OFFSET(sym, str, mem) \
DEFINE(sym, offsetof(struct str, mem));
 
+static char syscalls[] = {
+#include 
+};
 void foo(void)
 {
 #include 
+DEFINE(UM_NR_syscall_max, sizeof(syscalls) - 1);
 }
diff --git a/arch/um/include/sysdep-i386/syscalls.h 
b/arch/um/include/sysdep-i386/syscalls.h
index 57bd79e..fb1fd94 100644
--- a/arch/um/include/sysdep-i386/syscalls.h
+++ b/arch/um/include/sysdep-i386/syscalls.h
@@ -5,6 +5,7 @@
 
 #include "asm/unistd.h"
 #include "sysdep/ptrace.h"
+#include "kern_constants.h"
 
 typedef long syscall_handler_t(struct pt_regs);
 
@@ -23,3 +24,6 @@ extern syscall_handler_t *sys_call_table[];
 extern long sys_mmap2(unsigned long addr, unsigned long len,
  unsigned long prot, unsigned long flags,
  unsigned long fd, unsigned long pgoff);
+
+#define NR_syscalls (UM_NR_syscall_max + 1)
+
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[Patch] arch/um/include/init.h: Fix missing macro definitions

2008-01-31 Thread WANG Cong

This patch fixed the following build error in current -git tree.

arch/um/kernel/config.c:10: error: expected declaration specifiers or '...' 
before '.' token
...


Cc: Jeff Dike <[EMAIL PROTECTED]>
Signed-off-by: WANG Cong <[EMAIL PROTECTED]>

---

diff --git a/arch/um/include/init.h b/arch/um/include/init.h
index cebc6ca..70982e1 100644
--- a/arch/um/include/init.h
+++ b/arch/um/include/init.h
@@ -40,6 +40,18 @@
 typedef int (*initcall_t)(void);
 typedef void (*exitcall_t)(void);
 
+#ifndef __section
+# define __section(S) __attribute__ ((__section__(#S)))
+#endif
+
+#ifndef __used
+#if __GNUC__ == 3 && __GNUC_MINOR__ == 2
+# define __used __attribute__((__unused__))
+#else
+# define __used __attribute__((__used__))
+#endif
+#endif
+
 /* These are for everybody (although not all archs will actually
discard it in modules) */
 #define __init __section(.init.text)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[Patch] include/asm-generic/tlb.h: fix a missing header

2008-01-31 Thread WANG Cong

This patch fixes this build error in current -git tree:

  CC  kernel/sched.o
In file included from include/asm/arch/tlb.h:10,
 from include/asm/tlb.h:5,
 from kernel/sched.c:71:
include/asm-generic/tlb.h: In function 'tlb_finish_mmu':
include/asm-generic/tlb.h:91: error: implicit declaration of function 
'check_pgt_cache'
make[1]: *** [kernel/sched.o] Error 1
make: *** [kernel] Error 2


Cc: Ingo Molnar <[EMAIL PROTECTED]>
Cc: Christoph Lameter <[EMAIL PROTECTED]>
Signed-off-by: WANG Cong <[EMAIL PROTECTED]>

---

diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h
index 6ce9f3a..4ebbe15 100644
--- a/include/asm-generic/tlb.h
+++ b/include/asm-generic/tlb.h
@@ -16,6 +16,7 @@
 #include 
 #include 
 #include 
+#include 
 
 /*
  * For UP we don't need to worry about TLB flush
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[Patch] include/asm-generic/tlb.h: fix a missing header

2008-01-31 Thread WANG Cong

This patch fixes this build error in current -git tree:

  CC  kernel/sched.o
In file included from include/asm/arch/tlb.h:10,
 from include/asm/tlb.h:5,
 from kernel/sched.c:71:
include/asm-generic/tlb.h: In function 'tlb_finish_mmu':
include/asm-generic/tlb.h:91: error: implicit declaration of function 
'check_pgt_cache'
make[1]: *** [kernel/sched.o] Error 1
make: *** [kernel] Error 2


Cc: Ingo Molnar [EMAIL PROTECTED]
Cc: Christoph Lameter [EMAIL PROTECTED]
Signed-off-by: WANG Cong [EMAIL PROTECTED]

---

diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h
index 6ce9f3a..4ebbe15 100644
--- a/include/asm-generic/tlb.h
+++ b/include/asm-generic/tlb.h
@@ -16,6 +16,7 @@
 #include linux/swap.h
 #include linux/quicklist.h
 #include asm/tlbflush.h
+#include asm/pgalloc.h
 
 /*
  * For UP we don't need to worry about TLB flush
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[Patch] arch/um/include/init.h: Fix missing macro definitions

2008-01-31 Thread WANG Cong

This patch fixed the following build error in current -git tree.

arch/um/kernel/config.c:10: error: expected declaration specifiers or '...' 
before '.' token
...


Cc: Jeff Dike [EMAIL PROTECTED]
Signed-off-by: WANG Cong [EMAIL PROTECTED]

---

diff --git a/arch/um/include/init.h b/arch/um/include/init.h
index cebc6ca..70982e1 100644
--- a/arch/um/include/init.h
+++ b/arch/um/include/init.h
@@ -40,6 +40,18 @@
 typedef int (*initcall_t)(void);
 typedef void (*exitcall_t)(void);
 
+#ifndef __section
+# define __section(S) __attribute__ ((__section__(#S)))
+#endif
+
+#ifndef __used
+#if __GNUC__ == 3  __GNUC_MINOR__ == 2
+# define __used __attribute__((__unused__))
+#else
+# define __used __attribute__((__used__))
+#endif
+#endif
+
 /* These are for everybody (although not all archs will actually
discard it in modules) */
 #define __init __section(.init.text)
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[git Patch] UML: a build error fix

2008-01-31 Thread WANG Cong

This patch fixed this error:

arch/um/kernel/skas/syscall.c: In function 'handle_syscall':
arch/um/kernel/skas/syscall.c:33: error: 'NR_syscalls' undeclared (first use in 
this function)
arch/um/kernel/skas/syscall.c:33: error: (Each undeclared identifier is 
reported only once
arch/um/kernel/skas/syscall.c:33: error: for each function it appears in.)
make[2]: *** [arch/um/kernel/skas/syscall.o] Error 1
make[1]: *** [arch/um/kernel/skas] Error 2
make: *** [arch/um/kernel] Error 2


Cc: Jeff Dike [EMAIL PROTECTED]
Signed-off-by: WANG Cong [EMAIL PROTECTED]

---

diff --git a/arch/um/include/sysdep-i386/kernel-offsets.h 
b/arch/um/include/sysdep-i386/kernel-offsets.h
index 5868526..da820d2 100644
--- a/arch/um/include/sysdep-i386/kernel-offsets.h
+++ b/arch/um/include/sysdep-i386/kernel-offsets.h
@@ -15,7 +15,11 @@
 #define OFFSET(sym, str, mem) \
DEFINE(sym, offsetof(struct str, mem));
 
+static char syscalls[] = {
+#include asm/arch/unistd.h
+};
 void foo(void)
 {
 #include common-offsets.h
+DEFINE(UM_NR_syscall_max, sizeof(syscalls) - 1);
 }
diff --git a/arch/um/include/sysdep-i386/syscalls.h 
b/arch/um/include/sysdep-i386/syscalls.h
index 57bd79e..fb1fd94 100644
--- a/arch/um/include/sysdep-i386/syscalls.h
+++ b/arch/um/include/sysdep-i386/syscalls.h
@@ -5,6 +5,7 @@
 
 #include asm/unistd.h
 #include sysdep/ptrace.h
+#include kern_constants.h
 
 typedef long syscall_handler_t(struct pt_regs);
 
@@ -23,3 +24,6 @@ extern syscall_handler_t *sys_call_table[];
 extern long sys_mmap2(unsigned long addr, unsigned long len,
  unsigned long prot, unsigned long flags,
  unsigned long fd, unsigned long pgoff);
+
+#define NR_syscalls (UM_NR_syscall_max + 1)
+
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [git pull] x86 arch updates for v2.6.25

2008-01-31 Thread WANG Cong
On Thu, Jan 31, 2008 at 05:15:23PM +0100, Ingo Molnar wrote:

* Adrian Bunk [EMAIL PROTECTED] wrote:

 On Thu, Jan 31, 2008 at 05:00:33PM +0100, Ingo Molnar wrote:
  
  * Adrian Bunk [EMAIL PROTECTED] wrote:
  
   You tested x86 but broke more than half a dozen other archtectures, 
   with at least 3 different commits breaking other architectures.
  
  Note that all known breakages are fixed in current -git, except for the 
  s390 problem that Martin/Nick posted the fix.
 
 What about the breakages caused by commit 
 a5a19c63f4e55e32dc0bc3d936d7f94793d8b380 (this commit broke the 
 defconfig compilation on at least avr32, blackfin, sh, sparc and uml)?

the patch below fixes that.


I just send the same patch[1] minutes ago. ;-)

1. http://lkml.org/lkml/2008/1/31/223

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[Patch] mm: fix a section mismatch warning

2008-01-31 Thread WANG Cong

This patch fix this mismatch warning from mm:

WARNING: vmlinux.o(.meminit.text+0x37f): Section mismatch in reference from the 
function free_area_init_core() to the function .init.text:setup_usemap()
modpost: Found 1 section mismatch(es).

Cc: Sam Ravnborg [EMAIL PROTECTED]
Signed-off-by: WANG Cong [EMAIL PROTECTED]

---

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index b2838c2..8a9ae3c 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3321,7 +3321,7 @@ static inline int pageblock_default_order(unsigned int 
order)
  *   - mark all memory queues empty
  *   - clear the memory bitmaps
  */
-static void __meminit free_area_init_core(struct pglist_data *pgdat,
+static void __init free_area_init_core(struct pglist_data *pgdat,
unsigned long *zones_size, unsigned long *zholes_size)
 {
enum zone_type j;
@@ -3445,7 +3445,7 @@ static void __init_refok alloc_node_mem_map(struct 
pglist_data *pgdat)
 #endif /* CONFIG_FLAT_NODE_MEM_MAP */
 }
 
-void __meminit free_area_init_node(int nid, struct pglist_data *pgdat,
+void __init free_area_init_node(int nid, struct pglist_data *pgdat,
unsigned long *zones_size, unsigned long node_start_pfn,
unsigned long *zholes_size)
 {
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Patch] include/asm-generic/tlb.h: fix a missing header

2008-01-31 Thread WANG Cong
On Thu, Jan 31, 2008 at 02:08:31PM -0800, Christoph Lameter wrote:
On Thu, 31 Jan 2008, WANG Cong wrote:

 index 6ce9f3a..4ebbe15 100644
 --- a/include/asm-generic/tlb.h
 +++ b/include/asm-generic/tlb.h
 @@ -16,6 +16,7 @@
  #include linux/swap.h
  #include linux/quicklist.h
  #include asm/tlbflush.h
 +#include asm/pgalloc.h

Please also remove the #include linux/quicklist.h. It should have been 
part of 
a patch 
reversal.

Please ignore this patch, since Ingo already had the same one.

Thanks!

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


(Try#3) [Patch] Shut up warnings from files under drivers/

2008-01-27 Thread WANG Cong
On Sun, Jan 27, 2008 at 10:21:00AM +0100, Sam Ravnborg wrote:
>Hi WANG.
>
>Thanks for chasing these annoying warnings - it is
>good to keep the warning level low so we keep
>attention when new warnings happens!
>
>> index d775eb6..eec1624 100644
>> --- a/drivers/video/aty/atyfb_base.c
>> +++ b/drivers/video/aty/atyfb_base.c
>> @@ -244,7 +244,9 @@ static int atyfb_sync(struct fb_info *info);
>>   */
>>  
>>  static int aty_init(struct fb_info *info);
>> +#if defined(CONFIG_PM) && defined(CONFIG_PCI)
>>  static void aty_resume_chip(struct fb_info *info);
>> +#endif
>
>It is preferable to have the forward declaration unconditional
>to keep the #if/#endif count low.
>
>
>>  #endif
>> @@ -2709,6 +2711,7 @@ aty_init_exit:
>>  return -1;
>>  }
>>  
>> +#if defined(CONFIG_PM) && defined(CONFIG_PCI)
>>  static void aty_resume_chip(struct fb_info *info)
>>  {
>>  struct atyfb_par *par = info->par;
>> @@ -2721,6 +2724,7 @@ static void aty_resume_chip(struct fb_info *info)
>>  if (par->aux_start)
>>  aty_st_le32(BUS_CNTL, aty_ld_le32(BUS_CNTL, par) | 
>> BUS_APER_REG_DIS, par);
>>  }
>> +#endif
>
>Moving the aty_resume_chip() function down just above
>atyfb_pci_resume() would put in in the same #if/#endif
>block and you can kill the forward declaration too.
>Did you try that out?

Yes, it works.

Here's the updated patch, and I dropped the drivers/char/applicom.c
part as Jiri Slaby has better fix.

--->

Fix defined-but-not-used warnings from files under drivers/,
such as:

drivers/video/aty/atyfb_base.c:2713: warning: ‘aty_resume_chip’ defined but not 
used

Compile tests passed.

Cc: Jeff Garzik <[EMAIL PROTECTED]>
Cc: Greg KH <[EMAIL PROTECTED]>
Cc: Sam Ravnborg <[EMAIL PROTECTED]>
Cc: Jiri Slaby <[EMAIL PROTECTED]>
Signed-off-by: WANG Cong <[EMAIL PROTECTED]>

---

diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c
index 905d1f5..ae1f565 100644
--- a/drivers/char/synclink.c
+++ b/drivers/char/synclink.c
@@ -897,7 +897,6 @@ static char *driver_version = "$Revision: 4.38 $";
 
 static int synclink_init_one (struct pci_dev *dev,
 const struct pci_device_id *ent);
-static void synclink_remove_one (struct pci_dev *dev);
 
 static struct pci_device_id synclink_pci_tbl[] = {
{ PCI_VENDOR_ID_MICROGATE, PCI_DEVICE_ID_MICROGATE_USC, PCI_ANY_ID, 
PCI_ANY_ID, },
@@ -908,6 +907,10 @@ MODULE_DEVICE_TABLE(pci, synclink_pci_tbl);
 
 MODULE_LICENSE("GPL");
 
+static void __devexit synclink_remove_one (struct pci_dev *dev)
+{
+}
+
 static struct pci_driver synclink_pci_driver = {
.name   = "synclink",
.id_table   = synclink_pci_tbl,
@@ -8166,7 +8169,3 @@ static int __devinit synclink_init_one (struct pci_dev 
*dev,
return 0;
 }
 
-static void __devexit synclink_remove_one (struct pci_dev *dev)
-{
-}
-
diff --git a/drivers/crypto/hifn_795x.c b/drivers/crypto/hifn_795x.c
index dfbf24c..f33f82a 100644
--- a/drivers/crypto/hifn_795x.c
+++ b/drivers/crypto/hifn_795x.c
@@ -2730,7 +2730,7 @@ err_out_disable_pci_device:
return err;
 }
 
-static void hifn_remove(struct pci_dev *pdev)
+static void __devexit hifn_remove(struct pci_dev *pdev)
 {
int i;
struct hifn_device *dev;
diff --git a/drivers/telephony/ixj.c b/drivers/telephony/ixj.c
index 49cd979..1549c0b 100644
--- a/drivers/telephony/ixj.c
+++ b/drivers/telephony/ixj.c
@@ -284,7 +284,7 @@ static int samplerate = 100;
 
 module_param(ixjdebug, int, 0);
 
-static struct pci_device_id ixj_pci_tbl[] __devinitdata = {
+static struct pci_device_id ixj_pci_tbl[] __used __devinitdata = {
{ PCI_VENDOR_ID_QUICKNET, PCI_DEVICE_ID_QUICKNET_XJ,
  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
{ }
diff --git a/drivers/video/aty/aty128fb.c b/drivers/video/aty/aty128fb.c
index cbd3308..4e57fcf 100644
--- a/drivers/video/aty/aty128fb.c
+++ b/drivers/video/aty/aty128fb.c
@@ -165,7 +165,7 @@ static const char *r128_family[] __devinitdata = {
  */
 static int aty128_probe(struct pci_dev *pdev,
const struct pci_device_id *ent);
-static void aty128_remove(struct pci_dev *pdev);
+static void __devexit aty128_remove(struct pci_dev *pdev);
 static int aty128_pci_suspend(struct pci_dev *pdev, pm_message_t state);
 static int aty128_pci_resume(struct pci_dev *pdev);
 static int aty128_do_resume(struct pci_dev *pdev);
diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c
index d775eb6..3829f3e 100644
--- a/drivers/video/aty/atyfb_base.c
+++ b/drivers/video/aty/atyfb_base.c
@@ -244,7 +244,6 @@ static int atyfb_sync(struct fb_info *info);
  */
 
 static int aty_init(struct fb_info *info);
-static void aty_resume_chip(stru

Re: (Updated) [Patch] Shut up warnings from files under drivers/

2008-01-27 Thread WANG Cong
On Sun, Jan 27, 2008 at 10:21:12AM +0100, Jiri Slaby wrote:
>On 01/27/2008 10:08 AM, Jiri Slaby wrote:
>>On 01/27/2008 05:15 AM, WANG Cong wrote:
>>>Fix defined-but-not-used warnings from files under drivers/,
>>>such as:
>>>
>>>drivers/char/applicom.c:68: warning: ‘applicom_pci_tbl’ defined but 
>>>not used
>>>
>>>Compile tests passed.
>>>
>>>Cc: Jeff Garzik <[EMAIL PROTECTED]>
>>>Cc: Greg KH <[EMAIL PROTECTED]>
>>>Cc: Sam Ravnborg <[EMAIL PROTECTED]>
>>>Signed-off-by: WANG Cong <[EMAIL PROTECTED]>
>>>
>>>---
>>>
>>>diff --git a/drivers/char/applicom.c b/drivers/char/applicom.c
>>>index 1f0b752..97171ad 100644
>>>--- a/drivers/char/applicom.c
>>>+++ b/drivers/char/applicom.c
>>>@@ -65,7 +65,7 @@ static char *applicom_pci_devnames[] = {
>>> "PCI2000PFB"
>>> };
>>> 
>>>-static struct pci_device_id applicom_pci_tbl[] = {
>>>+static struct pci_device_id applicom_pci_tbl[] __used = {
>>> { PCI_VENDOR_ID_APPLICOM, PCI_DEVICE_ID_APPLICOM_PCIGENERIC,
>>>   PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
>>> { PCI_VENDOR_ID_APPLICOM, PCI_DEVICE_ID_APPLICOM_PCI2000IBS_CAN,
>>
>>I have probably a better fix with pci_match_id() referencing this array.
>
>Hmm, checking it one more time persuades me that the best fix ever is to 
>convert it to probing. David, do you have the card?

OK. I will drop this part.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Patch] drivers/base/core.c: fix a compile error

2008-01-27 Thread WANG Cong

>
>No, that will fix the build error, but die when linking :(
>
>I'll work on a real fix for this now...
>

Sorry.

I just compiled it since the building process was stopped
by another error.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Patch] drivers/base/core.c: fix a compile error

2008-01-27 Thread WANG Cong


No, that will fix the build error, but die when linking :(

I'll work on a real fix for this now...


Sorry.

I just compiled it since the building process was stopped
by another error.


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: (Updated) [Patch] Shut up warnings from files under drivers/

2008-01-27 Thread WANG Cong
On Sun, Jan 27, 2008 at 10:21:12AM +0100, Jiri Slaby wrote:
On 01/27/2008 10:08 AM, Jiri Slaby wrote:
On 01/27/2008 05:15 AM, WANG Cong wrote:
Fix defined-but-not-used warnings from files under drivers/,
such as:

drivers/char/applicom.c:68: warning: ‘applicom_pci_tbl’ defined but 
not used

Compile tests passed.

Cc: Jeff Garzik [EMAIL PROTECTED]
Cc: Greg KH [EMAIL PROTECTED]
Cc: Sam Ravnborg [EMAIL PROTECTED]
Signed-off-by: WANG Cong [EMAIL PROTECTED]

---

diff --git a/drivers/char/applicom.c b/drivers/char/applicom.c
index 1f0b752..97171ad 100644
--- a/drivers/char/applicom.c
+++ b/drivers/char/applicom.c
@@ -65,7 +65,7 @@ static char *applicom_pci_devnames[] = {
 PCI2000PFB
 };
 
-static struct pci_device_id applicom_pci_tbl[] = {
+static struct pci_device_id applicom_pci_tbl[] __used = {
 { PCI_VENDOR_ID_APPLICOM, PCI_DEVICE_ID_APPLICOM_PCIGENERIC,
   PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
 { PCI_VENDOR_ID_APPLICOM, PCI_DEVICE_ID_APPLICOM_PCI2000IBS_CAN,

I have probably a better fix with pci_match_id() referencing this array.

Hmm, checking it one more time persuades me that the best fix ever is to 
convert it to probing. David, do you have the card?

OK. I will drop this part.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


(Try#3) [Patch] Shut up warnings from files under drivers/

2008-01-27 Thread WANG Cong
On Sun, Jan 27, 2008 at 10:21:00AM +0100, Sam Ravnborg wrote:
Hi WANG.

Thanks for chasing these annoying warnings - it is
good to keep the warning level low so we keep
attention when new warnings happens!

 index d775eb6..eec1624 100644
 --- a/drivers/video/aty/atyfb_base.c
 +++ b/drivers/video/aty/atyfb_base.c
 @@ -244,7 +244,9 @@ static int atyfb_sync(struct fb_info *info);
   */
  
  static int aty_init(struct fb_info *info);
 +#if defined(CONFIG_PM)  defined(CONFIG_PCI)
  static void aty_resume_chip(struct fb_info *info);
 +#endif

It is preferable to have the forward declaration unconditional
to keep the #if/#endif count low.


  #endif
 @@ -2709,6 +2711,7 @@ aty_init_exit:
  return -1;
  }
  
 +#if defined(CONFIG_PM)  defined(CONFIG_PCI)
  static void aty_resume_chip(struct fb_info *info)
  {
  struct atyfb_par *par = info-par;
 @@ -2721,6 +2724,7 @@ static void aty_resume_chip(struct fb_info *info)
  if (par-aux_start)
  aty_st_le32(BUS_CNTL, aty_ld_le32(BUS_CNTL, par) | 
 BUS_APER_REG_DIS, par);
  }
 +#endif

Moving the aty_resume_chip() function down just above
atyfb_pci_resume() would put in in the same #if/#endif
block and you can kill the forward declaration too.
Did you try that out?

Yes, it works.

Here's the updated patch, and I dropped the drivers/char/applicom.c
part as Jiri Slaby has better fix.

---

Fix defined-but-not-used warnings from files under drivers/,
such as:

drivers/video/aty/atyfb_base.c:2713: warning: ‘aty_resume_chip’ defined but not 
used

Compile tests passed.

Cc: Jeff Garzik [EMAIL PROTECTED]
Cc: Greg KH [EMAIL PROTECTED]
Cc: Sam Ravnborg [EMAIL PROTECTED]
Cc: Jiri Slaby [EMAIL PROTECTED]
Signed-off-by: WANG Cong [EMAIL PROTECTED]

---

diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c
index 905d1f5..ae1f565 100644
--- a/drivers/char/synclink.c
+++ b/drivers/char/synclink.c
@@ -897,7 +897,6 @@ static char *driver_version = $Revision: 4.38 $;
 
 static int synclink_init_one (struct pci_dev *dev,
 const struct pci_device_id *ent);
-static void synclink_remove_one (struct pci_dev *dev);
 
 static struct pci_device_id synclink_pci_tbl[] = {
{ PCI_VENDOR_ID_MICROGATE, PCI_DEVICE_ID_MICROGATE_USC, PCI_ANY_ID, 
PCI_ANY_ID, },
@@ -908,6 +907,10 @@ MODULE_DEVICE_TABLE(pci, synclink_pci_tbl);
 
 MODULE_LICENSE(GPL);
 
+static void __devexit synclink_remove_one (struct pci_dev *dev)
+{
+}
+
 static struct pci_driver synclink_pci_driver = {
.name   = synclink,
.id_table   = synclink_pci_tbl,
@@ -8166,7 +8169,3 @@ static int __devinit synclink_init_one (struct pci_dev 
*dev,
return 0;
 }
 
-static void __devexit synclink_remove_one (struct pci_dev *dev)
-{
-}
-
diff --git a/drivers/crypto/hifn_795x.c b/drivers/crypto/hifn_795x.c
index dfbf24c..f33f82a 100644
--- a/drivers/crypto/hifn_795x.c
+++ b/drivers/crypto/hifn_795x.c
@@ -2730,7 +2730,7 @@ err_out_disable_pci_device:
return err;
 }
 
-static void hifn_remove(struct pci_dev *pdev)
+static void __devexit hifn_remove(struct pci_dev *pdev)
 {
int i;
struct hifn_device *dev;
diff --git a/drivers/telephony/ixj.c b/drivers/telephony/ixj.c
index 49cd979..1549c0b 100644
--- a/drivers/telephony/ixj.c
+++ b/drivers/telephony/ixj.c
@@ -284,7 +284,7 @@ static int samplerate = 100;
 
 module_param(ixjdebug, int, 0);
 
-static struct pci_device_id ixj_pci_tbl[] __devinitdata = {
+static struct pci_device_id ixj_pci_tbl[] __used __devinitdata = {
{ PCI_VENDOR_ID_QUICKNET, PCI_DEVICE_ID_QUICKNET_XJ,
  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
{ }
diff --git a/drivers/video/aty/aty128fb.c b/drivers/video/aty/aty128fb.c
index cbd3308..4e57fcf 100644
--- a/drivers/video/aty/aty128fb.c
+++ b/drivers/video/aty/aty128fb.c
@@ -165,7 +165,7 @@ static const char *r128_family[] __devinitdata = {
  */
 static int aty128_probe(struct pci_dev *pdev,
const struct pci_device_id *ent);
-static void aty128_remove(struct pci_dev *pdev);
+static void __devexit aty128_remove(struct pci_dev *pdev);
 static int aty128_pci_suspend(struct pci_dev *pdev, pm_message_t state);
 static int aty128_pci_resume(struct pci_dev *pdev);
 static int aty128_do_resume(struct pci_dev *pdev);
diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c
index d775eb6..3829f3e 100644
--- a/drivers/video/aty/atyfb_base.c
+++ b/drivers/video/aty/atyfb_base.c
@@ -244,7 +244,6 @@ static int atyfb_sync(struct fb_info *info);
  */
 
 static int aty_init(struct fb_info *info);
-static void aty_resume_chip(struct fb_info *info);
 #ifdef CONFIG_ATARI
 static int store_video_par(char *videopar, unsigned char m64_num);
 #endif
@@ -2076,6 +2075,20 @@ static int atyfb_pci_suspend(struct pci_dev *pdev, 
pm_message_t state)
return 0;
 }
 
+static void aty_resume_chip(struct fb_info *info)
+{
+   struct atyfb_par *par = info-par;
+
+   aty_st_le32(MEM_CNTL, par

(Updated) [Patch] Shut up warnings from files under drivers/

2008-01-26 Thread WANG Cong

>Investigating a bit more I realized that gcc looses the
>__used__ attribution due to the prototype.
>So there are two correct fixes:
>a) move the function up so we do not need the forward
>   declaration
>b) add a __devexit to the forward decalration too.
>
>I strongly prefer the first version and this is the
>correct fix for these cases.
>
>Do we have a gcc bug here - I did not see a definitive answer in gcc docs?
>

Here is the updated version.

>

Fix defined-but-not-used warnings from files under drivers/,
such as:

drivers/char/applicom.c:68: warning: ‘applicom_pci_tbl’ defined but not used

Compile tests passed.

Cc: Jeff Garzik <[EMAIL PROTECTED]>
Cc: Greg KH <[EMAIL PROTECTED]>
Cc: Sam Ravnborg <[EMAIL PROTECTED]>
Signed-off-by: WANG Cong <[EMAIL PROTECTED]>

---

diff --git a/drivers/char/applicom.c b/drivers/char/applicom.c
index 1f0b752..97171ad 100644
--- a/drivers/char/applicom.c
+++ b/drivers/char/applicom.c
@@ -65,7 +65,7 @@ static char *applicom_pci_devnames[] = {
"PCI2000PFB"
 };
 
-static struct pci_device_id applicom_pci_tbl[] = {
+static struct pci_device_id applicom_pci_tbl[] __used = {
{ PCI_VENDOR_ID_APPLICOM, PCI_DEVICE_ID_APPLICOM_PCIGENERIC,
  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
{ PCI_VENDOR_ID_APPLICOM, PCI_DEVICE_ID_APPLICOM_PCI2000IBS_CAN,
diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c
index 905d1f5..ae1f565 100644
--- a/drivers/char/synclink.c
+++ b/drivers/char/synclink.c
@@ -897,7 +897,6 @@ static char *driver_version = "$Revision: 4.38 $";
 
 static int synclink_init_one (struct pci_dev *dev,
 const struct pci_device_id *ent);
-static void synclink_remove_one (struct pci_dev *dev);
 
 static struct pci_device_id synclink_pci_tbl[] = {
{ PCI_VENDOR_ID_MICROGATE, PCI_DEVICE_ID_MICROGATE_USC, PCI_ANY_ID, 
PCI_ANY_ID, },
@@ -908,6 +907,10 @@ MODULE_DEVICE_TABLE(pci, synclink_pci_tbl);
 
 MODULE_LICENSE("GPL");
 
+static void __devexit synclink_remove_one (struct pci_dev *dev)
+{
+}
+
 static struct pci_driver synclink_pci_driver = {
.name   = "synclink",
.id_table   = synclink_pci_tbl,
@@ -8166,7 +8169,3 @@ static int __devinit synclink_init_one (struct pci_dev 
*dev,
return 0;
 }
 
-static void __devexit synclink_remove_one (struct pci_dev *dev)
-{
-}
-
diff --git a/drivers/crypto/hifn_795x.c b/drivers/crypto/hifn_795x.c
index dfbf24c..f33f82a 100644
--- a/drivers/crypto/hifn_795x.c
+++ b/drivers/crypto/hifn_795x.c
@@ -2730,7 +2730,7 @@ err_out_disable_pci_device:
return err;
 }
 
-static void hifn_remove(struct pci_dev *pdev)
+static void __devexit hifn_remove(struct pci_dev *pdev)
 {
int i;
struct hifn_device *dev;
diff --git a/drivers/telephony/ixj.c b/drivers/telephony/ixj.c
index 49cd979..1549c0b 100644
--- a/drivers/telephony/ixj.c
+++ b/drivers/telephony/ixj.c
@@ -284,7 +284,7 @@ static int samplerate = 100;
 
 module_param(ixjdebug, int, 0);
 
-static struct pci_device_id ixj_pci_tbl[] __devinitdata = {
+static struct pci_device_id ixj_pci_tbl[] __used __devinitdata = {
{ PCI_VENDOR_ID_QUICKNET, PCI_DEVICE_ID_QUICKNET_XJ,
  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
{ }
diff --git a/drivers/video/aty/aty128fb.c b/drivers/video/aty/aty128fb.c
index cbd3308..4e57fcf 100644
--- a/drivers/video/aty/aty128fb.c
+++ b/drivers/video/aty/aty128fb.c
@@ -165,7 +165,7 @@ static const char *r128_family[] __devinitdata = {
  */
 static int aty128_probe(struct pci_dev *pdev,
const struct pci_device_id *ent);
-static void aty128_remove(struct pci_dev *pdev);
+static void __devexit aty128_remove(struct pci_dev *pdev);
 static int aty128_pci_suspend(struct pci_dev *pdev, pm_message_t state);
 static int aty128_pci_resume(struct pci_dev *pdev);
 static int aty128_do_resume(struct pci_dev *pdev);
diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c
index d775eb6..eec1624 100644
--- a/drivers/video/aty/atyfb_base.c
+++ b/drivers/video/aty/atyfb_base.c
@@ -244,7 +244,9 @@ static int atyfb_sync(struct fb_info *info);
  */
 
 static int aty_init(struct fb_info *info);
+#if defined(CONFIG_PM) && defined(CONFIG_PCI)
 static void aty_resume_chip(struct fb_info *info);
+#endif
 #ifdef CONFIG_ATARI
 static int store_video_par(char *videopar, unsigned char m64_num);
 #endif
@@ -2709,6 +2711,7 @@ aty_init_exit:
return -1;
 }
 
+#if defined(CONFIG_PM) && defined(CONFIG_PCI)
 static void aty_resume_chip(struct fb_info *info)
 {
struct atyfb_par *par = info->par;
@@ -2721,6 +2724,7 @@ static void aty_resume_chip(struct fb_info *info)
if (par->aux_start)
aty_st_le32(BUS_CNTL, aty_ld_le32(BUS_CNTL, par) | 
BUS_APER_REG_DIS, par);
 }
+#endif
 
 #ifdef CONFIG_ATARI
 static int __devinit store_video_par(char *v

Re: [Patch] Shut up warnings from files under drivers/

2008-01-26 Thread WANG Cong
On Sat, Jan 26, 2008 at 08:17:17PM +0100, Sam Ravnborg wrote:
>On Sat, Jan 26, 2008 at 04:55:58AM -0500, Jeff Garzik wrote:
>> WANG Cong wrote:
>> >diff --git a/drivers/video/kyro/fbdev.c b/drivers/video/kyro/fbdev.c
>> >index acb9370..437ebd0 100644
>> >--- a/drivers/video/kyro/fbdev.c
>> >+++ b/drivers/video/kyro/fbdev.c
>> >@@ -90,7 +90,9 @@ static int nomtrr __devinitdata = 0;
>> > 
>> > /* PCI driver prototypes */
>> > static int kyrofb_probe(struct pci_dev *pdev, const struct pci_device_id 
>> > *ent);
>> >+#if defined(MODULE) || defined(CONFIG_HOTPLUG)
>> > static void kyrofb_remove(struct pci_dev *pdev);
>> >+#endif
>> > 
>> > static struct fb_videomode kyro_modedb[] __devinitdata = {
>> >{
>> >@@ -754,6 +756,7 @@ out_unmap:
>> >return -EINVAL;
>> > }
>> > 
>> >+#if defined(MODULE) || defined(CONFIG_HOTPLUG)
>> > static void __devexit kyrofb_remove(struct pci_dev *pdev)
>> > {
>> >struct fb_info *info = pci_get_drvdata(pdev);
>> >@@ -783,6 +786,7 @@ static void __devexit kyrofb_remove(struct pci_dev 
>> >*pdev)
>> >pci_set_drvdata(pdev, NULL);
>> >framebuffer_release(info);
>> > }
>> >+#endif
>> 
>> 
>> Quite strange -- due to __devexit_p() and the __devexit marker, ifdefs 
>> should not be needed.
>> 
>> I would look into why that isn't working as designed in these cases...
>
>I checked up on the synclink.c warning.
>We have the following code:
>
>static void synclink_remove_one (struct pci_dev *dev);
>
>...
>
>static struct pci_driver synclink_pci_driver = {
>.remove = __devexit_p(synclink_remove_one),
>};
>
>...
>
>static void __devexit synclink_remove_one (struct pci_dev *dev)
>{
>}
>
>And I double checked the preprocessed source to check
>that we applied the __attribute__((__used__)) to the function.

Yes. The only macro we used on synclink_remove_one is __devexit.
It's defination is:

#ifdef CONFIG_HOTPLUG
#define __devexit
#else
#define __devexit __exit
#endif

And __exit is:
#ifdef MODULE
#define __exit  __attribute__ ((__section__(".exit.text"))) __cold
#else
#define __exit  __attribute_used__ __attribute__ 
((__section__(".exit.text"))) __cold
#endif

So only when !defined(MODULE) && !defined(CONFIG_HOTPLUG),
__attribute_used__ is applied. And this case is just that
condition, thus this should be a bogus of gcc.


>
>Investigating a bit more I realized that gcc looses the
>__used__ attribution due to the prototype.
>So there are two correct fixes:
>a) move the function up so we do not need the forward
>   declaration
>b) add a __devexit to the forward decalration too.
>
>I strongly prefer the first version and this is the
>correct fix for these cases.
>
>Do we have a gcc bug here - I did not see a definitive answer in gcc docs?
>

Agreed. I will try a).


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: The latest linus tree can't build

2008-01-26 Thread WANG Cong
On Sat, Jan 26, 2008 at 12:45:14PM +0200, Adrian Bunk wrote:
>On Sat, Jan 26, 2008 at 06:38:45PM +0800, WANG Cong wrote:
>> 
>> Hi, Sam!
>> 
>> When I built the latest linus tree, I got this error:
>> 
>> ...
>>   CC  sound/oss/msnd.o
>> make[2]: *** No rule to make target `/etc/sound/msndperm.bin', needed by 
>> `sound/oss/msndperm.c'.  Stop.
>> make[1]: *** [sound/oss] Error 2
>> make: *** [sound] Error 2
>> 
>> My .config is just the one I sent to you in another thread.
>>...
>
>It's expected that CONFIG_STANDALONE=n allows configurations that won't 
>compile.

Oh, thank you!

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


The latest linus tree can't build

2008-01-26 Thread WANG Cong

Hi, Sam!

When I built the latest linus tree, I got this error:

...
  CC  sound/oss/msnd.o
make[2]: *** No rule to make target `/etc/sound/msndperm.bin', needed by 
`sound/oss/msndperm.c'.  Stop.
make[1]: *** [sound/oss] Error 2
make: *** [sound] Error 2

My .config is just the one I sent to you in another thread.
Need me to resend it?

Regards.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Patch] Shut up warnings from files under drivers/

2008-01-26 Thread WANG Cong

>
>Looking a bit closer the above is rubbish.
>We have:
>#if defined(MODULE) || defined(CONFIG_HOTPLUG)
>#define __devexit_p(x) x
>#else
>#define __devexit_p(x) NULL
>
>so the pointer to the function is used in
>both cases.

I think in the latter case, 'x' is not used, just
as gcc told me. ;)

>
>Could you drop me the config that produces the warning
>and the warning message.
>

Of course. Attached.

Regards.

#
# Automatically generated make config: don't edit
# Linux kernel version: 2.6.24
# Sat Jan 26 10:19:31 2008
#
# CONFIG_64BIT is not set
CONFIG_X86_32=y
# CONFIG_X86_64 is not set
CONFIG_X86=y
CONFIG_GENERIC_TIME=y
CONFIG_GENERIC_CMOS_UPDATE=y
CONFIG_CLOCKSOURCE_WATCHDOG=y
CONFIG_GENERIC_CLOCKEVENTS=y
CONFIG_LOCKDEP_SUPPORT=y
CONFIG_STACKTRACE_SUPPORT=y
CONFIG_SEMAPHORE_SLEEPERS=y
CONFIG_MMU=y
CONFIG_ZONE_DMA=y
CONFIG_QUICKLIST=y
CONFIG_GENERIC_ISA_DMA=y
CONFIG_GENERIC_IOMAP=y
CONFIG_GENERIC_HWEIGHT=y
CONFIG_ARCH_MAY_HAVE_PC_FDC=y
CONFIG_DMI=y
# CONFIG_RWSEM_GENERIC_SPINLOCK is not set
CONFIG_RWSEM_XCHGADD_ALGORITHM=y
# CONFIG_ARCH_HAS_ILOG2_U32 is not set
# CONFIG_ARCH_HAS_ILOG2_U64 is not set
CONFIG_GENERIC_CALIBRATE_DELAY=y
# CONFIG_GENERIC_TIME_VSYSCALL is not set
CONFIG_ARCH_SUPPORTS_OPROFILE=y
# CONFIG_ZONE_DMA32 is not set
CONFIG_ARCH_POPULATES_NODE_MAP=y
# CONFIG_AUDIT_ARCH is not set
CONFIG_GENERIC_HARDIRQS=y
CONFIG_GENERIC_IRQ_PROBE=y
CONFIG_X86_BIOS_REBOOT=y
CONFIG_KTIME_SCALAR=y
CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"

#
# General setup
#
CONFIG_EXPERIMENTAL=y
CONFIG_BROKEN_ON_SMP=y
CONFIG_INIT_ENV_ARG_LIMIT=32
CONFIG_LOCALVERSION=""
CONFIG_LOCALVERSION_AUTO=y
# CONFIG_SYSVIPC is not set
CONFIG_BSD_PROCESS_ACCT=y
# CONFIG_BSD_PROCESS_ACCT_V3 is not set
CONFIG_USER_NS=y
# CONFIG_PID_NS is not set
CONFIG_IKCONFIG=y
CONFIG_IKCONFIG_PROC=y
CONFIG_LOG_BUF_SHIFT=14
CONFIG_CGROUPS=y
# CONFIG_CGROUP_DEBUG is not set
CONFIG_CGROUP_NS=y
CONFIG_FAIR_GROUP_SCHED=y
CONFIG_FAIR_USER_SCHED=y
# CONFIG_FAIR_CGROUP_SCHED is not set
CONFIG_CGROUP_CPUACCT=y
# CONFIG_SYSFS_DEPRECATED is not set
CONFIG_RELAY=y
CONFIG_BLK_DEV_INITRD=y
CONFIG_INITRAMFS_SOURCE=""
CONFIG_CC_OPTIMIZE_FOR_SIZE=y
CONFIG_EMBEDDED=y
CONFIG_UID16=y
# CONFIG_SYSCTL_SYSCALL is not set
CONFIG_KALLSYMS=y
CONFIG_KALLSYMS_ALL=y
CONFIG_KALLSYMS_EXTRA_PASS=y
# CONFIG_HOTPLUG is not set
CONFIG_PRINTK=y
# CONFIG_BUG is not set
# CONFIG_ELF_CORE is not set
CONFIG_BASE_FULL=y
# CONFIG_FUTEX is not set
CONFIG_ANON_INODES=y
# CONFIG_EPOLL is not set
CONFIG_SIGNALFD=y
# CONFIG_EVENTFD is not set
# CONFIG_SHMEM is not set
CONFIG_VM_EVENT_COUNTERS=y
CONFIG_SLAB=y
# CONFIG_SLUB is not set
# CONFIG_SLOB is not set
CONFIG_SLABINFO=y
CONFIG_TINY_SHMEM=y
CONFIG_BASE_SMALL=0
# CONFIG_MODULES is not set
# CONFIG_BLOCK is not set
CONFIG_PREEMPT_NOTIFIERS=y
CONFIG_CLASSIC_RCU=y
# CONFIG_PREEMPT_RCU is not set

#
# Processor type and features
#
# CONFIG_TICK_ONESHOT is not set
# CONFIG_NO_HZ is not set
# CONFIG_HIGH_RES_TIMERS is not set
CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
# CONFIG_SMP is not set
CONFIG_X86_PC=y
# CONFIG_X86_ELAN is not set
# CONFIG_X86_VOYAGER is not set
# CONFIG_X86_NUMAQ is not set
# CONFIG_X86_SUMMIT is not set
# CONFIG_X86_BIGSMP is not set
# CONFIG_X86_VISWS is not set
# CONFIG_X86_GENERICARCH is not set
# CONFIG_X86_ES7000 is not set
# CONFIG_X86_VSMP is not set
CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
# CONFIG_PARAVIRT_GUEST is not set
# CONFIG_M386 is not set
# CONFIG_M486 is not set
# CONFIG_M586 is not set
# CONFIG_M586TSC is not set
# CONFIG_M586MMX is not set
# CONFIG_M686 is not set
# CONFIG_MPENTIUMII is not set
# CONFIG_MPENTIUMIII is not set
# CONFIG_MPENTIUMM is not set
# CONFIG_MPENTIUM4 is not set
# CONFIG_MK6 is not set
# CONFIG_MK7 is not set
CONFIG_MK8=y
# CONFIG_MCRUSOE is not set
# CONFIG_MEFFICEON is not set
# CONFIG_MWINCHIPC6 is not set
# CONFIG_MWINCHIP2 is not set
# CONFIG_MWINCHIP3D is not set
# CONFIG_MGEODEGX1 is not set
# CONFIG_MGEODE_LX is not set
# CONFIG_MCYRIXIII is not set
# CONFIG_MVIAC3_2 is not set
# CONFIG_MVIAC7 is not set
# CONFIG_MPSC is not set
# CONFIG_MCORE2 is not set
# CONFIG_GENERIC_CPU is not set
# CONFIG_X86_GENERIC is not set
CONFIG_X86_CMPXCHG=y
CONFIG_X86_L1_CACHE_SHIFT=6
CONFIG_X86_XADD=y
CONFIG_X86_WP_WORKS_OK=y
CONFIG_X86_INVLPG=y
CONFIG_X86_BSWAP=y
CONFIG_X86_POPAD_OK=y
CONFIG_X86_GOOD_APIC=y
CONFIG_X86_INTEL_USERCOPY=y
CONFIG_X86_USE_PPRO_CHECKSUM=y
CONFIG_X86_TSC=y
CONFIG_X86_MINIMUM_CPU_FAMILY=4
CONFIG_HPET_TIMER=y
CONFIG_PREEMPT_NONE=y
# CONFIG_PREEMPT_VOLUNTARY is not set
# CONFIG_PREEMPT is not set
CONFIG_RCU_TRACE=y
# CONFIG_X86_UP_APIC is not set
# CONFIG_X86_MCE is not set
CONFIG_VM86=y
# CONFIG_TOSHIBA is not set
# CONFIG_I8K is not set
# CONFIG_X86_REBOOTFIXUPS is not set
# CONFIG_MICROCODE is not set
# CONFIG_X86_MSR is not set
# CONFIG_X86_CPUID is not set
# CONFIG_NOHIGHMEM is not set
CONFIG_HIGHMEM4G=y
# CONFIG_HIGHMEM64G is not set
CONFIG_VMSPLIT_3G=y
# CONFIG_VMSPLIT_3G_OPT is not set
# CONFIG_VMSPLIT_2G is not set
# CONFIG_VMSPLIT_2G_OPT is not 

Re: [Patch] Shut up warnings from files under drivers/

2008-01-26 Thread WANG Cong
On Sat, Jan 26, 2008 at 04:55:58AM -0500, Jeff Garzik wrote:
>WANG Cong wrote:
>>diff --git a/drivers/video/kyro/fbdev.c b/drivers/video/kyro/fbdev.c
>>index acb9370..437ebd0 100644
>>--- a/drivers/video/kyro/fbdev.c
>>+++ b/drivers/video/kyro/fbdev.c
>>@@ -90,7 +90,9 @@ static int nomtrr __devinitdata = 0;
>> 
>> /* PCI driver prototypes */
>> static int kyrofb_probe(struct pci_dev *pdev, const struct pci_device_id 
>> *ent);
>>+#if defined(MODULE) || defined(CONFIG_HOTPLUG)
>> static void kyrofb_remove(struct pci_dev *pdev);
>>+#endif
>> 
>> static struct fb_videomode kyro_modedb[] __devinitdata = {
>>  {
>>@@ -754,6 +756,7 @@ out_unmap:
>>  return -EINVAL;
>> }
>> 
>>+#if defined(MODULE) || defined(CONFIG_HOTPLUG)
>> static void __devexit kyrofb_remove(struct pci_dev *pdev)
>> {
>>  struct fb_info *info = pci_get_drvdata(pdev);
>>@@ -783,6 +786,7 @@ static void __devexit kyrofb_remove(struct pci_dev 
>>*pdev)
>>  pci_set_drvdata(pdev, NULL);
>>  framebuffer_release(info);
>> }
>>+#endif
>
>
>Quite strange -- due to __devexit_p() and the __devexit marker, ifdefs 
>should not be needed.
>
>I would look into why that isn't working as designed in these cases...
>

For example, the defination of __devexit_p:

#if defined(MODULE) || defined(CONFIG_HOTPLUG)
#define __devexit_p(x) x
#else
#define __devexit_p(x) NULL
#endif

If !(defined(MODULE) || defined(CONFIG_HOTPLUG)), __devexit_p
is just a NULL pointer, thus 'x' may be unused although defined.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Patch] Shut up warnings from files under drivers/

2008-01-26 Thread WANG Cong
On Sat, Jan 26, 2008 at 10:57:23AM +0100, Sam Ravnborg wrote:
>Hi WANG.
>On Sat, Jan 26, 2008 at 05:30:07PM +0800, WANG Cong wrote:
>> 
>> Fix two kind of defined-but-not-used warnings.
>> 
>> One is due to defination of MODULE_DEVICE_TABLE, the
>> other is due to __devexit_p. The solution is just to
>> add proper directives to protect those usages.
>
>Please include the actual warnings that you fix.
>

Sure.

Such as this one:

drivers/char/applicom.c:68: warning: ‘applicom_pci_tbl’ defined but not used

Others are similar.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[Patch] Shut up warnings from files under drivers/

2008-01-26 Thread WANG Cong

Fix two kind of defined-but-not-used warnings.

One is due to defination of MODULE_DEVICE_TABLE, the
other is due to __devexit_p. The solution is just to
add proper directives to protect those usages.

Compile tests passed.

Cc: Greg KH <[EMAIL PROTECTED]>
Signed-off-by: WANG Cong <[EMAIL PROTECTED]>

---

diff --git a/drivers/char/applicom.c b/drivers/char/applicom.c
index 1f0b752..247bc16 100644
--- a/drivers/char/applicom.c
+++ b/drivers/char/applicom.c
@@ -65,6 +65,7 @@ static char *applicom_pci_devnames[] = {
"PCI2000PFB"
 };
 
+#ifdef MODULE
 static struct pci_device_id applicom_pci_tbl[] = {
{ PCI_VENDOR_ID_APPLICOM, PCI_DEVICE_ID_APPLICOM_PCIGENERIC,
  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
@@ -74,6 +75,8 @@ static struct pci_device_id applicom_pci_tbl[] = {
  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
{ 0 }
 };
+#endif
+
 MODULE_DEVICE_TABLE(pci, applicom_pci_tbl);
 
 MODULE_AUTHOR("David Woodhouse & Applicom International");
diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c
index 905d1f5..2009dc9 100644
--- a/drivers/char/synclink.c
+++ b/drivers/char/synclink.c
@@ -897,7 +897,9 @@ static char *driver_version = "$Revision: 4.38 $";
 
 static int synclink_init_one (struct pci_dev *dev,
 const struct pci_device_id *ent);
+#if defined(MODULE) || defined(CONFIG_HOTPLUG)
 static void synclink_remove_one (struct pci_dev *dev);
+#endif
 
 static struct pci_device_id synclink_pci_tbl[] = {
{ PCI_VENDOR_ID_MICROGATE, PCI_DEVICE_ID_MICROGATE_USC, PCI_ANY_ID, 
PCI_ANY_ID, },
@@ -8166,7 +8168,8 @@ static int __devinit synclink_init_one (struct pci_dev 
*dev,
return 0;
 }
 
+#if defined(MODULE) || defined(CONFIG_HOTPLUG)
 static void __devexit synclink_remove_one (struct pci_dev *dev)
 {
 }
-
+#endif
diff --git a/drivers/crypto/hifn_795x.c b/drivers/crypto/hifn_795x.c
index 16413e5..635f651 100644
--- a/drivers/crypto/hifn_795x.c
+++ b/drivers/crypto/hifn_795x.c
@@ -2046,6 +2046,7 @@ static irqreturn_t hifn_interrupt(int irq, void *data)
return IRQ_HANDLED;
 }
 
+#if defined(MODULE) || defined(CONFIG_HOTPLUG)
 static void hifn_flush(struct hifn_device *dev)
 {
unsigned long flags;
@@ -2073,6 +2074,7 @@ static void hifn_flush(struct hifn_device *dev)
}
spin_unlock_irqrestore(>lock, flags);
 }
+#endif
 
 static int hifn_setkey(struct crypto_ablkcipher *cipher, const u8 *key,
unsigned int len)
@@ -2730,6 +2732,7 @@ err_out_disable_pci_device:
return err;
 }
 
+#if defined(MODULE) || defined(CONFIG_HOTPLUG)
 static void hifn_remove(struct pci_dev *pdev)
 {
int i;
@@ -2767,6 +2770,7 @@ static void hifn_remove(struct pci_dev *pdev)
pci_release_regions(pdev);
pci_disable_device(pdev);
 }
+#endif
 
 static struct pci_device_id hifn_pci_tbl[] = {
{ PCI_DEVICE(PCI_VENDOR_ID_HIFN, PCI_DEVICE_ID_HIFN_7955) },
diff --git a/drivers/telephony/ixj.c b/drivers/telephony/ixj.c
index 49cd979..1877084 100644
--- a/drivers/telephony/ixj.c
+++ b/drivers/telephony/ixj.c
@@ -284,11 +284,13 @@ static int samplerate = 100;
 
 module_param(ixjdebug, int, 0);
 
+#ifdef MODULE
 static struct pci_device_id ixj_pci_tbl[] __devinitdata = {
{ PCI_VENDOR_ID_QUICKNET, PCI_DEVICE_ID_QUICKNET_XJ,
  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
{ }
 };
+#endif
 
 MODULE_DEVICE_TABLE(pci, ixj_pci_tbl);
 
diff --git a/drivers/video/aty/aty128fb.c b/drivers/video/aty/aty128fb.c
index cbd3308..3a1aa7e 100644
--- a/drivers/video/aty/aty128fb.c
+++ b/drivers/video/aty/aty128fb.c
@@ -165,7 +165,9 @@ static const char *r128_family[] __devinitdata = {
  */
 static int aty128_probe(struct pci_dev *pdev,
const struct pci_device_id *ent);
+#if defined(MODULE) || defined(CONFIG_HOTPLUG)
 static void aty128_remove(struct pci_dev *pdev);
+#endif
 static int aty128_pci_suspend(struct pci_dev *pdev, pm_message_t state);
 static int aty128_pci_resume(struct pci_dev *pdev);
 static int aty128_do_resume(struct pci_dev *pdev);
@@ -1844,11 +1846,14 @@ error:
return;
 }
 
+#if defined(MODULE) || defined(CONFIG_HOTPLUG)
 static void aty128_bl_exit(struct backlight_device *bd)
 {
backlight_device_unregister(bd);
printk("aty128: Backlight unloaded\n");
 }
+#endif
+
 #endif /* CONFIG_FB_ATY128_BACKLIGHT */
 
 /*
@@ -2125,6 +2130,7 @@ err_free_fb:
return -ENODEV;
 }
 
+#if defined(MODULE) || defined(CONFIG_HOTPLUG)
 static void __devexit aty128_remove(struct pci_dev *pdev)
 {
struct fb_info *info = pci_get_drvdata(pdev);
@@ -2155,6 +2161,7 @@ static void __devexit aty128_remove(struct pci_dev *pdev)
   pci_resource_len(pdev, 2));
framebuffer_release(info);
 }
+#endif /* MODULE || CONFIG_HOTPLUG */
 #endif /* CONFIG_PCI */
 
 
diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c
index d775eb6..eec162

[Patch] drivers/base/core.c: fix a compile error

2008-01-26 Thread WANG Cong
On Fri, Jan 25, 2008 at 03:24:13PM -0800, Jeremy Fitzhardinge wrote:
>Greg KH wrote:
>>Ah, sorry, I missed that "note" :(
>>
>>thanks,
>>
>>greg 'time to get that make randconfig system up and working' k-h
>>  
>
>Here's a config that fails.
>

Here's one possible fix. Please review.

Signed-off-by: WANG Cong <[EMAIL PROTECTED]>

---

Index: linux-2.6/include/linux/genhd.h
===
--- linux-2.6.orig/include/linux/genhd.h
+++ linux-2.6/include/linux/genhd.h
@@ -12,6 +12,8 @@
 #include 
 #include 
 
+extern struct device_type part_type;
+
 #ifdef CONFIG_BLOCK
 
 #define kobj_to_dev(k) container_of(k, struct device, kobj)
@@ -19,7 +21,6 @@
 #define dev_to_part(device) container_of(device, struct hd_struct, dev)
 
 extern struct device_type disk_type;
-extern struct device_type part_type;
 extern struct kobject *block_depr;
 extern struct class block_class;
 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[Patch] drivers/base/core.c: fix a compile error

2008-01-26 Thread WANG Cong
On Fri, Jan 25, 2008 at 03:24:13PM -0800, Jeremy Fitzhardinge wrote:
Greg KH wrote:
Ah, sorry, I missed that note :(

thanks,

greg 'time to get that make randconfig system up and working' k-h
  

Here's a config that fails.


Here's one possible fix. Please review.

Signed-off-by: WANG Cong [EMAIL PROTECTED]

---

Index: linux-2.6/include/linux/genhd.h
===
--- linux-2.6.orig/include/linux/genhd.h
+++ linux-2.6/include/linux/genhd.h
@@ -12,6 +12,8 @@
 #include linux/types.h
 #include linux/kdev_t.h
 
+extern struct device_type part_type;
+
 #ifdef CONFIG_BLOCK
 
 #define kobj_to_dev(k) container_of(k, struct device, kobj)
@@ -19,7 +21,6 @@
 #define dev_to_part(device) container_of(device, struct hd_struct, dev)
 
 extern struct device_type disk_type;
-extern struct device_type part_type;
 extern struct kobject *block_depr;
 extern struct class block_class;
 
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Patch] Shut up warnings from files under drivers/

2008-01-26 Thread WANG Cong
On Sat, Jan 26, 2008 at 04:55:58AM -0500, Jeff Garzik wrote:
WANG Cong wrote:
diff --git a/drivers/video/kyro/fbdev.c b/drivers/video/kyro/fbdev.c
index acb9370..437ebd0 100644
--- a/drivers/video/kyro/fbdev.c
+++ b/drivers/video/kyro/fbdev.c
@@ -90,7 +90,9 @@ static int nomtrr __devinitdata = 0;
 
 /* PCI driver prototypes */
 static int kyrofb_probe(struct pci_dev *pdev, const struct pci_device_id 
 *ent);
+#if defined(MODULE) || defined(CONFIG_HOTPLUG)
 static void kyrofb_remove(struct pci_dev *pdev);
+#endif
 
 static struct fb_videomode kyro_modedb[] __devinitdata = {
  {
@@ -754,6 +756,7 @@ out_unmap:
  return -EINVAL;
 }
 
+#if defined(MODULE) || defined(CONFIG_HOTPLUG)
 static void __devexit kyrofb_remove(struct pci_dev *pdev)
 {
  struct fb_info *info = pci_get_drvdata(pdev);
@@ -783,6 +786,7 @@ static void __devexit kyrofb_remove(struct pci_dev 
*pdev)
  pci_set_drvdata(pdev, NULL);
  framebuffer_release(info);
 }
+#endif


Quite strange -- due to __devexit_p() and the __devexit marker, ifdefs 
should not be needed.

I would look into why that isn't working as designed in these cases...


For example, the defination of __devexit_p:

#if defined(MODULE) || defined(CONFIG_HOTPLUG)
#define __devexit_p(x) x
#else
#define __devexit_p(x) NULL
#endif

If !(defined(MODULE) || defined(CONFIG_HOTPLUG)), __devexit_p
is just a NULL pointer, thus 'x' may be unused although defined.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[Patch] Shut up warnings from files under drivers/

2008-01-26 Thread WANG Cong

Fix two kind of defined-but-not-used warnings.

One is due to defination of MODULE_DEVICE_TABLE, the
other is due to __devexit_p. The solution is just to
add proper directives to protect those usages.

Compile tests passed.

Cc: Greg KH [EMAIL PROTECTED]
Signed-off-by: WANG Cong [EMAIL PROTECTED]

---

diff --git a/drivers/char/applicom.c b/drivers/char/applicom.c
index 1f0b752..247bc16 100644
--- a/drivers/char/applicom.c
+++ b/drivers/char/applicom.c
@@ -65,6 +65,7 @@ static char *applicom_pci_devnames[] = {
PCI2000PFB
 };
 
+#ifdef MODULE
 static struct pci_device_id applicom_pci_tbl[] = {
{ PCI_VENDOR_ID_APPLICOM, PCI_DEVICE_ID_APPLICOM_PCIGENERIC,
  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
@@ -74,6 +75,8 @@ static struct pci_device_id applicom_pci_tbl[] = {
  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
{ 0 }
 };
+#endif
+
 MODULE_DEVICE_TABLE(pci, applicom_pci_tbl);
 
 MODULE_AUTHOR(David Woodhouse  Applicom International);
diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c
index 905d1f5..2009dc9 100644
--- a/drivers/char/synclink.c
+++ b/drivers/char/synclink.c
@@ -897,7 +897,9 @@ static char *driver_version = $Revision: 4.38 $;
 
 static int synclink_init_one (struct pci_dev *dev,
 const struct pci_device_id *ent);
+#if defined(MODULE) || defined(CONFIG_HOTPLUG)
 static void synclink_remove_one (struct pci_dev *dev);
+#endif
 
 static struct pci_device_id synclink_pci_tbl[] = {
{ PCI_VENDOR_ID_MICROGATE, PCI_DEVICE_ID_MICROGATE_USC, PCI_ANY_ID, 
PCI_ANY_ID, },
@@ -8166,7 +8168,8 @@ static int __devinit synclink_init_one (struct pci_dev 
*dev,
return 0;
 }
 
+#if defined(MODULE) || defined(CONFIG_HOTPLUG)
 static void __devexit synclink_remove_one (struct pci_dev *dev)
 {
 }
-
+#endif
diff --git a/drivers/crypto/hifn_795x.c b/drivers/crypto/hifn_795x.c
index 16413e5..635f651 100644
--- a/drivers/crypto/hifn_795x.c
+++ b/drivers/crypto/hifn_795x.c
@@ -2046,6 +2046,7 @@ static irqreturn_t hifn_interrupt(int irq, void *data)
return IRQ_HANDLED;
 }
 
+#if defined(MODULE) || defined(CONFIG_HOTPLUG)
 static void hifn_flush(struct hifn_device *dev)
 {
unsigned long flags;
@@ -2073,6 +2074,7 @@ static void hifn_flush(struct hifn_device *dev)
}
spin_unlock_irqrestore(dev-lock, flags);
 }
+#endif
 
 static int hifn_setkey(struct crypto_ablkcipher *cipher, const u8 *key,
unsigned int len)
@@ -2730,6 +2732,7 @@ err_out_disable_pci_device:
return err;
 }
 
+#if defined(MODULE) || defined(CONFIG_HOTPLUG)
 static void hifn_remove(struct pci_dev *pdev)
 {
int i;
@@ -2767,6 +2770,7 @@ static void hifn_remove(struct pci_dev *pdev)
pci_release_regions(pdev);
pci_disable_device(pdev);
 }
+#endif
 
 static struct pci_device_id hifn_pci_tbl[] = {
{ PCI_DEVICE(PCI_VENDOR_ID_HIFN, PCI_DEVICE_ID_HIFN_7955) },
diff --git a/drivers/telephony/ixj.c b/drivers/telephony/ixj.c
index 49cd979..1877084 100644
--- a/drivers/telephony/ixj.c
+++ b/drivers/telephony/ixj.c
@@ -284,11 +284,13 @@ static int samplerate = 100;
 
 module_param(ixjdebug, int, 0);
 
+#ifdef MODULE
 static struct pci_device_id ixj_pci_tbl[] __devinitdata = {
{ PCI_VENDOR_ID_QUICKNET, PCI_DEVICE_ID_QUICKNET_XJ,
  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
{ }
 };
+#endif
 
 MODULE_DEVICE_TABLE(pci, ixj_pci_tbl);
 
diff --git a/drivers/video/aty/aty128fb.c b/drivers/video/aty/aty128fb.c
index cbd3308..3a1aa7e 100644
--- a/drivers/video/aty/aty128fb.c
+++ b/drivers/video/aty/aty128fb.c
@@ -165,7 +165,9 @@ static const char *r128_family[] __devinitdata = {
  */
 static int aty128_probe(struct pci_dev *pdev,
const struct pci_device_id *ent);
+#if defined(MODULE) || defined(CONFIG_HOTPLUG)
 static void aty128_remove(struct pci_dev *pdev);
+#endif
 static int aty128_pci_suspend(struct pci_dev *pdev, pm_message_t state);
 static int aty128_pci_resume(struct pci_dev *pdev);
 static int aty128_do_resume(struct pci_dev *pdev);
@@ -1844,11 +1846,14 @@ error:
return;
 }
 
+#if defined(MODULE) || defined(CONFIG_HOTPLUG)
 static void aty128_bl_exit(struct backlight_device *bd)
 {
backlight_device_unregister(bd);
printk(aty128: Backlight unloaded\n);
 }
+#endif
+
 #endif /* CONFIG_FB_ATY128_BACKLIGHT */
 
 /*
@@ -2125,6 +2130,7 @@ err_free_fb:
return -ENODEV;
 }
 
+#if defined(MODULE) || defined(CONFIG_HOTPLUG)
 static void __devexit aty128_remove(struct pci_dev *pdev)
 {
struct fb_info *info = pci_get_drvdata(pdev);
@@ -2155,6 +2161,7 @@ static void __devexit aty128_remove(struct pci_dev *pdev)
   pci_resource_len(pdev, 2));
framebuffer_release(info);
 }
+#endif /* MODULE || CONFIG_HOTPLUG */
 #endif /* CONFIG_PCI */
 
 
diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c
index d775eb6..eec1624 100644
--- a/drivers/video/aty/atyfb_base.c
+++ b/drivers/video/aty

Re: [Patch] Shut up warnings from files under drivers/

2008-01-26 Thread WANG Cong


Looking a bit closer the above is rubbish.
We have:
#if defined(MODULE) || defined(CONFIG_HOTPLUG)
#define __devexit_p(x) x
#else
#define __devexit_p(x) NULL

so the pointer to the function is used in
both cases.

I think in the latter case, 'x' is not used, just
as gcc told me. ;)


Could you drop me the config that produces the warning
and the warning message.


Of course. Attached.

Regards.

#
# Automatically generated make config: don't edit
# Linux kernel version: 2.6.24
# Sat Jan 26 10:19:31 2008
#
# CONFIG_64BIT is not set
CONFIG_X86_32=y
# CONFIG_X86_64 is not set
CONFIG_X86=y
CONFIG_GENERIC_TIME=y
CONFIG_GENERIC_CMOS_UPDATE=y
CONFIG_CLOCKSOURCE_WATCHDOG=y
CONFIG_GENERIC_CLOCKEVENTS=y
CONFIG_LOCKDEP_SUPPORT=y
CONFIG_STACKTRACE_SUPPORT=y
CONFIG_SEMAPHORE_SLEEPERS=y
CONFIG_MMU=y
CONFIG_ZONE_DMA=y
CONFIG_QUICKLIST=y
CONFIG_GENERIC_ISA_DMA=y
CONFIG_GENERIC_IOMAP=y
CONFIG_GENERIC_HWEIGHT=y
CONFIG_ARCH_MAY_HAVE_PC_FDC=y
CONFIG_DMI=y
# CONFIG_RWSEM_GENERIC_SPINLOCK is not set
CONFIG_RWSEM_XCHGADD_ALGORITHM=y
# CONFIG_ARCH_HAS_ILOG2_U32 is not set
# CONFIG_ARCH_HAS_ILOG2_U64 is not set
CONFIG_GENERIC_CALIBRATE_DELAY=y
# CONFIG_GENERIC_TIME_VSYSCALL is not set
CONFIG_ARCH_SUPPORTS_OPROFILE=y
# CONFIG_ZONE_DMA32 is not set
CONFIG_ARCH_POPULATES_NODE_MAP=y
# CONFIG_AUDIT_ARCH is not set
CONFIG_GENERIC_HARDIRQS=y
CONFIG_GENERIC_IRQ_PROBE=y
CONFIG_X86_BIOS_REBOOT=y
CONFIG_KTIME_SCALAR=y
CONFIG_DEFCONFIG_LIST=/lib/modules/$UNAME_RELEASE/.config

#
# General setup
#
CONFIG_EXPERIMENTAL=y
CONFIG_BROKEN_ON_SMP=y
CONFIG_INIT_ENV_ARG_LIMIT=32
CONFIG_LOCALVERSION=
CONFIG_LOCALVERSION_AUTO=y
# CONFIG_SYSVIPC is not set
CONFIG_BSD_PROCESS_ACCT=y
# CONFIG_BSD_PROCESS_ACCT_V3 is not set
CONFIG_USER_NS=y
# CONFIG_PID_NS is not set
CONFIG_IKCONFIG=y
CONFIG_IKCONFIG_PROC=y
CONFIG_LOG_BUF_SHIFT=14
CONFIG_CGROUPS=y
# CONFIG_CGROUP_DEBUG is not set
CONFIG_CGROUP_NS=y
CONFIG_FAIR_GROUP_SCHED=y
CONFIG_FAIR_USER_SCHED=y
# CONFIG_FAIR_CGROUP_SCHED is not set
CONFIG_CGROUP_CPUACCT=y
# CONFIG_SYSFS_DEPRECATED is not set
CONFIG_RELAY=y
CONFIG_BLK_DEV_INITRD=y
CONFIG_INITRAMFS_SOURCE=
CONFIG_CC_OPTIMIZE_FOR_SIZE=y
CONFIG_EMBEDDED=y
CONFIG_UID16=y
# CONFIG_SYSCTL_SYSCALL is not set
CONFIG_KALLSYMS=y
CONFIG_KALLSYMS_ALL=y
CONFIG_KALLSYMS_EXTRA_PASS=y
# CONFIG_HOTPLUG is not set
CONFIG_PRINTK=y
# CONFIG_BUG is not set
# CONFIG_ELF_CORE is not set
CONFIG_BASE_FULL=y
# CONFIG_FUTEX is not set
CONFIG_ANON_INODES=y
# CONFIG_EPOLL is not set
CONFIG_SIGNALFD=y
# CONFIG_EVENTFD is not set
# CONFIG_SHMEM is not set
CONFIG_VM_EVENT_COUNTERS=y
CONFIG_SLAB=y
# CONFIG_SLUB is not set
# CONFIG_SLOB is not set
CONFIG_SLABINFO=y
CONFIG_TINY_SHMEM=y
CONFIG_BASE_SMALL=0
# CONFIG_MODULES is not set
# CONFIG_BLOCK is not set
CONFIG_PREEMPT_NOTIFIERS=y
CONFIG_CLASSIC_RCU=y
# CONFIG_PREEMPT_RCU is not set

#
# Processor type and features
#
# CONFIG_TICK_ONESHOT is not set
# CONFIG_NO_HZ is not set
# CONFIG_HIGH_RES_TIMERS is not set
CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
# CONFIG_SMP is not set
CONFIG_X86_PC=y
# CONFIG_X86_ELAN is not set
# CONFIG_X86_VOYAGER is not set
# CONFIG_X86_NUMAQ is not set
# CONFIG_X86_SUMMIT is not set
# CONFIG_X86_BIGSMP is not set
# CONFIG_X86_VISWS is not set
# CONFIG_X86_GENERICARCH is not set
# CONFIG_X86_ES7000 is not set
# CONFIG_X86_VSMP is not set
CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
# CONFIG_PARAVIRT_GUEST is not set
# CONFIG_M386 is not set
# CONFIG_M486 is not set
# CONFIG_M586 is not set
# CONFIG_M586TSC is not set
# CONFIG_M586MMX is not set
# CONFIG_M686 is not set
# CONFIG_MPENTIUMII is not set
# CONFIG_MPENTIUMIII is not set
# CONFIG_MPENTIUMM is not set
# CONFIG_MPENTIUM4 is not set
# CONFIG_MK6 is not set
# CONFIG_MK7 is not set
CONFIG_MK8=y
# CONFIG_MCRUSOE is not set
# CONFIG_MEFFICEON is not set
# CONFIG_MWINCHIPC6 is not set
# CONFIG_MWINCHIP2 is not set
# CONFIG_MWINCHIP3D is not set
# CONFIG_MGEODEGX1 is not set
# CONFIG_MGEODE_LX is not set
# CONFIG_MCYRIXIII is not set
# CONFIG_MVIAC3_2 is not set
# CONFIG_MVIAC7 is not set
# CONFIG_MPSC is not set
# CONFIG_MCORE2 is not set
# CONFIG_GENERIC_CPU is not set
# CONFIG_X86_GENERIC is not set
CONFIG_X86_CMPXCHG=y
CONFIG_X86_L1_CACHE_SHIFT=6
CONFIG_X86_XADD=y
CONFIG_X86_WP_WORKS_OK=y
CONFIG_X86_INVLPG=y
CONFIG_X86_BSWAP=y
CONFIG_X86_POPAD_OK=y
CONFIG_X86_GOOD_APIC=y
CONFIG_X86_INTEL_USERCOPY=y
CONFIG_X86_USE_PPRO_CHECKSUM=y
CONFIG_X86_TSC=y
CONFIG_X86_MINIMUM_CPU_FAMILY=4
CONFIG_HPET_TIMER=y
CONFIG_PREEMPT_NONE=y
# CONFIG_PREEMPT_VOLUNTARY is not set
# CONFIG_PREEMPT is not set
CONFIG_RCU_TRACE=y
# CONFIG_X86_UP_APIC is not set
# CONFIG_X86_MCE is not set
CONFIG_VM86=y
# CONFIG_TOSHIBA is not set
# CONFIG_I8K is not set
# CONFIG_X86_REBOOTFIXUPS is not set
# CONFIG_MICROCODE is not set
# CONFIG_X86_MSR is not set
# CONFIG_X86_CPUID is not set
# CONFIG_NOHIGHMEM is not set
CONFIG_HIGHMEM4G=y
# CONFIG_HIGHMEM64G is not set
CONFIG_VMSPLIT_3G=y
# CONFIG_VMSPLIT_3G_OPT is not set
# CONFIG_VMSPLIT_2G is not set
# CONFIG_VMSPLIT_2G_OPT is not set
# 

The latest linus tree can't build

2008-01-26 Thread WANG Cong

Hi, Sam!

When I built the latest linus tree, I got this error:

...
  CC  sound/oss/msnd.o
make[2]: *** No rule to make target `/etc/sound/msndperm.bin', needed by 
`sound/oss/msndperm.c'.  Stop.
make[1]: *** [sound/oss] Error 2
make: *** [sound] Error 2

My .config is just the one I sent to you in another thread.
Need me to resend it?

Regards.


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Patch] Shut up warnings from files under drivers/

2008-01-26 Thread WANG Cong
On Sat, Jan 26, 2008 at 10:57:23AM +0100, Sam Ravnborg wrote:
Hi WANG.
On Sat, Jan 26, 2008 at 05:30:07PM +0800, WANG Cong wrote:
 
 Fix two kind of defined-but-not-used warnings.
 
 One is due to defination of MODULE_DEVICE_TABLE, the
 other is due to __devexit_p. The solution is just to
 add proper directives to protect those usages.

Please include the actual warnings that you fix.


Sure.

Such as this one:

drivers/char/applicom.c:68: warning: ‘applicom_pci_tbl’ defined but not used

Others are similar.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: The latest linus tree can't build

2008-01-26 Thread WANG Cong
On Sat, Jan 26, 2008 at 12:45:14PM +0200, Adrian Bunk wrote:
On Sat, Jan 26, 2008 at 06:38:45PM +0800, WANG Cong wrote:
 
 Hi, Sam!
 
 When I built the latest linus tree, I got this error:
 
 ...
   CC  sound/oss/msnd.o
 make[2]: *** No rule to make target `/etc/sound/msndperm.bin', needed by 
 `sound/oss/msndperm.c'.  Stop.
 make[1]: *** [sound/oss] Error 2
 make: *** [sound] Error 2
 
 My .config is just the one I sent to you in another thread.
...

It's expected that CONFIG_STANDALONE=n allows configurations that won't 
compile.

Oh, thank you!

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Patch] Shut up warnings from files under drivers/

2008-01-26 Thread WANG Cong
On Sat, Jan 26, 2008 at 08:17:17PM +0100, Sam Ravnborg wrote:
On Sat, Jan 26, 2008 at 04:55:58AM -0500, Jeff Garzik wrote:
 WANG Cong wrote:
 diff --git a/drivers/video/kyro/fbdev.c b/drivers/video/kyro/fbdev.c
 index acb9370..437ebd0 100644
 --- a/drivers/video/kyro/fbdev.c
 +++ b/drivers/video/kyro/fbdev.c
 @@ -90,7 +90,9 @@ static int nomtrr __devinitdata = 0;
  
  /* PCI driver prototypes */
  static int kyrofb_probe(struct pci_dev *pdev, const struct pci_device_id 
  *ent);
 +#if defined(MODULE) || defined(CONFIG_HOTPLUG)
  static void kyrofb_remove(struct pci_dev *pdev);
 +#endif
  
  static struct fb_videomode kyro_modedb[] __devinitdata = {
 {
 @@ -754,6 +756,7 @@ out_unmap:
 return -EINVAL;
  }
  
 +#if defined(MODULE) || defined(CONFIG_HOTPLUG)
  static void __devexit kyrofb_remove(struct pci_dev *pdev)
  {
 struct fb_info *info = pci_get_drvdata(pdev);
 @@ -783,6 +786,7 @@ static void __devexit kyrofb_remove(struct pci_dev 
 *pdev)
 pci_set_drvdata(pdev, NULL);
 framebuffer_release(info);
  }
 +#endif
 
 
 Quite strange -- due to __devexit_p() and the __devexit marker, ifdefs 
 should not be needed.
 
 I would look into why that isn't working as designed in these cases...

I checked up on the synclink.c warning.
We have the following code:

static void synclink_remove_one (struct pci_dev *dev);

...

static struct pci_driver synclink_pci_driver = {
.remove = __devexit_p(synclink_remove_one),
};

...

static void __devexit synclink_remove_one (struct pci_dev *dev)
{
}

And I double checked the preprocessed source to check
that we applied the __attribute__((__used__)) to the function.

Yes. The only macro we used on synclink_remove_one is __devexit.
It's defination is:

#ifdef CONFIG_HOTPLUG
#define __devexit
#else
#define __devexit __exit
#endif

And __exit is:
#ifdef MODULE
#define __exit  __attribute__ ((__section__(.exit.text))) __cold
#else
#define __exit  __attribute_used__ __attribute__ 
((__section__(.exit.text))) __cold
#endif

So only when !defined(MODULE)  !defined(CONFIG_HOTPLUG),
__attribute_used__ is applied. And this case is just that
condition, thus this should be a bogus of gcc.



Investigating a bit more I realized that gcc looses the
__used__ attribution due to the prototype.
So there are two correct fixes:
a) move the function up so we do not need the forward
   declaration
b) add a __devexit to the forward decalration too.

I strongly prefer the first version and this is the
correct fix for these cases.

Do we have a gcc bug here - I did not see a definitive answer in gcc docs?


Agreed. I will try a).


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Incorrect filename comments in arch/x86/boot

2008-01-25 Thread WANG Cong
On Tue, Jan 22, 2008 at 12:20:12PM -0800, H. Peter Anvin wrote:
>Pavel Machek wrote:
>>Hi!
>>
>>Not sure if this is worth fixing, or if I should just delete those
>>comments...? (Or does someone want to do that? ;-). 
>>  Pavel
>
>I'll take care of it.
>

Hmm, arch/i386/boot/ is an empty dir. Why not remove it?
Only used to put bzImage? Why not choose another dir?
Maybe arch/x86/boot/, I think. ;)


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


  1   2   3   4   5   >