All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, Borislav Petkov <bp@alien8.de>,
	Nadav Amit <namit@vmware.com>, Joe Perches <joe@perches.com>,
	Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>,
	Segher Boessenkool <segher@kernel.crashing.org>,
	Ingo Molnar <mingo@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: [RFC][PATCH] tree-wide: Remove __inline__ and __inline usage
Date: Tue, 6 Nov 2018 11:02:29 +0100	[thread overview]
Message-ID: <20181106100229.GI22431@hirez.programming.kicks-ass.net> (raw)

Hi Linus,

A proposed GCC asm extention:

  https://gcc.gnu.org/ml/gcc-patches/2018-10/msg01931.html

allows adding the "inline" keyword to 'asm ("")' statements. The
problem is that we're possibly redefining "inline" to
"inline __attribute__((__always_inline__))" which makes the proposed:

  asm volatile inline ("")

not compile.

However, since we've been depricating the use of the alternative
inline keywords: "__inline__" and "__inline", and there are only a
'few' uses left of them in the tree:

  $ git grep -e "\<__inline__\>" | wc -l
  487
  $ git grep -e "\<__inline\>" | wc -l
  56
  $ git grep -e "\<inline\>" | wc -l
  69957

let's finish them off now.

Therefore I'm proposing to run:

  git grep -l "\<__inline\(\|__\)\>" | while read file
  do
	sed -i -e 's/\<__inline\(\|__\)\>/inline/g' $file
  done

On your current tree, and apply the below fixup patch on top of that
result.

This would then allow us to do something like (+- GCC feature tests):

  #define asm_volatile(stmt...) asm volatile __inline__(stmt)

once that GCC patch lands.

Cc: Nadav Amit <namit@vmware.com>
Cc: Joe Perches <joe@perches.com>
Cc: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Cc: Segher Boessenkool <segher@kernel.crashing.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
 include/linux/compiler_types.h |    3 ---
 scripts/checkpatch.pl          |   12 ++++++------
 scripts/genksyms/keywords.c    |    2 --
 scripts/kernel-doc             |    2 --
 4 files changed, 6 insertions(+), 13 deletions(-)

--- a/include/linux/compiler_types.h
+++ b/include/linux/compiler_types.h
@@ -202,9 +202,6 @@ struct ftrace_likely_data {
 	__maybe_unused notrace
 #endif
 
-#define inline inline
-#define inline   inline
-
 /*
  * Rather then using noinline to prevent stack consumption, use
  * noinline_for_stack instead.  For documentation reasons.
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -389,7 +389,7 @@ our $Attribute	= qr{
 			__weak
 		  }x;
 our $Modifier;
-our $Inline	= qr{inline|__always_inline|noinline|inline|inline};
+our $Inline	= qr{inline|__always_inline|noinline};
 our $Member	= qr{->$Ident|\.$Ident|\[[^]]*\]};
 our $Lval	= qr{$Ident(?:$Member)*};
 
@@ -5771,13 +5771,13 @@ sub process {
 			      "inline keyword should sit between storage class and type\n" . $herecurr);
 		}
 
-# Check for inline and inline, prefer inline
+# Check for __inline__ and __inline, prefer inline
 		if ($realfile !~ m@\binclude/uapi/@ &&
-		    $line =~ /\b(inline|inline)\b/) {
-			if (WARN("INLINE",
-				 "plain inline is preferred over $1\n" . $herecurr) &&
+		    $line =~ /\b(__inline__|__inline)\b/) {
+			if (ERROR("INLINE",
+				  "plain inline is preferred over $1\n" . $herecurr) &&
 			    $fix) {
-				$fixed[$fixlinenr] =~ s/\b(inline|inline)\b/inline/;
+				$fixed[$fixlinenr] =~ s/\b(__inline__|__inline)\b/inline/;
 
 			}
 		}
--- a/scripts/genksyms/keywords.c
+++ b/scripts/genksyms/keywords.c
@@ -14,8 +14,6 @@ static struct resword {
 	{ "__const", CONST_KEYW },
 	{ "__const__", CONST_KEYW },
 	{ "__extension__", EXTENSION_KEYW },
-	{ "inline", INLINE_KEYW },
-	{ "inline", INLINE_KEYW },
 	{ "__signed", SIGNED_KEYW },
 	{ "__signed__", SIGNED_KEYW },
 	{ "__typeof", TYPEOF_KEYW },
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -1569,8 +1569,6 @@ sub dump_function($$) {
     $prototype =~ s/^extern +//;
     $prototype =~ s/^asmlinkage +//;
     $prototype =~ s/^inline +//;
-    $prototype =~ s/^inline +//;
-    $prototype =~ s/^inline +//;
     $prototype =~ s/^__always_inline +//;
     $prototype =~ s/^noinline +//;
     $prototype =~ s/__init +//;

             reply	other threads:[~2018-11-06 10:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-06 10:02 Peter Zijlstra [this message]
2018-11-06 14:09 ` [RFC][PATCH] tree-wide: Remove __inline__ and __inline usage Miguel Ojeda
2018-11-06 14:46   ` Peter Zijlstra
2018-11-06 17:21     ` Miguel Ojeda
2018-11-06 19:18 ` Linus Torvalds
2018-11-06 19:41   ` Peter Zijlstra
2018-11-06 19:51     ` Linus Torvalds
2018-11-06 19:59       ` Peter Zijlstra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181106100229.GI22431@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=bp@alien8.de \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miguel.ojeda.sandonis@gmail.com \
    --cc=mingo@kernel.org \
    --cc=namit@vmware.com \
    --cc=segher@kernel.crashing.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.