Re: [PATCH] [MIPS] Enable the timerfd_*() o32 system calls

2008-02-19 Thread Dmitri Vorobiev
Ralf Baechle пишет:
> On Tue, Feb 19, 2008 at 12:02:37AM +0300, Dmitri Vorobiev wrote:
> 
>> This patch enables the system calls timerfd_create(), timerfd_settime()
>> and timerfd_gettime() for MIPS architecture.
>>
>> Please see the following Bugzilla entry for more details:
>>
>> http://bugzilla.kernel.org/show_bug.cgi?id=10038
>>
>> This was tested using a Malta 4Kc board in both little-endian and
>> big-endian modes. The unit test program is available from the URL
>> above.
>>
>> Note that only the "o32"-style system calls have been added. This is
>> due to the fact that I have no suitable equipment to test the other
>> flavors of MIPS ABI.
> 
> Thanks.  I added the missing bits for the others ABIs and applied the
> combined patch.

Thank you, Ralf!

Dmitri

> 
>   Ralf
> 

--
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] [MIPS] Enable the timerfd_*() o32 system calls

2008-02-19 Thread Dmitri Vorobiev
Ralf Baechle пишет:
 On Tue, Feb 19, 2008 at 12:02:37AM +0300, Dmitri Vorobiev wrote:
 
 This patch enables the system calls timerfd_create(), timerfd_settime()
 and timerfd_gettime() for MIPS architecture.

 Please see the following Bugzilla entry for more details:

 http://bugzilla.kernel.org/show_bug.cgi?id=10038

 This was tested using a Malta 4Kc board in both little-endian and
 big-endian modes. The unit test program is available from the URL
 above.

 Note that only the o32-style system calls have been added. This is
 due to the fact that I have no suitable equipment to test the other
 flavors of MIPS ABI.
 
 Thanks.  I added the missing bits for the others ABIs and applied the
 combined patch.

Thank you, Ralf!

Dmitri

 
   Ralf
 

--
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] [MIPS] Enable the timerfd_*() o32 system calls

2008-02-18 Thread Dmitri Vorobiev
This patch enables the system calls timerfd_create(), timerfd_settime()
and timerfd_gettime() for MIPS architecture.

Please see the following Bugzilla entry for more details:

http://bugzilla.kernel.org/show_bug.cgi?id=10038

This was tested using a Malta 4Kc board in both little-endian and
big-endian modes. The unit test program is available from the URL
above.

Note that only the "o32"-style system calls have been added. This is
due to the fact that I have no suitable equipment to test the other
flavors of MIPS ABI.

Signed-off-by: Dmitri Vorobiev <[EMAIL PROTECTED]>
---
 arch/mips/kernel/scall32-o32.S |3 +++
 include/asm-mips/unistd.h  |7 +--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S
index f798139..08a9c50 100644
--- a/arch/mips/kernel/scall32-o32.S
+++ b/arch/mips/kernel/scall32-o32.S
@@ -663,6 +663,9 @@ einval: li  v0, -EINVAL
sys sys_ni_syscall  0
sys sys_eventfd 1
sys sys_fallocate   6   /* 4320 */
+   sys sys_timerfd_create  2
+   sys sys_timerfd_gettime 2
+   sys sys_timerfd_settime 4
.endm
 
/* We pre-compute the number of _instruction_ bytes needed to
diff --git a/include/asm-mips/unistd.h b/include/asm-mips/unistd.h
index fa9a587..7316b55 100644
--- a/include/asm-mips/unistd.h
+++ b/include/asm-mips/unistd.h
@@ -341,16 +341,19 @@
 #define __NR_timerfd   (__NR_Linux + 318)
 #define __NR_eventfd   (__NR_Linux + 319)
 #define __NR_fallocate (__NR_Linux + 320)
+#define __NR_timerfd_create(__NR_Linux + 321)
+#define __NR_timerfd_gettime   (__NR_Linux + 322)
+#define __NR_timerfd_settime   (__NR_Linux + 323)
 
 /*
  * Offset of the last Linux o32 flavoured syscall
  */
-#define __NR_Linux_syscalls320
+#define __NR_Linux_syscalls323
 
 #endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
 
 #define __NR_O32_Linux 4000
-#define __NR_O32_Linux_syscalls320
+#define __NR_O32_Linux_syscalls323
 
 #if _MIPS_SIM == _MIPS_SIM_ABI64
 
-- 
1.5.3

--
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] [MIPS] Enable the timerfd_*() o32 system calls

2008-02-18 Thread Dmitri Vorobiev
This patch enables the system calls timerfd_create(), timerfd_settime()
and timerfd_gettime() for MIPS architecture.

Please see the following Bugzilla entry for more details:

http://bugzilla.kernel.org/show_bug.cgi?id=10038

This was tested using a Malta 4Kc board in both little-endian and
big-endian modes. The unit test program is available from the URL
above.

Note that only the o32-style system calls have been added. This is
due to the fact that I have no suitable equipment to test the other
flavors of MIPS ABI.

Signed-off-by: Dmitri Vorobiev [EMAIL PROTECTED]
---
 arch/mips/kernel/scall32-o32.S |3 +++
 include/asm-mips/unistd.h  |7 +--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S
index f798139..08a9c50 100644
--- a/arch/mips/kernel/scall32-o32.S
+++ b/arch/mips/kernel/scall32-o32.S
@@ -663,6 +663,9 @@ einval: li  v0, -EINVAL
sys sys_ni_syscall  0
sys sys_eventfd 1
sys sys_fallocate   6   /* 4320 */
+   sys sys_timerfd_create  2
+   sys sys_timerfd_gettime 2
+   sys sys_timerfd_settime 4
.endm
 
/* We pre-compute the number of _instruction_ bytes needed to
diff --git a/include/asm-mips/unistd.h b/include/asm-mips/unistd.h
index fa9a587..7316b55 100644
--- a/include/asm-mips/unistd.h
+++ b/include/asm-mips/unistd.h
@@ -341,16 +341,19 @@
 #define __NR_timerfd   (__NR_Linux + 318)
 #define __NR_eventfd   (__NR_Linux + 319)
 #define __NR_fallocate (__NR_Linux + 320)
+#define __NR_timerfd_create(__NR_Linux + 321)
+#define __NR_timerfd_gettime   (__NR_Linux + 322)
+#define __NR_timerfd_settime   (__NR_Linux + 323)
 
 /*
  * Offset of the last Linux o32 flavoured syscall
  */
-#define __NR_Linux_syscalls320
+#define __NR_Linux_syscalls323
 
 #endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
 
 #define __NR_O32_Linux 4000
-#define __NR_O32_Linux_syscalls320
+#define __NR_O32_Linux_syscalls323
 
 #if _MIPS_SIM == _MIPS_SIM_ABI64
 
-- 
1.5.3

--
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 v2 8/9] bfs: remove multiple assignments

2008-01-30 Thread Dmitri Vorobiev
Al Viro wrote:
> On Mon, Jan 28, 2008 at 01:02:03AM -0600, Joel Schopp wrote:
> -inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC;
> +inode->i_mtime = CURRENT_TIME_SEC;
> +inode->i_atime = CURRENT_TIME_SEC;
> +inode->i_ctime = CURRENT_TIME_SEC;
 multiple assignments like "x = y = z = value;" can potentially
 (depending on the compiler and arch) be faster than "x = value; y =
 value; z=value;"

 I am surprized that this script complains about them as it is a
 perfectly valid thing to do in C.
>>> I think it seems wise to ask the maintainers of checkpatch.pl to
>>> comment on that. I'm Cc:ing them now.
>>>
>> There are plenty of things that are valid to do in C that don't make for 
>> maintainable code.  These scripts are designed to make your code easier for 
>> real people to review and maintain.
> 
> Except that in this case the new variant is not equivalent to the old one...

Yes, you're right. In fact, I felt like sending yet another version
of these patches, but this gets preempted all the time by "the other things".

Dmitri
--
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 v2 8/9] bfs: remove multiple assignments

2008-01-30 Thread Dmitri Vorobiev
Al Viro wrote:
 On Mon, Jan 28, 2008 at 01:02:03AM -0600, Joel Schopp wrote:
 -inode-i_mtime = inode-i_atime = inode-i_ctime = CURRENT_TIME_SEC;
 +inode-i_mtime = CURRENT_TIME_SEC;
 +inode-i_atime = CURRENT_TIME_SEC;
 +inode-i_ctime = CURRENT_TIME_SEC;
 multiple assignments like x = y = z = value; can potentially
 (depending on the compiler and arch) be faster than x = value; y =
 value; z=value;

 I am surprized that this script complains about them as it is a
 perfectly valid thing to do in C.
 I think it seems wise to ask the maintainers of checkpatch.pl to
 comment on that. I'm Cc:ing them now.

 There are plenty of things that are valid to do in C that don't make for 
 maintainable code.  These scripts are designed to make your code easier for 
 real people to review and maintain.
 
 Except that in this case the new variant is not equivalent to the old one...

Yes, you're right. In fact, I felt like sending yet another version
of these patches, but this gets preempted all the time by the other things.

Dmitri
--
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/17] [MIPS] Malta: massive code cleanup

2008-01-28 Thread Dmitri Vorobiev
Ralf Baechle пишет:
> On Thu, Jan 24, 2008 at 07:52:40PM +0300, Dmitri Vorobiev wrote:
> 
> Whole series queued for 2.6.25.

OK, thanks.

Dmitri

> 
> Thanks,
> 
>   Ralf
> 

--
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] X86: coding style fixes to arch/x86/math-errors.c - take 2

2008-01-28 Thread Dmitri Vorobiev
Ingo Molnar пишет:
> * Dmitri Vorobiev <[EMAIL PROTECTED]> wrote:
> 
>> Paolo Ciarrocchi пишет:
>>> On Jan 27, 2008 11:48 PM, Paolo Ciarrocchi <[EMAIL PROTECTED]> wrote:
>>>> On Jan 27, 2008 11:42 PM, Ingo Molnar <[EMAIL PROTECTED]> wrote:
>> ...
>>> How should I compare the .o file?
>>> Simply doing a md5sum or should I do a objdump -d before?
>>> Or a strip?
>>>
>> Comparing the vmlinux images shoudls suffice. But you'll have to make 
>> sure that the object file resulting from the C source that you're 
>> changing gets linked into vmlinux.
> 
> the vmlinux includes build timestamps so that wont really match. 

Oh, you're right. Sorry for a misleading comment.

Dmitri
--
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/17] [MIPS] Malta: massive code cleanup

2008-01-28 Thread Dmitri Vorobiev
Ralf Baechle пишет:
 On Thu, Jan 24, 2008 at 07:52:40PM +0300, Dmitri Vorobiev wrote:
 
 Whole series queued for 2.6.25.

OK, thanks.

Dmitri

 
 Thanks,
 
   Ralf
 

--
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] X86: coding style fixes to arch/x86/math-errors.c - take 2

2008-01-27 Thread Dmitri Vorobiev
Paolo Ciarrocchi пишет:
> On Jan 27, 2008 11:48 PM, Paolo Ciarrocchi <[EMAIL PROTECTED]> wrote:
>> On Jan 27, 2008 11:42 PM, Ingo Molnar <[EMAIL PROTECTED]> wrote:
...
> 
> How should I compare the .o file?
> Simply doing a md5sum or should I do a objdump -d before?
> Or a strip?
> 

Comparing the vmlinux images shoudls suffice. But you'll
have to make sure that the object file resulting from the
C source that you're changing gets linked into vmlinux.

Dmitri

> Ciao,

--
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] X86: coding style fixes to arch/x86/math-errors.c - take 2

2008-01-27 Thread Dmitri Vorobiev
Paolo Ciarrocchi пишет:
> This file has not been modified since October so should be 
> easy to integrate the following patch.
> 
> Before:
> total: 214 errors, 28 warnings, 739 lines checked
> 
> After:
> total: 4 errors, 28 warnings, 708 lines checked
> 
> Compile tested:
> 
> [EMAIL PROTECTED]:/tmp$ size error.o.*
>textdata bss dec hex filename
>3476   0   03476 d94 error.o.after
>3476   0   03476 d94 error.o.before
> 
> 
> [EMAIL PROTECTED]:/tmp$ md5sum error.o.*
> f0b89bbbc0e24b74b0d78270bd3a4dd1  error.o.after
> a1e8d0723421256a1a21b2fc2add9031  error.o.before
> 
> Should I be worried about the md5sum difference?
>

Looks like it would be better to proceed in the following manner:

1) remove dead code (no md5 change);
2) reformat the lines to use tabs, not spaces (no md5 change);
3) address the "else-braces" and "single statement block" errors
   (no md5 change);
4) remove all unnecessary spaces (no md5 change);
5) add the KERN_ macros (md5 will change).
6) address remaining checkpatch complaints (no md5 change wrt #5
   above).

Each item above might get into a separate patch.

See more comments below.
 
> Signed-off-by: Paolo Ciarrocchi <[EMAIL PROTECTED]>
> ---
> 
> The only remaining errors are like the following:
> 
> ERROR: need consistent spacing around '*' (ctx:WxB)
> #110: FILE: errors.c:110:
> + FPU_get_user(FPU_modrm, 1 + (u_char __user *) address);
>  ^
> Any hint on how to fix them?
> 
>  arch/x86/math-emu/errors.c |  405 
> 
>  1 files changed, 187 insertions(+), 218 deletions(-)
> 
> diff --git a/arch/x86/math-emu/errors.c b/arch/x86/math-emu/errors.c
> index a1b0d22..fa23366 100644
> --- a/arch/x86/math-emu/errors.c
> +++ b/arch/x86/math-emu/errors.c
> @@ -43,25 +43,23 @@ void Un_impl(void)
>RE_ENTRANT_CHECK_OFF;
>/* No need to check access_ok(), we have previously fetched these bytes. */
>printk("Unimplemented FPU Opcode at eip=%p : ", (void __user *) address);
> -  if ( FPU_CS == __USER_CS )
> -{
> -  while ( 1 )
> - {
> +  if (FPU_CS == __USER_CS) {
> +  while (1) {
> FPU_get_user(byte1, (u_char __user *) address);
> -   if ( (byte1 & 0xf8) == 0xd8 ) break;
> +   if ((byte1 & 0xf8) == 0xd8)
> + break;
> printk("[%02x]", byte1);
> address++;
>   }
>printk("%02x ", byte1);
>FPU_get_user(FPU_modrm, 1 + (u_char __user *) address);
> -  
> +
>if (FPU_modrm >= 0300)
>   printk("%02x (%02x+%d)\n", FPU_modrm, FPU_modrm & 0xf8, FPU_modrm & 7);
>else
>   printk("/%d\n", (FPU_modrm >> 3) & 7);
>  }
> -  else
> -{
> +  else {
>printk("cs selector = %04x\n", FPU_CS);
>  }
>

Is there any point in changing code inside the #if 0/#endif block?
  
> @@ -76,10 +74,10 @@ void Un_impl(void)
>  /*
> Called for opcodes which are illegal and which are known to result in a
> SIGILL with a real 80486.
> -   */
> +*/
>  void FPU_illegal(void)
>  {
> -  math_abort(FPU_info,SIGILL);
> +  math_abort(FPU_info, SIGILL);
>  }
>  
>  
> @@ -88,61 +86,69 @@ void FPU_printall(void)
>  {
>int i;
>static const char *tag_desc[] = { "Valid", "Zero", "ERROR", "Empty",
> -  "DeNorm", "Inf", "NaN" };
> + "DeNorm", "Inf", "NaN" };

Umm... Why?

>u_char byte1, FPU_modrm;
>unsigned long address = FPU_ORIG_EIP;
>  
>RE_ENTRANT_CHECK_OFF;
>/* No need to check access_ok(), we have previously fetched these bytes. */
>printk("At %p:", (void *) address);
> -  if ( FPU_CS == __USER_CS )
> -{
> +  if (FPU_CS == __USER_CS) {
>  #define MAX_PRINTED_BYTES 20
> -  for ( i = 0; i < MAX_PRINTED_BYTES; i++ )
> - {
> +  for (i = 0; i < MAX_PRINTED_BYTES; i++) {
> FPU_get_user(byte1, (u_char __user *) address);
> -   if ( (byte1 & 0xf8) == 0xd8 )
> - {
> +   if ((byte1 & 0xf8) == 0xd8) {
> printk(" %02x", byte1);
> break;
>   }
> printk(" [%02x]", byte1);
> address++;
>   }
> -  if ( i == MAX_PRINTED_BYTES )
> +  if (i == MAX_PRINTED_BYTES)
>   printk(" [more..]\n");
> -  else
> - {
> +  else {
> FPU_get_user(FPU_modrm, 1 + (u_char __user *) address);
> -   
> +
> if (FPU_modrm >= 0300)
> - printk(" %02x (%02x+%d)\n", FPU_modrm, FPU_modrm & 0xf8, FPU_modrm 
> & 7);
> + printk(" %02x (%02x+%d)\n", FPU_modrm, FPU_modrm & 0xf8,
> + FPU_modrm & 7);
> else
>   printk(" /%d, mod=%d rm=%d\n",
>  (FPU_modrm >> 3) & 7, (FPU_modrm >> 6) & 3, FPU_modrm & 7);
>   }
>  }
>else
> -{
>printk("%04x\n", FPU_CS);
> -}
>  
>partial_status = status_word();
>  
>  #ifdef DEBUGGING
> -if ( partial_status & SW_Backward )printk("SW: 

Re: [PATCH] X86: coding style fixes to arch/x86/math-errors.c

2008-01-27 Thread Dmitri Vorobiev
Paolo Ciarrocchi пишет:
> This file has not been modified since October so should be 
> easy to integrate the following patch.
> 
> Before:
> total: 214 errors, 28 warnings, 739 lines checked
> 
> After:
> total: 4 errors, 28 warnings, 708 lines checked
> 
> Compile tested:
> 
> [EMAIL PROTECTED]:/tmp$ size error.o.*
>textdata bss dec hex filename
>3476   0   03476 d94 error.o.after
>3476   0   03476 d94 error.o.before
> 
> Signed-off-by: Paolo Ciarrocchi <[EMAIL PROTECTED]>
> ---
> 
> The only remaining errors are like the following:
> 
> ERROR: need consistent spacing around '*' (ctx:WxB)
> #110: FILE: errors.c:110:
> + FPU_get_user(FPU_modrm, 1 + (u_char __user *) address);
>  ^
> Any hint on how to fix them?
> 
> 
>  arch/x86/math-emu/errors.c |  405 
> 
>  1 files changed, 187 insertions(+), 218 deletions(-)
> 
> diff --git a/arch/x86/math-emu/errors.c b/arch/x86/math-emu/errors.c
> index a1b0d22..3510abe 100644
> --- a/arch/x86/math-emu/errors.c
> +++ b/arch/x86/math-emu/errors.c
> @@ -43,25 +43,23 @@ void Un_impl(void)
>RE_ENTRANT_CHECK_OFF;
>/* No need to check access_ok(), we have previously fetched these bytes. */
>printk("Unimplemented FPU Opcode at eip=%p : ", (void __user *) address);
> -  if ( FPU_CS == __USER_CS )
> -{
> -  while ( 1 )
> - {
> +  if (FPU_CS == __USER_CS) {
> +  while (1) {
> FPU_get_user(byte1, (u_char __user *) address);
> -   if ( (byte1 & 0xf8) == 0xd8 ) break;
> +   if ((byte1 & 0xf8) == 0xd8)
> + break;
> printk("[%02x]", byte1);
> address++;
>   }
>printk("%02x ", byte1);
>FPU_get_user(FPU_modrm, 1 + (u_char __user *) address);
> -  
> +
>if (FPU_modrm >= 0300)
>   printk("%02x (%02x+%d)\n", FPU_modrm, FPU_modrm & 0xf8, FPU_modrm & 7);
>else
>   printk("/%d\n", (FPU_modrm >> 3) & 7);
>  }
> -  else
> -{
> +  else {
>printk("cs selector = %04x\n", FPU_CS);
>  }
>  
> @@ -76,10 +74,10 @@ void Un_impl(void)
>  /*
> Called for opcodes which are illegal and which are known to result in a
> SIGILL with a real 80486.
> -   */
> +*/
>  void FPU_illegal(void)
>  {
> -  math_abort(FPU_info,SIGILL);
> +  math_abort(FPU_info , SIGILL);

Looks like you're trading bad for worse here.

>  }
>  
>  
> @@ -88,61 +86,69 @@ void FPU_printall(void)
>  {
>int i;
>static const char *tag_desc[] = { "Valid", "Zero", "ERROR", "Empty",
> -  "DeNorm", "Inf", "NaN" };
> + "DeNorm", "Inf", "NaN" };
>u_char byte1, FPU_modrm;
>unsigned long address = FPU_ORIG_EIP;
>  
>RE_ENTRANT_CHECK_OFF;
>/* No need to check access_ok(), we have previously fetched these bytes. */
>printk("At %p:", (void *) address);
> -  if ( FPU_CS == __USER_CS )
> -{
> +  if (FPU_CS == __USER_CS) {
>  #define MAX_PRINTED_BYTES 20
> -  for ( i = 0; i < MAX_PRINTED_BYTES; i++ )
> - {
> +  for (i = 0; i < MAX_PRINTED_BYTES; i++) {
> FPU_get_user(byte1, (u_char __user *) address);
> -   if ( (byte1 & 0xf8) == 0xd8 )
> - {
> +   if ((byte1 & 0xf8) == 0xd8) {
> printk(" %02x", byte1);
> break;
>   }
> printk(" [%02x]", byte1);
> address++;
>   }
> -  if ( i == MAX_PRINTED_BYTES )
> +  if (i == MAX_PRINTED_BYTES)
>   printk(" [more..]\n");
> -  else
> - {
> +  else {
> FPU_get_user(FPU_modrm, 1 + (u_char __user *) address);
> -   
> +
> if (FPU_modrm >= 0300)
> - printk(" %02x (%02x+%d)\n", FPU_modrm, FPU_modrm & 0xf8, FPU_modrm 
> & 7);
> + printk(" %02x (%02x+%d)\n", FPU_modrm, FPU_modrm & 0xf8,
> + FPU_modrm & 7);
> else
>   printk(" /%d, mod=%d rm=%d\n",
>  (FPU_modrm >> 3) & 7, (FPU_modrm >> 6) & 3, FPU_modrm & 7);
>   }
>  }
>else
> -{
>printk("%04x\n", FPU_CS);
> -}
>  
>partial_status = status_word();
>  
>  #ifdef DEBUGGING
> -if ( partial_status & SW_Backward )printk("SW: backward 
> compatibility\n");
> -if ( partial_status & SW_C3 )  printk("SW: condition bit 3\n");
> -if ( partial_status & SW_C2 )  printk("SW: condition bit 2\n");
> -if ( partial_status & SW_C1 )  printk("SW: condition bit 1\n");
> -if ( partial_status & SW_C0 )  printk("SW: condition bit 0\n");
> -if ( partial_status & SW_Summary ) printk("SW: exception summary\n");
> -if ( partial_status & SW_Stack_Fault ) printk("SW: stack fault\n");
> -if ( partial_status & SW_Precision )   printk("SW: loss of precision\n");
> -if ( partial_status & SW_Underflow )   printk("SW: underflow\n");
> -if ( partial_status & SW_Overflow )printk("SW: overflow\n");
> -if ( partial_status & SW_Zero_Div )

Re: [PATCH] X86: coding style fixes to arch/x86/math-errors.c

2008-01-27 Thread Dmitri Vorobiev
Paolo Ciarrocchi пишет:
 This file has not been modified since October so should be 
 easy to integrate the following patch.
 
 Before:
 total: 214 errors, 28 warnings, 739 lines checked
 
 After:
 total: 4 errors, 28 warnings, 708 lines checked
 
 Compile tested:
 
 [EMAIL PROTECTED]:/tmp$ size error.o.*
textdata bss dec hex filename
3476   0   03476 d94 error.o.after
3476   0   03476 d94 error.o.before
 
 Signed-off-by: Paolo Ciarrocchi [EMAIL PROTECTED]
 ---
 
 The only remaining errors are like the following:
 
 ERROR: need consistent spacing around '*' (ctx:WxB)
 #110: FILE: errors.c:110:
 + FPU_get_user(FPU_modrm, 1 + (u_char __user *) address);
  ^
 Any hint on how to fix them?
 
 
  arch/x86/math-emu/errors.c |  405 
 
  1 files changed, 187 insertions(+), 218 deletions(-)
 
 diff --git a/arch/x86/math-emu/errors.c b/arch/x86/math-emu/errors.c
 index a1b0d22..3510abe 100644
 --- a/arch/x86/math-emu/errors.c
 +++ b/arch/x86/math-emu/errors.c
 @@ -43,25 +43,23 @@ void Un_impl(void)
RE_ENTRANT_CHECK_OFF;
/* No need to check access_ok(), we have previously fetched these bytes. */
printk(Unimplemented FPU Opcode at eip=%p : , (void __user *) address);
 -  if ( FPU_CS == __USER_CS )
 -{
 -  while ( 1 )
 - {
 +  if (FPU_CS == __USER_CS) {
 +  while (1) {
 FPU_get_user(byte1, (u_char __user *) address);
 -   if ( (byte1  0xf8) == 0xd8 ) break;
 +   if ((byte1  0xf8) == 0xd8)
 + break;
 printk([%02x], byte1);
 address++;
   }
printk(%02x , byte1);
FPU_get_user(FPU_modrm, 1 + (u_char __user *) address);
 -  
 +
if (FPU_modrm = 0300)
   printk(%02x (%02x+%d)\n, FPU_modrm, FPU_modrm  0xf8, FPU_modrm  7);
else
   printk(/%d\n, (FPU_modrm  3)  7);
  }
 -  else
 -{
 +  else {
printk(cs selector = %04x\n, FPU_CS);
  }
  
 @@ -76,10 +74,10 @@ void Un_impl(void)
  /*
 Called for opcodes which are illegal and which are known to result in a
 SIGILL with a real 80486.
 -   */
 +*/
  void FPU_illegal(void)
  {
 -  math_abort(FPU_info,SIGILL);
 +  math_abort(FPU_info , SIGILL);

Looks like you're trading bad for worse here.

  }
  
  
 @@ -88,61 +86,69 @@ void FPU_printall(void)
  {
int i;
static const char *tag_desc[] = { Valid, Zero, ERROR, Empty,
 -  DeNorm, Inf, NaN };
 + DeNorm, Inf, NaN };
u_char byte1, FPU_modrm;
unsigned long address = FPU_ORIG_EIP;
  
RE_ENTRANT_CHECK_OFF;
/* No need to check access_ok(), we have previously fetched these bytes. */
printk(At %p:, (void *) address);
 -  if ( FPU_CS == __USER_CS )
 -{
 +  if (FPU_CS == __USER_CS) {
  #define MAX_PRINTED_BYTES 20
 -  for ( i = 0; i  MAX_PRINTED_BYTES; i++ )
 - {
 +  for (i = 0; i  MAX_PRINTED_BYTES; i++) {
 FPU_get_user(byte1, (u_char __user *) address);
 -   if ( (byte1  0xf8) == 0xd8 )
 - {
 +   if ((byte1  0xf8) == 0xd8) {
 printk( %02x, byte1);
 break;
   }
 printk( [%02x], byte1);
 address++;
   }
 -  if ( i == MAX_PRINTED_BYTES )
 +  if (i == MAX_PRINTED_BYTES)
   printk( [more..]\n);
 -  else
 - {
 +  else {
 FPU_get_user(FPU_modrm, 1 + (u_char __user *) address);
 -   
 +
 if (FPU_modrm = 0300)
 - printk( %02x (%02x+%d)\n, FPU_modrm, FPU_modrm  0xf8, FPU_modrm 
  7);
 + printk( %02x (%02x+%d)\n, FPU_modrm, FPU_modrm  0xf8,
 + FPU_modrm  7);
 else
   printk( /%d, mod=%d rm=%d\n,
  (FPU_modrm  3)  7, (FPU_modrm  6)  3, FPU_modrm  7);
   }
  }
else
 -{
printk(%04x\n, FPU_CS);
 -}
  
partial_status = status_word();
  
  #ifdef DEBUGGING
 -if ( partial_status  SW_Backward )printk(SW: backward 
 compatibility\n);
 -if ( partial_status  SW_C3 )  printk(SW: condition bit 3\n);
 -if ( partial_status  SW_C2 )  printk(SW: condition bit 2\n);
 -if ( partial_status  SW_C1 )  printk(SW: condition bit 1\n);
 -if ( partial_status  SW_C0 )  printk(SW: condition bit 0\n);
 -if ( partial_status  SW_Summary ) printk(SW: exception summary\n);
 -if ( partial_status  SW_Stack_Fault ) printk(SW: stack fault\n);
 -if ( partial_status  SW_Precision )   printk(SW: loss of precision\n);
 -if ( partial_status  SW_Underflow )   printk(SW: underflow\n);
 -if ( partial_status  SW_Overflow )printk(SW: overflow\n);
 -if ( partial_status  SW_Zero_Div )printk(SW: divide by zero\n);
 -if ( partial_status  SW_Denorm_Op )   printk(SW: denormalized operand\n);
 -if ( partial_status  SW_Invalid ) printk(SW: invalid operation\n);
 +if (partial_status  SW_Backward)
 +  printk(SW: backward compatibility\n);
 

Re: [PATCH] X86: coding style fixes to arch/x86/math-errors.c - take 2

2008-01-27 Thread Dmitri Vorobiev
Paolo Ciarrocchi пишет:
 This file has not been modified since October so should be 
 easy to integrate the following patch.
 
 Before:
 total: 214 errors, 28 warnings, 739 lines checked
 
 After:
 total: 4 errors, 28 warnings, 708 lines checked
 
 Compile tested:
 
 [EMAIL PROTECTED]:/tmp$ size error.o.*
textdata bss dec hex filename
3476   0   03476 d94 error.o.after
3476   0   03476 d94 error.o.before
 
 
 [EMAIL PROTECTED]:/tmp$ md5sum error.o.*
 f0b89bbbc0e24b74b0d78270bd3a4dd1  error.o.after
 a1e8d0723421256a1a21b2fc2add9031  error.o.before
 
 Should I be worried about the md5sum difference?


Looks like it would be better to proceed in the following manner:

1) remove dead code (no md5 change);
2) reformat the lines to use tabs, not spaces (no md5 change);
3) address the else-braces and single statement block errors
   (no md5 change);
4) remove all unnecessary spaces (no md5 change);
5) add the KERN_ macros (md5 will change).
6) address remaining checkpatch complaints (no md5 change wrt #5
   above).

Each item above might get into a separate patch.

See more comments below.
 
 Signed-off-by: Paolo Ciarrocchi [EMAIL PROTECTED]
 ---
 
 The only remaining errors are like the following:
 
 ERROR: need consistent spacing around '*' (ctx:WxB)
 #110: FILE: errors.c:110:
 + FPU_get_user(FPU_modrm, 1 + (u_char __user *) address);
  ^
 Any hint on how to fix them?
 
  arch/x86/math-emu/errors.c |  405 
 
  1 files changed, 187 insertions(+), 218 deletions(-)
 
 diff --git a/arch/x86/math-emu/errors.c b/arch/x86/math-emu/errors.c
 index a1b0d22..fa23366 100644
 --- a/arch/x86/math-emu/errors.c
 +++ b/arch/x86/math-emu/errors.c
 @@ -43,25 +43,23 @@ void Un_impl(void)
RE_ENTRANT_CHECK_OFF;
/* No need to check access_ok(), we have previously fetched these bytes. */
printk(Unimplemented FPU Opcode at eip=%p : , (void __user *) address);
 -  if ( FPU_CS == __USER_CS )
 -{
 -  while ( 1 )
 - {
 +  if (FPU_CS == __USER_CS) {
 +  while (1) {
 FPU_get_user(byte1, (u_char __user *) address);
 -   if ( (byte1  0xf8) == 0xd8 ) break;
 +   if ((byte1  0xf8) == 0xd8)
 + break;
 printk([%02x], byte1);
 address++;
   }
printk(%02x , byte1);
FPU_get_user(FPU_modrm, 1 + (u_char __user *) address);
 -  
 +
if (FPU_modrm = 0300)
   printk(%02x (%02x+%d)\n, FPU_modrm, FPU_modrm  0xf8, FPU_modrm  7);
else
   printk(/%d\n, (FPU_modrm  3)  7);
  }
 -  else
 -{
 +  else {
printk(cs selector = %04x\n, FPU_CS);
  }


Is there any point in changing code inside the #if 0/#endif block?
  
 @@ -76,10 +74,10 @@ void Un_impl(void)
  /*
 Called for opcodes which are illegal and which are known to result in a
 SIGILL with a real 80486.
 -   */
 +*/
  void FPU_illegal(void)
  {
 -  math_abort(FPU_info,SIGILL);
 +  math_abort(FPU_info, SIGILL);
  }
  
  
 @@ -88,61 +86,69 @@ void FPU_printall(void)
  {
int i;
static const char *tag_desc[] = { Valid, Zero, ERROR, Empty,
 -  DeNorm, Inf, NaN };
 + DeNorm, Inf, NaN };

Umm... Why?

u_char byte1, FPU_modrm;
unsigned long address = FPU_ORIG_EIP;
  
RE_ENTRANT_CHECK_OFF;
/* No need to check access_ok(), we have previously fetched these bytes. */
printk(At %p:, (void *) address);
 -  if ( FPU_CS == __USER_CS )
 -{
 +  if (FPU_CS == __USER_CS) {
  #define MAX_PRINTED_BYTES 20
 -  for ( i = 0; i  MAX_PRINTED_BYTES; i++ )
 - {
 +  for (i = 0; i  MAX_PRINTED_BYTES; i++) {
 FPU_get_user(byte1, (u_char __user *) address);
 -   if ( (byte1  0xf8) == 0xd8 )
 - {
 +   if ((byte1  0xf8) == 0xd8) {
 printk( %02x, byte1);
 break;
   }
 printk( [%02x], byte1);
 address++;
   }
 -  if ( i == MAX_PRINTED_BYTES )
 +  if (i == MAX_PRINTED_BYTES)
   printk( [more..]\n);
 -  else
 - {
 +  else {
 FPU_get_user(FPU_modrm, 1 + (u_char __user *) address);
 -   
 +
 if (FPU_modrm = 0300)
 - printk( %02x (%02x+%d)\n, FPU_modrm, FPU_modrm  0xf8, FPU_modrm 
  7);
 + printk( %02x (%02x+%d)\n, FPU_modrm, FPU_modrm  0xf8,
 + FPU_modrm  7);
 else
   printk( /%d, mod=%d rm=%d\n,
  (FPU_modrm  3)  7, (FPU_modrm  6)  3, FPU_modrm  7);
   }
  }
else
 -{
printk(%04x\n, FPU_CS);
 -}
  
partial_status = status_word();
  
  #ifdef DEBUGGING
 -if ( partial_status  SW_Backward )printk(SW: backward 
 compatibility\n);
 -if ( partial_status  SW_C3 )  printk(SW: condition bit 3\n);
 -if ( partial_status  SW_C2 )  printk(SW: condition bit 2\n);
 -if ( partial_status  SW_C1 )  printk(SW: 

Re: [PATCH] X86: coding style fixes to arch/x86/math-errors.c - take 2

2008-01-27 Thread Dmitri Vorobiev
Paolo Ciarrocchi пишет:
 On Jan 27, 2008 11:48 PM, Paolo Ciarrocchi [EMAIL PROTECTED] wrote:
 On Jan 27, 2008 11:42 PM, Ingo Molnar [EMAIL PROTECTED] wrote:
...
 
 How should I compare the .o file?
 Simply doing a md5sum or should I do a objdump -d before?
 Or a strip?
 

Comparing the vmlinux images shoudls suffice. But you'll
have to make sure that the object file resulting from the
C source that you're changing gets linked into vmlinux.

Dmitri

 Ciao,

--
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 v2 8/9] bfs: remove multiple assignments

2008-01-26 Thread Dmitri Vorobiev
Tigran Aivazian wrote:
> On Sat, 26 Jan 2008, Dmitri Vorobiev wrote:
>> -inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC;
>> +inode->i_mtime = CURRENT_TIME_SEC;
>> +inode->i_atime = CURRENT_TIME_SEC;
>> +inode->i_ctime = CURRENT_TIME_SEC;
> 
> multiple assignments like "x = y = z = value;" can potentially
> (depending on the compiler and arch) be faster than "x = value; y =
> value; z=value;"
> 
> I am surprized that this script complains about them as it is a
> perfectly valid thing to do in C.

I think it seems wise to ask the maintainers of checkpatch.pl to
comment on that. I'm Cc:ing them now.

Thanks,

Dmitri

--
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 v2 8/9] bfs: remove multiple assignments

2008-01-26 Thread Dmitri Vorobiev
Tigran Aivazian wrote:
 On Sat, 26 Jan 2008, Dmitri Vorobiev wrote:
 -inode-i_mtime = inode-i_atime = inode-i_ctime = CURRENT_TIME_SEC;
 +inode-i_mtime = CURRENT_TIME_SEC;
 +inode-i_atime = CURRENT_TIME_SEC;
 +inode-i_ctime = CURRENT_TIME_SEC;
 
 multiple assignments like x = y = z = value; can potentially
 (depending on the compiler and arch) be faster than x = value; y =
 value; z=value;
 
 I am surprized that this script complains about them as it is a
 perfectly valid thing to do in C.

I think it seems wise to ask the maintainers of checkpatch.pl to
comment on that. I'm Cc:ing them now.

Thanks,

Dmitri

--
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 5/9] bfs: move function prototype to the proper header file

2008-01-25 Thread Dmitri Vorobiev
Adrian Bunk пишет:
> On Thu, Jan 24, 2008 at 11:22:21PM +, Tigran Aivazian wrote:
>> On Fri, 25 Jan 2008, Dmitri Vorobiev wrote:
>>
>>> Heikki Orsila пишет:
>>>>> +extern void dump_imap(const char *, struct super_block *);
>>>>> +
>>>> Functions should not be externed, remove extern keyword.
>>>>
>>> Care to explain why?
>> because dump_imap() is just a BFS' internal helper (for debugging 
>> purposes only btw) to dump the inode map via printk. Why should it be 
>> moved into the header, i.e. where one expects to see things potentially 
>> visible by the rest of the kernel?
>> ...
> 
> fs/bfs/bfs.h is not visible to the rest of the kernel, it's the right 
> place for bfs-internal code.
> 
> Whether there's an "extern" written is just a syntax thing with zero 
> semantical implications. We tend to not write the "extern" in the 
> kernel, but that's nothing cast in stone.

Adrian, thanks for the feedback.

The next version of this patch series will not have the extern keyword
for this helper. I'll try to have the second version sent to trivial
by tomorrow.

Dmitri

--
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 0/9] bfs: assorted cleanups

2008-01-25 Thread Dmitri Vorobiev
Dmitri Vorobiev пишет:
> Hello Adrian,
> 
> Last time when I had sent some BFS bugfixes to the maintainer of
> this filesystem driver, he did not respond, and Andrew Morton
> had to take care of those.
> 
> For this reason, and because the patches in this little patch bomb
> are trivial, I am sending this to you in the hope that these can
> be pushed upstream when the next merge window opens.

Adrian, please drop this version of the patches. I'll send you a new
one addressing the feedback and indicating the ack I received from the
driver maintainer in a private email.

Thanks,

Dmitri
--
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 0/9] bfs: assorted cleanups

2008-01-25 Thread Dmitri Vorobiev
Dmitri Vorobiev пишет:
 Hello Adrian,
 
 Last time when I had sent some BFS bugfixes to the maintainer of
 this filesystem driver, he did not respond, and Andrew Morton
 had to take care of those.
 
 For this reason, and because the patches in this little patch bomb
 are trivial, I am sending this to you in the hope that these can
 be pushed upstream when the next merge window opens.

Adrian, please drop this version of the patches. I'll send you a new
one addressing the feedback and indicating the ack I received from the
driver maintainer in a private email.

Thanks,

Dmitri
--
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 5/9] bfs: move function prototype to the proper header file

2008-01-25 Thread Dmitri Vorobiev
Adrian Bunk пишет:
 On Thu, Jan 24, 2008 at 11:22:21PM +, Tigran Aivazian wrote:
 On Fri, 25 Jan 2008, Dmitri Vorobiev wrote:

 Heikki Orsila пишет:
 +extern void dump_imap(const char *, struct super_block *);
 +
 Functions should not be externed, remove extern keyword.

 Care to explain why?
 because dump_imap() is just a BFS' internal helper (for debugging 
 purposes only btw) to dump the inode map via printk. Why should it be 
 moved into the header, i.e. where one expects to see things potentially 
 visible by the rest of the kernel?
 ...
 
 fs/bfs/bfs.h is not visible to the rest of the kernel, it's the right 
 place for bfs-internal code.
 
 Whether there's an extern written is just a syntax thing with zero 
 semantical implications. We tend to not write the extern in the 
 kernel, but that's nothing cast in stone.

Adrian, thanks for the feedback.

The next version of this patch series will not have the extern keyword
for this helper. I'll try to have the second version sent to trivial
by tomorrow.

Dmitri

--
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 5/9] bfs: move function prototype to the proper header file

2008-01-24 Thread Dmitri Vorobiev
Heikki Orsila пишет:
> On Fri, Jan 25, 2008 at 02:13:00AM +0300, Dmitri Vorobiev wrote:
>> Care to explain why?
> 
> Because functions are always external objects in C. I just verified that 
> from K
> 

Yes, I know that :)

The reasons behind me using this keyword were: 1) to keep the code symmetric;
2)-4) as explained elsewhere in this thread.

Anyways, you and Tigran have been convincing enough and the corrected patch
is there.

Thanks,

Dmitri
--
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 5/9] bfs: move function prototype to the proper header file

2008-01-24 Thread Dmitri Vorobiev
Tigran Aivazian пишет:
> On Fri, 25 Jan 2008, Dmitri Vorobiev wrote:
> 
>> Heikki Orsila пишет:
>>>> +extern void dump_imap(const char *, struct super_block *);
>>>> +
>>>
>>> Functions should not be externed, remove extern keyword.
>>>
>>
>> Care to explain why?
> 
> because dump_imap() is just a BFS' internal helper (for debugging
> purposes only btw) to dump the inode map via printk. Why should it be
> moved into the header, i.e. where one expects to see things potentially
> visible by the rest of the kernel?
>

Thanks, Tigran.

Please find below the corrected version. Compilation test passed successfully.

Dmitri
 
==

The dump_imap() routine is defined in bs/bfs/inode.c and used both in
the same file and in fs/bfs/dir.c. This patch adds an extern function
declaration to the private bfs.h header file.

The effect is that one warning issued by checkpatch.pl is gone.

Before the patch:

$ ./scripts/checkpatch.pl --file  fs/bfs/dir.c | grep total
total: 0 errors, 1 warnings, 370 lines checked

After the patch:

$ ./scripts/checkpatch.pl --file  fs/bfs/dir.c | grep total
total: 0 errors, 0 warnings, 368 lines checked

This patch was compile-tested by building the BFS driver both
as a module and as a part of the kernel proper.

Signed-off-by: Dmitri Vorobiev <[EMAIL PROTECTED]>
---
diff --git a/fs/bfs/bfs.h b/fs/bfs/bfs.h
index 090b96e..352804f 100644
--- a/fs/bfs/bfs.h
+++ b/fs/bfs/bfs.h
@@ -54,4 +54,7 @@ extern const struct address_space_operations bfs_aops;
 extern const struct inode_operations bfs_dir_inops;
 extern const struct file_operations bfs_dir_operations;
 
+/* inode.c */
+void dump_imap(const char *, struct super_block *);
+
 #endif /* _FS_BFS_BFS_H */
diff --git a/fs/bfs/dir.c b/fs/bfs/dir.c
index 5462a5b..2964505 100644
--- a/fs/bfs/dir.c
+++ b/fs/bfs/dir.c
@@ -81,8 +81,6 @@ const struct file_operations bfs_dir_operations = {
.fsync  = file_fsync,
 };
 
-extern void dump_imap(const char *, struct super_block *);
-
 static int bfs_create(struct inode *dir, struct dentry *dentry, int mode,
struct nameidata *nd)
 {
diff --git a/fs/bfs/inode.c b/fs/bfs/inode.c
index 5191990..91d5686 100644
--- a/fs/bfs/inode.c
+++ b/fs/bfs/inode.c
@@ -30,8 +30,6 @@ MODULE_LICENSE("GPL");
 #define dprintf(x...)
 #endif
 
-void dump_imap(const char *prefix, struct super_block *s);
-
 static void bfs_read_inode(struct inode *inode)
 {
unsigned long ino = inode->i_ino;

--
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 5/9] bfs: move function prototype to the proper header file

2008-01-24 Thread Dmitri Vorobiev
Heikki Orsila пишет:
> On Fri, Jan 25, 2008 at 01:32:04AM +0300, Dmitri Vorobiev wrote:
>> diff --git a/fs/bfs/bfs.h b/fs/bfs/bfs.h
>> index 090b96e..ecc74bb 100644
>> --- a/fs/bfs/bfs.h
>> +++ b/fs/bfs/bfs.h
> ...
>> +/* inode.c */
>> +extern void dump_imap(const char *, struct super_block *);
>> +
> 
> Functions should not be externed, remove extern keyword.
> 

Care to explain why?

Following is an explanation why the contrary is probably true:

1) We have lots of precedents in existing code:

[EMAIL PROTECTED]:~/Projects/misc/linux$ git-grep 'extern void' include | wc -l
5523
[EMAIL PROTECTED]:~/Projects/misc/linux$

2) Linus' Coding style does not mandate what you requested.

3) The checkpatch.pl did not complain at this particular patch.

Thanks,

Dmitri

--
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 8/9] bfs: remove multiple assignments

2008-01-24 Thread Dmitri Vorobiev
The checkpatch.pl reported several warnings about multiple variable
assignments in the BFS driver sources. This trivial patch fixes these
warnings by giving each assignment its own line.

No functional changes introduced.

This patch was compile-tested by building the BFS driver both
as a module and as a part of the kernel proper.

Signed-off-by: Dmitri Vorobiev <[EMAIL PROTECTED]>
---
 fs/bfs/dir.c   |   13 +
 fs/bfs/file.c  |6 --
 fs/bfs/inode.c |7 +--
 3 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/fs/bfs/dir.c b/fs/bfs/dir.c
index 2964505..94fed7a 100644
--- a/fs/bfs/dir.c
+++ b/fs/bfs/dir.c
@@ -104,7 +104,9 @@ static int bfs_create(struct inode *dir, struct dentry 
*dentry, int mode,
info->si_freei--;
inode->i_uid = current->fsuid;
inode->i_gid = (dir->i_mode & S_ISGID) ? dir->i_gid : current->fsgid;
-   inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC;
+   inode->i_mtime = CURRENT_TIME_SEC;
+   inode->i_atime = CURRENT_TIME_SEC;
+   inode->i_ctime = CURRENT_TIME_SEC;
inode->i_blocks = 0;
inode->i_op = _file_inops;
inode->i_fop = _file_operations;
@@ -200,7 +202,8 @@ static int bfs_unlink(struct inode *dir, struct dentry 
*dentry)
}
de->ino = 0;
mark_buffer_dirty(bh);
-   dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC;
+   dir->i_ctime = CURRENT_TIME_SEC;
+   dir->i_mtime = CURRENT_TIME_SEC;
mark_inode_dirty(dir);
inode->i_ctime = dir->i_ctime;
inode_dec_link_count(inode);
@@ -220,7 +223,8 @@ static int bfs_rename(struct inode *old_dir, struct dentry 
*old_dentry,
struct bfs_dirent *old_de, *new_de;
int error = -ENOENT;
 
-   old_bh = new_bh = NULL;
+   old_bh = NULL;
+   new_bh = NULL;
old_inode = old_dentry->d_inode;
if (S_ISDIR(old_inode->i_mode))
return -EINVAL;
@@ -252,7 +256,8 @@ static int bfs_rename(struct inode *old_dir, struct dentry 
*old_dentry,
goto end_rename;
}
old_de->ino = 0;
-   old_dir->i_ctime = old_dir->i_mtime = CURRENT_TIME_SEC;
+   old_dir->i_ctime = CURRENT_TIME_SEC;
+   old_dir->i_mtime = CURRENT_TIME_SEC;
mark_inode_dirty(old_dir);
if (new_inode) {
new_inode->i_ctime = CURRENT_TIME_SEC;
diff --git a/fs/bfs/file.c b/fs/bfs/file.c
index f32b2a2..ab2fa66 100644
--- a/fs/bfs/file.c
+++ b/fs/bfs/file.c
@@ -111,7 +111,8 @@ static int bfs_get_block(struct inode *inode, sector_t 
block,
create, (unsigned long)block, phys);
map_bh(bh_result, sb, phys);
info->si_freeb -= phys - bi->i_eblock;
-   info->si_lf_eblk = bi->i_eblock = phys;
+   info->si_lf_eblk = phys;
+   bi->i_eblock = phys;
mark_inode_dirty(inode);
mark_buffer_dirty(sbh);
err = 0;
@@ -140,7 +141,8 @@ static int bfs_get_block(struct inode *inode, sector_t 
block,
create, (unsigned long)block, phys);
bi->i_sblock = phys;
phys += block;
-   info->si_lf_eblk = bi->i_eblock = phys;
+   info->si_lf_eblk = phys;
+   bi->i_eblock = phys;
 
/*
 * This assumes nothing can write the inode back while we are here
diff --git a/fs/bfs/inode.c b/fs/bfs/inode.c
index 91d5686..7eefafb 100644
--- a/fs/bfs/inode.c
+++ b/fs/bfs/inode.c
@@ -157,7 +157,9 @@ static void bfs_delete_inode(struct inode *inode)
}
 
inode->i_size = 0;
-   inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC;
+   inode->i_atime = CURRENT_TIME_SEC;
+   inode->i_mtime = CURRENT_TIME_SEC;
+   inode->i_ctime = CURRENT_TIME_SEC;
lock_kernel();
mark_inode_dirty(inode);
 
@@ -213,7 +215,8 @@ static int bfs_statfs(struct dentry *dentry, struct kstatfs 
*buf)
buf->f_type = BFS_MAGIC;
buf->f_bsize = s->s_blocksize;
buf->f_blocks = info->si_blocks;
-   buf->f_bfree = buf->f_bavail = info->si_freeb;
+   buf->f_bfree = info->si_freeb;
+   buf->f_bavail = info->si_freeb;
buf->f_files = info->si_lasti + 1 - BFS_ROOT_INO;
buf->f_ffree = info->si_freei;
buf->f_fsid.val[0] = (u32)id;
-- 
1.5.3

--
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 9/9] bfs: use the proper header file for inclusion

2008-01-24 Thread Dmitri Vorobiev
The checkpatch.pl reported the following warning:

$ ./scripts/checkpatch.pl --strict --file fs/bfs/inode.c
CHECK: Use #include  instead of 
+#include 

This patch fixes this warning.

No functional changes introduced.

This patch was compile-tested by building the BFS driver both
as a module and as a part of the kernel proper.

Signed-off-by: Dmitri Vorobiev <[EMAIL PROTECTED]>
---
 fs/bfs/inode.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/bfs/inode.c b/fs/bfs/inode.c
index 7eefafb..00c54fa 100644
--- a/fs/bfs/inode.c
+++ b/fs/bfs/inode.c
@@ -15,7 +15,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include "bfs.h"
 
 MODULE_AUTHOR("Tigran Aivazian <[EMAIL PROTECTED]>");
-- 
1.5.3

--
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 6/9] bfs: coding style cleanup in fs/bfs/file.c

2008-01-24 Thread Dmitri Vorobiev
Clean up errors found by checkpatch.pl.

Before the patch:

$ ./scripts/checkpatch.pl --file  fs/bfs/file.c | grep total
total: 6 errors, 0 warnings, 191 lines checked

After the patch:

$ ./scripts/checkpatch.pl --file  fs/bfs/file.c | grep total
total: 0 errors, 0 warnings, 191 lines checked

No functional changes introduced.

This patch was compile-tested by building the BFS driver both
as a module and as a part of the kernel proper.

Signed-off-by: Dmitri Vorobiev <[EMAIL PROTECTED]>
---
 fs/bfs/file.c |   12 ++--
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/fs/bfs/file.c b/fs/bfs/file.c
index b11e63e..f32b2a2 100644
--- a/fs/bfs/file.c
+++ b/fs/bfs/file.c
@@ -55,7 +55,7 @@ static int bfs_move_blocks(struct super_block *sb, unsigned 
long start,
 
dprintf("%08lx-%08lx->%08lx\n", start, end, where);
for (i = start; i <= end; i++)
-   if(bfs_move_block(i, where + i, sb)) {
+   if (bfs_move_block(i, where + i, sb)) {
dprintf("failed to move block %08lx -> %08lx\n", i,
where + i);
return -EIO;
@@ -77,7 +77,7 @@ static int bfs_get_block(struct inode *inode, sector_t block,
if (!create) {
if (phys <= bi->i_eblock) {
dprintf("c=%d, b=%08lx, phys=%09lx (granted)\n",
-create, (unsigned long)block, phys);
+   create, (unsigned long)block, phys);
map_bh(bh_result, sb, phys);
}
return 0;
@@ -88,7 +88,7 @@ static int bfs_get_block(struct inode *inode, sector_t block,
 * range of blocks allocated for this file, we can grant it.
 */
if (bi->i_sblock && (phys <= bi->i_eblock)) {
-   dprintf("c=%d, b=%08lx, phys=%08lx (interim block granted)\n", 
+   dprintf("c=%d, b=%08lx, phys=%08lx (interim block granted)\n",
create, (unsigned long)block, phys);
map_bh(bh_result, sb, phys);
return 0;
@@ -107,7 +107,7 @@ static int bfs_get_block(struct inode *inode, sector_t 
block,
 * anywhere.
 */
if (bi->i_eblock == info->si_lf_eblk) {
-   dprintf("c=%d, b=%08lx, phys=%08lx (simple extension)\n", 
+   dprintf("c=%d, b=%08lx, phys=%08lx (simple extension)\n",
create, (unsigned long)block, phys);
map_bh(bh_result, sb, phys);
info->si_freeb -= phys - bi->i_eblock;
@@ -126,7 +126,7 @@ static int bfs_get_block(struct inode *inode, sector_t 
block,
}
 
if (bi->i_sblock) {
-   err = bfs_move_blocks(inode->i_sb, bi->i_sblock, 
+   err = bfs_move_blocks(inode->i_sb, bi->i_sblock,
bi->i_eblock, phys);
if (err) {
dprintf("failed to move ino=%08lx -> fs corruption\n",
@@ -137,7 +137,7 @@ static int bfs_get_block(struct inode *inode, sector_t 
block,
err = 0;
 
dprintf("c=%d, b=%08lx, phys=%08lx (moved)\n",
-create, (unsigned long)block, phys);
+   create, (unsigned long)block, phys);
bi->i_sblock = phys;
phys += block;
info->si_lf_eblk = bi->i_eblock = phys;
-- 
1.5.3

--
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 7/9] bfs: coding style cleanup in include/linux/bfs_fs.h

2008-01-24 Thread Dmitri Vorobiev
Clean up errors found by checkpatch.pl.

Before the patch:

$ ./scripts/checkpatch.pl --file  include/linux/bfs_fs.h | grep total
total: 5 errors, 3 warnings, 80 lines checked

After the patch:

$ ./scripts/checkpatch.pl --file  include/linux/bfs_fs.h | grep total
total: 0 errors, 0 warnings, 83 lines checked

No functional changes introduced.

This patch was compile-tested by building the BFS driver both
as a module and as a part of the kernel proper.

Signed-off-by: Dmitri Vorobiev <[EMAIL PROTECTED]>
---
 include/linux/bfs_fs.h |   17 ++---
 1 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/include/linux/bfs_fs.h b/include/linux/bfs_fs.h
index 8ed6dfd..d7b11a6 100644
--- a/include/linux/bfs_fs.h
+++ b/include/linux/bfs_fs.h
@@ -36,7 +36,7 @@ struct bfs_inode {
__u32 i_padding[4];
 };
 
-#define BFS_NAMELEN14  
+#define BFS_NAMELEN14
 #define BFS_DIRENT_SIZE16
 #define BFS_DIRS_PER_BLOCK 32
 
@@ -61,20 +61,23 @@ struct bfs_super_block {
 
 
 #define BFS_OFF2INO(offset) \
-offset) - BFS_BSIZE) / sizeof(struct bfs_inode)) + BFS_ROOT_INO)
+   offset) - BFS_BSIZE) / sizeof(struct bfs_inode)) + BFS_ROOT_INO)
 
 #define BFS_INO2OFF(ino) \
((__u32)(((ino) - BFS_ROOT_INO) * sizeof(struct bfs_inode)) + BFS_BSIZE)
 #define BFS_NZFILESIZE(ip) \
-((le32_to_cpu((ip)->i_eoffset) + 1) -  le32_to_cpu((ip)->i_sblock) * 
BFS_BSIZE)
+   ((le32_to_cpu((ip)->i_eoffset) + 1) - \
+le32_to_cpu((ip)->i_sblock) * BFS_BSIZE)
 
 #define BFS_FILESIZE(ip) \
-((ip)->i_sblock == 0 ? 0 : BFS_NZFILESIZE(ip))
+   ((ip)->i_sblock == 0 ? 0 : BFS_NZFILESIZE(ip))
 
 #define BFS_FILEBLOCKS(ip) \
-((ip)->i_sblock == 0 ? 0 : (le32_to_cpu((ip)->i_eblock) + 1) -  
le32_to_cpu((ip)->i_sblock))
+   ((ip)->i_sblock == 0 ? 0 : (le32_to_cpu((ip)->i_eblock) + 1) - \
+le32_to_cpu((ip)->i_sblock))
 #define BFS_UNCLEAN(bfs_sb, sb)\
-   ((le32_to_cpu(bfs_sb->s_from) != -1) && (le32_to_cpu(bfs_sb->s_to) != 
-1) && !(sb->s_flags & MS_RDONLY))
-
+   ((le32_to_cpu(bfs_sb->s_from) != -1) && \
+   (le32_to_cpu(bfs_sb->s_to) != -1) && \
+   !(sb->s_flags & MS_RDONLY))
 
 #endif /* _LINUX_BFS_FS_H */
-- 
1.5.3

--
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 3/9] bfs: coding style cleanup in fs/bfs/bfs.h

2008-01-24 Thread Dmitri Vorobiev
Clean up errors found by checkpatch.pl.

Before the patch:

$ ./scripts/checkpatch.pl --file  fs/bfs/bfs.h | grep total
total: 2 errors, 0 warnings, 57 lines checked

After the patch:

$ ./scripts/checkpatch.pl --file  fs/bfs/bfs.h | grep total
total: 0 errors, 0 warnings, 57 lines checked

No functional changes introduced.

This patch was compile-tested by building the BFS driver both
as a module and as a part of the kernel proper.

Signed-off-by: Dmitri Vorobiev <[EMAIL PROTECTED]>
---
 fs/bfs/bfs.h |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/bfs/bfs.h b/fs/bfs/bfs.h
index ac7a8b1..090b96e 100644
--- a/fs/bfs/bfs.h
+++ b/fs/bfs/bfs.h
@@ -16,8 +16,8 @@ struct bfs_sb_info {
unsigned long si_freei;
unsigned long si_lf_eblk;
unsigned long si_lasti;
-   unsigned long * si_imap;
-   struct buffer_head * si_sbh;/* buffer header w/superblock */
+   unsigned long *si_imap;
+   struct buffer_head *si_sbh; /* buffer header w/superblock */
 };
 
 /*
-- 
1.5.3

--
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 4/9] bfs: coding style cleanup in fs/bfs/dir.c

2008-01-24 Thread Dmitri Vorobiev
Clean up errors found by checkpatch.pl.

Before the patch:

$ ./scripts/checkpatch.pl --file  fs/bfs/dir.c | grep total
total: 7 errors, 1 warnings, 370 lines checked

After the patch:

$ ./scripts/checkpatch.pl --file  fs/bfs/dir.c | grep total
total: 0 errors, 1 warnings, 370 lines checked

No functional changes introduced.

This patch was compile-tested by building the BFS driver both
as a module and as a part of the kernel proper.

Signed-off-by: Dmitri Vorobiev <[EMAIL PROTECTED]>
---
 fs/bfs/dir.c |   14 +++---
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/fs/bfs/dir.c b/fs/bfs/dir.c
index 1fd056d..5462a5b 100644
--- a/fs/bfs/dir.c
+++ b/fs/bfs/dir.c
@@ -72,7 +72,7 @@ static int bfs_readdir(struct file *f, void *dirent, 
filldir_t filldir)
}
 
unlock_kernel();
-   return 0;   
+   return 0;
 }
 
 const struct file_operations bfs_dir_operations = {
@@ -117,7 +117,7 @@ static int bfs_create(struct inode *dir, struct dentry 
*dentry, int mode,
BFS_I(inode)->i_sblock = 0;
BFS_I(inode)->i_eblock = 0;
insert_inode_hash(inode);
-mark_inode_dirty(inode);
+   mark_inode_dirty(inode);
dump_imap("create", s);
 
err = bfs_add_entry(dir, dentry->d_name.name, dentry->d_name.len,
@@ -228,8 +228,8 @@ static int bfs_rename(struct inode *old_dir, struct dentry 
*old_dentry,
return -EINVAL;
 
lock_kernel();
-   old_bh = bfs_find_entry(old_dir, 
-   old_dentry->d_name.name, 
+   old_bh = bfs_find_entry(old_dir,
+   old_dentry->d_name.name,
old_dentry->d_name.len, _de);
 
if (!old_bh || (le16_to_cpu(old_de->ino) != old_inode->i_ino))
@@ -237,8 +237,8 @@ static int bfs_rename(struct inode *old_dir, struct dentry 
*old_dentry,
 
error = -EPERM;
new_inode = new_dentry->d_inode;
-   new_bh = bfs_find_entry(new_dir, 
-   new_dentry->d_name.name, 
+   new_bh = bfs_find_entry(new_dir,
+   new_dentry->d_name.name,
new_dentry->d_name.len, _de);
 
if (new_bh && !new_inode) {
@@ -246,7 +246,7 @@ static int bfs_rename(struct inode *old_dir, struct dentry 
*old_dentry,
new_bh = NULL;
}
if (!new_bh) {
-   error = bfs_add_entry(new_dir, 
+   error = bfs_add_entry(new_dir,
new_dentry->d_name.name,
new_dentry->d_name.len,
old_inode->i_ino);
-- 
1.5.3

--
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 5/9] bfs: move function prototype to the proper header file

2008-01-24 Thread Dmitri Vorobiev
The dump_imap() routine is defined in bs/bfs/inode.c and used both in
the same file and in fs/bfs/dir.c. This patch adds an extern function
declaration to the private bfs.h header file.

The effect is that one warning issued by checkpatch.pl is gone.

Before the patch:

$ ./scripts/checkpatch.pl --file  fs/bfs/dir.c | grep total
total: 0 errors, 1 warnings, 370 lines checked

After the patch:

$ ./scripts/checkpatch.pl --file  fs/bfs/dir.c | grep total
total: 0 errors, 0 warnings, 368 lines checked

This patch was compile-tested by building the BFS driver both
as a module and as a part of the kernel proper.

Signed-off-by: Dmitri Vorobiev <[EMAIL PROTECTED]>
---
 fs/bfs/bfs.h   |3 +++
 fs/bfs/dir.c   |2 --
 fs/bfs/inode.c |2 --
 3 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/fs/bfs/bfs.h b/fs/bfs/bfs.h
index 090b96e..ecc74bb 100644
--- a/fs/bfs/bfs.h
+++ b/fs/bfs/bfs.h
@@ -54,4 +54,7 @@ extern const struct address_space_operations bfs_aops;
 extern const struct inode_operations bfs_dir_inops;
 extern const struct file_operations bfs_dir_operations;
 
+/* inode.c */
+extern void dump_imap(const char *, struct super_block *);
+
 #endif /* _FS_BFS_BFS_H */
diff --git a/fs/bfs/dir.c b/fs/bfs/dir.c
index 5462a5b..2964505 100644
--- a/fs/bfs/dir.c
+++ b/fs/bfs/dir.c
@@ -81,8 +81,6 @@ const struct file_operations bfs_dir_operations = {
.fsync  = file_fsync,
 };
 
-extern void dump_imap(const char *, struct super_block *);
-
 static int bfs_create(struct inode *dir, struct dentry *dentry, int mode,
struct nameidata *nd)
 {
diff --git a/fs/bfs/inode.c b/fs/bfs/inode.c
index 5191990..91d5686 100644
--- a/fs/bfs/inode.c
+++ b/fs/bfs/inode.c
@@ -30,8 +30,6 @@ MODULE_LICENSE("GPL");
 #define dprintf(x...)
 #endif
 
-void dump_imap(const char *prefix, struct super_block *s);
-
 static void bfs_read_inode(struct inode *inode)
 {
unsigned long ino = inode->i_ino;
-- 
1.5.3

--
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 1/9] bfs: remove a useless variable

2008-01-24 Thread Dmitri Vorobiev
In the bfs_fill_super() routine, the "sblock" variable is declared
and assigned a value. However, this value is never used. This trivial
patch removes this useless variable.

This was compile-tested by building the bfs driver both as a module
and as a part of the kernel proper. Both build finished successfully.

Run time test was performed using a BFS image and verifying that the
filesystem remained functional after the change.

Signed-off-by: Dmitri Vorobiev <[EMAIL PROTECTED]>
---
 fs/bfs/inode.c |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/fs/bfs/inode.c b/fs/bfs/inode.c
index a64a71d..2284657 100644
--- a/fs/bfs/inode.c
+++ b/fs/bfs/inode.c
@@ -368,7 +368,7 @@ static int bfs_fill_super(struct super_block *s, void 
*data, int silent)
struct bfs_inode *di;
int block = (i - BFS_ROOT_INO) / BFS_INODES_PER_BLOCK + 1;
int off = (i - BFS_ROOT_INO) % BFS_INODES_PER_BLOCK;
-   unsigned long sblock, eblock;
+   unsigned long eblock;
 
if (!off) {
brelse(bh);
@@ -387,7 +387,6 @@ static int bfs_fill_super(struct super_block *s, void 
*data, int silent)
set_bit(i, info->si_imap);
info->si_freeb -= BFS_FILEBLOCKS(di);
 
-   sblock =  le32_to_cpu(di->i_sblock);
eblock =  le32_to_cpu(di->i_eblock);
if (eblock > info->si_lf_eblk)
info->si_lf_eblk = eblock;
-- 
1.5.3

--
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 2/9] bfs: coding style cleanup in fs/bfs/inode.c

2008-01-24 Thread Dmitri Vorobiev
This patch cleans up errors found by checkpatch.pl.

Before the patch:

$ ./scripts/checkpatch.pl --file fs/bfs/inode.c  | grep total
total: 11 errors, 0 warnings, 445 lines checked

After the patch:

$ ./scripts/checkpatch.pl --file fs/bfs/inode.c  | grep total
total: 0 errors, 0 warnings, 446 lines checked

No functional changes introduced.

This patch was compile-tested by building the BFS driver both
as a module and as a part of the kernel proper.

Signed-off-by: Dmitri Vorobiev <[EMAIL PROTECTED]>
---
 fs/bfs/inode.c |   23 ---
 1 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/fs/bfs/inode.c b/fs/bfs/inode.c
index 2284657..5191990 100644
--- a/fs/bfs/inode.c
+++ b/fs/bfs/inode.c
@@ -90,12 +90,12 @@ static void bfs_read_inode(struct inode *inode)
 static int bfs_write_inode(struct inode *inode, int unused)
 {
unsigned int ino = (u16)inode->i_ino;
-unsigned long i_sblock;
+   unsigned long i_sblock;
struct bfs_inode *di;
struct buffer_head *bh;
int block, off;
 
-dprintf("ino=%08x\n", ino);
+   dprintf("ino=%08x\n", ino);
 
if ((ino < BFS_ROOT_INO) || (ino > BFS_SB(inode->i_sb)->si_lasti)) {
printf("Bad inode number %s:%08x\n", inode->i_sb->s_id, ino);
@@ -128,7 +128,7 @@ static int bfs_write_inode(struct inode *inode, int unused)
di->i_atime = cpu_to_le32(inode->i_atime.tv_sec);
di->i_mtime = cpu_to_le32(inode->i_mtime.tv_sec);
di->i_ctime = cpu_to_le32(inode->i_ctime.tv_sec);
-i_sblock = BFS_I(inode)->i_sblock;
+   i_sblock = BFS_I(inode)->i_sblock;
di->i_sblock = cpu_to_le32(i_sblock);
di->i_eblock = cpu_to_le32(BFS_I(inode)->i_eblock);
di->i_eoffset = cpu_to_le32(i_sblock * BFS_BSIZE + inode->i_size - 1);
@@ -157,7 +157,7 @@ static void bfs_delete_inode(struct inode *inode)
printf("invalid ino=%08lx\n", ino);
return;
}
-   
+
inode->i_size = 0;
inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC;
lock_kernel();
@@ -177,13 +177,13 @@ static void bfs_delete_inode(struct inode *inode)
mark_buffer_dirty(bh);
brelse(bh);
 
-if (bi->i_dsk_ino) {
+   if (bi->i_dsk_ino) {
if (bi->i_sblock)
info->si_freeb += bi->i_eblock + 1 - bi->i_sblock;
info->si_freei++;
clear_bit(ino, info->si_imap);
dump_imap("delete_inode", s);
-}
+   }
 
/*
 * If this was the last file, make the previous block
@@ -293,7 +293,8 @@ void dump_imap(const char *prefix, struct super_block *s)
if (!tmpbuf)
return;
for (i = BFS_SB(s)->si_lasti; i >= 0; i--) {
-   if (i > PAGE_SIZE - 100) break;
+   if (i > PAGE_SIZE - 100)
+   break;
if (test_bit(i, BFS_SB(s)->si_imap))
strcat(tmpbuf, "1");
else
@@ -321,12 +322,12 @@ static int bfs_fill_super(struct super_block *s, void 
*data, int silent)
sb_set_blocksize(s, BFS_BSIZE);
 
bh = sb_bread(s, 0);
-   if(!bh)
+   if (!bh)
goto out;
bfs_sb = (struct bfs_super_block *)bh->b_data;
if (le32_to_cpu(bfs_sb->s_magic) != BFS_MAGIC) {
if (!silent)
-   printf("No BFS filesystem on %s (magic=%08x)\n", 
+   printf("No BFS filesystem on %s (magic=%08x)\n",
s->s_id,  le32_to_cpu(bfs_sb->s_magic));
goto out;
}
@@ -395,7 +396,7 @@ static int bfs_fill_super(struct super_block *s, void 
*data, int silent)
if (!(s->s_flags & MS_RDONLY)) {
mark_buffer_dirty(info->si_sbh);
s->s_dirt = 1;
-   } 
+   }
dump_imap("read_super", s);
return 0;
 
@@ -425,7 +426,7 @@ static int __init init_bfs_fs(void)
int err = init_inodecache();
if (err)
goto out1;
-err = register_filesystem(_fs_type);
+   err = register_filesystem(_fs_type);
if (err)
goto out;
return 0;
-- 
1.5.3

--
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 0/9] bfs: assorted cleanups

2008-01-24 Thread Dmitri Vorobiev
Hello Adrian,

Last time when I had sent some BFS bugfixes to the maintainer of
this filesystem driver, he did not respond, and Andrew Morton
had to take care of those.

For this reason, and because the patches in this little patch bomb
are trivial, I am sending this to you in the hope that these can
be pushed upstream when the next merge window opens.

In case you'll be wondering why I need BFS: I teach system programming
and operating systems at the premises of the Moscow State University.
The BFS code is used as an example of a simple filesystem driver
implementation in Linux. This hopefully explains why I want to have
clean code in here :)

Some checkpatch.pl stats follow.

Before:


| | errors | warnings | checks |

| bfs.h   |   2|0 |   0|

| dir.c   |   7|1 |   4|

| file.c  |   6|0 |   2|

| inode.c |   11   |0 |   3|


After:


| | errors | warnings | checks |

| bfs.h   |   0|0 |   0|

| dir.c   |   0|0 |   0|

| file.c  |   0|0 |   0|

| inode.c |   0|0 |   0|


Please consider.

Thanks,

Dmitri Vorobiev
--
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] x86: fix unconditional arch/x86/kernel/pcspeaker.c?compiling

2008-01-24 Thread Dmitri Vorobiev
Michael Opdenacker пишет:
> On Friday 18 January 2008, Matt Mackall wrote:
>> Probably makes sense to define it right next to INPUT_PCSPKR in
>> drivers/input/Kconfig.
>>
>> Then do the appropriate fix for all arches mentioned in INPUT_PCSPKR.
>>
>> For extra points, you can move the duplicate pcspeaker.c code out of all
>> those arches and stash it somewhere in drivers/input. Presumably it's
>> possible to get it to link into the kernel even when INPUT is modular.
> 
> Here's the patch, after spending some time to get familiar with git.
> 
> The patch is against git x86/mm, and it seems to work fine on x86. However,
> on x86, you no longer have /sys/devices/platform/pcspkr after
> running "make allnoconfig". To get it, you have to explicitely add support
> to CONFIG_INPUT_PCSPKR (m or y). I hope this is fine.
> 
> I'm copying the MIPS maintainer as this patch touches his tree too.

This patch does not apply cleanly to linux-mips Git tree:

> snip
patching file arch/x86/kernel/Makefile
Hunk #1 FAILED at 69.
1 out of 1 hunk FAILED -- saving rejects to file arch/x86/kernel/Makefile.rej
> snip

I believe this is because the linux-mips tree and the -mm tree are not in sync.

> 
> On MIPS, there should be no impact though, as CONFIG_PCSPEAKER is set in
> defconfig files.
> 
> In other architectures where CONFIG_INPUT_PCSPKR can exist,
> there is a change: when CONFIG_INPUT_PCSPKR is set, the platform device
> will be added, while it didn't exist before. I hope this is fine.
> 

It seems tempting to include at least Alpha in this patch, because they
have a device initcall identical to the one, which you're removing from
the MIPS and x86 arch code.

Thanks,

Dmitri
--
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/17] [MIPS] Malta: remove a superfluous comment

2008-01-24 Thread Dmitri Vorobiev
Using the "We die here" comment right before calling the die()
function is an extremely vivid example of overcommenting.

Remove the redundant comment and save one line.

No functional changes introduced.

Signed-off-by: Dmitri Vorobiev <[EMAIL PROTECTED]>
---
 arch/mips/mips-boards/malta/malta_int.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/arch/mips/mips-boards/malta/malta_int.c 
b/arch/mips/mips-boards/malta/malta_int.c
index 41eb232..a268912 100644
--- a/arch/mips/mips-boards/malta/malta_int.c
+++ b/arch/mips/mips-boards/malta/malta_int.c
@@ -173,7 +173,6 @@ static void corehi_irqdispatch(void)
break;
}
 
-   /* We die here*/
die("CoreHi interrupt", regs);
 }
 
-- 
1.5.3

--
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/17] [MIPS] Malta: fix oversized lines in malta_int.c

2008-01-24 Thread Dmitri Vorobiev
This patch fixes all "line over 80 characters" warnings found
in arch/mips/mips-boards/malta/malta_int.c by the checkpatch.pl
script.

No functional changes introduced.

Signed-off-by: Dmitri Vorobiev <[EMAIL PROTECTED]>
---
 arch/mips/mips-boards/malta/malta_int.c |   22 --
 1 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/arch/mips/mips-boards/malta/malta_int.c 
b/arch/mips/mips-boards/malta/malta_int.c
index 6d371f4..1b4b9c5 100644
--- a/arch/mips/mips-boards/malta/malta_int.c
+++ b/arch/mips/mips-boards/malta/malta_int.c
@@ -304,17 +304,25 @@ void __init arch_init_irq(void)
case MIPS_REVISION_SCON_SOCIT:
case MIPS_REVISION_SCON_ROCIT:
if (cpu_has_veic)
-   init_msc_irqs(MIPS_MSC01_IC_REG_BASE, MSC01E_INT_BASE, 
msc_eicirqmap, msc_nr_eicirqs);
+   init_msc_irqs(MIPS_MSC01_IC_REG_BASE,
+   MSC01E_INT_BASE, msc_eicirqmap,
+   msc_nr_eicirqs);
else
-   init_msc_irqs(MIPS_MSC01_IC_REG_BASE, MSC01C_INT_BASE, 
msc_irqmap, msc_nr_irqs);
+   init_msc_irqs(MIPS_MSC01_IC_REG_BASE,
+   MSC01C_INT_BASE, msc_irqmap,
+   msc_nr_irqs);
break;
 
case MIPS_REVISION_SCON_SOCITSC:
case MIPS_REVISION_SCON_SOCITSCP:
if (cpu_has_veic)
-   init_msc_irqs(MIPS_SOCITSC_IC_REG_BASE, 
MSC01E_INT_BASE, msc_eicirqmap, msc_nr_eicirqs);
+   init_msc_irqs(MIPS_SOCITSC_IC_REG_BASE,
+   MSC01E_INT_BASE, msc_eicirqmap,
+   msc_nr_eicirqs);
else
-   init_msc_irqs(MIPS_SOCITSC_IC_REG_BASE, 
MSC01C_INT_BASE, msc_irqmap, msc_nr_irqs);
+   init_msc_irqs(MIPS_SOCITSC_IC_REG_BASE,
+   MSC01C_INT_BASE, msc_irqmap,
+   msc_nr_irqs);
}
 
if (cpu_has_veic) {
@@ -345,11 +353,13 @@ void __init arch_init_irq(void)
}
 #else /* Not SMTC */
setup_irq(MIPS_CPU_IRQ_BASE+MIPSCPU_INT_I8259A, );
-   setup_irq(MIPS_CPU_IRQ_BASE+MIPSCPU_INT_COREHI, 
_irqaction);
+   setup_irq(MIPS_CPU_IRQ_BASE+MIPSCPU_INT_COREHI,
+   _irqaction);
 #endif /* CONFIG_MIPS_MT_SMTC */
}
else {
setup_irq(MIPS_CPU_IRQ_BASE+MIPSCPU_INT_I8259A, );
-   setup_irq(MIPS_CPU_IRQ_BASE+MIPSCPU_INT_COREHI, 
_irqaction);
+   setup_irq(MIPS_CPU_IRQ_BASE+MIPSCPU_INT_COREHI,
+   _irqaction);
}
 }
-- 
1.5.3

--
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/17] [MIPS] Malta: else should follow close brace in malta_int.c

2008-01-24 Thread Dmitri Vorobiev
This patch fixes two errors reported by checkpatch.pl.

No functional changes introduced.

Signed-off-by: Dmitri Vorobiev <[EMAIL PROTECTED]>
---
 arch/mips/mips-boards/malta/malta_int.c |6 ++
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/mips/mips-boards/malta/malta_int.c 
b/arch/mips/mips-boards/malta/malta_int.c
index a268912..2473a77 100644
--- a/arch/mips/mips-boards/malta/malta_int.c
+++ b/arch/mips/mips-boards/malta/malta_int.c
@@ -329,8 +329,7 @@ void __init arch_init_irq(void)
set_vi_handler(MSC01E_INT_COREHI, corehi_irqdispatch);
setup_irq(MSC01E_INT_BASE+MSC01E_INT_I8259A, );
setup_irq(MSC01E_INT_BASE+MSC01E_INT_COREHI, _irqaction);
-   }
-   else if (cpu_has_vint) {
+   } else if (cpu_has_vint) {
set_vi_handler(MIPSCPU_INT_I8259A, malta_hw0_irqdispatch);
set_vi_handler(MIPSCPU_INT_COREHI, corehi_irqdispatch);
 #ifdef CONFIG_MIPS_MT_SMTC
@@ -355,8 +354,7 @@ void __init arch_init_irq(void)
setup_irq(MIPS_CPU_IRQ_BASE+MIPSCPU_INT_COREHI,
_irqaction);
 #endif /* CONFIG_MIPS_MT_SMTC */
-   }
-   else {
+   } else {
setup_irq(MIPS_CPU_IRQ_BASE+MIPSCPU_INT_I8259A, );
setup_irq(MIPS_CPU_IRQ_BASE+MIPSCPU_INT_COREHI,
_irqaction);
-- 
1.5.3

--
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/17] [MIPS] Malta: fix braces at single statement blocks

2008-01-24 Thread Dmitri Vorobiev
This patch fixes a couple of warnings reported by checkpatch.pl.

No functional changes introduced.

Signed-off-by: Dmitri Vorobiev <[EMAIL PROTECTED]>
---
 arch/mips/mips-boards/malta/malta_int.c   |3 ++-
 arch/mips/mips-boards/malta/malta_setup.c |3 +--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/mips/mips-boards/malta/malta_int.c 
b/arch/mips/mips-boards/malta/malta_int.c
index 92e6e2d..dbe60eb 100644
--- a/arch/mips/mips-boards/malta/malta_int.c
+++ b/arch/mips/mips-boards/malta/malta_int.c
@@ -114,7 +114,8 @@ static void malta_hw0_irqdispatch(void)
 
irq = get_int();
if (irq < 0) {
-   return;  /* interrupt has already been cleared */
+   /* interrupt has already been cleared */
+   return;
}
 
do_IRQ(MALTA_INT_BASE + irq);
diff --git a/arch/mips/mips-boards/malta/malta_setup.c 
b/arch/mips/mips-boards/malta/malta_setup.c
index 8dacb6a..8d62966 100644
--- a/arch/mips/mips-boards/malta/malta_setup.c
+++ b/arch/mips/mips-boards/malta/malta_setup.c
@@ -202,9 +202,8 @@ void __init plat_mem_setup(void)
 #endif
}
 #ifdef CONFIG_DMA_COHERENT
-   else {
+   else
panic("Hardware DMA cache coherency not supported");
-   }
 #endif
 
 #ifdef CONFIG_BLK_DEV_IDE
-- 
1.5.3

--
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/17] [MIPS] Malta: make the helper function static

2008-01-24 Thread Dmitri Vorobiev
One helper function can become static. This patch adds the needed
keyword.

No functional changes introduced.

Signed-off-by: Dmitri Vorobiev <[EMAIL PROTECTED]>
---
 arch/mips/mips-boards/malta/malta_setup.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/mips/mips-boards/malta/malta_setup.c 
b/arch/mips/mips-boards/malta/malta_setup.c
index 8d62966..541f4e7 100644
--- a/arch/mips/mips-boards/malta/malta_setup.c
+++ b/arch/mips/mips-boards/malta/malta_setup.c
@@ -80,7 +80,7 @@ const char display_string[] = "LINUX ON MALTA   ";
 #endif /* CONFIG_MIPS_MT_SMTC */
 
 #ifdef CONFIG_BLK_DEV_FD
-void __init fd_activate(void)
+static void __init fd_activate(void)
 {
/*
 * Activate Floppy Controller in the SMSC FDC37M817 Super I/O
-- 
1.5.3

--
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 17/17] [MIPS] remove Documentation/mips/GT64120.README

2008-01-24 Thread Dmitri Vorobiev
Based upon the 2.4 kernel, the information presented in the
Documentation/mips/GT64120.README file is outdated. Worse,
the document contents are plain misleading nowadays because
the text mentions files and directories, which have been
deleted, moved or restructured for 2.6.

This patch removes the documentation, which is no more valid.

Signed-off-by: Dmitri Vorobiev <[EMAIL PROTECTED]>
---
 Documentation/mips/00-INDEX   |2 -
 Documentation/mips/GT64120.README |   65 -
 2 files changed, 0 insertions(+), 67 deletions(-)
 delete mode 100644 Documentation/mips/GT64120.README

diff --git a/Documentation/mips/00-INDEX b/Documentation/mips/00-INDEX
index 3f13bf8..8ae9cff 100644
--- a/Documentation/mips/00-INDEX
+++ b/Documentation/mips/00-INDEX
@@ -2,5 +2,3 @@
- this file.
 AU1xxx_IDE.README
- README for MIPS AU1XXX IDE driver.
-GT64120.README
-   - README for dir with info on MIPS boards using GT-64120 or GT-64120A.
diff --git a/Documentation/mips/GT64120.README 
b/Documentation/mips/GT64120.README
deleted file mode 100644
index 2d0eec9..000
--- a/Documentation/mips/GT64120.README
+++ /dev/null
@@ -1,65 +0,0 @@
-README for arch/mips/gt64120 directory and subdirectories
-
-Jun Sun, [EMAIL PROTECTED] or [EMAIL PROTECTED]
-01/27, 2001
-
-MOTIVATION
---
-
-Many MIPS boards share the same system controller (or CPU companian chip),
-such as GT-64120.  It is highly desirable to let these boards share
-the same controller code instead of duplicating them.
-
-This directory is meant to hold all MIPS boards that use GT-64120 or GT-64120A.
-
-
-HOW TO ADD A BOARD
---
- 
-. Create a subdirectory include/asm/gt64120/.  
-
-. Create a file called gt64120_dep.h under that directory.
-
-. Modify include/asm/gt64120/gt64120.h file to include the new gt64120_dep.h
-  based on config options.  The board-dep section is at the end of 
-  include/asm/gt64120/gt64120.h file. There you can find all required
-  definitions include/asm/gt64120//gt64120_dep.h file must supply.
-
-. Create a subdirectory arch/mips/gt64120/ directory to hold
-  board specific routines.
-
-. The GT-64120 common code is supplied under arch/mips/gt64120/common 
directory.
-  It includes:
-   1) arch/mips/gt64120/pci.c -
-   common PCI routine, include the top-level pcibios_init()
-   2) arch/mips/gt64120/irq.c -
-   common IRQ routine, include the top-level do_IRQ() 
-  [This part really belongs to arch/mips/kernel. jsun]
-   3) arch/mips/gt64120/gt_irq.c -
-   common IRQ routines for GT-64120 chip.  Currently it only 
handles
-   the timer interrupt.
-
-. Board-specific routines are supplied under arch/mips/gt64120/ dir.
-   1) arch/mips/gt64120//pci.c - it provides bus fixup routine
-   2) arch/mips/gt64120//irq.c - it provides enable/disable irqs
-   and board irq setup routine (irq_setup)
-   3) arch/mips/gt64120//int-handler.S -
-   The first-level interrupt dispatching routine.
-   4) a bunch of other "normal" stuff (setup, prom, dbg_io, reset, etc)
-
-. Follow other "normal" procedure to modify configuration files, etc.
-
-
-TO-DO LIST
---
-
-. Expand arch/mips/gt64120/gt_irq.c to handle all GT-64120 interrupts.
-  We probably need to introduce GT_IRQ_BASE  in board-dep header file,
-  which is used the starting irq_nr for all GT irqs.
-
-  A function, gt64120_handle_irq(), will be added so that the first-level
-  irq dispatcher will call this function if it detects an interrupt
-  from GT-64120.
-
-. More support for GT-64120 PCI features (2nd PCI bus, perhaps)
-
-- 
1.5.3

--
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/17] [MIPS] Malta, Atlas: move an extern function declaration to the header file

2008-01-24 Thread Dmitri Vorobiev
This was compile-tested using default configs for the boards
affected by this change.

This patch does not introduce any functional changes.

Signed-off-by: Dmitri Vorobiev <[EMAIL PROTECTED]>
---
 arch/mips/mips-boards/atlas/atlas_setup.c |4 
 arch/mips/mips-boards/malta/malta_setup.c |4 
 include/asm-mips/mips-boards/generic.h|4 
 3 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/arch/mips/mips-boards/atlas/atlas_setup.c 
b/arch/mips/mips-boards/atlas/atlas_setup.c
index 5ce8004..5c50080 100644
--- a/arch/mips/mips-boards/atlas/atlas_setup.c
+++ b/arch/mips/mips-boards/atlas/atlas_setup.c
@@ -34,10 +34,6 @@
 #include 
 #include 
 
-#ifdef CONFIG_KGDB
-extern void kgdb_config(void);
-#endif
-
 static void __init serial_init(void);
 
 const char *get_system_type(void)
diff --git a/arch/mips/mips-boards/malta/malta_setup.c 
b/arch/mips/mips-boards/malta/malta_setup.c
index 3e2de0b..8dacb6a 100644
--- a/arch/mips/mips-boards/malta/malta_setup.c
+++ b/arch/mips/mips-boards/malta/malta_setup.c
@@ -35,10 +35,6 @@
 #include 
 #endif
 
-#ifdef CONFIG_KGDB
-extern void kgdb_config(void);
-#endif
-
 struct resource standard_io_resources[] = {
{
.name = "dma1",
diff --git a/include/asm-mips/mips-boards/generic.h 
b/include/asm-mips/mips-boards/generic.h
index 2ca6bda..1c39d33 100644
--- a/include/asm-mips/mips-boards/generic.h
+++ b/include/asm-mips/mips-boards/generic.h
@@ -105,4 +105,8 @@ extern void mips_pcibios_init(void);
 #define mips_pcibios_init() do { } while (0)
 #endif
 
+#ifdef CONFIG_KGDB
+extern void kgdb_config(void);
+#endif
+
 #endif  /* __ASM_MIPS_BOARDS_GENERIC_H */
-- 
1.5.3

--
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/17] [MIPS] Malta: remaining bits of the board support code cleanup

2008-01-24 Thread Dmitri Vorobiev
This patch factors out the code, which handles the Bonito system
controller. The case of not supporting the DMA coherency is handled
separately to make the logic obvious. Besides, a couple of empty
lines added to beautify the code even further.

No functional changes introduced.

Signed-off-by: Dmitri Vorobiev <[EMAIL PROTECTED]>
---
 arch/mips/mips-boards/malta/malta_setup.c |   80 +++--
 1 files changed, 42 insertions(+), 38 deletions(-)

diff --git a/arch/mips/mips-boards/malta/malta_setup.c 
b/arch/mips/mips-boards/malta/malta_setup.c
index 541f4e7..2cd8f57 100644
--- a/arch/mips/mips-boards/malta/malta_setup.c
+++ b/arch/mips/mips-boards/malta/malta_setup.c
@@ -1,6 +1,7 @@
 /*
  * Carsten Langgaard, [EMAIL PROTECTED]
  * Copyright (C) 2000 MIPS Technologies, Inc.  All rights reserved.
+ * Copyright (C) Dmitri Vorobiev
  *
  *  This program is free software; you can distribute it and/or modify it
  *  under the terms of the GNU General Public License (Version 2) as
@@ -145,6 +146,41 @@ static void __init screen_info_setup(void)
 }
 #endif
 
+static void __init bonito_quirks_setup(void)
+{
+   char *argptr;
+
+   argptr = prom_getcmdline();
+   if (strstr(argptr, "debug")) {
+   BONITO_BONGENCFG |= BONITO_BONGENCFG_DEBUGMODE;
+   printk(KERN_INFO "Enabled Bonito debug mode\n");
+   } else
+   BONITO_BONGENCFG &= ~BONITO_BONGENCFG_DEBUGMODE;
+
+#ifdef CONFIG_DMA_COHERENT
+   if (BONITO_PCICACHECTRL & BONITO_PCICACHECTRL_CPUCOH_PRES) {
+   BONITO_PCICACHECTRL |= BONITO_PCICACHECTRL_CPUCOH_EN;
+   printk(KERN_INFO "Enabled Bonito CPU coherency\n");
+
+   argptr = prom_getcmdline();
+   if (strstr(argptr, "iobcuncached")) {
+   BONITO_PCICACHECTRL &= ~BONITO_PCICACHECTRL_IOBCCOH_EN;
+   BONITO_PCIMEMBASECFG = BONITO_PCIMEMBASECFG &
+   ~(BONITO_PCIMEMBASECFG_MEMBASE0_CACHED |
+   BONITO_PCIMEMBASECFG_MEMBASE1_CACHED);
+   printk(KERN_INFO "Disabled Bonito IOBC coherency\n");
+   } else {
+   BONITO_PCICACHECTRL |= BONITO_PCICACHECTRL_IOBCCOH_EN;
+   BONITO_PCIMEMBASECFG |=
+   (BONITO_PCIMEMBASECFG_MEMBASE0_CACHED |
+   BONITO_PCIMEMBASECFG_MEMBASE1_CACHED);
+   printk(KERN_INFO "Enabled Bonito IOBC coherency\n");
+   }
+   } else
+   panic("Hardware DMA cache coherency not supported");
+#endif
+}
+
 void __init plat_mem_setup(void)
 {
unsigned int i;
@@ -164,54 +200,22 @@ void __init plat_mem_setup(void)
kgdb_config();
 #endif
 
-   if (mips_revision_sconid == MIPS_REVISION_SCON_BONITO) {
-   char *argptr;
-
-   argptr = prom_getcmdline();
-   if (strstr(argptr, "debug")) {
-   BONITO_BONGENCFG |= BONITO_BONGENCFG_DEBUGMODE;
-   printk("Enabled Bonito debug mode\n");
-   }
-   else
-   BONITO_BONGENCFG &= ~BONITO_BONGENCFG_DEBUGMODE;
-
 #ifdef CONFIG_DMA_COHERENT
-   if (BONITO_PCICACHECTRL & BONITO_PCICACHECTRL_CPUCOH_PRES) {
-   BONITO_PCICACHECTRL |= BONITO_PCICACHECTRL_CPUCOH_EN;
-   printk("Enabled Bonito CPU coherency\n");
-
-   argptr = prom_getcmdline();
-   if (strstr(argptr, "iobcuncached")) {
-   BONITO_PCICACHECTRL &= 
~BONITO_PCICACHECTRL_IOBCCOH_EN;
-   BONITO_PCIMEMBASECFG = BONITO_PCIMEMBASECFG &
-   ~(BONITO_PCIMEMBASECFG_MEMBASE0_CACHED |
- BONITO_PCIMEMBASECFG_MEMBASE1_CACHED);
-   printk("Disabled Bonito IOBC coherency\n");
-   }
-   else {
-   BONITO_PCICACHECTRL |= 
BONITO_PCICACHECTRL_IOBCCOH_EN;
-   BONITO_PCIMEMBASECFG |=
-   (BONITO_PCIMEMBASECFG_MEMBASE0_CACHED |
-BONITO_PCIMEMBASECFG_MEMBASE1_CACHED);
-   printk("Enabled Bonito IOBC coherency\n");
-   }
-   }
-   else
-   panic("Hardware DMA cache coherency not supported");
-
-#endif
-   }
-#ifdef CONFIG_DMA_COHERENT
-   else
+   if (mips_revision_sconid != MIPS_REVISION_SCON_BONITO)
panic("Hardware DMA cache coherency not supported");
 #endif
 
+

[PATCH 09/17] [MIPS] Malta: include instead of

2008-01-24 Thread Dmitri Vorobiev
The checkpatch.pl script reported a few warnings about header files.
This patch fixes these warnings.

Compile-tested using the default Malta config.

No functional changes introduced.

Signed-off-by: Dmitri Vorobiev <[EMAIL PROTECTED]>
---
 arch/mips/mips-boards/malta/malta_int.c   |2 +-
 arch/mips/mips-boards/malta/malta_setup.c |6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/mips/mips-boards/malta/malta_int.c 
b/arch/mips/mips-boards/malta/malta_int.c
index 1b4b9c5..41eb232 100644
--- a/arch/mips/mips-boards/malta/malta_int.c
+++ b/arch/mips/mips-boards/malta/malta_int.c
@@ -26,13 +26,13 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/arch/mips/mips-boards/malta/malta_setup.c 
b/arch/mips/mips-boards/malta/malta_setup.c
index e5ac079..3e2de0b 100644
--- a/arch/mips/mips-boards/malta/malta_setup.c
+++ b/arch/mips/mips-boards/malta/malta_setup.c
@@ -15,21 +15,21 @@
  *  with this program; if not, write to the Free Software Foundation, Inc.,
  *  59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
  */
+#include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
+#include 
 
-#include 
 #include 
-#include 
 #include 
 #include 
 #include 
 #include 
 #include 
-#include 
 #include 
 #ifdef CONFIG_VT
 #include 
-- 
1.5.3

--
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/17] [MIPS] Malta: Use C89 style for comments

2008-01-24 Thread Dmitri Vorobiev
Remove comments in C99 style and make checkpatch.pl happy.

No functional changes introduced.

Signed-off-by: Dmitri Vorobiev <[EMAIL PROTECTED]>
---
 arch/mips/mips-boards/malta/malta_int.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/mips/mips-boards/malta/malta_int.c 
b/arch/mips/mips-boards/malta/malta_int.c
index 2473a77..92e6e2d 100644
--- a/arch/mips/mips-boards/malta/malta_int.c
+++ b/arch/mips/mips-boards/malta/malta_int.c
@@ -214,9 +214,9 @@ static inline unsigned int irq_ffs(unsigned int pending)
 
t0 = pending & 0x8000;
t0 = t0 < 1;
-   //t0 = t0 << 2;
+   /* t0 = t0 << 2; */
a0 = a0 - t0;
-   //pending = pending << t0;
+   /* pending = pending << t0; */
 
return a0;
 #endif
-- 
1.5.3

--
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/17] [MIPS] Malta: use tabs not spaces

2008-01-24 Thread Dmitri Vorobiev
This patch fixes all "use tabs not spaces" warnings reported by
the checkpatch.pl script on the board-specific files.

No functional changes introduced.

Signed-off-by: Dmitri Vorobiev <[EMAIL PROTECTED]>
---
 arch/mips/mips-boards/malta/malta_int.c  |   64 +++---
 arch/mips/mips-boards/malta/malta_smtc.c |4 +-
 2 files changed, 34 insertions(+), 34 deletions(-)

diff --git a/arch/mips/mips-boards/malta/malta_int.c 
b/arch/mips/mips-boards/malta/malta_int.c
index 2483b40..6d371f4 100644
--- a/arch/mips/mips-boards/malta/malta_int.c
+++ b/arch/mips/mips-boards/malta/malta_int.c
@@ -47,7 +47,7 @@ static DEFINE_SPINLOCK(mips_irq_lock);
 static inline int mips_pcibios_iack(void)
 {
int irq;
-u32 dummy;
+   u32 dummy;
 
/*
 * Determine highest priority pending interrupt by performing
@@ -58,7 +58,7 @@ static inline int mips_pcibios_iack(void)
case MIPS_REVISION_SCON_ROCIT:
case MIPS_REVISION_SCON_SOCITSC:
case MIPS_REVISION_SCON_SOCITSCP:
-   MSC_READ(MSC01_PCI_IACK, irq);
+   MSC_READ(MSC01_PCI_IACK, irq);
irq &= 0xff;
break;
case MIPS_REVISION_SCON_GT64120:
@@ -123,15 +123,15 @@ static void malta_hw0_irqdispatch(void)
 static void corehi_irqdispatch(void)
 {
unsigned int intedge, intsteer, pcicmd, pcibadaddr;
-unsigned int pcimstat, intisr, inten, intpol;
+   unsigned int pcimstat, intisr, inten, intpol;
unsigned int intrcause, datalo, datahi;
struct pt_regs *regs = get_irq_regs();
 
printk(KERN_EMERG "CoreHI interrupt, shouldn't happen, we die here!\n");
printk(KERN_EMERG "epc   : %08lx\nStatus: %08lx\n"
-  "Cause : %08lx\nbadVaddr : %08lx\n",
-  regs->cp0_epc, regs->cp0_status,
-  regs->cp0_cause, regs->cp0_badvaddr);
+   "Cause : %08lx\nbadVaddr : %08lx\n",
+   regs->cp0_epc, regs->cp0_status,
+   regs->cp0_cause, regs->cp0_badvaddr);
 
/* Read all the registers and then print them as there is a
   problem with interspersed printk's upsetting the Bonito controller.
@@ -139,29 +139,29 @@ static void corehi_irqdispatch(void)
*/
 
switch (mips_revision_sconid) {
-case MIPS_REVISION_SCON_SOCIT:
+   case MIPS_REVISION_SCON_SOCIT:
case MIPS_REVISION_SCON_ROCIT:
case MIPS_REVISION_SCON_SOCITSC:
case MIPS_REVISION_SCON_SOCITSCP:
-ll_msc_irq();
-break;
-case MIPS_REVISION_SCON_GT64120:
-intrcause = GT_READ(GT_INTRCAUSE_OFS);
-datalo = GT_READ(GT_CPUERR_ADDRLO_OFS);
-datahi = GT_READ(GT_CPUERR_ADDRHI_OFS);
+   ll_msc_irq();
+   break;
+   case MIPS_REVISION_SCON_GT64120:
+   intrcause = GT_READ(GT_INTRCAUSE_OFS);
+   datalo = GT_READ(GT_CPUERR_ADDRLO_OFS);
+   datahi = GT_READ(GT_CPUERR_ADDRHI_OFS);
printk(KERN_EMERG "GT_INTRCAUSE = %08x\n", intrcause);
printk(KERN_EMERG "GT_CPUERR_ADDR = %02x%08x\n",
datahi, datalo);
-break;
-case MIPS_REVISION_SCON_BONITO:
-pcibadaddr = BONITO_PCIBADADDR;
-pcimstat = BONITO_PCIMSTAT;
-intisr = BONITO_INTISR;
-inten = BONITO_INTEN;
-intpol = BONITO_INTPOL;
-intedge = BONITO_INTEDGE;
-intsteer = BONITO_INTSTEER;
-pcicmd = BONITO_PCICMD;
+   break;
+   case MIPS_REVISION_SCON_BONITO:
+   pcibadaddr = BONITO_PCIBADADDR;
+   pcimstat = BONITO_PCIMSTAT;
+   intisr = BONITO_INTISR;
+   inten = BONITO_INTEN;
+   intpol = BONITO_INTPOL;
+   intedge = BONITO_INTEDGE;
+   intsteer = BONITO_INTSTEER;
+   pcicmd = BONITO_PCICMD;
printk(KERN_EMERG "BONITO_INTISR = %08x\n", intisr);
printk(KERN_EMERG "BONITO_INTEN = %08x\n", inten);
printk(KERN_EMERG "BONITO_INTPOL = %08x\n", intpol);
@@ -170,11 +170,11 @@ static void corehi_irqdispatch(void)
printk(KERN_EMERG "BONITO_PCICMD = %08x\n", pcicmd);
printk(KERN_EMERG "BONITO_PCIBADADDR = %08x\n", pcibadaddr);
printk(KERN_EMERG "BONITO_PCIMSTAT = %08x\n", pcimstat);
-break;
-}
+   break;
+   }
 
-/* We die here*/
-die("CoreHi interrupt", regs);
+   /* We die here*/
+   die("CoreHi interrupt", regs);
 }
 
 static inline int clz(unsigned long x)
@@ -300,17 +300,17 @@ void __

[PATCH 08/17] [MIPS] Malta, Atlas, Sead: remove an extern from .c files

2008-01-24 Thread Dmitri Vorobiev
This patch moves the "extern" declaration for the function
mips_reboot_setup() from the board setup .c files to the
header file include/asm-mips/mips-boards/generic.h.

This fixes a warning produced by the checkpatch.pl script.

No functional changes introduced.

This was compile-tested by building the kernel for all
three boards affected by this change. All builds finished
successfully.

Signed-off-by: Dmitri Vorobiev <[EMAIL PROTECTED]>
---
 arch/mips/mips-boards/atlas/atlas_setup.c |2 --
 arch/mips/mips-boards/malta/malta_setup.c |2 --
 arch/mips/mips-boards/sead/sead_setup.c   |2 --
 include/asm-mips/mips-boards/generic.h|2 ++
 4 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/arch/mips/mips-boards/atlas/atlas_setup.c 
b/arch/mips/mips-boards/atlas/atlas_setup.c
index e405d11..5ce8004 100644
--- a/arch/mips/mips-boards/atlas/atlas_setup.c
+++ b/arch/mips/mips-boards/atlas/atlas_setup.c
@@ -34,8 +34,6 @@
 #include 
 #include 
 
-extern void mips_reboot_setup(void);
-
 #ifdef CONFIG_KGDB
 extern void kgdb_config(void);
 #endif
diff --git a/arch/mips/mips-boards/malta/malta_setup.c 
b/arch/mips/mips-boards/malta/malta_setup.c
index 480521f..e5ac079 100644
--- a/arch/mips/mips-boards/malta/malta_setup.c
+++ b/arch/mips/mips-boards/malta/malta_setup.c
@@ -35,8 +35,6 @@
 #include 
 #endif
 
-extern void mips_reboot_setup(void);
-
 #ifdef CONFIG_KGDB
 extern void kgdb_config(void);
 #endif
diff --git a/arch/mips/mips-boards/sead/sead_setup.c 
b/arch/mips/mips-boards/sead/sead_setup.c
index 1fb61b8..8aa8e5b 100644
--- a/arch/mips/mips-boards/sead/sead_setup.c
+++ b/arch/mips/mips-boards/sead/sead_setup.c
@@ -34,8 +34,6 @@
 #include 
 #include 
 
-extern void mips_reboot_setup(void);
-
 static void __init serial_init(void);
 
 const char *get_system_type(void)
diff --git a/include/asm-mips/mips-boards/generic.h 
b/include/asm-mips/mips-boards/generic.h
index d589774..2ca6bda 100644
--- a/include/asm-mips/mips-boards/generic.h
+++ b/include/asm-mips/mips-boards/generic.h
@@ -97,6 +97,8 @@ extern int mips_revision_corid;
 
 extern int mips_revision_sconid;
 
+extern void mips_reboot_setup(void);
+
 #ifdef CONFIG_PCI
 extern void mips_pcibios_init(void);
 #else
-- 
1.5.3

--
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/17] [MIPS] Malta: remove a dead function declaration

2008-01-24 Thread Dmitri Vorobiev
Neither is the mips_rtc_get_time() routine defined anywhere in
the MIPS architecture-specific code, nor does anyone call it any
more. This patch removes the extern declaration of this fossil.

This patch does not introduce any functional changes.

Signed-off-by: Dmitri Vorobiev <[EMAIL PROTECTED]>
---
 arch/mips/mips-boards/malta/malta_setup.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/arch/mips/mips-boards/malta/malta_setup.c 
b/arch/mips/mips-boards/malta/malta_setup.c
index 8b391ee..480521f 100644
--- a/arch/mips/mips-boards/malta/malta_setup.c
+++ b/arch/mips/mips-boards/malta/malta_setup.c
@@ -36,7 +36,6 @@
 #endif
 
 extern void mips_reboot_setup(void);
-extern unsigned long mips_rtc_get_time(void);
 
 #ifdef CONFIG_KGDB
 extern void kgdb_config(void);
-- 
1.5.3

--
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/17] [MIPS] Malta: use the KERN_ facility level in printk()

2008-01-24 Thread Dmitri Vorobiev
This patch adds the KERN_ macros to printk() calls. Where applicable,
spaces are replaced by tabs.

These changes noticeably reduce the number of errors and warnings
reported by the checkpatch.pl script for the malta_int.c file.

Before the patch: total: 47 errors, 20 warnings, 354 lines checked

After the patch: total: 34 errors, 7 warnings, 355 lines checked

No functional changes introduced.

Signed-off-by: Dmitri Vorobiev <[EMAIL PROTECTED]>
---
 arch/mips/mips-boards/malta/malta_int.c |   27 ++-
 1 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/arch/mips/mips-boards/malta/malta_int.c 
b/arch/mips/mips-boards/malta/malta_int.c
index f010261..2483b40 100644
--- a/arch/mips/mips-boards/malta/malta_int.c
+++ b/arch/mips/mips-boards/malta/malta_int.c
@@ -83,7 +83,7 @@ static inline int mips_pcibios_iack(void)
BONITO_PCIMAP_CFG = 0;
break;
default:
-   printk("Unknown system controller.\n");
+   printk(KERN_WARNING "Unknown system controller.\n");
return -1;
}
return irq;
@@ -127,8 +127,8 @@ static void corehi_irqdispatch(void)
unsigned int intrcause, datalo, datahi;
struct pt_regs *regs = get_irq_regs();
 
-printk("CoreHI interrupt, shouldn't happen, so we die here!!!\n");
-printk("epc   : %08lx\nStatus: %08lx\n"
+   printk(KERN_EMERG "CoreHI interrupt, shouldn't happen, we die here!\n");
+   printk(KERN_EMERG "epc   : %08lx\nStatus: %08lx\n"
   "Cause : %08lx\nbadVaddr : %08lx\n",
   regs->cp0_epc, regs->cp0_status,
   regs->cp0_cause, regs->cp0_badvaddr);
@@ -149,8 +149,9 @@ static void corehi_irqdispatch(void)
 intrcause = GT_READ(GT_INTRCAUSE_OFS);
 datalo = GT_READ(GT_CPUERR_ADDRLO_OFS);
 datahi = GT_READ(GT_CPUERR_ADDRHI_OFS);
-printk("GT_INTRCAUSE = %08x\n", intrcause);
-printk("GT_CPUERR_ADDR = %02x%08x\n", datahi, datalo);
+   printk(KERN_EMERG "GT_INTRCAUSE = %08x\n", intrcause);
+   printk(KERN_EMERG "GT_CPUERR_ADDR = %02x%08x\n",
+   datahi, datalo);
 break;
 case MIPS_REVISION_SCON_BONITO:
 pcibadaddr = BONITO_PCIBADADDR;
@@ -161,14 +162,14 @@ static void corehi_irqdispatch(void)
 intedge = BONITO_INTEDGE;
 intsteer = BONITO_INTSTEER;
 pcicmd = BONITO_PCICMD;
-printk("BONITO_INTISR = %08x\n", intisr);
-printk("BONITO_INTEN = %08x\n", inten);
-printk("BONITO_INTPOL = %08x\n", intpol);
-printk("BONITO_INTEDGE = %08x\n", intedge);
-printk("BONITO_INTSTEER = %08x\n", intsteer);
-printk("BONITO_PCICMD = %08x\n", pcicmd);
-printk("BONITO_PCIBADADDR = %08x\n", pcibadaddr);
-printk("BONITO_PCIMSTAT = %08x\n", pcimstat);
+   printk(KERN_EMERG "BONITO_INTISR = %08x\n", intisr);
+   printk(KERN_EMERG "BONITO_INTEN = %08x\n", inten);
+   printk(KERN_EMERG "BONITO_INTPOL = %08x\n", intpol);
+   printk(KERN_EMERG "BONITO_INTEDGE = %08x\n", intedge);
+   printk(KERN_EMERG "BONITO_INTSTEER = %08x\n", intsteer);
+   printk(KERN_EMERG "BONITO_PCICMD = %08x\n", pcicmd);
+   printk(KERN_EMERG "BONITO_PCIBADADDR = %08x\n", pcibadaddr);
+   printk(KERN_EMERG "BONITO_PCIMSTAT = %08x\n", pcimstat);
 break;
 }
 
-- 
1.5.3

--
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/17] [MIPS] Malta: massive code cleanup

2008-01-24 Thread Dmitri Vorobiev
Ralf,

This is the Malta cleanup, which I was talking about some time ago.

The patches should be fairly obvious. They make no functional
changes.

Build tests passed successfully when I used the default configs
for Atlas, Malta and SEAD.

Just in case, I also ran boot tests, which passed successfully with
the default Malta config and a Qemu-emulated Malta board in both BE
and LE modes.

The net effect is that the number of errors, warnings, and checks
reported by checkpatch.pl changes as follows:

Before:


  | errors | warnings | checks 

malta_int.c   |  47|20|1   

malta_setup.c |  3 |21|3

malta_smtc.c  |  2 |0 |0


After:


  | errors | warnings | checks 

malta_int.c   |  0 |0 |0   

malta_setup.c |  0 |0 |0

malta_smtc.c  |  0 |0 |0


The last patch in the series removes a very obsolete and misleading
document from Documentation/mips.

Please consider.

Thanks,

Dmitri
--
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/17] [MIPS] Malta: set up the screen info in a separate function

2008-01-24 Thread Dmitri Vorobiev
This patch adds a separate short and sweet function to initialize
the screen_info global variable.

This improves readability of the Malta board setup code.

No functional changes introduced.

Signed-off-by: Dmitri Vorobiev <[EMAIL PROTECTED]>
---
 arch/mips/mips-boards/malta/malta_setup.c |   39 
 1 files changed, 22 insertions(+), 17 deletions(-)

diff --git a/arch/mips/mips-boards/malta/malta_setup.c 
b/arch/mips/mips-boards/malta/malta_setup.c
index 79d74ea..8b391ee 100644
--- a/arch/mips/mips-boards/malta/malta_setup.c
+++ b/arch/mips/mips-boards/malta/malta_setup.c
@@ -132,6 +132,26 @@ static void __init pci_clock_check(void)
 }
 #endif
 
+#if defined(CONFIG_VT) && defined(CONFIG_VGA_CONSOLE)
+static void __init screen_info_setup(void)
+{
+   screen_info = (struct screen_info) {
+   .orig_x = 0,
+   .orig_y = 25,
+   .ext_mem_k = 0,
+   .orig_video_page = 0,
+   .orig_video_mode = 0,
+   .orig_video_cols = 80,
+   .unused2 = 0,
+   .orig_video_ega_bx = 0,
+   .unused3 = 0,
+   .orig_video_lines = 25,
+   .orig_video_isVGA = VIDEO_TYPE_VGAC,
+   .orig_video_points = 16
+   };
+}
+#endif
+
 void __init plat_mem_setup(void)
 {
unsigned int i;
@@ -200,23 +220,8 @@ void __init plat_mem_setup(void)
 #ifdef CONFIG_BLK_DEV_FD
fd_activate();
 #endif
-#ifdef CONFIG_VT
-#if defined(CONFIG_VGA_CONSOLE)
-   screen_info = (struct screen_info) {
-   .orig_x = 0,
-   .orig_y = 25,
-   .ext_mem_k = 0,
-   .orig_video_page = 0,
-   .orig_video_mode = 0,
-   .orig_video_cols = 80,
-   .unused2 = 0,
-   .orig_video_ega_bx = 0,
-   .unused3 = 0,
-   .orig_video_lines = 25,
-   .orig_video_isVGA = VIDEO_TYPE_VGAC,
-   .orig_video_points = 16
-   };
-#endif
+#if defined(CONFIG_VT) && defined(CONFIG_VGA_CONSOLE)
+   screen_info_setup();
 #endif
mips_reboot_setup();
 }
-- 
1.5.3

--
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/17] [MIPS] Malta: check the PCI clock frequency in a separate function

2008-01-24 Thread Dmitri Vorobiev
This patch adds a separate short and sweet function to check the
PCI clock frequency. This is to improve readability of the Malta
setup code.

Along the way, a couple of coding style violations are fixed.

No functional changes introduced.

Signed-off-by: Dmitri Vorobiev <[EMAIL PROTECTED]>
---
 arch/mips/mips-boards/malta/malta_setup.c |   43 +
 1 files changed, 25 insertions(+), 18 deletions(-)

diff --git a/arch/mips/mips-boards/malta/malta_setup.c 
b/arch/mips/mips-boards/malta/malta_setup.c
index d051405..79d74ea 100644
--- a/arch/mips/mips-boards/malta/malta_setup.c
+++ b/arch/mips/mips-boards/malta/malta_setup.c
@@ -108,6 +108,30 @@ void __init fd_activate(void)
 }
 #endif
 
+#ifdef CONFIG_BLK_DEV_IDE
+static void __init pci_clock_check(void)
+{
+   unsigned int __iomem *jmpr_p =
+   (unsigned int *) ioremap(MALTA_JMPRS_REG, sizeof(unsigned int));
+   int jmpr = (__raw_readl(jmpr_p) >> 2) & 0x07;
+   static const int pciclocks[] __initdata = {
+   33, 20, 25, 30, 12, 16, 37, 10
+   };
+   int pciclock = pciclocks[jmpr];
+   char *argptr = prom_getcmdline();
+
+   if (pciclock != 33 && !strstr(argptr, "idebus=")) {
+   printk(KERN_WARNING "WARNING: PCI clock is %dMHz, "
+   "setting idebus\n", pciclock);
+   argptr += strlen(argptr);
+   sprintf(argptr, " idebus=%d", pciclock);
+   if (pciclock < 20 || pciclock > 66)
+   printk(KERN_WARNING "WARNING: IDE timing "
+   "calculations will be incorrect\n");
+   }
+}
+#endif
+
 void __init plat_mem_setup(void)
 {
unsigned int i;
@@ -171,24 +195,7 @@ void __init plat_mem_setup(void)
 #endif
 
 #ifdef CONFIG_BLK_DEV_IDE
-   /* Check PCI clock */
-   {
-   unsigned int __iomem *jmpr_p = (unsigned int *) 
ioremap(MALTA_JMPRS_REG, sizeof(unsigned int));
-   int jmpr = (__raw_readl(jmpr_p) >> 2) & 0x07;
-   static const int pciclocks[] __initdata = {
-   33, 20, 25, 30, 12, 16, 37, 10
-   };
-   int pciclock = pciclocks[jmpr];
-   char *argptr = prom_getcmdline();
-
-   if (pciclock != 33 && !strstr (argptr, "idebus=")) {
-   printk("WARNING: PCI clock is %dMHz, setting idebus\n", 
pciclock);
-   argptr += strlen(argptr);
-   sprintf(argptr, " idebus=%d", pciclock);
-   if (pciclock < 20 || pciclock > 66)
-   printk("WARNING: IDE timing calculations will 
be incorrect\n");
-   }
-   }
+   pci_clock_check();
 #endif
 #ifdef CONFIG_BLK_DEV_FD
fd_activate();
-- 
1.5.3

--
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/17] [MIPS] Malta: use Linux kernel style for structure initialization

2008-01-24 Thread Dmitri Vorobiev
This patch reformats the structure initialization code thus
making the latter look idiomatic.

No functional changes introduced.

Signed-off-by: Dmitri Vorobiev <[EMAIL PROTECTED]>
---
 arch/mips/mips-boards/malta/malta_setup.c |   56 +---
 1 files changed, 42 insertions(+), 14 deletions(-)

diff --git a/arch/mips/mips-boards/malta/malta_setup.c 
b/arch/mips/mips-boards/malta/malta_setup.c
index bc43a5c..d051405 100644
--- a/arch/mips/mips-boards/malta/malta_setup.c
+++ b/arch/mips/mips-boards/malta/malta_setup.c
@@ -43,11 +43,36 @@ extern void kgdb_config(void);
 #endif
 
 struct resource standard_io_resources[] = {
-   { .name = "dma1", .start = 0x00, .end = 0x1f, .flags = IORESOURCE_BUSY 
},
-   { .name = "timer", .start = 0x40, .end = 0x5f, .flags = IORESOURCE_BUSY 
},
-   { .name = "keyboard", .start = 0x60, .end = 0x6f, .flags = 
IORESOURCE_BUSY },
-   { .name = "dma page reg", .start = 0x80, .end = 0x8f, .flags = 
IORESOURCE_BUSY },
-   { .name = "dma2", .start = 0xc0, .end = 0xdf, .flags = IORESOURCE_BUSY 
},
+   {
+   .name = "dma1",
+   .start = 0x00,
+   .end = 0x1f,
+   .flags = IORESOURCE_BUSY
+   },
+   {
+   .name = "timer",
+   .start = 0x40,
+   .end = 0x5f,
+   .flags = IORESOURCE_BUSY
+   },
+   {
+   .name = "keyboard",
+   .start = 0x60,
+   .end = 0x6f,
+   .flags = IORESOURCE_BUSY
+   },
+   {
+   .name = "dma page reg",
+   .start = 0x80,
+   .end = 0x8f,
+   .flags = IORESOURCE_BUSY
+   },
+   {
+   .name = "dma2",
+   .start = 0xc0,
+   .end = 0xdf,
+   .flags = IORESOURCE_BUSY
+   },
 };
 
 const char *get_system_type(void)
@@ -171,15 +196,18 @@ void __init plat_mem_setup(void)
 #ifdef CONFIG_VT
 #if defined(CONFIG_VGA_CONSOLE)
screen_info = (struct screen_info) {
-   0, 25,  /* orig-x, orig-y */
-   0,  /* unused */
-   0,  /* orig-video-page */
-   0,  /* orig-video-mode */
-   80, /* orig-video-cols */
-   0, 0, 0,/* ega_ax, ega_bx, ega_cx */
-   25, /* orig-video-lines */
-   VIDEO_TYPE_VGAC,/* orig-video-isVGA */
-   16  /* orig-video-points */
+   .orig_x = 0,
+   .orig_y = 25,
+   .ext_mem_k = 0,
+   .orig_video_page = 0,
+   .orig_video_mode = 0,
+   .orig_video_cols = 80,
+   .unused2 = 0,
+   .orig_video_ega_bx = 0,
+   .unused3 = 0,
+   .orig_video_lines = 25,
+   .orig_video_isVGA = VIDEO_TYPE_VGAC,
+   .orig_video_points = 16
};
 #endif
 #endif
-- 
1.5.3

--
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/17] [MIPS] Malta: use Linux kernel style for structure initialization

2008-01-24 Thread Dmitri Vorobiev
This patch reformats the structure initialization code thus
making the latter look idiomatic.

No functional changes introduced.

Signed-off-by: Dmitri Vorobiev [EMAIL PROTECTED]
---
 arch/mips/mips-boards/malta/malta_setup.c |   56 +---
 1 files changed, 42 insertions(+), 14 deletions(-)

diff --git a/arch/mips/mips-boards/malta/malta_setup.c 
b/arch/mips/mips-boards/malta/malta_setup.c
index bc43a5c..d051405 100644
--- a/arch/mips/mips-boards/malta/malta_setup.c
+++ b/arch/mips/mips-boards/malta/malta_setup.c
@@ -43,11 +43,36 @@ extern void kgdb_config(void);
 #endif
 
 struct resource standard_io_resources[] = {
-   { .name = dma1, .start = 0x00, .end = 0x1f, .flags = IORESOURCE_BUSY 
},
-   { .name = timer, .start = 0x40, .end = 0x5f, .flags = IORESOURCE_BUSY 
},
-   { .name = keyboard, .start = 0x60, .end = 0x6f, .flags = 
IORESOURCE_BUSY },
-   { .name = dma page reg, .start = 0x80, .end = 0x8f, .flags = 
IORESOURCE_BUSY },
-   { .name = dma2, .start = 0xc0, .end = 0xdf, .flags = IORESOURCE_BUSY 
},
+   {
+   .name = dma1,
+   .start = 0x00,
+   .end = 0x1f,
+   .flags = IORESOURCE_BUSY
+   },
+   {
+   .name = timer,
+   .start = 0x40,
+   .end = 0x5f,
+   .flags = IORESOURCE_BUSY
+   },
+   {
+   .name = keyboard,
+   .start = 0x60,
+   .end = 0x6f,
+   .flags = IORESOURCE_BUSY
+   },
+   {
+   .name = dma page reg,
+   .start = 0x80,
+   .end = 0x8f,
+   .flags = IORESOURCE_BUSY
+   },
+   {
+   .name = dma2,
+   .start = 0xc0,
+   .end = 0xdf,
+   .flags = IORESOURCE_BUSY
+   },
 };
 
 const char *get_system_type(void)
@@ -171,15 +196,18 @@ void __init plat_mem_setup(void)
 #ifdef CONFIG_VT
 #if defined(CONFIG_VGA_CONSOLE)
screen_info = (struct screen_info) {
-   0, 25,  /* orig-x, orig-y */
-   0,  /* unused */
-   0,  /* orig-video-page */
-   0,  /* orig-video-mode */
-   80, /* orig-video-cols */
-   0, 0, 0,/* ega_ax, ega_bx, ega_cx */
-   25, /* orig-video-lines */
-   VIDEO_TYPE_VGAC,/* orig-video-isVGA */
-   16  /* orig-video-points */
+   .orig_x = 0,
+   .orig_y = 25,
+   .ext_mem_k = 0,
+   .orig_video_page = 0,
+   .orig_video_mode = 0,
+   .orig_video_cols = 80,
+   .unused2 = 0,
+   .orig_video_ega_bx = 0,
+   .unused3 = 0,
+   .orig_video_lines = 25,
+   .orig_video_isVGA = VIDEO_TYPE_VGAC,
+   .orig_video_points = 16
};
 #endif
 #endif
-- 
1.5.3

--
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/17] [MIPS] Malta: massive code cleanup

2008-01-24 Thread Dmitri Vorobiev
Ralf,

This is the Malta cleanup, which I was talking about some time ago.

The patches should be fairly obvious. They make no functional
changes.

Build tests passed successfully when I used the default configs
for Atlas, Malta and SEAD.

Just in case, I also ran boot tests, which passed successfully with
the default Malta config and a Qemu-emulated Malta board in both BE
and LE modes.

The net effect is that the number of errors, warnings, and checks
reported by checkpatch.pl changes as follows:

Before:


  | errors | warnings | checks 

malta_int.c   |  47|20|1   

malta_setup.c |  3 |21|3

malta_smtc.c  |  2 |0 |0


After:


  | errors | warnings | checks 

malta_int.c   |  0 |0 |0   

malta_setup.c |  0 |0 |0

malta_smtc.c  |  0 |0 |0


The last patch in the series removes a very obsolete and misleading
document from Documentation/mips.

Please consider.

Thanks,

Dmitri
--
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/17] [MIPS] Malta: use the KERN_ facility level in printk()

2008-01-24 Thread Dmitri Vorobiev
This patch adds the KERN_ macros to printk() calls. Where applicable,
spaces are replaced by tabs.

These changes noticeably reduce the number of errors and warnings
reported by the checkpatch.pl script for the malta_int.c file.

Before the patch: total: 47 errors, 20 warnings, 354 lines checked

After the patch: total: 34 errors, 7 warnings, 355 lines checked

No functional changes introduced.

Signed-off-by: Dmitri Vorobiev [EMAIL PROTECTED]
---
 arch/mips/mips-boards/malta/malta_int.c |   27 ++-
 1 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/arch/mips/mips-boards/malta/malta_int.c 
b/arch/mips/mips-boards/malta/malta_int.c
index f010261..2483b40 100644
--- a/arch/mips/mips-boards/malta/malta_int.c
+++ b/arch/mips/mips-boards/malta/malta_int.c
@@ -83,7 +83,7 @@ static inline int mips_pcibios_iack(void)
BONITO_PCIMAP_CFG = 0;
break;
default:
-   printk(Unknown system controller.\n);
+   printk(KERN_WARNING Unknown system controller.\n);
return -1;
}
return irq;
@@ -127,8 +127,8 @@ static void corehi_irqdispatch(void)
unsigned int intrcause, datalo, datahi;
struct pt_regs *regs = get_irq_regs();
 
-printk(CoreHI interrupt, shouldn't happen, so we die here!!!\n);
-printk(epc   : %08lx\nStatus: %08lx\n
+   printk(KERN_EMERG CoreHI interrupt, shouldn't happen, we die here!\n);
+   printk(KERN_EMERG epc   : %08lx\nStatus: %08lx\n
   Cause : %08lx\nbadVaddr : %08lx\n,
   regs-cp0_epc, regs-cp0_status,
   regs-cp0_cause, regs-cp0_badvaddr);
@@ -149,8 +149,9 @@ static void corehi_irqdispatch(void)
 intrcause = GT_READ(GT_INTRCAUSE_OFS);
 datalo = GT_READ(GT_CPUERR_ADDRLO_OFS);
 datahi = GT_READ(GT_CPUERR_ADDRHI_OFS);
-printk(GT_INTRCAUSE = %08x\n, intrcause);
-printk(GT_CPUERR_ADDR = %02x%08x\n, datahi, datalo);
+   printk(KERN_EMERG GT_INTRCAUSE = %08x\n, intrcause);
+   printk(KERN_EMERG GT_CPUERR_ADDR = %02x%08x\n,
+   datahi, datalo);
 break;
 case MIPS_REVISION_SCON_BONITO:
 pcibadaddr = BONITO_PCIBADADDR;
@@ -161,14 +162,14 @@ static void corehi_irqdispatch(void)
 intedge = BONITO_INTEDGE;
 intsteer = BONITO_INTSTEER;
 pcicmd = BONITO_PCICMD;
-printk(BONITO_INTISR = %08x\n, intisr);
-printk(BONITO_INTEN = %08x\n, inten);
-printk(BONITO_INTPOL = %08x\n, intpol);
-printk(BONITO_INTEDGE = %08x\n, intedge);
-printk(BONITO_INTSTEER = %08x\n, intsteer);
-printk(BONITO_PCICMD = %08x\n, pcicmd);
-printk(BONITO_PCIBADADDR = %08x\n, pcibadaddr);
-printk(BONITO_PCIMSTAT = %08x\n, pcimstat);
+   printk(KERN_EMERG BONITO_INTISR = %08x\n, intisr);
+   printk(KERN_EMERG BONITO_INTEN = %08x\n, inten);
+   printk(KERN_EMERG BONITO_INTPOL = %08x\n, intpol);
+   printk(KERN_EMERG BONITO_INTEDGE = %08x\n, intedge);
+   printk(KERN_EMERG BONITO_INTSTEER = %08x\n, intsteer);
+   printk(KERN_EMERG BONITO_PCICMD = %08x\n, pcicmd);
+   printk(KERN_EMERG BONITO_PCIBADADDR = %08x\n, pcibadaddr);
+   printk(KERN_EMERG BONITO_PCIMSTAT = %08x\n, pcimstat);
 break;
 }
 
-- 
1.5.3

--
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/17] [MIPS] Malta, Atlas, Sead: remove an extern from .c files

2008-01-24 Thread Dmitri Vorobiev
This patch moves the extern declaration for the function
mips_reboot_setup() from the board setup .c files to the
header file include/asm-mips/mips-boards/generic.h.

This fixes a warning produced by the checkpatch.pl script.

No functional changes introduced.

This was compile-tested by building the kernel for all
three boards affected by this change. All builds finished
successfully.

Signed-off-by: Dmitri Vorobiev [EMAIL PROTECTED]
---
 arch/mips/mips-boards/atlas/atlas_setup.c |2 --
 arch/mips/mips-boards/malta/malta_setup.c |2 --
 arch/mips/mips-boards/sead/sead_setup.c   |2 --
 include/asm-mips/mips-boards/generic.h|2 ++
 4 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/arch/mips/mips-boards/atlas/atlas_setup.c 
b/arch/mips/mips-boards/atlas/atlas_setup.c
index e405d11..5ce8004 100644
--- a/arch/mips/mips-boards/atlas/atlas_setup.c
+++ b/arch/mips/mips-boards/atlas/atlas_setup.c
@@ -34,8 +34,6 @@
 #include asm/time.h
 #include asm/traps.h
 
-extern void mips_reboot_setup(void);
-
 #ifdef CONFIG_KGDB
 extern void kgdb_config(void);
 #endif
diff --git a/arch/mips/mips-boards/malta/malta_setup.c 
b/arch/mips/mips-boards/malta/malta_setup.c
index 480521f..e5ac079 100644
--- a/arch/mips/mips-boards/malta/malta_setup.c
+++ b/arch/mips/mips-boards/malta/malta_setup.c
@@ -35,8 +35,6 @@
 #include linux/console.h
 #endif
 
-extern void mips_reboot_setup(void);
-
 #ifdef CONFIG_KGDB
 extern void kgdb_config(void);
 #endif
diff --git a/arch/mips/mips-boards/sead/sead_setup.c 
b/arch/mips/mips-boards/sead/sead_setup.c
index 1fb61b8..8aa8e5b 100644
--- a/arch/mips/mips-boards/sead/sead_setup.c
+++ b/arch/mips/mips-boards/sead/sead_setup.c
@@ -34,8 +34,6 @@
 #include asm/mips-boards/seadint.h
 #include asm/time.h
 
-extern void mips_reboot_setup(void);
-
 static void __init serial_init(void);
 
 const char *get_system_type(void)
diff --git a/include/asm-mips/mips-boards/generic.h 
b/include/asm-mips/mips-boards/generic.h
index d589774..2ca6bda 100644
--- a/include/asm-mips/mips-boards/generic.h
+++ b/include/asm-mips/mips-boards/generic.h
@@ -97,6 +97,8 @@ extern int mips_revision_corid;
 
 extern int mips_revision_sconid;
 
+extern void mips_reboot_setup(void);
+
 #ifdef CONFIG_PCI
 extern void mips_pcibios_init(void);
 #else
-- 
1.5.3

--
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 09/17] [MIPS] Malta: include linux/cpu.h instead of asm/cpu.h

2008-01-24 Thread Dmitri Vorobiev
The checkpatch.pl script reported a few warnings about header files.
This patch fixes these warnings.

Compile-tested using the default Malta config.

No functional changes introduced.

Signed-off-by: Dmitri Vorobiev [EMAIL PROTECTED]
---
 arch/mips/mips-boards/malta/malta_int.c   |2 +-
 arch/mips/mips-boards/malta/malta_setup.c |6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/mips/mips-boards/malta/malta_int.c 
b/arch/mips/mips-boards/malta/malta_int.c
index 1b4b9c5..41eb232 100644
--- a/arch/mips/mips-boards/malta/malta_int.c
+++ b/arch/mips/mips-boards/malta/malta_int.c
@@ -26,13 +26,13 @@
 #include linux/sched.h
 #include linux/slab.h
 #include linux/interrupt.h
+#include linux/io.h
 #include linux/kernel_stat.h
 #include linux/kernel.h
 #include linux/random.h
 
 #include asm/i8259.h
 #include asm/irq_cpu.h
-#include asm/io.h
 #include asm/irq_regs.h
 #include asm/mips-boards/malta.h
 #include asm/mips-boards/maltaint.h
diff --git a/arch/mips/mips-boards/malta/malta_setup.c 
b/arch/mips/mips-boards/malta/malta_setup.c
index e5ac079..3e2de0b 100644
--- a/arch/mips/mips-boards/malta/malta_setup.c
+++ b/arch/mips/mips-boards/malta/malta_setup.c
@@ -15,21 +15,21 @@
  *  with this program; if not, write to the Free Software Foundation, Inc.,
  *  59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
  */
+#include linux/cpu.h
 #include linux/init.h
 #include linux/sched.h
 #include linux/ioport.h
+#include linux/irq.h
 #include linux/pci.h
 #include linux/screen_info.h
+#include linux/time.h
 
-#include asm/cpu.h
 #include asm/bootinfo.h
-#include asm/irq.h
 #include asm/mips-boards/generic.h
 #include asm/mips-boards/prom.h
 #include asm/mips-boards/malta.h
 #include asm/mips-boards/maltaint.h
 #include asm/dma.h
-#include asm/time.h
 #include asm/traps.h
 #ifdef CONFIG_VT
 #include linux/console.h
-- 
1.5.3

--
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/17] [MIPS] Malta: Use C89 style for comments

2008-01-24 Thread Dmitri Vorobiev
Remove comments in C99 style and make checkpatch.pl happy.

No functional changes introduced.

Signed-off-by: Dmitri Vorobiev [EMAIL PROTECTED]
---
 arch/mips/mips-boards/malta/malta_int.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/mips/mips-boards/malta/malta_int.c 
b/arch/mips/mips-boards/malta/malta_int.c
index 2473a77..92e6e2d 100644
--- a/arch/mips/mips-boards/malta/malta_int.c
+++ b/arch/mips/mips-boards/malta/malta_int.c
@@ -214,9 +214,9 @@ static inline unsigned int irq_ffs(unsigned int pending)
 
t0 = pending  0x8000;
t0 = t0  1;
-   //t0 = t0  2;
+   /* t0 = t0  2; */
a0 = a0 - t0;
-   //pending = pending  t0;
+   /* pending = pending  t0; */
 
return a0;
 #endif
-- 
1.5.3

--
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/17] [MIPS] Malta, Atlas: move an extern function declaration to the header file

2008-01-24 Thread Dmitri Vorobiev
This was compile-tested using default configs for the boards
affected by this change.

This patch does not introduce any functional changes.

Signed-off-by: Dmitri Vorobiev [EMAIL PROTECTED]
---
 arch/mips/mips-boards/atlas/atlas_setup.c |4 
 arch/mips/mips-boards/malta/malta_setup.c |4 
 include/asm-mips/mips-boards/generic.h|4 
 3 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/arch/mips/mips-boards/atlas/atlas_setup.c 
b/arch/mips/mips-boards/atlas/atlas_setup.c
index 5ce8004..5c50080 100644
--- a/arch/mips/mips-boards/atlas/atlas_setup.c
+++ b/arch/mips/mips-boards/atlas/atlas_setup.c
@@ -34,10 +34,6 @@
 #include asm/time.h
 #include asm/traps.h
 
-#ifdef CONFIG_KGDB
-extern void kgdb_config(void);
-#endif
-
 static void __init serial_init(void);
 
 const char *get_system_type(void)
diff --git a/arch/mips/mips-boards/malta/malta_setup.c 
b/arch/mips/mips-boards/malta/malta_setup.c
index 3e2de0b..8dacb6a 100644
--- a/arch/mips/mips-boards/malta/malta_setup.c
+++ b/arch/mips/mips-boards/malta/malta_setup.c
@@ -35,10 +35,6 @@
 #include linux/console.h
 #endif
 
-#ifdef CONFIG_KGDB
-extern void kgdb_config(void);
-#endif
-
 struct resource standard_io_resources[] = {
{
.name = dma1,
diff --git a/include/asm-mips/mips-boards/generic.h 
b/include/asm-mips/mips-boards/generic.h
index 2ca6bda..1c39d33 100644
--- a/include/asm-mips/mips-boards/generic.h
+++ b/include/asm-mips/mips-boards/generic.h
@@ -105,4 +105,8 @@ extern void mips_pcibios_init(void);
 #define mips_pcibios_init() do { } while (0)
 #endif
 
+#ifdef CONFIG_KGDB
+extern void kgdb_config(void);
+#endif
+
 #endif  /* __ASM_MIPS_BOARDS_GENERIC_H */
-- 
1.5.3

--
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/17] [MIPS] Malta: remaining bits of the board support code cleanup

2008-01-24 Thread Dmitri Vorobiev
This patch factors out the code, which handles the Bonito system
controller. The case of not supporting the DMA coherency is handled
separately to make the logic obvious. Besides, a couple of empty
lines added to beautify the code even further.

No functional changes introduced.

Signed-off-by: Dmitri Vorobiev [EMAIL PROTECTED]
---
 arch/mips/mips-boards/malta/malta_setup.c |   80 +++--
 1 files changed, 42 insertions(+), 38 deletions(-)

diff --git a/arch/mips/mips-boards/malta/malta_setup.c 
b/arch/mips/mips-boards/malta/malta_setup.c
index 541f4e7..2cd8f57 100644
--- a/arch/mips/mips-boards/malta/malta_setup.c
+++ b/arch/mips/mips-boards/malta/malta_setup.c
@@ -1,6 +1,7 @@
 /*
  * Carsten Langgaard, [EMAIL PROTECTED]
  * Copyright (C) 2000 MIPS Technologies, Inc.  All rights reserved.
+ * Copyright (C) Dmitri Vorobiev
  *
  *  This program is free software; you can distribute it and/or modify it
  *  under the terms of the GNU General Public License (Version 2) as
@@ -145,6 +146,41 @@ static void __init screen_info_setup(void)
 }
 #endif
 
+static void __init bonito_quirks_setup(void)
+{
+   char *argptr;
+
+   argptr = prom_getcmdline();
+   if (strstr(argptr, debug)) {
+   BONITO_BONGENCFG |= BONITO_BONGENCFG_DEBUGMODE;
+   printk(KERN_INFO Enabled Bonito debug mode\n);
+   } else
+   BONITO_BONGENCFG = ~BONITO_BONGENCFG_DEBUGMODE;
+
+#ifdef CONFIG_DMA_COHERENT
+   if (BONITO_PCICACHECTRL  BONITO_PCICACHECTRL_CPUCOH_PRES) {
+   BONITO_PCICACHECTRL |= BONITO_PCICACHECTRL_CPUCOH_EN;
+   printk(KERN_INFO Enabled Bonito CPU coherency\n);
+
+   argptr = prom_getcmdline();
+   if (strstr(argptr, iobcuncached)) {
+   BONITO_PCICACHECTRL = ~BONITO_PCICACHECTRL_IOBCCOH_EN;
+   BONITO_PCIMEMBASECFG = BONITO_PCIMEMBASECFG 
+   ~(BONITO_PCIMEMBASECFG_MEMBASE0_CACHED |
+   BONITO_PCIMEMBASECFG_MEMBASE1_CACHED);
+   printk(KERN_INFO Disabled Bonito IOBC coherency\n);
+   } else {
+   BONITO_PCICACHECTRL |= BONITO_PCICACHECTRL_IOBCCOH_EN;
+   BONITO_PCIMEMBASECFG |=
+   (BONITO_PCIMEMBASECFG_MEMBASE0_CACHED |
+   BONITO_PCIMEMBASECFG_MEMBASE1_CACHED);
+   printk(KERN_INFO Enabled Bonito IOBC coherency\n);
+   }
+   } else
+   panic(Hardware DMA cache coherency not supported);
+#endif
+}
+
 void __init plat_mem_setup(void)
 {
unsigned int i;
@@ -164,54 +200,22 @@ void __init plat_mem_setup(void)
kgdb_config();
 #endif
 
-   if (mips_revision_sconid == MIPS_REVISION_SCON_BONITO) {
-   char *argptr;
-
-   argptr = prom_getcmdline();
-   if (strstr(argptr, debug)) {
-   BONITO_BONGENCFG |= BONITO_BONGENCFG_DEBUGMODE;
-   printk(Enabled Bonito debug mode\n);
-   }
-   else
-   BONITO_BONGENCFG = ~BONITO_BONGENCFG_DEBUGMODE;
-
 #ifdef CONFIG_DMA_COHERENT
-   if (BONITO_PCICACHECTRL  BONITO_PCICACHECTRL_CPUCOH_PRES) {
-   BONITO_PCICACHECTRL |= BONITO_PCICACHECTRL_CPUCOH_EN;
-   printk(Enabled Bonito CPU coherency\n);
-
-   argptr = prom_getcmdline();
-   if (strstr(argptr, iobcuncached)) {
-   BONITO_PCICACHECTRL = 
~BONITO_PCICACHECTRL_IOBCCOH_EN;
-   BONITO_PCIMEMBASECFG = BONITO_PCIMEMBASECFG 
-   ~(BONITO_PCIMEMBASECFG_MEMBASE0_CACHED |
- BONITO_PCIMEMBASECFG_MEMBASE1_CACHED);
-   printk(Disabled Bonito IOBC coherency\n);
-   }
-   else {
-   BONITO_PCICACHECTRL |= 
BONITO_PCICACHECTRL_IOBCCOH_EN;
-   BONITO_PCIMEMBASECFG |=
-   (BONITO_PCIMEMBASECFG_MEMBASE0_CACHED |
-BONITO_PCIMEMBASECFG_MEMBASE1_CACHED);
-   printk(Enabled Bonito IOBC coherency\n);
-   }
-   }
-   else
-   panic(Hardware DMA cache coherency not supported);
-
-#endif
-   }
-#ifdef CONFIG_DMA_COHERENT
-   else
+   if (mips_revision_sconid != MIPS_REVISION_SCON_BONITO)
panic(Hardware DMA cache coherency not supported);
 #endif
 
+   if (mips_revision_sconid == MIPS_REVISION_SCON_BONITO)
+   bonito_quirks_setup();
+
 #ifdef CONFIG_BLK_DEV_IDE
pci_clock_check();
 #endif
+
 #ifdef CONFIG_BLK_DEV_FD
fd_activate();
 #endif
+
 #if defined

[PATCH 15/17] [MIPS] Malta: make the helper function static

2008-01-24 Thread Dmitri Vorobiev
One helper function can become static. This patch adds the needed
keyword.

No functional changes introduced.

Signed-off-by: Dmitri Vorobiev [EMAIL PROTECTED]
---
 arch/mips/mips-boards/malta/malta_setup.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/mips/mips-boards/malta/malta_setup.c 
b/arch/mips/mips-boards/malta/malta_setup.c
index 8d62966..541f4e7 100644
--- a/arch/mips/mips-boards/malta/malta_setup.c
+++ b/arch/mips/mips-boards/malta/malta_setup.c
@@ -80,7 +80,7 @@ const char display_string[] = LINUX ON MALTA   ;
 #endif /* CONFIG_MIPS_MT_SMTC */
 
 #ifdef CONFIG_BLK_DEV_FD
-void __init fd_activate(void)
+static void __init fd_activate(void)
 {
/*
 * Activate Floppy Controller in the SMSC FDC37M817 Super I/O
-- 
1.5.3

--
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 17/17] [MIPS] remove Documentation/mips/GT64120.README

2008-01-24 Thread Dmitri Vorobiev
Based upon the 2.4 kernel, the information presented in the
Documentation/mips/GT64120.README file is outdated. Worse,
the document contents are plain misleading nowadays because
the text mentions files and directories, which have been
deleted, moved or restructured for 2.6.

This patch removes the documentation, which is no more valid.

Signed-off-by: Dmitri Vorobiev [EMAIL PROTECTED]
---
 Documentation/mips/00-INDEX   |2 -
 Documentation/mips/GT64120.README |   65 -
 2 files changed, 0 insertions(+), 67 deletions(-)
 delete mode 100644 Documentation/mips/GT64120.README

diff --git a/Documentation/mips/00-INDEX b/Documentation/mips/00-INDEX
index 3f13bf8..8ae9cff 100644
--- a/Documentation/mips/00-INDEX
+++ b/Documentation/mips/00-INDEX
@@ -2,5 +2,3 @@
- this file.
 AU1xxx_IDE.README
- README for MIPS AU1XXX IDE driver.
-GT64120.README
-   - README for dir with info on MIPS boards using GT-64120 or GT-64120A.
diff --git a/Documentation/mips/GT64120.README 
b/Documentation/mips/GT64120.README
deleted file mode 100644
index 2d0eec9..000
--- a/Documentation/mips/GT64120.README
+++ /dev/null
@@ -1,65 +0,0 @@
-README for arch/mips/gt64120 directory and subdirectories
-
-Jun Sun, [EMAIL PROTECTED] or [EMAIL PROTECTED]
-01/27, 2001
-
-MOTIVATION
---
-
-Many MIPS boards share the same system controller (or CPU companian chip),
-such as GT-64120.  It is highly desirable to let these boards share
-the same controller code instead of duplicating them.
-
-This directory is meant to hold all MIPS boards that use GT-64120 or GT-64120A.
-
-
-HOW TO ADD A BOARD
---
- 
-. Create a subdirectory include/asm/gt64120/board.  
-
-. Create a file called gt64120_dep.h under that directory.
-
-. Modify include/asm/gt64120/gt64120.h file to include the new gt64120_dep.h
-  based on config options.  The board-dep section is at the end of 
-  include/asm/gt64120/gt64120.h file. There you can find all required
-  definitions include/asm/gt64120/board/gt64120_dep.h file must supply.
-
-. Create a subdirectory arch/mips/gt64120/board directory to hold
-  board specific routines.
-
-. The GT-64120 common code is supplied under arch/mips/gt64120/common 
directory.
-  It includes:
-   1) arch/mips/gt64120/pci.c -
-   common PCI routine, include the top-level pcibios_init()
-   2) arch/mips/gt64120/irq.c -
-   common IRQ routine, include the top-level do_IRQ() 
-  [This part really belongs to arch/mips/kernel. jsun]
-   3) arch/mips/gt64120/gt_irq.c -
-   common IRQ routines for GT-64120 chip.  Currently it only 
handles
-   the timer interrupt.
-
-. Board-specific routines are supplied under arch/mips/gt64120/board dir.
-   1) arch/mips/gt64120/board/pci.c - it provides bus fixup routine
-   2) arch/mips/gt64120/board/irq.c - it provides enable/disable irqs
-   and board irq setup routine (irq_setup)
-   3) arch/mips/gt64120/board/int-handler.S -
-   The first-level interrupt dispatching routine.
-   4) a bunch of other normal stuff (setup, prom, dbg_io, reset, etc)
-
-. Follow other normal procedure to modify configuration files, etc.
-
-
-TO-DO LIST
---
-
-. Expand arch/mips/gt64120/gt_irq.c to handle all GT-64120 interrupts.
-  We probably need to introduce GT_IRQ_BASE  in board-dep header file,
-  which is used the starting irq_nr for all GT irqs.
-
-  A function, gt64120_handle_irq(), will be added so that the first-level
-  irq dispatcher will call this function if it detects an interrupt
-  from GT-64120.
-
-. More support for GT-64120 PCI features (2nd PCI bus, perhaps)
-
-- 
1.5.3

--
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/17] [MIPS] Malta: fix braces at single statement blocks

2008-01-24 Thread Dmitri Vorobiev
This patch fixes a couple of warnings reported by checkpatch.pl.

No functional changes introduced.

Signed-off-by: Dmitri Vorobiev [EMAIL PROTECTED]
---
 arch/mips/mips-boards/malta/malta_int.c   |3 ++-
 arch/mips/mips-boards/malta/malta_setup.c |3 +--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/mips/mips-boards/malta/malta_int.c 
b/arch/mips/mips-boards/malta/malta_int.c
index 92e6e2d..dbe60eb 100644
--- a/arch/mips/mips-boards/malta/malta_int.c
+++ b/arch/mips/mips-boards/malta/malta_int.c
@@ -114,7 +114,8 @@ static void malta_hw0_irqdispatch(void)
 
irq = get_int();
if (irq  0) {
-   return;  /* interrupt has already been cleared */
+   /* interrupt has already been cleared */
+   return;
}
 
do_IRQ(MALTA_INT_BASE + irq);
diff --git a/arch/mips/mips-boards/malta/malta_setup.c 
b/arch/mips/mips-boards/malta/malta_setup.c
index 8dacb6a..8d62966 100644
--- a/arch/mips/mips-boards/malta/malta_setup.c
+++ b/arch/mips/mips-boards/malta/malta_setup.c
@@ -202,9 +202,8 @@ void __init plat_mem_setup(void)
 #endif
}
 #ifdef CONFIG_DMA_COHERENT
-   else {
+   else
panic(Hardware DMA cache coherency not supported);
-   }
 #endif
 
 #ifdef CONFIG_BLK_DEV_IDE
-- 
1.5.3

--
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/17] [MIPS] Malta: else should follow close brace in malta_int.c

2008-01-24 Thread Dmitri Vorobiev
This patch fixes two errors reported by checkpatch.pl.

No functional changes introduced.

Signed-off-by: Dmitri Vorobiev [EMAIL PROTECTED]
---
 arch/mips/mips-boards/malta/malta_int.c |6 ++
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/mips/mips-boards/malta/malta_int.c 
b/arch/mips/mips-boards/malta/malta_int.c
index a268912..2473a77 100644
--- a/arch/mips/mips-boards/malta/malta_int.c
+++ b/arch/mips/mips-boards/malta/malta_int.c
@@ -329,8 +329,7 @@ void __init arch_init_irq(void)
set_vi_handler(MSC01E_INT_COREHI, corehi_irqdispatch);
setup_irq(MSC01E_INT_BASE+MSC01E_INT_I8259A, i8259irq);
setup_irq(MSC01E_INT_BASE+MSC01E_INT_COREHI, corehi_irqaction);
-   }
-   else if (cpu_has_vint) {
+   } else if (cpu_has_vint) {
set_vi_handler(MIPSCPU_INT_I8259A, malta_hw0_irqdispatch);
set_vi_handler(MIPSCPU_INT_COREHI, corehi_irqdispatch);
 #ifdef CONFIG_MIPS_MT_SMTC
@@ -355,8 +354,7 @@ void __init arch_init_irq(void)
setup_irq(MIPS_CPU_IRQ_BASE+MIPSCPU_INT_COREHI,
corehi_irqaction);
 #endif /* CONFIG_MIPS_MT_SMTC */
-   }
-   else {
+   } else {
setup_irq(MIPS_CPU_IRQ_BASE+MIPSCPU_INT_I8259A, i8259irq);
setup_irq(MIPS_CPU_IRQ_BASE+MIPSCPU_INT_COREHI,
corehi_irqaction);
-- 
1.5.3

--
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/17] [MIPS] Malta: remove a superfluous comment

2008-01-24 Thread Dmitri Vorobiev
Using the We die here comment right before calling the die()
function is an extremely vivid example of overcommenting.

Remove the redundant comment and save one line.

No functional changes introduced.

Signed-off-by: Dmitri Vorobiev [EMAIL PROTECTED]
---
 arch/mips/mips-boards/malta/malta_int.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/arch/mips/mips-boards/malta/malta_int.c 
b/arch/mips/mips-boards/malta/malta_int.c
index 41eb232..a268912 100644
--- a/arch/mips/mips-boards/malta/malta_int.c
+++ b/arch/mips/mips-boards/malta/malta_int.c
@@ -173,7 +173,6 @@ static void corehi_irqdispatch(void)
break;
}
 
-   /* We die here*/
die(CoreHi interrupt, regs);
 }
 
-- 
1.5.3

--
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/17] [MIPS] Malta: fix oversized lines in malta_int.c

2008-01-24 Thread Dmitri Vorobiev
This patch fixes all line over 80 characters warnings found
in arch/mips/mips-boards/malta/malta_int.c by the checkpatch.pl
script.

No functional changes introduced.

Signed-off-by: Dmitri Vorobiev [EMAIL PROTECTED]
---
 arch/mips/mips-boards/malta/malta_int.c |   22 --
 1 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/arch/mips/mips-boards/malta/malta_int.c 
b/arch/mips/mips-boards/malta/malta_int.c
index 6d371f4..1b4b9c5 100644
--- a/arch/mips/mips-boards/malta/malta_int.c
+++ b/arch/mips/mips-boards/malta/malta_int.c
@@ -304,17 +304,25 @@ void __init arch_init_irq(void)
case MIPS_REVISION_SCON_SOCIT:
case MIPS_REVISION_SCON_ROCIT:
if (cpu_has_veic)
-   init_msc_irqs(MIPS_MSC01_IC_REG_BASE, MSC01E_INT_BASE, 
msc_eicirqmap, msc_nr_eicirqs);
+   init_msc_irqs(MIPS_MSC01_IC_REG_BASE,
+   MSC01E_INT_BASE, msc_eicirqmap,
+   msc_nr_eicirqs);
else
-   init_msc_irqs(MIPS_MSC01_IC_REG_BASE, MSC01C_INT_BASE, 
msc_irqmap, msc_nr_irqs);
+   init_msc_irqs(MIPS_MSC01_IC_REG_BASE,
+   MSC01C_INT_BASE, msc_irqmap,
+   msc_nr_irqs);
break;
 
case MIPS_REVISION_SCON_SOCITSC:
case MIPS_REVISION_SCON_SOCITSCP:
if (cpu_has_veic)
-   init_msc_irqs(MIPS_SOCITSC_IC_REG_BASE, 
MSC01E_INT_BASE, msc_eicirqmap, msc_nr_eicirqs);
+   init_msc_irqs(MIPS_SOCITSC_IC_REG_BASE,
+   MSC01E_INT_BASE, msc_eicirqmap,
+   msc_nr_eicirqs);
else
-   init_msc_irqs(MIPS_SOCITSC_IC_REG_BASE, 
MSC01C_INT_BASE, msc_irqmap, msc_nr_irqs);
+   init_msc_irqs(MIPS_SOCITSC_IC_REG_BASE,
+   MSC01C_INT_BASE, msc_irqmap,
+   msc_nr_irqs);
}
 
if (cpu_has_veic) {
@@ -345,11 +353,13 @@ void __init arch_init_irq(void)
}
 #else /* Not SMTC */
setup_irq(MIPS_CPU_IRQ_BASE+MIPSCPU_INT_I8259A, i8259irq);
-   setup_irq(MIPS_CPU_IRQ_BASE+MIPSCPU_INT_COREHI, 
corehi_irqaction);
+   setup_irq(MIPS_CPU_IRQ_BASE+MIPSCPU_INT_COREHI,
+   corehi_irqaction);
 #endif /* CONFIG_MIPS_MT_SMTC */
}
else {
setup_irq(MIPS_CPU_IRQ_BASE+MIPSCPU_INT_I8259A, i8259irq);
-   setup_irq(MIPS_CPU_IRQ_BASE+MIPSCPU_INT_COREHI, 
corehi_irqaction);
+   setup_irq(MIPS_CPU_IRQ_BASE+MIPSCPU_INT_COREHI,
+   corehi_irqaction);
}
 }
-- 
1.5.3

--
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] x86: fix unconditional arch/x86/kernel/pcspeaker.c?compiling

2008-01-24 Thread Dmitri Vorobiev
Michael Opdenacker пишет:
 On Friday 18 January 2008, Matt Mackall wrote:
 Probably makes sense to define it right next to INPUT_PCSPKR in
 drivers/input/Kconfig.

 Then do the appropriate fix for all arches mentioned in INPUT_PCSPKR.

 For extra points, you can move the duplicate pcspeaker.c code out of all
 those arches and stash it somewhere in drivers/input. Presumably it's
 possible to get it to link into the kernel even when INPUT is modular.
 
 Here's the patch, after spending some time to get familiar with git.
 
 The patch is against git x86/mm, and it seems to work fine on x86. However,
 on x86, you no longer have /sys/devices/platform/pcspkr after
 running make allnoconfig. To get it, you have to explicitely add support
 to CONFIG_INPUT_PCSPKR (m or y). I hope this is fine.
 
 I'm copying the MIPS maintainer as this patch touches his tree too.

This patch does not apply cleanly to linux-mips Git tree:

 snip
patching file arch/x86/kernel/Makefile
Hunk #1 FAILED at 69.
1 out of 1 hunk FAILED -- saving rejects to file arch/x86/kernel/Makefile.rej
 snip

I believe this is because the linux-mips tree and the -mm tree are not in sync.

 
 On MIPS, there should be no impact though, as CONFIG_PCSPEAKER is set in
 defconfig files.
 
 In other architectures where CONFIG_INPUT_PCSPKR can exist,
 there is a change: when CONFIG_INPUT_PCSPKR is set, the platform device
 will be added, while it didn't exist before. I hope this is fine.
 

It seems tempting to include at least Alpha in this patch, because they
have a device initcall identical to the one, which you're removing from
the MIPS and x86 arch code.

Thanks,

Dmitri
--
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 0/9] bfs: assorted cleanups

2008-01-24 Thread Dmitri Vorobiev
Hello Adrian,

Last time when I had sent some BFS bugfixes to the maintainer of
this filesystem driver, he did not respond, and Andrew Morton
had to take care of those.

For this reason, and because the patches in this little patch bomb
are trivial, I am sending this to you in the hope that these can
be pushed upstream when the next merge window opens.

In case you'll be wondering why I need BFS: I teach system programming
and operating systems at the premises of the Moscow State University.
The BFS code is used as an example of a simple filesystem driver
implementation in Linux. This hopefully explains why I want to have
clean code in here :)

Some checkpatch.pl stats follow.

Before:


| | errors | warnings | checks |

| bfs.h   |   2|0 |   0|

| dir.c   |   7|1 |   4|

| file.c  |   6|0 |   2|

| inode.c |   11   |0 |   3|


After:


| | errors | warnings | checks |

| bfs.h   |   0|0 |   0|

| dir.c   |   0|0 |   0|

| file.c  |   0|0 |   0|

| inode.c |   0|0 |   0|


Please consider.

Thanks,

Dmitri Vorobiev
--
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 1/9] bfs: remove a useless variable

2008-01-24 Thread Dmitri Vorobiev
In the bfs_fill_super() routine, the sblock variable is declared
and assigned a value. However, this value is never used. This trivial
patch removes this useless variable.

This was compile-tested by building the bfs driver both as a module
and as a part of the kernel proper. Both build finished successfully.

Run time test was performed using a BFS image and verifying that the
filesystem remained functional after the change.

Signed-off-by: Dmitri Vorobiev [EMAIL PROTECTED]
---
 fs/bfs/inode.c |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/fs/bfs/inode.c b/fs/bfs/inode.c
index a64a71d..2284657 100644
--- a/fs/bfs/inode.c
+++ b/fs/bfs/inode.c
@@ -368,7 +368,7 @@ static int bfs_fill_super(struct super_block *s, void 
*data, int silent)
struct bfs_inode *di;
int block = (i - BFS_ROOT_INO) / BFS_INODES_PER_BLOCK + 1;
int off = (i - BFS_ROOT_INO) % BFS_INODES_PER_BLOCK;
-   unsigned long sblock, eblock;
+   unsigned long eblock;
 
if (!off) {
brelse(bh);
@@ -387,7 +387,6 @@ static int bfs_fill_super(struct super_block *s, void 
*data, int silent)
set_bit(i, info-si_imap);
info-si_freeb -= BFS_FILEBLOCKS(di);
 
-   sblock =  le32_to_cpu(di-i_sblock);
eblock =  le32_to_cpu(di-i_eblock);
if (eblock  info-si_lf_eblk)
info-si_lf_eblk = eblock;
-- 
1.5.3

--
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 2/9] bfs: coding style cleanup in fs/bfs/inode.c

2008-01-24 Thread Dmitri Vorobiev
This patch cleans up errors found by checkpatch.pl.

Before the patch:

$ ./scripts/checkpatch.pl --file fs/bfs/inode.c  | grep total
total: 11 errors, 0 warnings, 445 lines checked

After the patch:

$ ./scripts/checkpatch.pl --file fs/bfs/inode.c  | grep total
total: 0 errors, 0 warnings, 446 lines checked

No functional changes introduced.

This patch was compile-tested by building the BFS driver both
as a module and as a part of the kernel proper.

Signed-off-by: Dmitri Vorobiev [EMAIL PROTECTED]
---
 fs/bfs/inode.c |   23 ---
 1 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/fs/bfs/inode.c b/fs/bfs/inode.c
index 2284657..5191990 100644
--- a/fs/bfs/inode.c
+++ b/fs/bfs/inode.c
@@ -90,12 +90,12 @@ static void bfs_read_inode(struct inode *inode)
 static int bfs_write_inode(struct inode *inode, int unused)
 {
unsigned int ino = (u16)inode-i_ino;
-unsigned long i_sblock;
+   unsigned long i_sblock;
struct bfs_inode *di;
struct buffer_head *bh;
int block, off;
 
-dprintf(ino=%08x\n, ino);
+   dprintf(ino=%08x\n, ino);
 
if ((ino  BFS_ROOT_INO) || (ino  BFS_SB(inode-i_sb)-si_lasti)) {
printf(Bad inode number %s:%08x\n, inode-i_sb-s_id, ino);
@@ -128,7 +128,7 @@ static int bfs_write_inode(struct inode *inode, int unused)
di-i_atime = cpu_to_le32(inode-i_atime.tv_sec);
di-i_mtime = cpu_to_le32(inode-i_mtime.tv_sec);
di-i_ctime = cpu_to_le32(inode-i_ctime.tv_sec);
-i_sblock = BFS_I(inode)-i_sblock;
+   i_sblock = BFS_I(inode)-i_sblock;
di-i_sblock = cpu_to_le32(i_sblock);
di-i_eblock = cpu_to_le32(BFS_I(inode)-i_eblock);
di-i_eoffset = cpu_to_le32(i_sblock * BFS_BSIZE + inode-i_size - 1);
@@ -157,7 +157,7 @@ static void bfs_delete_inode(struct inode *inode)
printf(invalid ino=%08lx\n, ino);
return;
}
-   
+
inode-i_size = 0;
inode-i_atime = inode-i_mtime = inode-i_ctime = CURRENT_TIME_SEC;
lock_kernel();
@@ -177,13 +177,13 @@ static void bfs_delete_inode(struct inode *inode)
mark_buffer_dirty(bh);
brelse(bh);
 
-if (bi-i_dsk_ino) {
+   if (bi-i_dsk_ino) {
if (bi-i_sblock)
info-si_freeb += bi-i_eblock + 1 - bi-i_sblock;
info-si_freei++;
clear_bit(ino, info-si_imap);
dump_imap(delete_inode, s);
-}
+   }
 
/*
 * If this was the last file, make the previous block
@@ -293,7 +293,8 @@ void dump_imap(const char *prefix, struct super_block *s)
if (!tmpbuf)
return;
for (i = BFS_SB(s)-si_lasti; i = 0; i--) {
-   if (i  PAGE_SIZE - 100) break;
+   if (i  PAGE_SIZE - 100)
+   break;
if (test_bit(i, BFS_SB(s)-si_imap))
strcat(tmpbuf, 1);
else
@@ -321,12 +322,12 @@ static int bfs_fill_super(struct super_block *s, void 
*data, int silent)
sb_set_blocksize(s, BFS_BSIZE);
 
bh = sb_bread(s, 0);
-   if(!bh)
+   if (!bh)
goto out;
bfs_sb = (struct bfs_super_block *)bh-b_data;
if (le32_to_cpu(bfs_sb-s_magic) != BFS_MAGIC) {
if (!silent)
-   printf(No BFS filesystem on %s (magic=%08x)\n, 
+   printf(No BFS filesystem on %s (magic=%08x)\n,
s-s_id,  le32_to_cpu(bfs_sb-s_magic));
goto out;
}
@@ -395,7 +396,7 @@ static int bfs_fill_super(struct super_block *s, void 
*data, int silent)
if (!(s-s_flags  MS_RDONLY)) {
mark_buffer_dirty(info-si_sbh);
s-s_dirt = 1;
-   } 
+   }
dump_imap(read_super, s);
return 0;
 
@@ -425,7 +426,7 @@ static int __init init_bfs_fs(void)
int err = init_inodecache();
if (err)
goto out1;
-err = register_filesystem(bfs_fs_type);
+   err = register_filesystem(bfs_fs_type);
if (err)
goto out;
return 0;
-- 
1.5.3

--
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 3/9] bfs: coding style cleanup in fs/bfs/bfs.h

2008-01-24 Thread Dmitri Vorobiev
Clean up errors found by checkpatch.pl.

Before the patch:

$ ./scripts/checkpatch.pl --file  fs/bfs/bfs.h | grep total
total: 2 errors, 0 warnings, 57 lines checked

After the patch:

$ ./scripts/checkpatch.pl --file  fs/bfs/bfs.h | grep total
total: 0 errors, 0 warnings, 57 lines checked

No functional changes introduced.

This patch was compile-tested by building the BFS driver both
as a module and as a part of the kernel proper.

Signed-off-by: Dmitri Vorobiev [EMAIL PROTECTED]
---
 fs/bfs/bfs.h |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/bfs/bfs.h b/fs/bfs/bfs.h
index ac7a8b1..090b96e 100644
--- a/fs/bfs/bfs.h
+++ b/fs/bfs/bfs.h
@@ -16,8 +16,8 @@ struct bfs_sb_info {
unsigned long si_freei;
unsigned long si_lf_eblk;
unsigned long si_lasti;
-   unsigned long * si_imap;
-   struct buffer_head * si_sbh;/* buffer header w/superblock */
+   unsigned long *si_imap;
+   struct buffer_head *si_sbh; /* buffer header w/superblock */
 };
 
 /*
-- 
1.5.3

--
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 4/9] bfs: coding style cleanup in fs/bfs/dir.c

2008-01-24 Thread Dmitri Vorobiev
Clean up errors found by checkpatch.pl.

Before the patch:

$ ./scripts/checkpatch.pl --file  fs/bfs/dir.c | grep total
total: 7 errors, 1 warnings, 370 lines checked

After the patch:

$ ./scripts/checkpatch.pl --file  fs/bfs/dir.c | grep total
total: 0 errors, 1 warnings, 370 lines checked

No functional changes introduced.

This patch was compile-tested by building the BFS driver both
as a module and as a part of the kernel proper.

Signed-off-by: Dmitri Vorobiev [EMAIL PROTECTED]
---
 fs/bfs/dir.c |   14 +++---
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/fs/bfs/dir.c b/fs/bfs/dir.c
index 1fd056d..5462a5b 100644
--- a/fs/bfs/dir.c
+++ b/fs/bfs/dir.c
@@ -72,7 +72,7 @@ static int bfs_readdir(struct file *f, void *dirent, 
filldir_t filldir)
}
 
unlock_kernel();
-   return 0;   
+   return 0;
 }
 
 const struct file_operations bfs_dir_operations = {
@@ -117,7 +117,7 @@ static int bfs_create(struct inode *dir, struct dentry 
*dentry, int mode,
BFS_I(inode)-i_sblock = 0;
BFS_I(inode)-i_eblock = 0;
insert_inode_hash(inode);
-mark_inode_dirty(inode);
+   mark_inode_dirty(inode);
dump_imap(create, s);
 
err = bfs_add_entry(dir, dentry-d_name.name, dentry-d_name.len,
@@ -228,8 +228,8 @@ static int bfs_rename(struct inode *old_dir, struct dentry 
*old_dentry,
return -EINVAL;
 
lock_kernel();
-   old_bh = bfs_find_entry(old_dir, 
-   old_dentry-d_name.name, 
+   old_bh = bfs_find_entry(old_dir,
+   old_dentry-d_name.name,
old_dentry-d_name.len, old_de);
 
if (!old_bh || (le16_to_cpu(old_de-ino) != old_inode-i_ino))
@@ -237,8 +237,8 @@ static int bfs_rename(struct inode *old_dir, struct dentry 
*old_dentry,
 
error = -EPERM;
new_inode = new_dentry-d_inode;
-   new_bh = bfs_find_entry(new_dir, 
-   new_dentry-d_name.name, 
+   new_bh = bfs_find_entry(new_dir,
+   new_dentry-d_name.name,
new_dentry-d_name.len, new_de);
 
if (new_bh  !new_inode) {
@@ -246,7 +246,7 @@ static int bfs_rename(struct inode *old_dir, struct dentry 
*old_dentry,
new_bh = NULL;
}
if (!new_bh) {
-   error = bfs_add_entry(new_dir, 
+   error = bfs_add_entry(new_dir,
new_dentry-d_name.name,
new_dentry-d_name.len,
old_inode-i_ino);
-- 
1.5.3

--
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 5/9] bfs: move function prototype to the proper header file

2008-01-24 Thread Dmitri Vorobiev
The dump_imap() routine is defined in bs/bfs/inode.c and used both in
the same file and in fs/bfs/dir.c. This patch adds an extern function
declaration to the private bfs.h header file.

The effect is that one warning issued by checkpatch.pl is gone.

Before the patch:

$ ./scripts/checkpatch.pl --file  fs/bfs/dir.c | grep total
total: 0 errors, 1 warnings, 370 lines checked

After the patch:

$ ./scripts/checkpatch.pl --file  fs/bfs/dir.c | grep total
total: 0 errors, 0 warnings, 368 lines checked

This patch was compile-tested by building the BFS driver both
as a module and as a part of the kernel proper.

Signed-off-by: Dmitri Vorobiev [EMAIL PROTECTED]
---
 fs/bfs/bfs.h   |3 +++
 fs/bfs/dir.c   |2 --
 fs/bfs/inode.c |2 --
 3 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/fs/bfs/bfs.h b/fs/bfs/bfs.h
index 090b96e..ecc74bb 100644
--- a/fs/bfs/bfs.h
+++ b/fs/bfs/bfs.h
@@ -54,4 +54,7 @@ extern const struct address_space_operations bfs_aops;
 extern const struct inode_operations bfs_dir_inops;
 extern const struct file_operations bfs_dir_operations;
 
+/* inode.c */
+extern void dump_imap(const char *, struct super_block *);
+
 #endif /* _FS_BFS_BFS_H */
diff --git a/fs/bfs/dir.c b/fs/bfs/dir.c
index 5462a5b..2964505 100644
--- a/fs/bfs/dir.c
+++ b/fs/bfs/dir.c
@@ -81,8 +81,6 @@ const struct file_operations bfs_dir_operations = {
.fsync  = file_fsync,
 };
 
-extern void dump_imap(const char *, struct super_block *);
-
 static int bfs_create(struct inode *dir, struct dentry *dentry, int mode,
struct nameidata *nd)
 {
diff --git a/fs/bfs/inode.c b/fs/bfs/inode.c
index 5191990..91d5686 100644
--- a/fs/bfs/inode.c
+++ b/fs/bfs/inode.c
@@ -30,8 +30,6 @@ MODULE_LICENSE(GPL);
 #define dprintf(x...)
 #endif
 
-void dump_imap(const char *prefix, struct super_block *s);
-
 static void bfs_read_inode(struct inode *inode)
 {
unsigned long ino = inode-i_ino;
-- 
1.5.3

--
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 6/9] bfs: coding style cleanup in fs/bfs/file.c

2008-01-24 Thread Dmitri Vorobiev
Clean up errors found by checkpatch.pl.

Before the patch:

$ ./scripts/checkpatch.pl --file  fs/bfs/file.c | grep total
total: 6 errors, 0 warnings, 191 lines checked

After the patch:

$ ./scripts/checkpatch.pl --file  fs/bfs/file.c | grep total
total: 0 errors, 0 warnings, 191 lines checked

No functional changes introduced.

This patch was compile-tested by building the BFS driver both
as a module and as a part of the kernel proper.

Signed-off-by: Dmitri Vorobiev [EMAIL PROTECTED]
---
 fs/bfs/file.c |   12 ++--
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/fs/bfs/file.c b/fs/bfs/file.c
index b11e63e..f32b2a2 100644
--- a/fs/bfs/file.c
+++ b/fs/bfs/file.c
@@ -55,7 +55,7 @@ static int bfs_move_blocks(struct super_block *sb, unsigned 
long start,
 
dprintf(%08lx-%08lx-%08lx\n, start, end, where);
for (i = start; i = end; i++)
-   if(bfs_move_block(i, where + i, sb)) {
+   if (bfs_move_block(i, where + i, sb)) {
dprintf(failed to move block %08lx - %08lx\n, i,
where + i);
return -EIO;
@@ -77,7 +77,7 @@ static int bfs_get_block(struct inode *inode, sector_t block,
if (!create) {
if (phys = bi-i_eblock) {
dprintf(c=%d, b=%08lx, phys=%09lx (granted)\n,
-create, (unsigned long)block, phys);
+   create, (unsigned long)block, phys);
map_bh(bh_result, sb, phys);
}
return 0;
@@ -88,7 +88,7 @@ static int bfs_get_block(struct inode *inode, sector_t block,
 * range of blocks allocated for this file, we can grant it.
 */
if (bi-i_sblock  (phys = bi-i_eblock)) {
-   dprintf(c=%d, b=%08lx, phys=%08lx (interim block granted)\n, 
+   dprintf(c=%d, b=%08lx, phys=%08lx (interim block granted)\n,
create, (unsigned long)block, phys);
map_bh(bh_result, sb, phys);
return 0;
@@ -107,7 +107,7 @@ static int bfs_get_block(struct inode *inode, sector_t 
block,
 * anywhere.
 */
if (bi-i_eblock == info-si_lf_eblk) {
-   dprintf(c=%d, b=%08lx, phys=%08lx (simple extension)\n, 
+   dprintf(c=%d, b=%08lx, phys=%08lx (simple extension)\n,
create, (unsigned long)block, phys);
map_bh(bh_result, sb, phys);
info-si_freeb -= phys - bi-i_eblock;
@@ -126,7 +126,7 @@ static int bfs_get_block(struct inode *inode, sector_t 
block,
}
 
if (bi-i_sblock) {
-   err = bfs_move_blocks(inode-i_sb, bi-i_sblock, 
+   err = bfs_move_blocks(inode-i_sb, bi-i_sblock,
bi-i_eblock, phys);
if (err) {
dprintf(failed to move ino=%08lx - fs corruption\n,
@@ -137,7 +137,7 @@ static int bfs_get_block(struct inode *inode, sector_t 
block,
err = 0;
 
dprintf(c=%d, b=%08lx, phys=%08lx (moved)\n,
-create, (unsigned long)block, phys);
+   create, (unsigned long)block, phys);
bi-i_sblock = phys;
phys += block;
info-si_lf_eblk = bi-i_eblock = phys;
-- 
1.5.3

--
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 7/9] bfs: coding style cleanup in include/linux/bfs_fs.h

2008-01-24 Thread Dmitri Vorobiev
Clean up errors found by checkpatch.pl.

Before the patch:

$ ./scripts/checkpatch.pl --file  include/linux/bfs_fs.h | grep total
total: 5 errors, 3 warnings, 80 lines checked

After the patch:

$ ./scripts/checkpatch.pl --file  include/linux/bfs_fs.h | grep total
total: 0 errors, 0 warnings, 83 lines checked

No functional changes introduced.

This patch was compile-tested by building the BFS driver both
as a module and as a part of the kernel proper.

Signed-off-by: Dmitri Vorobiev [EMAIL PROTECTED]
---
 include/linux/bfs_fs.h |   17 ++---
 1 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/include/linux/bfs_fs.h b/include/linux/bfs_fs.h
index 8ed6dfd..d7b11a6 100644
--- a/include/linux/bfs_fs.h
+++ b/include/linux/bfs_fs.h
@@ -36,7 +36,7 @@ struct bfs_inode {
__u32 i_padding[4];
 };
 
-#define BFS_NAMELEN14  
+#define BFS_NAMELEN14
 #define BFS_DIRENT_SIZE16
 #define BFS_DIRS_PER_BLOCK 32
 
@@ -61,20 +61,23 @@ struct bfs_super_block {
 
 
 #define BFS_OFF2INO(offset) \
-offset) - BFS_BSIZE) / sizeof(struct bfs_inode)) + BFS_ROOT_INO)
+   offset) - BFS_BSIZE) / sizeof(struct bfs_inode)) + BFS_ROOT_INO)
 
 #define BFS_INO2OFF(ino) \
((__u32)(((ino) - BFS_ROOT_INO) * sizeof(struct bfs_inode)) + BFS_BSIZE)
 #define BFS_NZFILESIZE(ip) \
-((le32_to_cpu((ip)-i_eoffset) + 1) -  le32_to_cpu((ip)-i_sblock) * 
BFS_BSIZE)
+   ((le32_to_cpu((ip)-i_eoffset) + 1) - \
+le32_to_cpu((ip)-i_sblock) * BFS_BSIZE)
 
 #define BFS_FILESIZE(ip) \
-((ip)-i_sblock == 0 ? 0 : BFS_NZFILESIZE(ip))
+   ((ip)-i_sblock == 0 ? 0 : BFS_NZFILESIZE(ip))
 
 #define BFS_FILEBLOCKS(ip) \
-((ip)-i_sblock == 0 ? 0 : (le32_to_cpu((ip)-i_eblock) + 1) -  
le32_to_cpu((ip)-i_sblock))
+   ((ip)-i_sblock == 0 ? 0 : (le32_to_cpu((ip)-i_eblock) + 1) - \
+le32_to_cpu((ip)-i_sblock))
 #define BFS_UNCLEAN(bfs_sb, sb)\
-   ((le32_to_cpu(bfs_sb-s_from) != -1)  (le32_to_cpu(bfs_sb-s_to) != 
-1)  !(sb-s_flags  MS_RDONLY))
-
+   ((le32_to_cpu(bfs_sb-s_from) != -1)  \
+   (le32_to_cpu(bfs_sb-s_to) != -1)  \
+   !(sb-s_flags  MS_RDONLY))
 
 #endif /* _LINUX_BFS_FS_H */
-- 
1.5.3

--
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 8/9] bfs: remove multiple assignments

2008-01-24 Thread Dmitri Vorobiev
The checkpatch.pl reported several warnings about multiple variable
assignments in the BFS driver sources. This trivial patch fixes these
warnings by giving each assignment its own line.

No functional changes introduced.

This patch was compile-tested by building the BFS driver both
as a module and as a part of the kernel proper.

Signed-off-by: Dmitri Vorobiev [EMAIL PROTECTED]
---
 fs/bfs/dir.c   |   13 +
 fs/bfs/file.c  |6 --
 fs/bfs/inode.c |7 +--
 3 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/fs/bfs/dir.c b/fs/bfs/dir.c
index 2964505..94fed7a 100644
--- a/fs/bfs/dir.c
+++ b/fs/bfs/dir.c
@@ -104,7 +104,9 @@ static int bfs_create(struct inode *dir, struct dentry 
*dentry, int mode,
info-si_freei--;
inode-i_uid = current-fsuid;
inode-i_gid = (dir-i_mode  S_ISGID) ? dir-i_gid : current-fsgid;
-   inode-i_mtime = inode-i_atime = inode-i_ctime = CURRENT_TIME_SEC;
+   inode-i_mtime = CURRENT_TIME_SEC;
+   inode-i_atime = CURRENT_TIME_SEC;
+   inode-i_ctime = CURRENT_TIME_SEC;
inode-i_blocks = 0;
inode-i_op = bfs_file_inops;
inode-i_fop = bfs_file_operations;
@@ -200,7 +202,8 @@ static int bfs_unlink(struct inode *dir, struct dentry 
*dentry)
}
de-ino = 0;
mark_buffer_dirty(bh);
-   dir-i_ctime = dir-i_mtime = CURRENT_TIME_SEC;
+   dir-i_ctime = CURRENT_TIME_SEC;
+   dir-i_mtime = CURRENT_TIME_SEC;
mark_inode_dirty(dir);
inode-i_ctime = dir-i_ctime;
inode_dec_link_count(inode);
@@ -220,7 +223,8 @@ static int bfs_rename(struct inode *old_dir, struct dentry 
*old_dentry,
struct bfs_dirent *old_de, *new_de;
int error = -ENOENT;
 
-   old_bh = new_bh = NULL;
+   old_bh = NULL;
+   new_bh = NULL;
old_inode = old_dentry-d_inode;
if (S_ISDIR(old_inode-i_mode))
return -EINVAL;
@@ -252,7 +256,8 @@ static int bfs_rename(struct inode *old_dir, struct dentry 
*old_dentry,
goto end_rename;
}
old_de-ino = 0;
-   old_dir-i_ctime = old_dir-i_mtime = CURRENT_TIME_SEC;
+   old_dir-i_ctime = CURRENT_TIME_SEC;
+   old_dir-i_mtime = CURRENT_TIME_SEC;
mark_inode_dirty(old_dir);
if (new_inode) {
new_inode-i_ctime = CURRENT_TIME_SEC;
diff --git a/fs/bfs/file.c b/fs/bfs/file.c
index f32b2a2..ab2fa66 100644
--- a/fs/bfs/file.c
+++ b/fs/bfs/file.c
@@ -111,7 +111,8 @@ static int bfs_get_block(struct inode *inode, sector_t 
block,
create, (unsigned long)block, phys);
map_bh(bh_result, sb, phys);
info-si_freeb -= phys - bi-i_eblock;
-   info-si_lf_eblk = bi-i_eblock = phys;
+   info-si_lf_eblk = phys;
+   bi-i_eblock = phys;
mark_inode_dirty(inode);
mark_buffer_dirty(sbh);
err = 0;
@@ -140,7 +141,8 @@ static int bfs_get_block(struct inode *inode, sector_t 
block,
create, (unsigned long)block, phys);
bi-i_sblock = phys;
phys += block;
-   info-si_lf_eblk = bi-i_eblock = phys;
+   info-si_lf_eblk = phys;
+   bi-i_eblock = phys;
 
/*
 * This assumes nothing can write the inode back while we are here
diff --git a/fs/bfs/inode.c b/fs/bfs/inode.c
index 91d5686..7eefafb 100644
--- a/fs/bfs/inode.c
+++ b/fs/bfs/inode.c
@@ -157,7 +157,9 @@ static void bfs_delete_inode(struct inode *inode)
}
 
inode-i_size = 0;
-   inode-i_atime = inode-i_mtime = inode-i_ctime = CURRENT_TIME_SEC;
+   inode-i_atime = CURRENT_TIME_SEC;
+   inode-i_mtime = CURRENT_TIME_SEC;
+   inode-i_ctime = CURRENT_TIME_SEC;
lock_kernel();
mark_inode_dirty(inode);
 
@@ -213,7 +215,8 @@ static int bfs_statfs(struct dentry *dentry, struct kstatfs 
*buf)
buf-f_type = BFS_MAGIC;
buf-f_bsize = s-s_blocksize;
buf-f_blocks = info-si_blocks;
-   buf-f_bfree = buf-f_bavail = info-si_freeb;
+   buf-f_bfree = info-si_freeb;
+   buf-f_bavail = info-si_freeb;
buf-f_files = info-si_lasti + 1 - BFS_ROOT_INO;
buf-f_ffree = info-si_freei;
buf-f_fsid.val[0] = (u32)id;
-- 
1.5.3

--
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 9/9] bfs: use the proper header file for inclusion

2008-01-24 Thread Dmitri Vorobiev
The checkpatch.pl reported the following warning:

$ ./scripts/checkpatch.pl --strict --file fs/bfs/inode.c
CHECK: Use #include linux/uaccess.h instead of asm/uaccess.h
+#include asm/uaccess.h

This patch fixes this warning.

No functional changes introduced.

This patch was compile-tested by building the BFS driver both
as a module and as a part of the kernel proper.

Signed-off-by: Dmitri Vorobiev [EMAIL PROTECTED]
---
 fs/bfs/inode.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/bfs/inode.c b/fs/bfs/inode.c
index 7eefafb..00c54fa 100644
--- a/fs/bfs/inode.c
+++ b/fs/bfs/inode.c
@@ -15,7 +15,7 @@
 #include linux/smp_lock.h
 #include linux/buffer_head.h
 #include linux/vfs.h
-#include asm/uaccess.h
+#include linux/uaccess.h
 #include bfs.h
 
 MODULE_AUTHOR(Tigran Aivazian [EMAIL PROTECTED]);
-- 
1.5.3

--
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 5/9] bfs: move function prototype to the proper header file

2008-01-24 Thread Dmitri Vorobiev
Heikki Orsila пишет:
 On Fri, Jan 25, 2008 at 01:32:04AM +0300, Dmitri Vorobiev wrote:
 diff --git a/fs/bfs/bfs.h b/fs/bfs/bfs.h
 index 090b96e..ecc74bb 100644
 --- a/fs/bfs/bfs.h
 +++ b/fs/bfs/bfs.h
 ...
 +/* inode.c */
 +extern void dump_imap(const char *, struct super_block *);
 +
 
 Functions should not be externed, remove extern keyword.
 

Care to explain why?

Following is an explanation why the contrary is probably true:

1) We have lots of precedents in existing code:

[EMAIL PROTECTED]:~/Projects/misc/linux$ git-grep 'extern void' include | wc -l
5523
[EMAIL PROTECTED]:~/Projects/misc/linux$

2) Linus' Coding style does not mandate what you requested.

3) The checkpatch.pl did not complain at this particular patch.

Thanks,

Dmitri

--
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 5/9] bfs: move function prototype to the proper header file

2008-01-24 Thread Dmitri Vorobiev
Tigran Aivazian пишет:
 On Fri, 25 Jan 2008, Dmitri Vorobiev wrote:
 
 Heikki Orsila пишет:
 +extern void dump_imap(const char *, struct super_block *);
 +

 Functions should not be externed, remove extern keyword.


 Care to explain why?
 
 because dump_imap() is just a BFS' internal helper (for debugging
 purposes only btw) to dump the inode map via printk. Why should it be
 moved into the header, i.e. where one expects to see things potentially
 visible by the rest of the kernel?


Thanks, Tigran.

Please find below the corrected version. Compilation test passed successfully.

Dmitri
 
==

The dump_imap() routine is defined in bs/bfs/inode.c and used both in
the same file and in fs/bfs/dir.c. This patch adds an extern function
declaration to the private bfs.h header file.

The effect is that one warning issued by checkpatch.pl is gone.

Before the patch:

$ ./scripts/checkpatch.pl --file  fs/bfs/dir.c | grep total
total: 0 errors, 1 warnings, 370 lines checked

After the patch:

$ ./scripts/checkpatch.pl --file  fs/bfs/dir.c | grep total
total: 0 errors, 0 warnings, 368 lines checked

This patch was compile-tested by building the BFS driver both
as a module and as a part of the kernel proper.

Signed-off-by: Dmitri Vorobiev [EMAIL PROTECTED]
---
diff --git a/fs/bfs/bfs.h b/fs/bfs/bfs.h
index 090b96e..352804f 100644
--- a/fs/bfs/bfs.h
+++ b/fs/bfs/bfs.h
@@ -54,4 +54,7 @@ extern const struct address_space_operations bfs_aops;
 extern const struct inode_operations bfs_dir_inops;
 extern const struct file_operations bfs_dir_operations;
 
+/* inode.c */
+void dump_imap(const char *, struct super_block *);
+
 #endif /* _FS_BFS_BFS_H */
diff --git a/fs/bfs/dir.c b/fs/bfs/dir.c
index 5462a5b..2964505 100644
--- a/fs/bfs/dir.c
+++ b/fs/bfs/dir.c
@@ -81,8 +81,6 @@ const struct file_operations bfs_dir_operations = {
.fsync  = file_fsync,
 };
 
-extern void dump_imap(const char *, struct super_block *);
-
 static int bfs_create(struct inode *dir, struct dentry *dentry, int mode,
struct nameidata *nd)
 {
diff --git a/fs/bfs/inode.c b/fs/bfs/inode.c
index 5191990..91d5686 100644
--- a/fs/bfs/inode.c
+++ b/fs/bfs/inode.c
@@ -30,8 +30,6 @@ MODULE_LICENSE(GPL);
 #define dprintf(x...)
 #endif
 
-void dump_imap(const char *prefix, struct super_block *s);
-
 static void bfs_read_inode(struct inode *inode)
 {
unsigned long ino = inode-i_ino;

--
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 5/9] bfs: move function prototype to the proper header file

2008-01-24 Thread Dmitri Vorobiev
Heikki Orsila пишет:
 On Fri, Jan 25, 2008 at 02:13:00AM +0300, Dmitri Vorobiev wrote:
 Care to explain why?
 
 Because functions are always external objects in C. I just verified that 
 from KR.
 

Yes, I know that :)

The reasons behind me using this keyword were: 1) to keep the code symmetric;
2)-4) as explained elsewhere in this thread.

Anyways, you and Tigran have been convincing enough and the corrected patch
is there.

Thanks,

Dmitri
--
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] x86_32: remove the useless NR_syscalls macro

2008-01-17 Thread Dmitri Vorobiev
This is against current x86.git.

The size of the system call table for 32-bit x86 kernels is obtained by
compile-time calculation of the sys_call_table array, not from the value,
which the NR_syscalls macro expands to. This trivial patch removes the
fossil macro.

Manually tested by grepping the x86 files for the "NR_syscalls" string.
No relevant use cases found.

Build-tested using allyesconfig, allnoconfig and a couple of randconfig
instances. All builds successfully finished.

Runtime test performed using a stripped-down Debian-ish config. The system
booted successfully.

Signed-off-by: Dmitri Vorobiev <[EMAIL PROTECTED]>
---
 include/asm-x86/unistd_32.h |2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/include/asm-x86/unistd_32.h b/include/asm-x86/unistd_32.h
index 9b15545..8d8f9b5 100644
--- a/include/asm-x86/unistd_32.h
+++ b/include/asm-x86/unistd_32.h
@@ -333,8 +333,6 @@ #define __NR_fallocate  324
 
 #ifdef __KERNEL__
 
-#define NR_syscalls 325
-
 #define __ARCH_WANT_IPC_PARSE_VERSION
 #define __ARCH_WANT_OLD_READDIR
 #define __ARCH_WANT_OLD_STAT
-- 
1.4.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] x86_32: remove the useless NR_syscalls macro

2008-01-17 Thread Dmitri Vorobiev
This is against current x86.git.

The size of the system call table for 32-bit x86 kernels is obtained by
compile-time calculation of the sys_call_table array, not from the value,
which the NR_syscalls macro expands to. This trivial patch removes the
fossil macro.

Manually tested by grepping the x86 files for the NR_syscalls string.
No relevant use cases found.

Build-tested using allyesconfig, allnoconfig and a couple of randconfig
instances. All builds successfully finished.

Runtime test performed using a stripped-down Debian-ish config. The system
booted successfully.

Signed-off-by: Dmitri Vorobiev [EMAIL PROTECTED]
---
 include/asm-x86/unistd_32.h |2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/include/asm-x86/unistd_32.h b/include/asm-x86/unistd_32.h
index 9b15545..8d8f9b5 100644
--- a/include/asm-x86/unistd_32.h
+++ b/include/asm-x86/unistd_32.h
@@ -333,8 +333,6 @@ #define __NR_fallocate  324
 
 #ifdef __KERNEL__
 
-#define NR_syscalls 325
-
 #define __ARCH_WANT_IPC_PARSE_VERSION
 #define __ARCH_WANT_OLD_READDIR
 #define __ARCH_WANT_OLD_STAT
-- 
1.4.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 -v2][MIPS] Add Atlas to feature-removal-schedule.txt

2008-01-14 Thread Dmitri Vorobiev
Ralf Baechle on Atlas board support in the linux-mips mailing list:

> Maciej is promising to fix it up since a few years ;-)  Aside of that it's
> safe to say the Atlas is dead like a coffin nail.

Signed-off-by: Dmitri Vorobiev <[EMAIL PROTECTED]>

---
diff --git a/Documentation/feature-removal-schedule.txt 
b/Documentation/feature-removal-schedule.txt
index 20c4c8b..2693ebc 100644
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
@@ -333,3 +333,11 @@ Why:   This driver has been marked obsolet
 Who:   Stephen Hemminger <[EMAIL PROTECTED]>
 
 ---
+
+What:  Support for MIPS Technologies' Atlas evaluation board
+When:  March 2008
+Why:   Apparently there is no user base left for this platform.
+   Hardware out of production since several years.
+Who:   Dmitri Vorobiev <[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][MIPS] Malta: Fix reading the PCI clock frequency on big-endian

2008-01-14 Thread Dmitri Vorobiev
The JMPRS register on Malta boards keeps a 32-bit CPU-endian
value. The readw() function assumes that the value it reads is a
little-endian 16-bit number. Therefore, using readw() to obtain
the value of the JMPRS register is a mistake. This error leads
to incorrect reading of the PCI clock frequency on big-endian
during board start-up.

Change readw() to __raw_readl().

This was tested by injecting a call to printk() and verifying
that the value of the jmpr variable was consistent with current
setting of the JP4 "PCI CLK" jumper.

Signed-off-by: Dmitri Vorobiev <[EMAIL PROTECTED]>
---
 arch/mips/mips-boards/malta/malta_setup.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/mips/mips-boards/malta/malta_setup.c 
b/arch/mips/mips-boards/malta/malta_setup.c
index 9a2636e..bc43a5c 100644
--- a/arch/mips/mips-boards/malta/malta_setup.c
+++ b/arch/mips/mips-boards/malta/malta_setup.c
@@ -149,7 +149,7 @@ void __init plat_mem_setup(void)
/* Check PCI clock */
{
unsigned int __iomem *jmpr_p = (unsigned int *) 
ioremap(MALTA_JMPRS_REG, sizeof(unsigned int));
-   int jmpr = (readw(jmpr_p) >> 2) & 0x07;
+   int jmpr = (__raw_readl(jmpr_p) >> 2) & 0x07;
static const int pciclocks[] __initdata = {
33, 20, 25, 30, 12, 16, 37, 10
};
-- 
1.5.3
--
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][MIPS] Add Atlas to feature-removal-schedule.

2008-01-14 Thread Dmitri Vorobiev
Ralf Baechle on Atlas board support in the linux-mips mailing list:

Maciej is promising to fix it up since a few years ;-)  Aside of that it's
safe to say the Atlas is dead like a coffin nail.

Signed-off-by: Dmitri Vorobiev <[EMAIL PROTECTED]>
---
 Documentation/feature-removal-schedule.txt |8 
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/Documentation/feature-removal-schedule.txt 
b/Documentation/feature-removal-schedule.txt
index 20c4c8b..c053318 100644
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
@@ -333,3 +333,11 @@ Why:   This driver has been marked obsolete for many 
years.
 Who:   Stephen Hemminger <[EMAIL PROTECTED]>
 
 ---
+
+What:  Support for MIPS Technologies' Altas evaluation board
+When:  March 2008
+Why:   Apparently there is no user base left for this platform.
+   Hardware out of production since several years.
+Who:   Dmitri Vorobiev <[EMAIL PROTECTED]>
+
+---
-- 
1.5.3
--
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][MIPS] Malta: Fix reading the PCI clock frequency on big-endian

2008-01-14 Thread Dmitri Vorobiev
The JMPRS register on Malta boards keeps a 32-bit CPU-endian
value. The readw() function assumes that the value it reads is a
little-endian 16-bit number. Therefore, using readw() to obtain
the value of the JMPRS register is a mistake. This error leads
to incorrect reading of the PCI clock frequency on big-endian
during board start-up.

Change readw() to __raw_readl().

This was tested by injecting a call to printk() and verifying
that the value of the jmpr variable was consistent with current
setting of the JP4 PCI CLK jumper.

Signed-off-by: Dmitri Vorobiev [EMAIL PROTECTED]
---
 arch/mips/mips-boards/malta/malta_setup.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/mips/mips-boards/malta/malta_setup.c 
b/arch/mips/mips-boards/malta/malta_setup.c
index 9a2636e..bc43a5c 100644
--- a/arch/mips/mips-boards/malta/malta_setup.c
+++ b/arch/mips/mips-boards/malta/malta_setup.c
@@ -149,7 +149,7 @@ void __init plat_mem_setup(void)
/* Check PCI clock */
{
unsigned int __iomem *jmpr_p = (unsigned int *) 
ioremap(MALTA_JMPRS_REG, sizeof(unsigned int));
-   int jmpr = (readw(jmpr_p)  2)  0x07;
+   int jmpr = (__raw_readl(jmpr_p)  2)  0x07;
static const int pciclocks[] __initdata = {
33, 20, 25, 30, 12, 16, 37, 10
};
-- 
1.5.3
--
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][MIPS] Add Atlas to feature-removal-schedule.

2008-01-14 Thread Dmitri Vorobiev
Ralf Baechle on Atlas board support in the linux-mips mailing list:

Maciej is promising to fix it up since a few years ;-)  Aside of that it's
safe to say the Atlas is dead like a coffin nail.

Signed-off-by: Dmitri Vorobiev [EMAIL PROTECTED]
---
 Documentation/feature-removal-schedule.txt |8 
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/Documentation/feature-removal-schedule.txt 
b/Documentation/feature-removal-schedule.txt
index 20c4c8b..c053318 100644
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
@@ -333,3 +333,11 @@ Why:   This driver has been marked obsolete for many 
years.
 Who:   Stephen Hemminger [EMAIL PROTECTED]
 
 ---
+
+What:  Support for MIPS Technologies' Altas evaluation board
+When:  March 2008
+Why:   Apparently there is no user base left for this platform.
+   Hardware out of production since several years.
+Who:   Dmitri Vorobiev [EMAIL PROTECTED]
+
+---
-- 
1.5.3
--
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 -v2][MIPS] Add Atlas to feature-removal-schedule.txt

2008-01-14 Thread Dmitri Vorobiev
Ralf Baechle on Atlas board support in the linux-mips mailing list:

 Maciej is promising to fix it up since a few years ;-)  Aside of that it's
 safe to say the Atlas is dead like a coffin nail.

Signed-off-by: Dmitri Vorobiev [EMAIL PROTECTED]

---
diff --git a/Documentation/feature-removal-schedule.txt 
b/Documentation/feature-removal-schedule.txt
index 20c4c8b..2693ebc 100644
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
@@ -333,3 +333,11 @@ Why:   This driver has been marked obsolet
 Who:   Stephen Hemminger [EMAIL PROTECTED]
 
 ---
+
+What:  Support for MIPS Technologies' Atlas evaluation board
+When:  March 2008
+Why:   Apparently there is no user base left for this platform.
+   Hardware out of production since several years.
+Who:   Dmitri Vorobiev [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/


Re: [JANITOR PROPOSAL] Switch ioctl functions to ->unlocked_ioctl

2008-01-08 Thread Dmitri Vorobiev
Matthew Wilcox пишет:
> On Tue, Jan 08, 2008 at 01:16:06PM -0700, Matthew Wilcox wrote:
>> On Tue, Jan 08, 2008 at 09:03:13PM +0100, Paolo Ciarrocchi wrote:
>>> Yes of course, I've been silly in didn't verify whether the file compile
>>> but I would appreciate to know whether I'm on the right track or not.
>> Well ... you're not.
> 
> Here's what a correct conversion might look like.  I haven't tried to
> compile it, so I'm copying and pasting it in order to damage whitespace
> and make sure nobody tries to compile it.

It seems that the kernel janitors project needs to explicitly describe the
prerequisites a person should meet before tackling the enterprise's toughest
technical challenges such as operating system kernel development.

On the face of it, it seems quite ridiculous to me that a team of extremely
qualified kernel engineers spend their valuable time teaching the basics of
the C language using this mailing list. Time is precious, and even more so
when we are having that many unresolved problems, e.g. when the Kernel Bug
Tracker lists more than 1300 open bugs:

http://bugzilla.kernel.org/buglist.cgi?order=relevance_status=__open__

Paolo, I have nothing against you personally as you seem to have adequately
reacted to what is going on and went on strengthening your C skills; my point
is that an operating system kernel development facility such as LKML is most
probably not the right place to set up a correspondence course in programming
basics.

> 
> index bf1075e..0c543a8 100644
> --- a/arch/arm/common/rtctime.c
> +++ b/arch/arm/common/rtctime.c
> @@ -174,8 +174,7 @@ static unsigned int rtc_poll(struct file *file, 
> poll_table *
> return data != 0 ? POLLIN | POLLRDNORM : 0;
>  }
>  
> -static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int 
> cmd,
> -unsigned long arg)
> +static long rtc_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
>  {
> struct rtc_ops *ops = file->private_data;
> struct rtc_time tm;
> @@ -183,6 +182,8 @@ static int rtc_ioctl(struct inode *inode, struct file 
> *file,
> void __user *uarg = (void __user *)arg;
> int ret = -EINVAL;
>  
> +   lock_kernel();
> +
> switch (cmd) {
> case RTC_ALM_READ:
> ret = rtc_arm_read_alarm(ops, );
> @@ -277,6 +278,9 @@ static int rtc_ioctl(struct inode *inode, struct file 
> *file,
> ret = ops->ioctl(cmd, arg);
> break;
> }
> +
> +   unlock_kernel();
> +
> return ret;
>  }
>  
> @@ -334,7 +338,7 @@ static const struct file_operations rtc_fops = {
> .llseek = no_llseek,
> .read   = rtc_read,
> .poll   = rtc_poll,
> -   .ioctl  = rtc_ioctl,
> +   .unlocked_ioctl = rtc_ioctl,
> .open   = rtc_open,
> .release= rtc_release,
> .fasync = rtc_fasync,
> 
> 

--
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: [JANITOR PROPOSAL] Switch ioctl functions to -unlocked_ioctl

2008-01-08 Thread Dmitri Vorobiev
Matthew Wilcox пишет:
 On Tue, Jan 08, 2008 at 01:16:06PM -0700, Matthew Wilcox wrote:
 On Tue, Jan 08, 2008 at 09:03:13PM +0100, Paolo Ciarrocchi wrote:
 Yes of course, I've been silly in didn't verify whether the file compile
 but I would appreciate to know whether I'm on the right track or not.
 Well ... you're not.
 
 Here's what a correct conversion might look like.  I haven't tried to
 compile it, so I'm copying and pasting it in order to damage whitespace
 and make sure nobody tries to compile it.

It seems that the kernel janitors project needs to explicitly describe the
prerequisites a person should meet before tackling the enterprise's toughest
technical challenges such as operating system kernel development.

On the face of it, it seems quite ridiculous to me that a team of extremely
qualified kernel engineers spend their valuable time teaching the basics of
the C language using this mailing list. Time is precious, and even more so
when we are having that many unresolved problems, e.g. when the Kernel Bug
Tracker lists more than 1300 open bugs:

http://bugzilla.kernel.org/buglist.cgi?order=relevancebug_status=__open__

Paolo, I have nothing against you personally as you seem to have adequately
reacted to what is going on and went on strengthening your C skills; my point
is that an operating system kernel development facility such as LKML is most
probably not the right place to set up a correspondence course in programming
basics.

 
 index bf1075e..0c543a8 100644
 --- a/arch/arm/common/rtctime.c
 +++ b/arch/arm/common/rtctime.c
 @@ -174,8 +174,7 @@ static unsigned int rtc_poll(struct file *file, 
 poll_table *
 return data != 0 ? POLLIN | POLLRDNORM : 0;
  }
  
 -static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int 
 cmd,
 -unsigned long arg)
 +static long rtc_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
  {
 struct rtc_ops *ops = file-private_data;
 struct rtc_time tm;
 @@ -183,6 +182,8 @@ static int rtc_ioctl(struct inode *inode, struct file 
 *file,
 void __user *uarg = (void __user *)arg;
 int ret = -EINVAL;
  
 +   lock_kernel();
 +
 switch (cmd) {
 case RTC_ALM_READ:
 ret = rtc_arm_read_alarm(ops, alrm);
 @@ -277,6 +278,9 @@ static int rtc_ioctl(struct inode *inode, struct file 
 *file,
 ret = ops-ioctl(cmd, arg);
 break;
 }
 +
 +   unlock_kernel();
 +
 return ret;
  }
  
 @@ -334,7 +338,7 @@ static const struct file_operations rtc_fops = {
 .llseek = no_llseek,
 .read   = rtc_read,
 .poll   = rtc_poll,
 -   .ioctl  = rtc_ioctl,
 +   .unlocked_ioctl = rtc_ioctl,
 .open   = rtc_open,
 .release= rtc_release,
 .fasync = rtc_fasync,
 
 

--
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/


[BUG][PATCH] fix broken software reset for Malta board

2008-01-07 Thread Dmitri Vorobiev
From: Dmitri Vorobiev <[EMAIL PROTECTED]>

I noticed that the commit f197465384bf7ef1af184c2ed1a4e268911a91e3
(MIPS Tech: Get rid of volatile in core code) broke the software
reset functionality for MIPS Malta boards in big-endian mode.

According to the MIPS Malta board user's manual, writing the magic
32-bit GORESET value into the SOFTRES register initiates board soft
reset. My experimentation has shown that the endianness of the GORESET
integer should thereby be the same as the endianness, which has been
set for the CPU itself. The writew() function used to write the magic
value in the code introduced by the commit mentioned above, however,
swaps bytes for big-endian kernels and transfers 16 bits instead of 32.

The patch below replaces the writew() function by the __raw_writel()
routine, which leaves the byte order intact and transfers the whole
MIPS machine word. Trivial code cleanup (replacing spaces by a tab
and cutting oversized lines to make checkpatch.pl happy) is also
included.

The patch was tested using a Malta evaluation board running in both
BE and LE modes. For both modes, software reset was fully functional
after the change.

P.S. I suspect that the same commit broke the "standby" functionality
for MIPS Atlas boards. However, I did not touch the Atlas code as I
don't have such board at my disposal and also because the linux-mips.org
Web site claims that Atlas support is scheduled for removal.

Signed-off-by: Dmitri Vorobiev <[EMAIL PROTECTED]>

---
diff --git a/arch/mips/mips-boards/generic/reset.c 
b/arch/mips/mips-boards/generic/reset.c
index 7a1bb51..583d468 100644
--- a/arch/mips/mips-boards/generic/reset.c
+++ b/arch/mips/mips-boards/generic/reset.c
@@ -39,16 +39,18 @@ static void atlas_machine_power_off(void);
 
 static void mips_machine_restart(char *command)
 {
-   unsigned int __iomem *softres_reg = ioremap(SOFTRES_REG, 
sizeof(unsigned int));
+   unsigned int __iomem *softres_reg =
+   ioremap(SOFTRES_REG, sizeof(unsigned int));
 
-   writew(GORESET, softres_reg);
+   __raw_writel(GORESET, softres_reg);
 }
 
 static void mips_machine_halt(void)
 {
-unsigned int __iomem *softres_reg = ioremap(SOFTRES_REG, 
sizeof(unsigned int));
+   unsigned int __iomem *softres_reg =
+   ioremap(SOFTRES_REG, sizeof(unsigned int));
 
-   writew(GORESET, softres_reg);
+   __raw_writel(GORESET, softres_reg);
 }
 
 #if defined(CONFIG_MIPS_ATLAS)
--
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/


[BUG][PATCH] fix broken software reset for Malta board

2008-01-07 Thread Dmitri Vorobiev
From: Dmitri Vorobiev [EMAIL PROTECTED]

I noticed that the commit f197465384bf7ef1af184c2ed1a4e268911a91e3
(MIPS Tech: Get rid of volatile in core code) broke the software
reset functionality for MIPS Malta boards in big-endian mode.

According to the MIPS Malta board user's manual, writing the magic
32-bit GORESET value into the SOFTRES register initiates board soft
reset. My experimentation has shown that the endianness of the GORESET
integer should thereby be the same as the endianness, which has been
set for the CPU itself. The writew() function used to write the magic
value in the code introduced by the commit mentioned above, however,
swaps bytes for big-endian kernels and transfers 16 bits instead of 32.

The patch below replaces the writew() function by the __raw_writel()
routine, which leaves the byte order intact and transfers the whole
MIPS machine word. Trivial code cleanup (replacing spaces by a tab
and cutting oversized lines to make checkpatch.pl happy) is also
included.

The patch was tested using a Malta evaluation board running in both
BE and LE modes. For both modes, software reset was fully functional
after the change.

P.S. I suspect that the same commit broke the standby functionality
for MIPS Atlas boards. However, I did not touch the Atlas code as I
don't have such board at my disposal and also because the linux-mips.org
Web site claims that Atlas support is scheduled for removal.

Signed-off-by: Dmitri Vorobiev [EMAIL PROTECTED]

---
diff --git a/arch/mips/mips-boards/generic/reset.c 
b/arch/mips/mips-boards/generic/reset.c
index 7a1bb51..583d468 100644
--- a/arch/mips/mips-boards/generic/reset.c
+++ b/arch/mips/mips-boards/generic/reset.c
@@ -39,16 +39,18 @@ static void atlas_machine_power_off(void);
 
 static void mips_machine_restart(char *command)
 {
-   unsigned int __iomem *softres_reg = ioremap(SOFTRES_REG, 
sizeof(unsigned int));
+   unsigned int __iomem *softres_reg =
+   ioremap(SOFTRES_REG, sizeof(unsigned int));
 
-   writew(GORESET, softres_reg);
+   __raw_writel(GORESET, softres_reg);
 }
 
 static void mips_machine_halt(void)
 {
-unsigned int __iomem *softres_reg = ioremap(SOFTRES_REG, 
sizeof(unsigned int));
+   unsigned int __iomem *softres_reg =
+   ioremap(SOFTRES_REG, sizeof(unsigned int));
 
-   writew(GORESET, softres_reg);
+   __raw_writel(GORESET, softres_reg);
 }
 
 #if defined(CONFIG_MIPS_ATLAS)
--
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 1/2] move WARN_ON() out of line

2008-01-05 Thread Dmitri Vorobiev
Arjan van de Ven пишет:
> Subject: move WARN_ON() out of line
> From: Arjan van de Ven <[EMAIL PROTECTED]>
> CC: Ingo Molnar <[EMAIL PROTECTED]>
> CC: Andrew Morton <[EMAIL PROTECTED]>
> CC: Olof Johansson <[EMAIL PROTECTED]>
> CC: Matt Meckall <[EMAIL PROTECTED]>
> 
> A quick grep shows that there are currently 1145 instances of WARN_ON
> in the kernel. Currently, WARN_ON is pretty much entirely inlined,
> which makes it hard to enhance it without growing the size of the kernel
> (and getting Andrew rightfully unhappy).
> 
> This patch build on top of Olof's patch that introduces __WARN,
> and places the slowpath out of line. It also uses Ingo's suggestion
> to not use __FUNCTION__ but to use kallsyms to do the lookup;
> this saves a ton of extra space since gcc doesn't need to store the
> function
> string twice now:
> 
> 3936367  833603  624736 5394706  525112 vmlinux.before
> 3917508  833603  624736 5375847  520767 vmlinux-slowpath
> 
> 15Kb savings...
> 

This looks twice as good for one of MIPS configs:

   textdata bss dec hex filename
4908276  204104 2846304 7958684  79709c vmlinux.after
4941596  204104 2846304 7992004  79f2c4 vmlinux.before
$ file vmlinux
vmlinux: ELF 32-bit MSB executable, MIPS, version 1 (SYSV), statically linked, 
not stripped

More than 30Kb gone, thanks a lot!

Tested-by: Dmitri Vorobiev <[EMAIL PROTECTED]>

> Signed-off-by: Arjan van de Ven <[EMAIL PROTECTED]>
> 
> 
> ---
>  include/asm-generic/bug.h |7 ++-
>  kernel/panic.c|   14 ++
>  2 files changed, 16 insertions(+), 5 deletions(-)
> 
> Index: linux-2.6.24-rc6/include/asm-generic/bug.h
> ===
> --- linux-2.6.24-rc6.orig/include/asm-generic/bug.h
> +++ linux-2.6.24-rc6/include/asm-generic/bug.h
> @@ -32,11 +32,8 @@ struct bug_entry {
>  #endif
> 
>  #ifndef __WARN
> -#define __WARN() do {\
> -printk("WARNING: at %s:%d %s()\n", __FILE__,\
> -__LINE__, __FUNCTION__);\
> -dump_stack();\
> -} while (0)
> +extern void warn_on_slowpath(const char *file, const int line);
> +#define __WARN() warn_on_slowpath(__FILE__, __LINE__)
>  #endif
> 
>  #ifndef WARN_ON
> Index: linux-2.6.24-rc6/kernel/panic.c
> ===
> --- linux-2.6.24-rc6.orig/kernel/panic.c
> +++ linux-2.6.24-rc6/kernel/panic.c
> @@ -20,6 +20,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
> 
>  int panic_on_oops;
>  int tainted;
> @@ -292,6 +293,19 @@ void oops_exit(void)
>  (unsigned long long)oops_id);
>  }
> 
> +
> +void warn_on_slowpath(const char *file, int line)
> +{
> +char function[KSYM_SYMBOL_LEN];
> +unsigned long caller = (unsigned long) __builtin_return_address(0);
> +
> +sprint_symbol(function, caller);
> +printk(KERN_WARNING "WARNING: at %s:%d %s()\n", file,
> +line, function);
> +dump_stack();
> +}
> +EXPORT_SYMBOL(warn_on_slowpath);
> +
>  #ifdef CONFIG_CC_STACKPROTECTOR
>  /*
>   * Called when gcc's -fstack-protector feature is used, and
> 
> 
> 
> 
> Subject: move WARN_ON() out of line
> From: Arjan van de Ven <[EMAIL PROTECTED]>
> CC: Ingo Molnar <[EMAIL PROTECTED]>
> CC: Andrew Morton <[EMAIL PROTECTED]>
> CC: Olof Johansson <[EMAIL PROTECTED]>
> CC: Matt Meckall <[EMAIL PROTECTED]>
> 
> A quick grep shows that there are currently 1145 instances of WARN_ON
> in the kernel. Currently, WARN_ON is pretty much entirely inlined,
> which makes it hard to enhance it without growing the size of the kernel
> (and getting Andrew unhappy).
> 
> This patch build on top of Olof's patch that introduces __WARN,
> and places the slowpath out of line. It also uses Ingo's suggestion
> to not use __FUNCTION__ but to use kallsyms to do the lookup;
> this saves a ton of extra space since gcc doesn't need to store the function
> string twice now:
> 
> 3936367  833603  624736 5394706  525112 vmlinux.before
> 3917508  833603  624736 5375847  520767 vmlinux-slowpath
> 
> 15Kb savings...
> 
> Signed-off-by: Arjan van de Ven <[EMAIL PROTECTED]>
> 
> 
> ---
>  include/asm-generic/bug.h |7 ++-
>  kernel/panic.c|   14 ++
>  2 files changed, 16 insertions(+), 5 deletions(-)
> 
> Index: linux-2.6.24-rc6/include/asm-generic/bug.h
> ===

Re: [patch 1/2] move WARN_ON() out of line

2008-01-05 Thread Dmitri Vorobiev
Arjan van de Ven пишет:
 Subject: move WARN_ON() out of line
 From: Arjan van de Ven [EMAIL PROTECTED]
 CC: Ingo Molnar [EMAIL PROTECTED]
 CC: Andrew Morton [EMAIL PROTECTED]
 CC: Olof Johansson [EMAIL PROTECTED]
 CC: Matt Meckall [EMAIL PROTECTED]
 
 A quick grep shows that there are currently 1145 instances of WARN_ON
 in the kernel. Currently, WARN_ON is pretty much entirely inlined,
 which makes it hard to enhance it without growing the size of the kernel
 (and getting Andrew rightfully unhappy).
 
 This patch build on top of Olof's patch that introduces __WARN,
 and places the slowpath out of line. It also uses Ingo's suggestion
 to not use __FUNCTION__ but to use kallsyms to do the lookup;
 this saves a ton of extra space since gcc doesn't need to store the
 function
 string twice now:
 
 3936367  833603  624736 5394706  525112 vmlinux.before
 3917508  833603  624736 5375847  520767 vmlinux-slowpath
 
 15Kb savings...
 

This looks twice as good for one of MIPS configs:

   textdata bss dec hex filename
4908276  204104 2846304 7958684  79709c vmlinux.after
4941596  204104 2846304 7992004  79f2c4 vmlinux.before
$ file vmlinux
vmlinux: ELF 32-bit MSB executable, MIPS, version 1 (SYSV), statically linked, 
not stripped

More than 30Kb gone, thanks a lot!

Tested-by: Dmitri Vorobiev [EMAIL PROTECTED]

 Signed-off-by: Arjan van de Ven [EMAIL PROTECTED]
 
 
 ---
  include/asm-generic/bug.h |7 ++-
  kernel/panic.c|   14 ++
  2 files changed, 16 insertions(+), 5 deletions(-)
 
 Index: linux-2.6.24-rc6/include/asm-generic/bug.h
 ===
 --- linux-2.6.24-rc6.orig/include/asm-generic/bug.h
 +++ linux-2.6.24-rc6/include/asm-generic/bug.h
 @@ -32,11 +32,8 @@ struct bug_entry {
  #endif
 
  #ifndef __WARN
 -#define __WARN() do {\
 -printk(WARNING: at %s:%d %s()\n, __FILE__,\
 -__LINE__, __FUNCTION__);\
 -dump_stack();\
 -} while (0)
 +extern void warn_on_slowpath(const char *file, const int line);
 +#define __WARN() warn_on_slowpath(__FILE__, __LINE__)
  #endif
 
  #ifndef WARN_ON
 Index: linux-2.6.24-rc6/kernel/panic.c
 ===
 --- linux-2.6.24-rc6.orig/kernel/panic.c
 +++ linux-2.6.24-rc6/kernel/panic.c
 @@ -20,6 +20,7 @@
  #include linux/kexec.h
  #include linux/debug_locks.h
  #include linux/random.h
 +#include linux/kallsyms.h
 
  int panic_on_oops;
  int tainted;
 @@ -292,6 +293,19 @@ void oops_exit(void)
  (unsigned long long)oops_id);
  }
 
 +
 +void warn_on_slowpath(const char *file, int line)
 +{
 +char function[KSYM_SYMBOL_LEN];
 +unsigned long caller = (unsigned long) __builtin_return_address(0);
 +
 +sprint_symbol(function, caller);
 +printk(KERN_WARNING WARNING: at %s:%d %s()\n, file,
 +line, function);
 +dump_stack();
 +}
 +EXPORT_SYMBOL(warn_on_slowpath);
 +
  #ifdef CONFIG_CC_STACKPROTECTOR
  /*
   * Called when gcc's -fstack-protector feature is used, and
 
 
 
 
 Subject: move WARN_ON() out of line
 From: Arjan van de Ven [EMAIL PROTECTED]
 CC: Ingo Molnar [EMAIL PROTECTED]
 CC: Andrew Morton [EMAIL PROTECTED]
 CC: Olof Johansson [EMAIL PROTECTED]
 CC: Matt Meckall [EMAIL PROTECTED]
 
 A quick grep shows that there are currently 1145 instances of WARN_ON
 in the kernel. Currently, WARN_ON is pretty much entirely inlined,
 which makes it hard to enhance it without growing the size of the kernel
 (and getting Andrew unhappy).
 
 This patch build on top of Olof's patch that introduces __WARN,
 and places the slowpath out of line. It also uses Ingo's suggestion
 to not use __FUNCTION__ but to use kallsyms to do the lookup;
 this saves a ton of extra space since gcc doesn't need to store the function
 string twice now:
 
 3936367  833603  624736 5394706  525112 vmlinux.before
 3917508  833603  624736 5375847  520767 vmlinux-slowpath
 
 15Kb savings...
 
 Signed-off-by: Arjan van de Ven [EMAIL PROTECTED]
 
 
 ---
  include/asm-generic/bug.h |7 ++-
  kernel/panic.c|   14 ++
  2 files changed, 16 insertions(+), 5 deletions(-)
 
 Index: linux-2.6.24-rc6/include/asm-generic/bug.h
 ===
 --- linux-2.6.24-rc6.orig/include/asm-generic/bug.h
 +++ linux-2.6.24-rc6/include/asm-generic/bug.h
 @@ -32,11 +32,8 @@ struct bug_entry {
  #endif
  
  #ifndef __WARN
 -#define __WARN() do {
 \
 - printk(WARNING: at %s:%d %s()\n, __FILE__,\
 - __LINE__, __FUNCTION__);\
 - dump_stack();   \
 -} while (0)
 +extern void warn_on_slowpath(const char *file, const int line);
 +#define __WARN

Re: [patch 1/3] move WARN_ON() out of line

2008-01-04 Thread Dmitri Vorobiev
Arjan van de Ven пишет:
> Subject: move WARN_ON() out of line
> From: Arjan van de Ven <[EMAIL PROTECTED]>
> CC: Ingo Molnar <[EMAIL PROTECTED]>
> CC: Andrew Morton <[EMAIL PROTECTED]>
> 
> A quick grep shows that there are currently 1145 instances of WARN_ON
> in the kernel. Currently, WARN_ON is pretty much entirely inlined,
> which makes it hard to enhance it without growing the size of the kernel
> (and getting Andrew unhappy).
> 
> This patch moves WARN_ON() out of line entirely. I've considered keeping
> the test inline and moving only the slowpath out of line, but I decided
> against that: an out of line test reduces the pressure on the CPUs
> branch predictor logic and gives smaller code, while a function call
> to a fixed location is quite fast. Likewise I've considered doing something
> similar to BUG() (eg use a trapping instruction) but that's not really
> better (it needs the test inline again and recovering from an invalid
> instruction isn't quite fun).
> 
> The code size reduction of this patch was about 6.5Kb (on a distro style
> .config):
> 
>text   databssdechexfilename
> 3096493 29345527607046150652 5dd9fcvmlinux.before
> 3090006 29345527607046144165 5dc0a5vmlinux.after
> 
> Signed-off-by: Arjan van de Ven <[EMAIL PROTECTED]>
> 
> ---
>  include/asm-generic/bug.h |   13 -
>  kernel/panic.c|   13 +
>  2 files changed, 17 insertions(+), 9 deletions(-)
> 
> Index: linux-2.6.24-rc6/include/asm-generic/bug.h
> ===
> --- linux-2.6.24-rc6.orig/include/asm-generic/bug.h
> +++ linux-2.6.24-rc6/include/asm-generic/bug.h
> @@ -32,15 +32,10 @@ struct bug_entry {
>  #endif
> 
>  #ifndef HAVE_ARCH_WARN_ON
> -#define WARN_ON(condition) ({\
> -int __ret_warn_on = !!(condition);\
> -if (unlikely(__ret_warn_on)) {\
> -printk("WARNING: at %s:%d %s()\n", __FILE__,\
> -__LINE__, __FUNCTION__);\
> -dump_stack();\
> -}\
> -unlikely(__ret_warn_on);\
> -})
> +extern int do_warn_on(const unsigned long condition, const char *file,
> +const int line, const char *function);
> +#define WARN_ON(condition) do_warn_on((unsigned long)(condition),
> __FILE__, \
> + __LINE__, __FUNCTION__)
>  #endif
> 
>  #else /* !CONFIG_BUG */
> Index: linux-2.6.24-rc6/kernel/panic.c
> ===
> --- linux-2.6.24-rc6.orig/kernel/panic.c
> +++ linux-2.6.24-rc6/kernel/panic.c
> @@ -20,6 +20,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
> 
>  int panic_on_oops;
>  int tainted;
> @@ -292,6 +293,18 @@ void oops_exit(void)
>  (unsigned long long)oops_id);
>  }
> 
> +int do_warn_on(const unsigned long condition, const char *file,
> +const int line, const char *function)
> +{
> +if (unlikely(condition)) {
> +printk(KERN_WARNING "WARNING: at %s:%d %s()\n",
> +__FILE__, __LINE__, __FUNCTION__);

Isn't this going to print "panic.c" for __FILE__, "do_warn_on" for __FUNCTION__
and whatever line number you have there for __LINE__? I put up a userspace 
equivalent
of what you're doing here, which confirms my suspision:

[EMAIL PROTECTED]:/tmp$ cat c.c
#include 

#define WARN_ON(condition) do_warn_on((unsigned long)(condition), __FILE__, \
__LINE__, __FUNCTION__)

int do_warn_on(const unsigned long condition, const char *file,
const int line, const char *function)
{
if (condition) {
printf("WARNING: at %s:%d %s()\n",
__FILE__, __LINE__, __FUNCTION__);
}
return !!condition;
}

int main()
{
WARN_ON(1);
return 0;
}
[EMAIL PROTECTED]:/tmp$ cc c.c
[EMAIL PROTECTED]:/tmp$ ./a.out
WARNING: at c.c:11 do_warn_on()
[EMAIL PROTECTED]:/tmp$

I think that your intention was to propagate the parameters to the do_warn_on() 
routine
to the printk() call, right?

> +dump_stack();
> +}
> +return !!condition;
> +}
> +EXPORT_SYMBOL(do_warn_on);
> +
>  #ifdef CONFIG_CC_STACKPROTECTOR
>  /*
>   * Called when gcc's -fstack-protector feature is used, and
> -- 
> 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/
> 

--
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] [Coding Style]: fs/ext{3,4}/ext{3,4}_jbd{,2}.c

2008-01-04 Thread Dmitri Vorobiev
Andreas Dilger пишет:
> On Jan 04, 2008  14:41 +0100, Richard Knutsson wrote:
>>>  @@ -54,6 +54,6 @@ int __ext4_journal_dirty_metadata(const char *where,
>>>  {
>>> int err = jbd2_journal_dirty_metadata(handle, bh);
>>> if (err)
>>> -   ext4_journal_abort_handle(where, __FUNCTION__, bh, handle,err);
>>> +   ext4_journal_abort_handle(where, __FUNCTION__, bh, handle, err);
>>> return err;
>>>  }
>> What about changing the __FUNCTION__ to __func__, while you are at it?
> 
> What's wrong with __FUNCTION__?  I thought that was ANSI C?

No, it was not. The ANSI C 1990 Standard defines the following so-called
"predefined macros": __LINE__, __FILE__, __DATE__, __TIME__, and __STDC__.
The ISO/IEC 9899 Standard commonly referred to as the C99, defines a few
additional predefined macros, as well as an additional predefined
identifier __func__. For more information please refer to the ISO/IEC 9899
document itself, which is freely available for download at the time of
me writing this.

Although seemingly "natural", the __FUNCTION__ macro has never been part
of the C Standard.

Dmitri

> 
> Cheers, Andreas
> --
> Andreas Dilger
> Sr. Staff Engineer, Lustre Group
> Sun Microsystems of Canada, Inc.
> 
> --
> 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/
> 

--
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] [Coding Style]: fs/ext{3,4}/ext{3,4}_jbd{,2}.c

2008-01-04 Thread Dmitri Vorobiev
Andreas Dilger пишет:
> On Jan 04, 2008  14:41 +0100, Richard Knutsson wrote:
>>>  @@ -54,6 +54,6 @@ int __ext4_journal_dirty_metadata(const char *where,
>>>  {
>>> int err = jbd2_journal_dirty_metadata(handle, bh);
>>> if (err)
>>> -   ext4_journal_abort_handle(where, __FUNCTION__, bh, handle,err);
>>> +   ext4_journal_abort_handle(where, __FUNCTION__, bh, handle, err);
>>> return err;
>>>  }
>> What about changing the __FUNCTION__ to __func__, while you are at it?
> 
> What's wrong with __FUNCTION__?  I thought that was ANSI C?

No, it was not. The ANSI C 1990 Standard defines the following so-called
"predefined macros": __LINE__, __FILE__, __DATE__, __TIME__, and __STDC__.
The ISO/IEC 9899 Standard commonly referred to as the C99, defines a few
additional predefined macros, as well as an additional predefined
identifier __func__. For more information please refer to the ISO/IEC 9899
document itself, which is freely available for download at the time of
me writing this.

Although seemingly "natural", the __FUNCTION__ macro has never been part
of the C Standard.

Dmitri

> 
> Cheers, Andreas
> --
> Andreas Dilger
> Sr. Staff Engineer, Lustre Group
> Sun Microsystems of Canada, Inc.
> 
> --
> 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/
> 

--
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] [Coding Style]: fs/ext{3,4}/ext{3,4}_jbd{,2}.c

2008-01-04 Thread Dmitri Vorobiev
Andreas Dilger пишет:
 On Jan 04, 2008  14:41 +0100, Richard Knutsson wrote:
  @@ -54,6 +54,6 @@ int __ext4_journal_dirty_metadata(const char *where,
  {
 int err = jbd2_journal_dirty_metadata(handle, bh);
 if (err)
 -   ext4_journal_abort_handle(where, __FUNCTION__, bh, handle,err);
 +   ext4_journal_abort_handle(where, __FUNCTION__, bh, handle, err);
 return err;
  }
 What about changing the __FUNCTION__ to __func__, while you are at it?
 
 What's wrong with __FUNCTION__?  I thought that was ANSI C?

No, it was not. The ANSI C 1990 Standard defines the following so-called
predefined macros: __LINE__, __FILE__, __DATE__, __TIME__, and __STDC__.
The ISO/IEC 9899 Standard commonly referred to as the C99, defines a few
additional predefined macros, as well as an additional predefined
identifier __func__. For more information please refer to the ISO/IEC 9899
document itself, which is freely available for download at the time of
me writing this.

Although seemingly natural, the __FUNCTION__ macro has never been part
of the C Standard.

Dmitri

 
 Cheers, Andreas
 --
 Andreas Dilger
 Sr. Staff Engineer, Lustre Group
 Sun Microsystems of Canada, Inc.
 
 --
 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/
 

--
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] [Coding Style]: fs/ext{3,4}/ext{3,4}_jbd{,2}.c

2008-01-04 Thread Dmitri Vorobiev
Andreas Dilger пишет:
 On Jan 04, 2008  14:41 +0100, Richard Knutsson wrote:
  @@ -54,6 +54,6 @@ int __ext4_journal_dirty_metadata(const char *where,
  {
 int err = jbd2_journal_dirty_metadata(handle, bh);
 if (err)
 -   ext4_journal_abort_handle(where, __FUNCTION__, bh, handle,err);
 +   ext4_journal_abort_handle(where, __FUNCTION__, bh, handle, err);
 return err;
  }
 What about changing the __FUNCTION__ to __func__, while you are at it?
 
 What's wrong with __FUNCTION__?  I thought that was ANSI C?

No, it was not. The ANSI C 1990 Standard defines the following so-called
predefined macros: __LINE__, __FILE__, __DATE__, __TIME__, and __STDC__.
The ISO/IEC 9899 Standard commonly referred to as the C99, defines a few
additional predefined macros, as well as an additional predefined
identifier __func__. For more information please refer to the ISO/IEC 9899
document itself, which is freely available for download at the time of
me writing this.

Although seemingly natural, the __FUNCTION__ macro has never been part
of the C Standard.

Dmitri

 
 Cheers, Andreas
 --
 Andreas Dilger
 Sr. Staff Engineer, Lustre Group
 Sun Microsystems of Canada, Inc.
 
 --
 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/
 

--
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   >