linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: James Morse <james.morse@arm.com>
To: linux-arm-kernel@lists.infradead.org
Cc: linux-arch@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>,
	Will Deacon <will.deacon@arm.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	James Morse <james.morse@arm.com>,
	Mark Rutland <mark.rutland@arm.com>
Subject: [PATCH] asm-generic/pgtable-nop?d.h: define folded with a value for use in C
Date: Wed,  3 Oct 2018 18:50:52 +0100	[thread overview]
Message-ID: <20181003175052.31917-1-james.morse@arm.com> (raw)
Message-ID: <20181003175052.c5wsw-adHPkSLr0wKc1RMItpkvKn2BJFA2rDn3RzF_g@z> (raw)

It turns out "if (__is_defined(__PAGETABLE_PMD_FOLDED))" isn't equivalent
to "#ifdef __PAGETABLE_PMD_FOLDED". (who knew!)

kconfig.h's __is_defined() expects a define of the form
"#define CONFIG_BOOGER 1". But these nop?d headers just have
"#define __PAGETABLE_PMD_FOLDED".

This means ____is_defined()'s triplet passed to __take_second_arg() is
'empty-string, 1 0' in both cases, meaning these symbols can't be used
from C. (they are always false).

asm-generic gets away with this as its using the pre-processor's
defined() macro on this, not the C __is_defined().

Add the expected '1'.

Signed-off-by: James Morse <james.morse@arm.com>
CC: Mark Rutland <mark.rutland@arm.com>
---
This fixes an issue with patches queued for arm64. Can it go via the arm64 tree?
Link: lore.kernel.org/r/0f9a3abc-4890-faf5-ee7e-18434641b858@arm.com



 include/asm-generic/pgtable-nopmd.h | 2 +-
 include/asm-generic/pgtable-nopud.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/asm-generic/pgtable-nopmd.h b/include/asm-generic/pgtable-nopmd.h
index f35f6e8149e4..fcb4769a075a 100644
--- a/include/asm-generic/pgtable-nopmd.h
+++ b/include/asm-generic/pgtable-nopmd.h
@@ -8,7 +8,7 @@
 
 struct mm_struct;
 
-#define __PAGETABLE_PMD_FOLDED
+#define __PAGETABLE_PMD_FOLDED	1
 
 /*
  * Having the pmd type consist of a pud gets the size right, and allows
diff --git a/include/asm-generic/pgtable-nopud.h b/include/asm-generic/pgtable-nopud.h
index e950b9c50f34..d300dbcddaf3 100644
--- a/include/asm-generic/pgtable-nopud.h
+++ b/include/asm-generic/pgtable-nopud.h
@@ -9,7 +9,7 @@
 #else
 #include <asm-generic/pgtable-nop4d.h>
 
-#define __PAGETABLE_PUD_FOLDED
+#define __PAGETABLE_PUD_FOLDED	1
 
 /*
  * Having the pud type consist of a p4d gets the size right, and allows
-- 
2.19.0

             reply	other threads:[~2018-10-04  0:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-03 17:50 James Morse [this message]
2018-10-03 17:50 ` [PATCH] asm-generic/pgtable-nop?d.h: define folded with a value for use in C James Morse
2018-10-04  9:45 ` Catalin Marinas
2018-10-04  9:45   ` Catalin Marinas
2018-10-05 11:02   ` Mark Rutland
2018-10-05 11:02     ` Mark Rutland

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=20181003175052.31917-1-james.morse@arm.com \
    --to=james.morse@arm.com \
    --cc=arnd@arndb.de \
    --cc=catalin.marinas@arm.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --cc=will.deacon@arm.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).