mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: tip-bot for Vivek Goyal <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@kernel.org,
	tglx@linutronix.de, hpa@linux.intel.com, vgoyal@redhat.com
Subject: [tip:x86/boot] x86, boot: Move memset() definition in compressed/ string.c
Date: Wed, 19 Mar 2014 16:31:31 -0700	[thread overview]
Message-ID: <tip-04999550f93234bf05597a9b7d26e2bfe27ba883@git.kernel.org> (raw)
In-Reply-To: <1395170800-11059-6-git-send-email-vgoyal@redhat.com>

Commit-ID:  04999550f93234bf05597a9b7d26e2bfe27ba883
Gitweb:     http://git.kernel.org/tip/04999550f93234bf05597a9b7d26e2bfe27ba883
Author:     Vivek Goyal <vgoyal@redhat.com>
AuthorDate: Tue, 18 Mar 2014 15:26:40 -0400
Committer:  H. Peter Anvin <hpa@linux.intel.com>
CommitDate: Wed, 19 Mar 2014 15:44:09 -0700

x86, boot: Move memset() definition in compressed/string.c

Currently compressed/misc.c needs to link against memset(). I think one of
the reasons of this need is inclusion of various header files which define
static inline functions and use memset() inside these. For example,
include/linux/bitmap.h

I think trying to include "../string.h" and using builtin version of memset
does not work because by the time "#define memset" shows up, it is too
late. Some other header file has already used memset() and expects to
find a definition during link phase.

Currently we have a C definitoin of memset() in misc.c. Move it to
compressed/string.c so that others can use it if need be.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Link: http://lkml.kernel.org/r/1395170800-11059-6-git-send-email-vgoyal@redhat.com
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
---
 arch/x86/boot/compressed/misc.c   | 20 +++++++-------------
 arch/x86/boot/compressed/string.c | 10 ++++++++++
 2 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c
index 3100092..1768461 100644
--- a/arch/x86/boot/compressed/misc.c
+++ b/arch/x86/boot/compressed/misc.c
@@ -98,8 +98,14 @@
  */
 #define STATIC		static
 
-#undef memset
 #undef memcpy
+
+/*
+ * Use a normal definition of memset() from string.c. There are already
+ * included header files which expect a definition of memset() and by
+ * the time we define memset macro, it is too late.
+ */
+#undef memset
 #define memzero(s, n)	memset((s), 0, (n))
 
 
@@ -110,8 +116,6 @@ static void error(char *m);
  */
 struct boot_params *real_mode;		/* Pointer to real-mode data */
 
-void *memset(void *s, int c, size_t n);
-
 memptr free_mem_ptr;
 memptr free_mem_end_ptr;
 
@@ -216,16 +220,6 @@ void __putstr(const char *s)
 	outb(0xff & (pos >> 1), vidport+1);
 }
 
-void *memset(void *s, int c, size_t n)
-{
-	int i;
-	char *ss = s;
-
-	for (i = 0; i < n; i++)
-		ss[i] = c;
-	return s;
-}
-
 static void error(char *x)
 {
 	error_putstr("\n\n");
diff --git a/arch/x86/boot/compressed/string.c b/arch/x86/boot/compressed/string.c
index 920b55e..f3c57e3 100644
--- a/arch/x86/boot/compressed/string.c
+++ b/arch/x86/boot/compressed/string.c
@@ -33,3 +33,13 @@ void *memcpy(void *dest, const void *src, size_t n)
 	return dest;
 }
 #endif
+
+void *memset(void *s, int c, size_t n)
+{
+	int i;
+	char *ss = s;
+
+	for (i = 0; i < n; i++)
+		ss[i] = c;
+	return s;
+}

      reply	other threads:[~2014-03-19 23:31 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-18 19:26 [PATCH 0/5] x86/boot: Some string function cleanup and consolidation Vivek Goyal
2014-03-18 19:26 ` [PATCH 1/5] x86/boot: undef memcmp before providing a new definition Vivek Goyal
2014-03-19 23:30   ` [tip:x86/boot] x86, boot: Undef " tip-bot for Vivek Goyal
2014-03-18 19:26 ` [PATCH 2/5] x86/boot: Create a separate string.h file to provide standard string functions Vivek Goyal
2014-03-19 23:30   ` [tip:x86/boot] x86, boot: " tip-bot for Vivek Goyal
2014-03-18 19:26 ` [PATCH 3/5] x86/boot: Move optmized memcpy() 32/64 bit versions to compressed/string.c Vivek Goyal
2014-03-19 23:31   ` [tip:x86/boot] x86, boot: Move optimized memcpy() 32/ 64 " tip-bot for Vivek Goyal
2014-03-18 19:26 ` [PATCH 4/5] x86/boot: Move memcmp() into string.h and string.c Vivek Goyal
2014-03-19 23:31   ` [tip:x86/boot] x86, boot: " tip-bot for Vivek Goyal
2014-03-18 19:26 ` [PATCH 5/5] x86/boot: Move memset() definition in compressed/string.c Vivek Goyal
2014-03-19 23:31   ` tip-bot for Vivek Goyal [this message]

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=tip-04999550f93234bf05597a9b7d26e2bfe27ba883@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=hpa@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=vgoyal@redhat.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

Powered by JetHome