2021-07-19 16:10:51

by kernel test robot

[permalink] [raw]
Subject: [printk:for-5.15-printk-index 4/5] kernel/printk/index.c:140:6: warning: no previous prototype for 'pi_create_file'

tree: https://git.kernel.org/pub/scm/linux/kernel/git/printk/linux.git for-5.15-printk-index
head: ad7d61f159db73974f1b0352f21afe04b0bbd920
commit: 337015573718b161891a3473d25f59273f2e626b [4/5] printk: Userspace format indexing support
config: arc-allyesconfig (attached as .config)
compiler: arceb-elf-gcc (GCC) 10.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/printk/linux.git/commit/?id=337015573718b161891a3473d25f59273f2e626b
git remote add printk https://git.kernel.org/pub/scm/linux/kernel/git/printk/linux.git
git fetch --no-tags printk for-5.15-printk-index
git checkout 337015573718b161891a3473d25f59273f2e626b
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross ARCH=arc

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>

All warnings (new ones prefixed by >>):

>> kernel/printk/index.c:140:6: warning: no previous prototype for 'pi_create_file' [-Wmissing-prototypes]
140 | void pi_create_file(struct module *mod)
| ^~~~~~~~~~~~~~
>> kernel/printk/index.c:146:6: warning: no previous prototype for 'pi_remove_file' [-Wmissing-prototypes]
146 | void pi_remove_file(struct module *mod)
| ^~~~~~~~~~~~~~


vim +/pi_create_file +140 kernel/printk/index.c

139
> 140 void pi_create_file(struct module *mod)
141 {
142 debugfs_create_file(pi_get_module_name(mod), 0444, dfs_index,
143 mod, &dfs_index_fops);
144 }
145
> 146 void pi_remove_file(struct module *mod)
147 {
148 debugfs_remove(debugfs_lookup(pi_get_module_name(mod), dfs_index));
149 }
150

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]


Attachments:
(No filename) (2.01 kB)
.config.gz (66.92 kB)
Download all attachments

2021-07-20 12:04:34

by Chris Down

[permalink] [raw]
Subject: Re: [printk:for-5.15-printk-index 4/5] kernel/printk/index.c:140:6: warning: no previous prototype for 'pi_create_file'

kernel test robot writes:
>tree: https://git.kernel.org/pub/scm/linux/kernel/git/printk/linux.git for-5.15-printk-index
>head: ad7d61f159db73974f1b0352f21afe04b0bbd920
>commit: 337015573718b161891a3473d25f59273f2e626b [4/5] printk: Userspace format indexing support
>config: arc-allyesconfig (attached as .config)
>compiler: arceb-elf-gcc (GCC) 10.3.0
>reproduce (this is a W=1 build):
> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # https://git.kernel.org/pub/scm/linux/kernel/git/printk/linux.git/commit/?id=337015573718b161891a3473d25f59273f2e626b
> git remote add printk https://git.kernel.org/pub/scm/linux/kernel/git/printk/linux.git
> git fetch --no-tags printk for-5.15-printk-index
> git checkout 337015573718b161891a3473d25f59273f2e626b
> # save the attached .config to linux build tree
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross ARCH=arc
>
>If you fix the issue, kindly add following tag as appropriate
>Reported-by: kernel test robot <[email protected]>
>
>All warnings (new ones prefixed by >>):
>
>>> kernel/printk/index.c:140:6: warning: no previous prototype for 'pi_create_file' [-Wmissing-prototypes]
> 140 | void pi_create_file(struct module *mod)
> | ^~~~~~~~~~~~~~
>>> kernel/printk/index.c:146:6: warning: no previous prototype for 'pi_remove_file' [-Wmissing-prototypes]
> 146 | void pi_remove_file(struct module *mod)
> | ^~~~~~~~~~~~~~

Ah, I missed `static inline', which causes the compiler to think we want to
export it even though we don't.

diff --git kernel/printk/index.c kernel/printk/index.c
index ca062f5e1779..e340e0a8b847 100644
--- kernel/printk/index.c
+++ kernel/printk/index.c
@@ -137,13 +137,13 @@ static const char *pi_get_module_name(struct module *mod)
}
#endif

-void pi_create_file(struct module *mod)
+static inline void pi_create_file(struct module *mod)
{
debugfs_create_file(pi_get_module_name(mod), 0444, dfs_index,
mod, &dfs_index_fops);
}

-void pi_remove_file(struct module *mod)
+static inline void pi_remove_file(struct module *mod)
{
debugfs_remove(debugfs_lookup(pi_get_module_name(mod), dfs_index));
}

2021-07-21 09:13:38

by Petr Mladek

[permalink] [raw]
Subject: Re: [printk:for-5.15-printk-index 4/5] kernel/printk/index.c:140:6: warning: no previous prototype for 'pi_create_file'

On Tue 2021-07-20 13:02:33, Chris Down wrote:
> kernel test robot writes:
> > tree: https://git.kernel.org/pub/scm/linux/kernel/git/printk/linux.git for-5.15-printk-index
> > head: ad7d61f159db73974f1b0352f21afe04b0bbd920
> > commit: 337015573718b161891a3473d25f59273f2e626b [4/5] printk: Userspace format indexing support
> > config: arc-allyesconfig (attached as .config)
> > compiler: arceb-elf-gcc (GCC) 10.3.0
> > reproduce (this is a W=1 build):
> > wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> > chmod +x ~/bin/make.cross
> > # https://git.kernel.org/pub/scm/linux/kernel/git/printk/linux.git/commit/?id=337015573718b161891a3473d25f59273f2e626b
> > git remote add printk https://git.kernel.org/pub/scm/linux/kernel/git/printk/linux.git
> > git fetch --no-tags printk for-5.15-printk-index
> > git checkout 337015573718b161891a3473d25f59273f2e626b
> > # save the attached .config to linux build tree
> > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross ARCH=arc
> >
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot <[email protected]>
> >
> > All warnings (new ones prefixed by >>):
> >
> > > > kernel/printk/index.c:140:6: warning: no previous prototype for 'pi_create_file' [-Wmissing-prototypes]
> > 140 | void pi_create_file(struct module *mod)
> > | ^~~~~~~~~~~~~~
> > > > kernel/printk/index.c:146:6: warning: no previous prototype for 'pi_remove_file' [-Wmissing-prototypes]
> > 146 | void pi_remove_file(struct module *mod)
> > | ^~~~~~~~~~~~~~
>
> Ah, I missed `static inline', which causes the compiler to think we want to
> export it even though we don't.
>
> diff --git kernel/printk/index.c kernel/printk/index.c
> index ca062f5e1779..e340e0a8b847 100644
> --- kernel/printk/index.c
> +++ kernel/printk/index.c
> @@ -137,13 +137,13 @@ static const char *pi_get_module_name(struct module *mod)
> }
> #endif
> -void pi_create_file(struct module *mod)
> +static inline void pi_create_file(struct module *mod)
> {
> debugfs_create_file(pi_get_module_name(mod), 0444, dfs_index,
> mod, &dfs_index_fops);
> }
> -void pi_remove_file(struct module *mod)
> +static inline void pi_remove_file(struct module *mod)
> {
> debugfs_remove(debugfs_lookup(pi_get_module_name(mod), dfs_index));
> }

Chris, please send this one as a proper patch as well.

Best Regards,
Petr

2021-07-23 11:21:57

by Petr Mladek

[permalink] [raw]
Subject: Re: [printk:for-5.15-printk-index 4/5] kernel/printk/index.c:140:6: warning: no previous prototype for 'pi_create_file'

On Tue 2021-07-20 13:02:33, Chris Down wrote:
> kernel test robot writes:
> > tree: https://git.kernel.org/pub/scm/linux/kernel/git/printk/linux.git for-5.15-printk-index
> > head: ad7d61f159db73974f1b0352f21afe04b0bbd920
> > commit: 337015573718b161891a3473d25f59273f2e626b [4/5] printk: Userspace format indexing support
> > config: arc-allyesconfig (attached as .config)
> > compiler: arceb-elf-gcc (GCC) 10.3.0
> > reproduce (this is a W=1 build):
> > wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> > chmod +x ~/bin/make.cross
> > # https://git.kernel.org/pub/scm/linux/kernel/git/printk/linux.git/commit/?id=337015573718b161891a3473d25f59273f2e626b
> > git remote add printk https://git.kernel.org/pub/scm/linux/kernel/git/printk/linux.git
> > git fetch --no-tags printk for-5.15-printk-index
> > git checkout 337015573718b161891a3473d25f59273f2e626b
> > # save the attached .config to linux build tree
> > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross ARCH=arc
> >
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot <[email protected]>
> >
> > All warnings (new ones prefixed by >>):
> >
> > > > kernel/printk/index.c:140:6: warning: no previous prototype for 'pi_create_file' [-Wmissing-prototypes]
> > 140 | void pi_create_file(struct module *mod)
> > | ^~~~~~~~~~~~~~
> > > > kernel/printk/index.c:146:6: warning: no previous prototype for 'pi_remove_file' [-Wmissing-prototypes]
> > 146 | void pi_remove_file(struct module *mod)
> > | ^~~~~~~~~~~~~~
>
> Ah, I missed `static inline', which causes the compiler to think we want to
> export it even though we don't.
>
> diff --git kernel/printk/index.c kernel/printk/index.c
> index ca062f5e1779..e340e0a8b847 100644
> --- kernel/printk/index.c
> +++ kernel/printk/index.c
> @@ -137,13 +137,13 @@ static const char *pi_get_module_name(struct module *mod)
> }
> #endif
> -void pi_create_file(struct module *mod)
> +static inline void pi_create_file(struct module *mod)
> {
> debugfs_create_file(pi_get_module_name(mod), 0444, dfs_index,
> mod, &dfs_index_fops);
> }
> -void pi_remove_file(struct module *mod)
> +static inline void pi_remove_file(struct module *mod)
> {
> debugfs_remove(debugfs_lookup(pi_get_module_name(mod), dfs_index));
> }

I have just pushed this fix into printk/linux.git,
branch for-5.15-printk-index.

Well, I just added the "static" keyword. Let the compiler decide
about inlining. There is no need to enforce it.

Best Regards,
Petr