Skip to contentSkip to conversation

staging: lustre: osc: osc_request: Fix sparse warnings

PATCH In review Amitoj Kaur Chawla 2 participants 2 messages Feb 16, 2016 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: lustre: osc: osc_request: Fix sparse warnings

Declare osc_cleanup() function and osc_obd_ops structure as static since they are defined and called only in this file.

This fixes the following sparse warnings:
drivers/staging/lustre/lustre/osc/osc_request.c:3210:5: warning:
symbol 'osc_cleanup' was not declared. Should it be static? drivers/staging/lustre/lustre/osc/osc_request.c:3259:16: warning:
symbol 'osc_obd_ops' was not declared. Should it be static?

---
 drivers/staging/lustre/lustre/osc/osc_request.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/lustre/lustre/osc/osc_request.c +2 -2
index 3ae00fc..47b4e8d 100644
@@ -3207,7 +3207,7 @@ static int osc_precleanup(struct obd_device *obd, enum obd_cleanup_stage stage)
 	return 0;
 }
 
-int osc_cleanup(struct obd_device *obd)
+static int osc_cleanup(struct obd_device *obd)
 {
 	struct client_obd *cli = &obd->u.cli;
 	int rc;
@@ -3256,7 +3256,7 @@ static int osc_process_config(struct obd_device *obd, u32 len, void *buf)
 	return osc_process_config_base(obd, buf);
 }
 
-struct obd_ops osc_obd_ops = {
+static struct obd_ops osc_obd_ops = {
 	.owner          = THIS_MODULE,
 	.setup          = osc_setup,
 	.precleanup     = osc_precleanup,
Signature · 1 line
1.9.1
#1 lore raw
Quoted 11 lines · On Tuesday 16 February 2016 18:13:26 Amitoj Kaur Chawla wrote:

Declare osc_cleanup() function and osc_obd_ops structure as static since they are defined and called only in this file.

This fixes the following sparse warnings:
drivers/staging/lustre/lustre/osc/osc_request.c:3210:5: warning:
symbol 'osc_cleanup' was not declared. Should it be static? drivers/staging/lustre/lustre/osc/osc_request.c:3259:16: warning:
symbol 'osc_obd_ops' was not declared. Should it be static?

---

The patch looks correct, but I'd suggest using something a little mode specific than "Fix sparse warnings" as the subject.

Quoted 9 lines
 drivers/staging/lustre/lustre/osc/osc_request.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/lustre/lustre/osc/osc_request.c +0 -0
index 3ae00fc..47b4e8d 100644

drivers/staging/lustre/lustre/osc/osc_request.c static int osc_precleanup(struct obd_device *obd, enum obd_cleanup_stage stage) · line 3213

Quoted 8 lines
drivers/staging/lustre/lustre/osc/osc_request.c +1 -1
@@ -3207,7 +3207,7 @@ static int osc_precleanup(struct obd_device *obd, enum obd_cleanup_stage stage)
        return 0;
 }
 
-int osc_cleanup(struct obd_device *obd)
+static int osc_cleanup(struct obd_device *obd)
 {
        struct client_obd *cli = &obd->u.cli;
        int rc;

I think you can now remove the forward declaration of this function. There is already a declaration that makes it static, but having it in the function definition is indeed nicer.

Arnd