Move externs from .c and fix Sparse warning
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
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
@@ -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
@@ -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
PATCH 2/3 Stagin: lustre: Fix externs should be avoided in .c
In reply to Haneen MohammedThis 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
@@ -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
@@ -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
PATCH 3/3 Staging: lustre: Fix Sparse warnings for static declarations
In reply to Haneen MohammedThe 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
@@ -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