Skip to contentSkip to conversation

staging: erofs: fixed -Wmissing-prototype warnings.

PATCH New Jeremy Sowden 3 participants 7 messages Jan 7, 2019 – Jan 8, 2019 Staging

lore
Share & tools
lore
#0 lore raw

cover staging: erofs: fixed -Wmissing-prototype warnings.

Fixes for -Wmissing-prototype warnings in the erofs driver. One group of functions have been made static; for the second, prototypes have been moved to a head

Jeremy Sowden (2):
staging: erofs: fixed -Wmissing-prototype warnings.
staging: erofs: fixed -Wmissing-prototype warnings.

 drivers/staging/erofs/data.c          |  6 ------
 drivers/staging/erofs/internal.h      |  7 +++++++
 drivers/staging/erofs/unzip_vle.c     |  2 +-
 drivers/staging/erofs/unzip_vle_lz4.c |  2 +-
 drivers/staging/erofs/utils.c         | 14 ++++++--------
 5 files changed, 15 insertions(+), 16 deletions(-)

base-commit: c8c2702409430a6a2fd928e857f15773aaafcc99

Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/2 staging: erofs: fixed -Wmissing-prototype warnings.

Define three functions which are not used outside their own translation-units as static in order to fix the following warnings:

drivers/staging/erofs/utils.c:134:6: warning: no previous prototype for ?erofs_try_to_release_workgroup? [-Wmissing-prototypes]
bool erofs_try_to_release_workgroup(struct erofs_sb_info *sbi,

        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

drivers/staging/erofs/unzip_vle.c:592:6: warning: no previous prototype for ?z_erofs_vle_work_release? [-Wmissing-prototypes]
void z_erofs_vle_work_release(struct z_erofs_vle_work *work)

        ^~~~~~~~~~~~~~~~~~~~~~~~

drivers/staging/erofs/unzip_vle_lz4.c:16:5: warning: no previous prototype for ?z_erofs_unzip_lz4? [-Wmissing-prototypes]
int z_erofs_unzip_lz4(void *in, void *out, size_t inlen, size_t outlen)

       ^~~~~~~~~~~~~~~~~
Signed-off-by Jeremy Sowden <jeremy at azazel.net>
---
 drivers/staging/erofs/unzip_vle.c     |  2 +-
 drivers/staging/erofs/unzip_vle_lz4.c |  2 +-
 drivers/staging/erofs/utils.c         | 12 ++++++------
 3 files changed, 8 insertions(+), 8 deletions(-)
drivers/staging/erofs/unzip_vle.c +1 -1
index 4ac1099a39c6..584612b47369 100644
@@ -589,7 +589,7 @@ static void __z_erofs_vle_work_release(struct z_erofs_vle_workgroup *grp,
 	erofs_workgroup_put(&grp->obj);
 }
 
-void z_erofs_vle_work_release(struct z_erofs_vle_work *work)
+static void z_erofs_vle_work_release(struct z_erofs_vle_work *work)
 {
 	struct z_erofs_vle_workgroup *grp =
 		z_erofs_vle_work_workgroup(work, true);
drivers/staging/erofs/unzip_vle_lz4.c +1 -1
index 52797bd89da1..8e8d705a6861 100644
@@ -13,7 +13,7 @@
 #include "unzip_vle.h"
 #include <linux/lz4.h>
 
-int z_erofs_unzip_lz4(void *in, void *out, size_t inlen, size_t outlen)
+static int z_erofs_unzip_lz4(void *in, void *out, size_t inlen, size_t outlen)
 {
 	int ret = LZ4_decompress_safe_partial(in, out, inlen, outlen, outlen);
 
drivers/staging/erofs/utils.c +6 -6
index b535898ca753..fc30025ef101 100644
@@ -131,9 +131,9 @@ static void erofs_workgroup_unfreeze_final(struct erofs_workgroup *grp)
 	__erofs_workgroup_free(grp);
 }
 
-bool erofs_try_to_release_workgroup(struct erofs_sb_info *sbi,
-				    struct erofs_workgroup *grp,
-				    bool cleanup)
+static bool erofs_try_to_release_workgroup(struct erofs_sb_info *sbi,
+					   struct erofs_workgroup *grp,
+					   bool cleanup)
 {
 	/*
 	 * for managed cache enabled, the refcount of workgroups
@@ -172,9 +172,9 @@ bool erofs_try_to_release_workgroup(struct erofs_sb_info *sbi,
 
 #else
 /* for nocache case, no customized reclaim path at all */
-bool erofs_try_to_release_workgroup(struct erofs_sb_info *sbi,
-				    struct erofs_workgroup *grp,
-				    bool cleanup)
+static bool erofs_try_to_release_workgroup(struct erofs_sb_info *sbi,
+					   struct erofs_workgroup *grp,
+					   bool cleanup)
 {
 	int cnt = atomic_read(&grp->refcount);
 
Signature · 1 line
2.20.1
#2 lore raw

PATCH 2/2 staging: erofs: fixed -Wmissing-prototype warnings.

In reply to Jeremy Sowden

Moved prototypes for two functions to header file in order to fix the following warnings:

drivers/staging/erofs/unzip_vle.c:577:6: warning: no previous prototype for ?erofs_workgroup_free_rcu? [-Wmissing-prototypes]
void erofs_workgroup_free_rcu(struct erofs_workgroup *grp)

        ^~~~~~~~~~~~~~~~~~~~~~~~

drivers/staging/erofs/unzip_vle.c:1702:5: warning: no previous prototype for ?z_erofs_map_blocks_iter? [-Wmissing-prototypes]
int z_erofs_map_blocks_iter(struct inode *inode,

       ^~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by Jeremy Sowden <jeremy at azazel.net>
---
 drivers/staging/erofs/data.c     | 6 ------
 drivers/staging/erofs/internal.h | 7 +++++++
 drivers/staging/erofs/utils.c    | 2 --
 3 files changed, 7 insertions(+), 8 deletions(-)
drivers/staging/erofs/data.c +0 -6
index 5a55f0bfdfbb..329fa4fa3e9c 100644
@@ -165,12 +165,6 @@ static int erofs_map_blocks_flatmode(struct inode *inode,
 	return err;
 }
 
-#ifdef CONFIG_EROFS_FS_ZIP
-extern int z_erofs_map_blocks_iter(struct inode *,
-				   struct erofs_map_blocks *,
-				   struct page **, int);
-#endif
-
 int erofs_map_blocks_iter(struct inode *inode,
 			  struct erofs_map_blocks *map,
 			  struct page **mpage_ret, int flags)
drivers/staging/erofs/internal.h +7 -0
index 49c587383315..192f4028d85d 100644
@@ -288,6 +288,8 @@ static inline void erofs_workstation_cleanup_all(struct super_block *sb)
 	erofs_shrink_workstation(EROFS_SB(sb), ~0UL, true);
 }
 
+extern void erofs_workgroup_free_rcu(struct erofs_workgroup *grp);
+
 #ifdef EROFS_FS_HAS_MANAGED_CACHE
 extern int erofs_try_to_free_all_cached_pages(struct erofs_sb_info *sbi,
 	struct erofs_workgroup *egrp);
@@ -530,6 +532,11 @@ struct erofs_map_blocks_iter {
 	struct page *mpage;
 };
 
+#ifdef CONFIG_EROFS_FS_ZIP
+extern int z_erofs_map_blocks_iter(struct inode *,
+				   struct erofs_map_blocks *,
+				   struct page **, int);
+#endif
 
 static inline struct page *
 erofs_get_inline_page(struct inode *inode,
drivers/staging/erofs/utils.c +0 -2
index fc30025ef101..aed211cd5875 100644
@@ -104,8 +104,6 @@ int erofs_register_workgroup(struct super_block *sb,
 	return err;
 }
 
-extern void erofs_workgroup_free_rcu(struct erofs_workgroup *grp);
-
 static void  __erofs_workgroup_free(struct erofs_workgroup *grp)
 {
 	atomic_long_dec(&erofs_global_shrink_cnt);
Signature · 1 line
2.20.1
#3 lore raw

cover staging: erofs: fixed -Wmissing-prototype warnings.

In reply to Jeremy Sowden

Hi Jeremy,

Quoted 3 lines · Jeremy Sowden

Fixes for -Wmissing-prototype warnings in the erofs driver. One group of functions have been made static; for the second, prototypes have been moved to a head

Is -Wmissing-prototypes required for the current linux kernel? I cannot see this warning in my personal kernel compilation...

Functions your fix have already been added proper erofs prefix, therefore it wouldn't pollute the global namespace:
z_erofs_vle_work_release
z_erofs_unzip_lz4
erofs_try_to_release_workgroup

erofs_workgroup_free_rcu
z_erofs_map_blocks_iter

some thought?

Thanks,
Gao Xiang

#4 lore raw

cover staging: erofs: fixed -Wmissing-prototype warnings.

Quoted 8 lines · Gao Xiang
Quoted 3 lines · Jeremy Sowden

Fixes for -Wmissing-prototype warnings in the erofs driver. One group of functions have been made static; for the second, prototypes have been moved to a head

Is -Wmissing-prototypes required for the current linux kernel? I cannot see this warning in my personal kernel compilation...

Quoted 8 lines

Functions your fix have already been added proper erofs prefix, therefore it wouldn't pollute the global namespace:
z_erofs_vle_work_release
z_erofs_unzip_lz4
erofs_try_to_release_workgroup

erofs_workgroup_free_rcu
z_erofs_map_blocks_iter

There was a request for help to fix these warnings on the driverdev-devel mailing list last Novemeber (I've also attached the message):

http://driverdev.linuxdriverproject.org/pipermail/driverdev-devel/2018-November/128432.html

Currently, the flag is only enabled by passing W=1 to make, but since it is useful, the idea is to fix all the current warnings and enable it in the main build.

J.
-------------- next part --------------
An embedded message was scrubbed...
From: Borislav Petkov <[email protected]>
Subject: HELP WANTED: Fix -Wmissing-prototypes warnings
Date: Fri, 9 Nov 2018 18:44:10 +0100
Size: 6710
URL: <http://lists.ozlabs.org/pipermail/linux-erofs/attachments/20190108/1c2a4ac1/attachment.mht>

#5 lore raw

cover staging: erofs: fixed -Wmissing-prototype warnings.

Quoted 20 lines · Jeremy Sowden
Quoted 7 lines · Gao Xiang
Quoted 3 lines · Jeremy Sowden

Fixes for -Wmissing-prototype warnings in the erofs driver. One group of functions have been made static; for the second, prototypes have been moved to a head

Is -Wmissing-prototypes required for the current linux kernel? I cannot see this warning in my personal kernel compilation...

Quoted 8 lines

Functions your fix have already been added proper erofs prefix, therefore it wouldn't pollute the global namespace:
z_erofs_vle_work_release
z_erofs_unzip_lz4
erofs_try_to_release_workgroup

erofs_workgroup_free_rcu
z_erofs_map_blocks_iter

There was a request for help to fix these warnings on the driverdev-devel mailing list last Novemeber (I've also attached the message):

Quoted 5 lines

http://driverdev.linuxdriverproject.org/pipermail/driverdev-devel/2018-November/128432.html

Currently, the flag is only enabled by passing W=1 to make, but since it is useful, the idea is to fix all the current warnings and enable it in the main build.

OK, it is fine with me personally too since it has no logic change. I will also take care of W=1 from now on, and thanks for your explanation ;)

Thanks,
Gao Xiang

Quoted 2 lines

J.

#6 lore raw

cover staging: erofs: fixed -Wmissing-prototype warnings.

In reply to Jeremy Sowden
Quoted 7 lines · Jeremy Sowden

Fixes for -Wmissing-prototype warnings in the erofs driver. One group of functions have been made static; for the second, prototypes have been moved to a head

Jeremy Sowden (2):
staging: erofs: fixed -Wmissing-prototype warnings.
staging: erofs: fixed -Wmissing-prototype warnings.

You sent two different patches that did different things, yet they had identical subject lines :(

Please fix that up, and resend.

greg k-h