Skip to contentSkip to conversation

init: Properly placing noinline keyword.

PATCH In review Rakib Mullick 4 participants 7 messages Oct 17, 2008 – Oct 20, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 init: Properly placing noinline keyword.

Here, noinline keyword should be placed between storage class and type. Thanks.

init/main.c +2 -2
@@ -457,7 +457,7 @@ static void __init setup_command_line(ch
  * gcc-3.4 accidentally inlines this function, so use noinline.
  */
 
-static void noinline __init_refok rest_init(void)
+static noinline void __init_refok rest_init(void)
 	__releases(kernel_lock)
 {
 	int pid;
@@ -792,7 +792,7 @@ static void run_init_process(char *init_
 /* This is a non __init function. Force it to be noinline otherwise gcc
  * makes it inline to init() and it becomes part of init.text section
  */
-static int noinline init_post(void)
+static noinline int init_post(void)
 {
 	free_initmem();
 	unlock_kernel();
#1 lore raw
Quoted 1 line · Rakib Mullick

Here, noinline keyword should be placed between storage class and type.

Why?

Quoted 17 lines
init/main.c +2 -2
@@ -457,7 +457,7 @@ static void __init setup_command_line(ch
  * gcc-3.4 accidentally inlines this function, so use noinline.
  */
 
-static void noinline __init_refok rest_init(void)
+static noinline void __init_refok rest_init(void)
 	__releases(kernel_lock)
 {
 	int pid;
@@ -792,7 +792,7 @@ static void run_init_process(char *init_
 /* This is a non __init function. Force it to be noinline otherwise gcc
  * makes it inline to init() and it becomes part of init.text section
  */
-static int noinline init_post(void)
+static noinline int init_post(void)
#2 lore raw
Quoted 5 lines · Alexey Dobriyan
Quoted 1 line · Rakib Mullick

Here, noinline keyword should be placed between storage class and type.

Why?

Because, scripts/checkpatch.pl warned with following warning:
ERROR: inline keyword should sit between storage class and type

Quoted 22 lines
Quoted 21 lines

--- linux-2.6-stable.orig/init/main.c

+++ linux-2.6-stable/init/main.c

init/main.c +2 -2
@@ -457,7 +457,7 @@ static void __init setup_command_line(ch
  * gcc-3.4 accidentally inlines this function, so use noinline.
  */
 
-static void noinline __init_refok rest_init(void)
+static noinline void __init_refok rest_init(void)
      __releases(kernel_lock)
 {
      int pid;
@@ -792,7 +792,7 @@ static void run_init_process(char *init_
 /* This is a non __init function. Force it to be noinline otherwise gcc
  * makes it inline to init() and it becomes part of init.text section
  */
-static int noinline init_post(void)
+static noinline int init_post(void)
#3 lore raw
Quoted 8 lines · Rakib Mullick
Quoted 5 lines · Alexey Dobriyan
Quoted 1 line · Rakib Mullick

Here, noinline keyword should be placed between storage class and type.

Why?

Because, scripts/checkpatch.pl warned with following warning:
ERROR: inline keyword should sit between storage class and type

Well, 'noinline' is different from 'inline'.

'noinline' is defined as:

#define noinline __attribute__((noinline))

in include/linux/compiler-gcc.h. But 'inline' is a _keyword_ defined by C standard. If checkpatch.pl complains about 'noinline', you should fix checkpatch.pl. :)

Signature · 1 line
"Sometimes the only way to stay sane is to go a little crazy."
#4 lore raw
Quoted 13 lines · Américo Wang
Quoted 8 lines · Rakib Mullick
Quoted 5 lines · Alexey Dobriyan
Quoted 1 line · Rakib Mullick

Here, noinline keyword should be placed between storage class and type.

Why?

Because, scripts/checkpatch.pl warned with following warning:
ERROR: inline keyword should sit between storage class and type

Well, 'noinline' is different from 'inline'.

Quoted 7 lines

'noinline' is defined as:

#define noinline __attribute__((noinline))

in include/linux/compiler-gcc.h. But 'inline' is a _keyword_ defined by C standard. If checkpatch.pl complains about 'noinline', you should fix checkpatch.pl. :)

Thanks, for explanation. But isn't it nice to place it between storage class and type ?

Quoted 12 lines

--
"Sometimes the only way to stay sane is to go a little crazy."

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

#5 lore raw
Quoted 16 lines · Rakib Mullick
Quoted 15 lines · Américo Wang
Quoted 8 lines · Rakib Mullick
Quoted 5 lines · Alexey Dobriyan
Quoted 1 line · Rakib Mullick

Here, noinline keyword should be placed between storage class and type.

Why?

Because, scripts/checkpatch.pl warned with following warning:
ERROR: inline keyword should sit between storage class and type

Well, 'noinline' is different from 'inline'.

'noinline' is defined as:

Quoted 7 lines
Quoted 5 lines

#define noinline __attribute__((noinline))

in include/linux/compiler-gcc.h. But 'inline' is a _keyword_ defined by C standard. If checkpatch.pl complains about 'noinline', you should fix checkpatch.pl. :)

Thanks, for explanation. But isn't it nice to place it between storage class and type ?

I don't think so, I don't know why checkpatch.pl prefers that style. I think probably only because that is more readable?

Anyway, gcc attribute is another different thing.

Signature · 1 line
"Sometimes the only way to stay sane is to go a little crazy."
#6 lore raw
Quoted 19 lines · On Fri, 17 Oct 2008 18:31:23 +0100 Am__rico Wang <[email protected]>…
Quoted 18 lines · Rakib Mullick
Quoted 17 lines · Am__rico Wang
Quoted 8 lines · Rakib Mullick
Quoted 5 lines · Alexey Dobriyan
Quoted 1 line · Rakib Mullick

Here, noinline keyword should be placed between storage class and type.

Why?

Because, scripts/checkpatch.pl warned with following warning:
ERROR: inline keyword should sit between storage class and type

Well, 'noinline' is different from 'inline'.

'noinline' is defined as:

#define noinline __attribute__((noinline))

Quoted 9 lines
Quoted 5 lines
Quoted 3 lines

in include/linux/compiler-gcc.h. But 'inline' is a _keyword_ defined by C standard. If checkpatch.pl complains about 'noinline', you should fix checkpatch.pl. :)

Thanks, for explanation. But isn't it nice to place it between storage class and type ?

I don't think so, I don't know why checkpatch.pl prefers that style. I think probably only because that is more readable?

I think it's good for consistency reasons. Yes, we _could_ have a random sprinkling of different keyword orderings, but what benefit is there in that? In the great majority of places the kernel uses static inline void' and static noinline void' ordering, and that's a good thing, no?

So I merged the patch and I'd support retaining the checkpatch warning.

My one concern is that the patch is too small. Probably there are other codesites which get the keywords in a non-standard order, and I'd rather fix them up in a single big pass rather than in a long series of little patches.