[PATCH RESENT] staging: lustre-libcfs: fix sparse warning

Patrick Boettcher patrick.boettcher at posteo.de
Wed Aug 5 15:26:22 UTC 2015


Hi all,

Please consider applying the following patch. It fixes some
sparse-warning related to global variable not being correctly declared.

This is a resent with the patch inline. Greg's bot was picky about it
for a reason!

Applies to linux-next/next-20150804.

----


From b04a87fd78f5e0dcdfe83362df367e4c244a4e3e Mon Sep 17 00:00:00 2001
From: Patrick Boettcher <patrick.boettcher at posteo.de>
Date: Wed, 5 Aug 2015 09:13:04 +0200
Subject: [PATCH] staging: lustre-libcfs: fix sparse warning

Fix sparse warnings of the following type:

warning: symbol '....' was not declared. Should it be static?

Signed-off-by: Patrick Boettcher <patrick.boettcher at posteo.de>
---
 drivers/staging/lustre/include/linux/libcfs/libcfs.h      | 13 +++++++++++++
 drivers/staging/lustre/lustre/libcfs/linux/linux-module.c |  2 --
 drivers/staging/lustre/lustre/libcfs/module.c             | 13 ++-----------
 3 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs.h b/drivers/staging/lustre/include/linux/libcfs/libcfs.h
index d585041..a1ece6d 100644
--- a/drivers/staging/lustre/include/linux/libcfs/libcfs.h
+++ b/drivers/staging/lustre/include/linux/libcfs/libcfs.h
@@ -148,4 +148,17 @@ void *libcfs_kvzalloc(size_t size, gfp_t flags);
 void *libcfs_kvzalloc_cpt(struct cfs_cpt_table *cptab, int cpt, size_t size,
 			  gfp_t flags);
 
+extern struct miscdevice libcfs_dev;
+/**
+ * The path of debug log dump upcall script.
+ */
+extern char lnet_upcall[1024];
+extern char lnet_debug_log_upcall[1024];
+
+extern void libcfs_init_nidstrings(void);
+
+extern struct cfs_psdev_ops	  libcfs_psdev_ops;
+
+extern struct cfs_wi_sched *cfs_sched_rehash;
+
 #endif /* _LIBCFS_H */
diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c
index e962f89..3014120 100644
--- a/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c
+++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c
@@ -96,8 +96,6 @@ int libcfs_ioctl_popdata(void *arg, void *data, int size)
 	return 0;
 }
 
-extern struct cfs_psdev_ops	  libcfs_psdev_ops;
-
 static int
 libcfs_psdev_open(struct inode *inode, struct file *file)
 {
diff --git a/drivers/staging/lustre/lustre/libcfs/module.c b/drivers/staging/lustre/lustre/libcfs/module.c
index 1ab4232..2035034 100644
--- a/drivers/staging/lustre/lustre/libcfs/module.c
+++ b/drivers/staging/lustre/lustre/libcfs/module.c
@@ -66,19 +66,10 @@ MODULE_AUTHOR("Peter J. Braam <braam at clusterfs.com>");
 MODULE_DESCRIPTION("Portals v3.1");
 MODULE_LICENSE("GPL");
 
-extern struct miscdevice libcfs_dev;
-extern struct cfs_wi_sched *cfs_sched_rehash;
-extern void libcfs_init_nidstrings(void);
-
 static void insert_debugfs(void);
 static void remove_debugfs(void);
 
 static struct dentry *lnet_debugfs_root;
-extern char lnet_upcall[1024];
-/**
- * The path of debug log dump upcall script.
- */
-extern char lnet_debug_log_upcall[1024];
 
 static void kportal_memhog_free(struct libcfs_device_userstate *ldu)
 {
@@ -716,7 +707,7 @@ struct lnet_debugfs_symlink_def {
 	char *target;
 };
 
-struct lnet_debugfs_symlink_def lnet_debugfs_symlinks[] = {
+static const struct lnet_debugfs_symlink_def lnet_debugfs_symlinks[] = {
 	{ "console_ratelimit",
 	  "/sys/module/libcfs/parameters/libcfs_console_ratelimit"},
 	{ "debug_path",
@@ -771,7 +762,7 @@ static void insert_debugfs(void)
 {
 	struct ctl_table *table;
 	struct dentry *entry;
-	struct lnet_debugfs_symlink_def *symlinks;
+	const struct lnet_debugfs_symlink_def *symlinks;
 
 	if (lnet_debugfs_root == NULL)
 		lnet_debugfs_root = debugfs_create_dir("lnet", NULL);
-- 
2.1.4



More information about the devel mailing list