Skip to contentSkip to conversation

Move externs from .c and fix Sparse warning

PATCH New Haneen Mohammed 1 participant 4 messages Mar 21, 2015 Staging

lore
Share & tools
lore
#0 lore raw

cover Move externs from .c and fix Sparse warning

This patchset fixes the following issues:
- Fix externs should be avoided in .c
- Fix Sparse warnings for static declarations.

Haneen Mohammed (3):
Staging: lustre: Fix externs should be avoided in .c
Stagin: lustre: Fix externs should be avoided in .c
Staging: lustre: Fix Sparse warnings for static declarations

 drivers/staging/lustre/lustre/include/obd_class.h  |  3 +++
 drivers/staging/lustre/lustre/obdclass/class_obd.c |  3 ---
 drivers/staging/lustre/lustre/obdclass/genops.c    | 13 ++++++-------
 3 files changed, 9 insertions(+), 10 deletions(-)
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/3 Staging: lustre: Fix externs should be avoided in .c

Thi patch moves extern declaration to "obd_class.h". Remove prototype from "class_obd.c".
Issue addressed by checkpatch.pl.

---
 drivers/staging/lustre/lustre/include/obd_class.h  | 2 ++
 drivers/staging/lustre/lustre/obdclass/class_obd.c | 3 ---
 2 files changed, 2 insertions(+), 3 deletions(-)
drivers/staging/lustre/lustre/include/obd_class.h +2 -0
index 4a29261..0b6178e 100644
@@ -1895,6 +1895,8 @@ void class_exit_uuidlist(void);
 
 /* class_obd.c */
 extern char obd_jobid_node[];
+extern struct miscdevice obd_psdev;
+extern spinlock_t obd_types_lock;
 
 /* prng.c */
 #define ll_generate_random_uuid(uuid_out) cfs_get_random_bytes(uuid_out, sizeof(class_uuid_t))
drivers/staging/lustre/lustre/obdclass/class_obd.c +0 -3
index 29456e1..d4b74b6 100644
@@ -437,8 +437,6 @@ int class_handle_ioctl(unsigned int cmd, unsigned long arg)
 	return err;
 } /* class_handle_ioctl */
 
-extern struct miscdevice obd_psdev;
-
 #define OBD_INIT_CHECK
 int obd_init_checks(void)
 {
@@ -508,7 +506,6 @@ int obd_init_checks(void)
 	return ret;
 }
 
-extern spinlock_t obd_types_lock;
 #if defined (CONFIG_PROC_FS)
 extern int class_procfs_init(void);
 extern int class_procfs_clean(void);
Signature · 1 line
1.9.1
#2 lore raw

PATCH 2/3 Stagin: lustre: Fix externs should be avoided in .c

In reply to Haneen Mohammed

This patch moves extern declaration from genops.c to obd_class.h, addressing checkpatch.pl warning: externs should be avoided in .c

---
 drivers/staging/lustre/lustre/include/obd_class.h | 1 +
 drivers/staging/lustre/lustre/obdclass/genops.c   | 1 -
 2 files changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/lustre/include/obd_class.h +1 -0
index 0b6178e..c15f391 100644
@@ -72,6 +72,7 @@ extern int lustre_get_jobid(char *jobid);
 struct lu_device_type;
 
 /* genops.c */
+extern struct list_head obd_types;
 struct obd_export *class_conn2export(struct lustre_handle *);
 int class_register_type(struct obd_ops *, struct md_ops *,
 			struct lprocfs_vars *, const char *nm,
drivers/staging/lustre/lustre/obdclass/genops.c +0 -1
index 50077b9..d8626f9 100644
@@ -43,7 +43,6 @@
 #include "../include/obd_class.h"
 #include "../include/lprocfs_status.h"
 
-extern struct list_head obd_types;
 spinlock_t obd_types_lock;
 
 struct kmem_cache *obd_device_cachep;
Signature · 1 line
1.9.1
#3 lore raw

PATCH 3/3 Staging: lustre: Fix Sparse warnings for static declarations

In reply to Haneen Mohammed

The following patch fixes Sparse warnings in genops.c regrding:
"Symbol * was not declared. Should it be static?"

---
 drivers/staging/lustre/lustre/obdclass/genops.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/staging/lustre/lustre/obdclass/genops.c +6 -6
index d8626f9..138e4f6 100644
@@ -48,11 +48,11 @@ spinlock_t obd_types_lock;
 struct kmem_cache *obd_device_cachep;
 struct kmem_cache *obdo_cachep;
 EXPORT_SYMBOL(obdo_cachep);
-struct kmem_cache *import_cachep;
+static struct kmem_cache *import_cachep;
 
-struct list_head      obd_zombie_imports;
-struct list_head      obd_zombie_exports;
-spinlock_t  obd_zombie_impexp_lock;
+static struct list_head      obd_zombie_imports;
+static struct list_head      obd_zombie_exports;
+static spinlock_t  obd_zombie_impexp_lock;
 static void obd_zombie_impexp_notify(void);
 static void obd_zombie_export_add(struct obd_export *exp);
 static void obd_zombie_import_add(struct obd_import *imp);
@@ -929,7 +929,7 @@ void class_unlink_export(struct obd_export *exp)
 EXPORT_SYMBOL(class_unlink_export);
 
 /* Import management functions */
-void class_import_destroy(struct obd_import *imp)
+static void class_import_destroy(struct obd_import *imp)
 {
 	CDEBUG(D_IOCTL, "destroying import %p for %s\n", imp,
 		imp->imp_obd->obd_name);
@@ -1128,7 +1128,7 @@ int class_connect(struct lustre_handle *conn, struct obd_device *obd,
 EXPORT_SYMBOL(class_connect);
 
 /* if export is involved in recovery then clean up related things */
-void class_export_recovery_cleanup(struct obd_export *exp)
+static void class_export_recovery_cleanup(struct obd_export *exp)
 {
 	struct obd_device *obd = exp->exp_obd;
 
Signature · 1 line
1.9.1