linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 0/2] x86/purgatory: Fix sparse warning, symbol not declared
@ 2017-02-19 23:12 Tobin C. Harding
  2017-02-19 23:12 ` [PATCH v4 1/2] " Tobin C. Harding
  2017-02-19 23:12 ` [PATCH v4 2/2] x86/purgatory: Fix sparse warning, symbol not declared Tobin C. Harding
  0 siblings, 2 replies; 5+ messages in thread
From: Tobin C. Harding @ 2017-02-19 23:12 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin
  Cc: x86, linux-kernel, Tobin C. Harding

Sparse emits several 'symbol not declared' warnings for various
functions and variables. 

Add static keyword to functions and variables which have file scope
only.

Add header file with funciton declaration. Add preprocessor guard and
include header in ASM file. Include header in C file contianing function
definition.

Changes since v3:
 - Put preprocessor directives in correct order.

Changes since v2:
 - Add preprocessor guard.

Changes since v1:
 - Add header file.

Tobin C. Harding (2):
  x86/purgatory: Fix sparse warning, symbol not declared
  x86/purgatory: Fix sparse warning, symbol not declared

 arch/x86/purgatory/purgatory.c    | 11 ++++++-----
 arch/x86/purgatory/purgatory.h    | 12 ++++++++++++
 arch/x86/purgatory/setup-x86_64.S |  4 ++--
 3 files changed, 20 insertions(+), 7 deletions(-)
 create mode 100644 arch/x86/purgatory/purgatory.h

-- 
2.7.4

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v4 1/2] x86/purgatory: Fix sparse warning, symbol not declared
  2017-02-19 23:12 [PATCH v4 0/2] x86/purgatory: Fix sparse warning, symbol not declared Tobin C. Harding
@ 2017-02-19 23:12 ` Tobin C. Harding
  2017-03-01 10:31   ` [tip:x86/urgent] x86/purgatory: Make functions and variables static tip-bot for Tobin C. Harding
  2017-02-19 23:12 ` [PATCH v4 2/2] x86/purgatory: Fix sparse warning, symbol not declared Tobin C. Harding
  1 sibling, 1 reply; 5+ messages in thread
From: Tobin C. Harding @ 2017-02-19 23:12 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin
  Cc: x86, linux-kernel, Tobin C. Harding

Sparse emits several 'symbol not declared' warnings for various
functions and variables.

Add static keyword to functions and variables which have file scope
only.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
---
 arch/x86/purgatory/purgatory.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/x86/purgatory/purgatory.c b/arch/x86/purgatory/purgatory.c
index 25e068b..2a5f437 100644
--- a/arch/x86/purgatory/purgatory.c
+++ b/arch/x86/purgatory/purgatory.c
@@ -18,11 +18,11 @@ struct sha_region {
 	unsigned long len;
 };
 
-unsigned long backup_dest = 0;
-unsigned long backup_src = 0;
-unsigned long backup_sz = 0;
+static unsigned long backup_dest;
+static unsigned long backup_src;
+static unsigned long backup_sz;
 
-u8 sha256_digest[SHA256_DIGEST_SIZE] = { 0 };
+static u8 sha256_digest[SHA256_DIGEST_SIZE] = { 0 };
 
 struct sha_region sha_regions[16] = {};
 
@@ -39,7 +39,7 @@ static int copy_backup_region(void)
 	return 0;
 }
 
-int verify_sha256_digest(void)
+static int verify_sha256_digest(void)
 {
 	struct sha_region *ptr, *end;
 	u8 digest[SHA256_DIGEST_SIZE];
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v4 2/2] x86/purgatory: Fix sparse warning, symbol not declared
  2017-02-19 23:12 [PATCH v4 0/2] x86/purgatory: Fix sparse warning, symbol not declared Tobin C. Harding
  2017-02-19 23:12 ` [PATCH v4 1/2] " Tobin C. Harding
@ 2017-02-19 23:12 ` Tobin C. Harding
  2017-03-01 10:32   ` [tip:x86/urgent] " tip-bot for Tobin C. Harding
  1 sibling, 1 reply; 5+ messages in thread
From: Tobin C. Harding @ 2017-02-19 23:12 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin
  Cc: x86, linux-kernel, Tobin C. Harding

Sparse emits warning, 'symbol not declared' for a function that has
neither file scope nor a forward declaration. The functions only call
site is an ASM file.

Add a header file with the function declaration. Include the
header file in the C source file defining the function in order
to fix the sparse warning. Include the header file in ASM file
containing the call site to document the usage.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
---
 arch/x86/purgatory/purgatory.c    |  1 +
 arch/x86/purgatory/purgatory.h    | 12 ++++++++++++
 arch/x86/purgatory/setup-x86_64.S |  4 ++--
 3 files changed, 15 insertions(+), 2 deletions(-)
 create mode 100644 arch/x86/purgatory/purgatory.h

diff --git a/arch/x86/purgatory/purgatory.c b/arch/x86/purgatory/purgatory.c
index 2a5f437..b6d5c89 100644
--- a/arch/x86/purgatory/purgatory.c
+++ b/arch/x86/purgatory/purgatory.c
@@ -11,6 +11,7 @@
  */
 
 #include "sha256.h"
+#include "purgatory.h"
 #include "../boot/string.h"
 
 struct sha_region {
diff --git a/arch/x86/purgatory/purgatory.h b/arch/x86/purgatory/purgatory.h
new file mode 100644
index 0000000..fb8b4f8
--- /dev/null
+++ b/arch/x86/purgatory/purgatory.h
@@ -0,0 +1,12 @@
+#ifndef PURGATORY_H
+#define PURGATORY_H
+
+#ifndef __ASSEMBLY__
+
+extern void purgatory(void);
+
+#endif	/* __ASSEMBLY__ */
+
+#endif /* PURGATORY_H */
+
+
diff --git a/arch/x86/purgatory/setup-x86_64.S b/arch/x86/purgatory/setup-x86_64.S
index fe3c91b..8045994 100644
--- a/arch/x86/purgatory/setup-x86_64.S
+++ b/arch/x86/purgatory/setup-x86_64.S
@@ -9,8 +9,8 @@
  * This source code is licensed under the GNU General Public License,
  * Version 2.  See the file COPYING for more details.
  */
-
-	.text
+#include "purgatory.h"	
+ 	.text
 	.globl purgatory_start
 	.balign 16
 purgatory_start:
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [tip:x86/urgent] x86/purgatory: Make functions and variables static
  2017-02-19 23:12 ` [PATCH v4 1/2] " Tobin C. Harding
@ 2017-03-01 10:31   ` tip-bot for Tobin C. Harding
  0 siblings, 0 replies; 5+ messages in thread
From: tip-bot for Tobin C. Harding @ 2017-03-01 10:31 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: me, hpa, tglx, mingo, linux-kernel

Commit-ID:  72042a8c7b01048a36ece216aaf206b7d60ca661
Gitweb:     http://git.kernel.org/tip/72042a8c7b01048a36ece216aaf206b7d60ca661
Author:     Tobin C. Harding <me@tobin.cc>
AuthorDate: Mon, 20 Feb 2017 10:12:35 +1100
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Wed, 1 Mar 2017 11:27:26 +0100

x86/purgatory: Make functions and variables static

Sparse emits several 'symbol not declared' warnings for various
functions and variables.

Add static keyword to functions and variables which have file scope
only.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Link: http://lkml.kernel.org/r/1487545956-2547-2-git-send-email-me@tobin.cc
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

---
 arch/x86/purgatory/purgatory.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/x86/purgatory/purgatory.c b/arch/x86/purgatory/purgatory.c
index 25e068b..2a5f437 100644
--- a/arch/x86/purgatory/purgatory.c
+++ b/arch/x86/purgatory/purgatory.c
@@ -18,11 +18,11 @@ struct sha_region {
 	unsigned long len;
 };
 
-unsigned long backup_dest = 0;
-unsigned long backup_src = 0;
-unsigned long backup_sz = 0;
+static unsigned long backup_dest;
+static unsigned long backup_src;
+static unsigned long backup_sz;
 
-u8 sha256_digest[SHA256_DIGEST_SIZE] = { 0 };
+static u8 sha256_digest[SHA256_DIGEST_SIZE] = { 0 };
 
 struct sha_region sha_regions[16] = {};
 
@@ -39,7 +39,7 @@ static int copy_backup_region(void)
 	return 0;
 }
 
-int verify_sha256_digest(void)
+static int verify_sha256_digest(void)
 {
 	struct sha_region *ptr, *end;
 	u8 digest[SHA256_DIGEST_SIZE];

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [tip:x86/urgent] x86/purgatory: Fix sparse warning, symbol not declared
  2017-02-19 23:12 ` [PATCH v4 2/2] x86/purgatory: Fix sparse warning, symbol not declared Tobin C. Harding
@ 2017-03-01 10:32   ` tip-bot for Tobin C. Harding
  0 siblings, 0 replies; 5+ messages in thread
From: tip-bot for Tobin C. Harding @ 2017-03-01 10:32 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: me, mingo, hpa, tglx, linux-kernel

Commit-ID:  e98fe5127b9cc8ab33d1094b81c19deb1f9082bf
Gitweb:     http://git.kernel.org/tip/e98fe5127b9cc8ab33d1094b81c19deb1f9082bf
Author:     Tobin C. Harding <me@tobin.cc>
AuthorDate: Mon, 20 Feb 2017 10:12:36 +1100
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Wed, 1 Mar 2017 11:27:26 +0100

x86/purgatory: Fix sparse warning, symbol not declared

Sparse emits warning, 'symbol not declared' for a function that has
neither file scope nor a forward declaration. The functions only call
site is an ASM file.

Add a header file with the function declaration. Include the header file in
the C source file defining the function in order to fix the sparse
warning. Include the header file in ASM file containing the call site to
document the usage.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Link: http://lkml.kernel.org/r/1487545956-2547-3-git-send-email-me@tobin.cc
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

---
 arch/x86/purgatory/purgatory.c    | 1 +
 arch/x86/purgatory/purgatory.h    | 8 ++++++++
 arch/x86/purgatory/setup-x86_64.S | 1 +
 3 files changed, 10 insertions(+)

diff --git a/arch/x86/purgatory/purgatory.c b/arch/x86/purgatory/purgatory.c
index 2a5f437..b6d5c89 100644
--- a/arch/x86/purgatory/purgatory.c
+++ b/arch/x86/purgatory/purgatory.c
@@ -11,6 +11,7 @@
  */
 
 #include "sha256.h"
+#include "purgatory.h"
 #include "../boot/string.h"
 
 struct sha_region {
diff --git a/arch/x86/purgatory/purgatory.h b/arch/x86/purgatory/purgatory.h
new file mode 100644
index 0000000..e2e365a
--- /dev/null
+++ b/arch/x86/purgatory/purgatory.h
@@ -0,0 +1,8 @@
+#ifndef PURGATORY_H
+#define PURGATORY_H
+
+#ifndef __ASSEMBLY__
+extern void purgatory(void);
+#endif	/* __ASSEMBLY__ */
+
+#endif /* PURGATORY_H */
diff --git a/arch/x86/purgatory/setup-x86_64.S b/arch/x86/purgatory/setup-x86_64.S
index fe3c91b..f90e9df 100644
--- a/arch/x86/purgatory/setup-x86_64.S
+++ b/arch/x86/purgatory/setup-x86_64.S
@@ -9,6 +9,7 @@
  * This source code is licensed under the GNU General Public License,
  * Version 2.  See the file COPYING for more details.
  */
+#include "purgatory.h"
 
 	.text
 	.globl purgatory_start

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-03-01 10:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-19 23:12 [PATCH v4 0/2] x86/purgatory: Fix sparse warning, symbol not declared Tobin C. Harding
2017-02-19 23:12 ` [PATCH v4 1/2] " Tobin C. Harding
2017-03-01 10:31   ` [tip:x86/urgent] x86/purgatory: Make functions and variables static tip-bot for Tobin C. Harding
2017-02-19 23:12 ` [PATCH v4 2/2] x86/purgatory: Fix sparse warning, symbol not declared Tobin C. Harding
2017-03-01 10:32   ` [tip:x86/urgent] " tip-bot for Tobin C. Harding

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).