public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [Patch 1/2] kbuild: two trivial fixes for check headers
@ 2009-06-04  8:01 Amerigo Wang
  2009-06-04  8:02 ` [Patch 2/2] kbuild: clean up scripts/headers.sh Amerigo Wang
  2009-06-04  9:15 ` [Patch 1/2] kbuild: two trivial fixes for check headers Sam Ravnborg
  0 siblings, 2 replies; 8+ messages in thread
From: Amerigo Wang @ 2009-06-04  8:01 UTC (permalink / raw)
  To: linux-kernel; +Cc: akpm, sam, Amerigo Wang, linux-kbuild


Remove a useless 'extern' in an exported header.
Fix a comment headers_check.pl.

Signed-off-by: WANG Cong <amwang@redhat.com>
Cc: Sam Ravnborg <sam@ravnborg.org>

------
diff --git a/include/mtd/jffs2-user.h b/include/mtd/jffs2-user.h
index fa94b0e..10dc7ef 100644
--- a/include/mtd/jffs2-user.h
+++ b/include/mtd/jffs2-user.h
@@ -18,7 +18,7 @@
 #undef je32_to_cpu
 #undef jemode_to_cpu
 
-extern int target_endian;
+int target_endian;
 
 #define t16(x) ({ __u16 __b = (x); (target_endian==__BYTE_ORDER)?__b:bswap_16(__b); })
 #define t32(x) ({ __u32 __b = (x); (target_endian==__BYTE_ORDER)?__b:bswap_32(__b); })
diff --git a/scripts/headers_check.pl b/scripts/headers_check.pl
index 56f90a4..ccdbace 100644
--- a/scripts/headers_check.pl
+++ b/scripts/headers_check.pl
@@ -2,7 +2,7 @@
 #
 # headers_check.pl execute a number of trivial consistency checks
 #
-# Usage: headers_check.pl dir [files...]
+# Usage: headers_check.pl dir arch [files...]
 # dir:   dir to look for included files
 # arch:  architecture
 # files: list of files to check

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

* [Patch 2/2] kbuild: clean up scripts/headers.sh
  2009-06-04  8:01 [Patch 1/2] kbuild: two trivial fixes for check headers Amerigo Wang
@ 2009-06-04  8:02 ` Amerigo Wang
  2009-06-04  9:15 ` [Patch 1/2] kbuild: two trivial fixes for check headers Sam Ravnborg
  1 sibling, 0 replies; 8+ messages in thread
From: Amerigo Wang @ 2009-06-04  8:02 UTC (permalink / raw)
  To: linux-kernel; +Cc: akpm, sam, Amerigo Wang, linux-kbuild


'drop' variable is unused.

'ppc' and 'sparc64' directories don't exist in arch/,
and I think their headers can be well exported, so
just remove them.

Signed-off-by: WANG Cong <amwang@redhat.com>
Cc: Sam Ravnborg <sam@ravnborg.org>

------
diff --git a/scripts/headers.sh b/scripts/headers.sh
index d33426f..0308ecc 100755
--- a/scripts/headers.sh
+++ b/scripts/headers.sh
@@ -15,19 +15,12 @@ do_command()
 	fi
 }
 
-# Do not try this architecture
-drop="generic um ppc sparc64 cris"
-
 archs=$(ls ${srctree}/arch)
 
 for arch in ${archs}; do
 	case ${arch} in
 	um)        # no userspace export
 		;;
-	ppc)       # headers exported by powerpc
-		;;
-	sparc64)   # headers exported by sparc
-		;;
 	cris)      # headers export are known broken
 		;;
 	*)

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

* Re: [Patch 1/2] kbuild: two trivial fixes for check headers
  2009-06-04  8:01 [Patch 1/2] kbuild: two trivial fixes for check headers Amerigo Wang
  2009-06-04  8:02 ` [Patch 2/2] kbuild: clean up scripts/headers.sh Amerigo Wang
@ 2009-06-04  9:15 ` Sam Ravnborg
  2009-06-04  9:23   ` Amerigo Wang
  2009-06-04  9:56   ` Amerigo Wang
  1 sibling, 2 replies; 8+ messages in thread
From: Sam Ravnborg @ 2009-06-04  9:15 UTC (permalink / raw)
  To: Amerigo Wang; +Cc: linux-kernel, akpm, linux-kbuild

On Thu, Jun 04, 2009 at 04:01:52AM -0400, Amerigo Wang wrote:
> 
> Remove a useless 'extern' in an exported header.
> Fix a comment headers_check.pl.

These two patches has nothing in commom.

> 
> Signed-off-by: WANG Cong <amwang@redhat.com>
> Cc: Sam Ravnborg <sam@ravnborg.org>
> 
> ------
> diff --git a/include/mtd/jffs2-user.h b/include/mtd/jffs2-user.h
> index fa94b0e..10dc7ef 100644
> --- a/include/mtd/jffs2-user.h
> +++ b/include/mtd/jffs2-user.h
> @@ -18,7 +18,7 @@
>  #undef je32_to_cpu
>  #undef jemode_to_cpu
>  
> -extern int target_endian;
> +int target_endian;

You now declare a global variable named target_endian each time you include this file - which is wrong.

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

* Re: [Patch 1/2] kbuild: two trivial fixes for check headers
  2009-06-04  9:15 ` [Patch 1/2] kbuild: two trivial fixes for check headers Sam Ravnborg
@ 2009-06-04  9:23   ` Amerigo Wang
  2009-06-04 10:39     ` Sam Ravnborg
  2009-06-04  9:56   ` Amerigo Wang
  1 sibling, 1 reply; 8+ messages in thread
From: Amerigo Wang @ 2009-06-04  9:23 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: linux-kernel, akpm, linux-kbuild

Sam Ravnborg wrote:
> On Thu, Jun 04, 2009 at 04:01:52AM -0400, Amerigo Wang wrote:
>   
>> Remove a useless 'extern' in an exported header.
>> Fix a comment headers_check.pl.
>>     
>
> These two patches has nothing in commom.
>   

They are both about kernel headers stuff.

>   
>> Signed-off-by: WANG Cong <amwang@redhat.com>
>> Cc: Sam Ravnborg <sam@ravnborg.org>
>>
>> ------
>> diff --git a/include/mtd/jffs2-user.h b/include/mtd/jffs2-user.h
>> index fa94b0e..10dc7ef 100644
>> --- a/include/mtd/jffs2-user.h
>> +++ b/include/mtd/jffs2-user.h
>> @@ -18,7 +18,7 @@
>>  #undef je32_to_cpu
>>  #undef jemode_to_cpu
>>  
>> -extern int target_endian;
>> +int target_endian;
>>     
>
> You now declare a global variable named target_endian each time you include this file - which is wrong.
>   
Why? 'make headers_check' complains about it.


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

* Re: [Patch 1/2] kbuild: two trivial fixes for check headers
  2009-06-04  9:15 ` [Patch 1/2] kbuild: two trivial fixes for check headers Sam Ravnborg
  2009-06-04  9:23   ` Amerigo Wang
@ 2009-06-04  9:56   ` Amerigo Wang
  1 sibling, 0 replies; 8+ messages in thread
From: Amerigo Wang @ 2009-06-04  9:56 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: Amerigo Wang, linux-kernel, akpm, linux-kbuild

On Thu, Jun 04, 2009 at 11:15:19AM +0200, Sam Ravnborg wrote:
>On Thu, Jun 04, 2009 at 04:01:52AM -0400, Amerigo Wang wrote:
>> 
>> Remove a useless 'extern' in an exported header.
>> Fix a comment headers_check.pl.
>
>These two patches has nothing in commom.
>
>> 
>> Signed-off-by: WANG Cong <amwang@redhat.com>
>> Cc: Sam Ravnborg <sam@ravnborg.org>
>> 
>> ------
>> diff --git a/include/mtd/jffs2-user.h b/include/mtd/jffs2-user.h
>> index fa94b0e..10dc7ef 100644
>> --- a/include/mtd/jffs2-user.h
>> +++ b/include/mtd/jffs2-user.h
>> @@ -18,7 +18,7 @@
>>  #undef je32_to_cpu
>>  #undef jemode_to_cpu
>>  
>> -extern int target_endian;
>> +int target_endian;
>
>You now declare a global variable named target_endian each time you include this file - which is wrong.

Hmmm, the script seems wrong, not the C code. :)
And the word 'prototype' is only for functions.

How about patch below?

Signed-off-by: WANG Cong <amwang@redhat.com>

---
diff --git a/scripts/headers_check.pl b/scripts/headers_check.pl
index 56f90a4..11dc869 100644
--- a/scripts/headers_check.pl
+++ b/scripts/headers_check.pl
@@ -2,7 +2,7 @@
 #
 # headers_check.pl execute a number of trivial consistency checks
 #
-# Usage: headers_check.pl dir [files...]
+# Usage: headers_check.pl dir arch [files...]
 # dir:   dir to look for included files
 # arch:  architecture
 # files: list of files to check
@@ -63,7 +63,7 @@ sub check_include
 
 sub check_prototypes
 {
-	if ($line =~ m/^\s*extern\b/) {
+	if ($line =~ m/^\s*extern\b.*\(.*\)/) {
 		printf STDERR "$filename:$lineno: extern's make no sense in userspace\n";
 	}
 }

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

* Re: [Patch 1/2] kbuild: two trivial fixes for check headers
  2009-06-04  9:23   ` Amerigo Wang
@ 2009-06-04 10:39     ` Sam Ravnborg
  2009-06-05  2:05       ` Amerigo Wang
  2009-06-05  2:23       ` Jaswinder Singh Rajput
  0 siblings, 2 replies; 8+ messages in thread
From: Sam Ravnborg @ 2009-06-04 10:39 UTC (permalink / raw)
  To: Amerigo Wang; +Cc: linux-kernel, akpm, linux-kbuild

On Thu, Jun 04, 2009 at 05:23:10PM +0800, Amerigo Wang wrote:
> Sam Ravnborg wrote:
> >On Thu, Jun 04, 2009 at 04:01:52AM -0400, Amerigo Wang wrote:
> >  
> >>Remove a useless 'extern' in an exported header.
> >>Fix a comment headers_check.pl.
> >>    
> >
> >These two patches has nothing in commom.
> >  
> 
> They are both about kernel headers stuff.
> 
> >  
> >>Signed-off-by: WANG Cong <amwang@redhat.com>
> >>Cc: Sam Ravnborg <sam@ravnborg.org>
> >>
> >>------
> >>diff --git a/include/mtd/jffs2-user.h b/include/mtd/jffs2-user.h
> >>index fa94b0e..10dc7ef 100644
> >>--- a/include/mtd/jffs2-user.h
> >>+++ b/include/mtd/jffs2-user.h
> >>@@ -18,7 +18,7 @@
> >> #undef je32_to_cpu
> >> #undef jemode_to_cpu
> >> 
> >>-extern int target_endian;
> >>+int target_endian;
> >>    
> >
> >You now declare a global variable named target_endian each time you 
> >include this file - which is wrong.
> >  
> Why? 'make headers_check' complains about it.

Rightfully is does...
But is think it is a prototype of a function.

But think about it - it does not makes sense to have an
extern declarationof a variable in an exported header.
There is no way that userspace can access this variable
from user-space and therefore the declaration of the variable
needs to be moved to a kernel-only header file.

So if you touch this I would ask you not to consider a single line
in jffs-user.h - but rather take a critiacal look at the whole
file and fix any issues there is.
And then to send it to the mtd people (dwmw2).
I did not look at the file but just looking at yout patch
the "undef jemode_to_cpu" looks fishy in an exported header.

	Sam

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

* Re: [Patch 1/2] kbuild: two trivial fixes for check headers
  2009-06-04 10:39     ` Sam Ravnborg
@ 2009-06-05  2:05       ` Amerigo Wang
  2009-06-05  2:23       ` Jaswinder Singh Rajput
  1 sibling, 0 replies; 8+ messages in thread
From: Amerigo Wang @ 2009-06-05  2:05 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: linux-kernel, akpm, linux-kbuild

Sam Ravnborg wrote:
> Rightfully is does...
> But is think it is a prototype of a function.
>
> But think about it - it does not makes sense to have an
> extern declarationof a variable in an exported header.
> There is no way that userspace can access this variable
> from user-space and therefore the declaration of the variable
> needs to be moved to a kernel-only header file.
>
>   

Agree, then the script looks wrong. I will fix it.

> So if you touch this I would ask you not to consider a single line
> in jffs-user.h - but rather take a critiacal look at the whole
> file and fix any issues there is.
> And then to send it to the mtd people (dwmw2).
> I did not look at the file but just looking at yout patch
> the "undef jemode_to_cpu" looks fishy in an exported header.
>   

Hmm, after googling a bit, I got this patch:

http://patchwork.ozlabs.org/patch/26224/

So I won't touch this.

Thanks.



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

* Re: [Patch 1/2] kbuild: two trivial fixes for check headers
  2009-06-04 10:39     ` Sam Ravnborg
  2009-06-05  2:05       ` Amerigo Wang
@ 2009-06-05  2:23       ` Jaswinder Singh Rajput
  1 sibling, 0 replies; 8+ messages in thread
From: Jaswinder Singh Rajput @ 2009-06-05  2:23 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Amerigo Wang, linux-kernel, akpm, linux-kbuild, David Woodhouse

On Thu, 2009-06-04 at 12:39 +0200, Sam Ravnborg wrote:

> So if you touch this I would ask you not to consider a single line
> in jffs-user.h - but rather take a critiacal look at the whole
> file and fix any issues there is.
> And then to send it to the mtd people (dwmw2).
> I did not look at the file but just looking at yout patch
> the "undef jemode_to_cpu" looks fishy in an exported header.
> 

David already have patches to remove whole jffs-user.h file and AFAIK he
already queued it. So no point of touching this file.

Thanks,
--
JSR


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

end of thread, other threads:[~2009-06-05  2:22 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-04  8:01 [Patch 1/2] kbuild: two trivial fixes for check headers Amerigo Wang
2009-06-04  8:02 ` [Patch 2/2] kbuild: clean up scripts/headers.sh Amerigo Wang
2009-06-04  9:15 ` [Patch 1/2] kbuild: two trivial fixes for check headers Sam Ravnborg
2009-06-04  9:23   ` Amerigo Wang
2009-06-04 10:39     ` Sam Ravnborg
2009-06-05  2:05       ` Amerigo Wang
2009-06-05  2:23       ` Jaswinder Singh Rajput
2009-06-04  9:56   ` Amerigo Wang

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