All of lore.kernel.org
 help / color / mirror / Atom feed
From: Brian Gerst <brgerst@gmail.com>
To: tj@kernel.org
Cc: linux-kernel@vger.kernel.org, Stephen Rothwell <sfr@canb.auug.org.au>
Subject: [PATCH] x86, percpu: Fix __this_cpu_ptr with const pointers
Date: Fri, 10 Sep 2010 01:31:04 -0400	[thread overview]
Message-ID: <1284096664-4539-1-git-send-email-brgerst@gmail.com> (raw)
In-Reply-To: <20100910124543.3e8604fd.sfr@canb.auug.org.au>

Fix this error when the pointer is marked const:
error: read-only variable 'tcp_ptr__' used as 'asm' output

Signed-off-by: Brian Gerst <brgerst@gmail.com>
CC: Stephen Rothwell <sfr@canb.auug.org.au>
---
 arch/x86/include/asm/percpu.h |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/x86/include/asm/percpu.h b/arch/x86/include/asm/percpu.h
index fe418dd..f62b52c 100644
--- a/arch/x86/include/asm/percpu.h
+++ b/arch/x86/include/asm/percpu.h
@@ -54,12 +54,12 @@
  */
 #define __this_cpu_ptr(ptr)				\
 ({							\
-	typeof(ptr) tcp_ptr__ = (ptr);			\
+	unsigned long tcp_ptr__;			\
 	__verify_pcpu_ptr(ptr);				\
 	asm volatile("add " __percpu_arg(1) ", %0"	\
-		     : "+r" (tcp_ptr__)			\
-		     : "m" (this_cpu_off));		\
-	tcp_ptr__;					\
+		     : "=r" (tcp_ptr__)			\
+		     : "m" (this_cpu_off), "0" (ptr));	\
+	(typeof(ptr) __kernel __force) tcp_ptr__;	\
 })
 #else
 #define __percpu_arg(x)		"%P" #x
-- 
1.7.2.2


  reply	other threads:[~2010-09-10  5:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-10  2:45 linux-next: build failure after merge of the percpu tree Stephen Rothwell
2010-09-10  5:31 ` Brian Gerst [this message]
2010-09-10  8:34   ` [PATCH] x86, percpu: Fix __this_cpu_ptr with const pointers Tejun Heo

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=1284096664-4539-1-git-send-email-brgerst@gmail.com \
    --to=brgerst@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sfr@canb.auug.org.au \
    --cc=tj@kernel.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.