* [PATCH 2/3] fix warning of not used variable @ 2008-12-04 1:00 Jianjun Kong 2008-12-04 10:12 ` Ingo Molnar 2008-12-04 11:36 ` Américo Wang 0 siblings, 2 replies; 7+ messages in thread From: Jianjun Kong @ 2008-12-04 1:00 UTC (permalink / raw) To: rusty; +Cc: Linux-Kernel-Mailing-List fix this warning: kernel/module.c:824: warning: ‘print_unload_info’ defined but not used print_unload_info() just used when CONFIG_PROC_FS was defined. Signed-off-by: Jianjun Kong <jianjun@zeuux.org> --- kernel/module.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/kernel/module.c b/kernel/module.c index 1f4cc00..20b5d25 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -820,6 +820,7 @@ sys_delete_module(const char __user *name_user, unsigned int flags) return ret; } +#ifdef CONFIG_PROC_FS static void print_unload_info(struct seq_file *m, struct module *mod) { struct module_use *use; @@ -842,6 +843,7 @@ static void print_unload_info(struct seq_file *m, struct module *mod) if (!printed_something) seq_printf(m, "-"); } +#endif void __symbol_put(const char *symbol) { @@ -893,11 +895,14 @@ void module_put(struct module *module) EXPORT_SYMBOL(module_put); #else /* !CONFIG_MODULE_UNLOAD */ + +#ifdef CONFIG_PROC_FS static void print_unload_info(struct seq_file *m, struct module *mod) { /* We don't know the usage count, or what modules are using. */ seq_printf(m, " - -"); } +#endif static inline void module_unload_free(struct module *mod) { -- 1.5.6.3 -- Jianjun Kong | Happy Hacking HOMEPAGE: http://kongove.cn/ GTALK: kongjianjun@gmail.com ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 2/3] fix warning of not used variable 2008-12-04 1:00 [PATCH 2/3] fix warning of not used variable Jianjun Kong @ 2008-12-04 10:12 ` Ingo Molnar 2008-12-04 11:34 ` Américo Wang 2008-12-04 11:36 ` Américo Wang 1 sibling, 1 reply; 7+ messages in thread From: Ingo Molnar @ 2008-12-04 10:12 UTC (permalink / raw) To: Jianjun Kong; +Cc: rusty, Linux-Kernel-Mailing-List * Jianjun Kong <jianjun@zeuux.org> wrote: > > fix this warning: > kernel/module.c:824: warning: ‘print_unload_info’ defined but not used > print_unload_info() just used when CONFIG_PROC_FS was defined. > > Signed-off-by: Jianjun Kong <jianjun@zeuux.org> > --- > kernel/module.c | 5 +++++ > 1 files changed, 5 insertions(+), 0 deletions(-) NAK. Warnings do not need to be "fixed", then need to be looked at and then there are two approaches: 1) GCC is wrong => annotate the code 2) GCC is right => fix the code Your patch does not give us any idea about which case this is, whether you have analyzed the reason why GCC emitted that warning. Besides, i dont see such warnings in kernel/module.c with latest GCC. Ingo ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/3] fix warning of not used variable 2008-12-04 10:12 ` Ingo Molnar @ 2008-12-04 11:34 ` Américo Wang 0 siblings, 0 replies; 7+ messages in thread From: Américo Wang @ 2008-12-04 11:34 UTC (permalink / raw) To: Ingo Molnar; +Cc: Jianjun Kong, rusty, Linux-Kernel-Mailing-List On Thu, Dec 4, 2008 at 10:12 AM, Ingo Molnar <mingo@elte.hu> wrote: > > > NAK. Warnings do not need to be "fixed", then need to be looked at and > then there are two approaches: > > 1) GCC is wrong => annotate the code > 2) GCC is right => fix the code > Gcc is correct. The only user of print_unload_info() is m_show() which is protected by CONFIG_PROC_FS. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/3] fix warning of not used variable 2008-12-04 1:00 [PATCH 2/3] fix warning of not used variable Jianjun Kong 2008-12-04 10:12 ` Ingo Molnar @ 2008-12-04 11:36 ` Américo Wang 2008-12-05 0:01 ` Rusty Russell 1 sibling, 1 reply; 7+ messages in thread From: Américo Wang @ 2008-12-04 11:36 UTC (permalink / raw) To: Jianjun Kong; +Cc: rusty, Linux-Kernel-Mailing-List On Thu, Dec 4, 2008 at 1:00 AM, Jianjun Kong <jianjun@zeuux.org> wrote: > > fix this warning: > kernel/module.c:824: warning: 'print_unload_info' defined but not used > print_unload_info() just used when CONFIG_PROC_FS was defined. > > Signed-off-by: Jianjun Kong <jianjun@zeuux.org> Reviewed-by: WANG Cong <wangcong@zeuux.org> Rusty? ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/3] fix warning of not used variable 2008-12-04 11:36 ` Américo Wang @ 2008-12-05 0:01 ` Rusty Russell 2008-12-06 0:52 ` Américo Wang 0 siblings, 1 reply; 7+ messages in thread From: Rusty Russell @ 2008-12-05 0:01 UTC (permalink / raw) To: Américo Wang; +Cc: Jianjun Kong, Linux-Kernel-Mailing-List, Ingo Molnar On Thursday 04 December 2008 22:06:33 Américo Wang wrote: > On Thu, Dec 4, 2008 at 1:00 AM, Jianjun Kong <jianjun@zeuux.org> wrote: > > fix this warning: > > kernel/module.c:824: warning: 'print_unload_info' defined but not used > > print_unload_info() just used when CONFIG_PROC_FS was defined. > > > > Signed-off-by: Jianjun Kong <jianjun@zeuux.org> > > Reviewed-by: WANG Cong <wangcong@zeuux.org> My main concern is that this adds two new #ifdef sections. How about marking both cases "inline" instead? Cheers, Rusty. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/3] fix warning of not used variable 2008-12-05 0:01 ` Rusty Russell @ 2008-12-06 0:52 ` Américo Wang 2008-12-06 2:29 ` Jianjun Kong 0 siblings, 1 reply; 7+ messages in thread From: Américo Wang @ 2008-12-06 0:52 UTC (permalink / raw) To: Rusty Russell; +Cc: Jianjun Kong, Linux-Kernel-Mailing-List, Ingo Molnar [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain; charset=UTF-8, Size: 822 bytes --] On Fri, Dec 5, 2008 at 12:01 AM, Rusty Russell <rusty@rustcorp.com.au> wrote:> On Thursday 04 December 2008 22:06:33 Américo Wang wrote:>> On Thu, Dec 4, 2008 at 1:00 AM, Jianjun Kong <jianjun@zeuux.org> wrote:>> > fix this warning:>> > kernel/module.c:824: warning: 'print_unload_info' defined but not used>> > print_unload_info() just used when CONFIG_PROC_FS was defined.>> >>> > Signed-off-by: Jianjun Kong <jianjun@zeuux.org>>>>> Reviewed-by: WANG Cong <wangcong@zeuux.org>>> My main concern is that this adds two new #ifdef sections. How about marking> both cases "inline" instead?> Hi, sorry for the delay. Er, making them inline can solve this problem?ÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥ ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/3] fix warning of not used variable 2008-12-06 0:52 ` Américo Wang @ 2008-12-06 2:29 ` Jianjun Kong 0 siblings, 0 replies; 7+ messages in thread From: Jianjun Kong @ 2008-12-06 2:29 UTC (permalink / raw) To: Américo Wang; +Cc: Rusty Russell, Linux-Kernel-Mailing-List, Ingo Molnar On Sat, Dec 06, 2008 at 12:52:56AM +0000, Américo Wang wrote: >On Fri, Dec 5, 2008 at 12:01 AM, Rusty Russell <rusty@rustcorp.com.au> wrote: >> On Thursday 04 December 2008 22:06:33 Américo Wang wrote: >>> On Thu, Dec 4, 2008 at 1:00 AM, Jianjun Kong <jianjun@zeuux.org> wrote: >>> > fix this warning: >>> > kernel/module.c:824: warning: 'print_unload_info' defined but not used >>> > print_unload_info() just used when CONFIG_PROC_FS was defined. >>> > >>> > Signed-off-by: Jianjun Kong <jianjun@zeuux.org> >>> >>> Reviewed-by: WANG Cong <wangcong@zeuux.org> >> >> My main concern is that this adds two new #ifdef sections. How about marking >> both cases "inline" instead? >> > >Hi, sorry for the delay. > >Er, making them inline can solve this problem? I have make a new patch, and it can compile without any warning :) --- From: Jianjun Kong <jianjun@zeuux.org> Date: Sat, 6 Dec 2008 10:19:09 +0800 Subject: [PATCH] kernel/module.c: fix compile warning MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Fix this warning: kernel/module.c:824: warning: ‘print_unload_info’ defined but not used print_unload_info() just was used when CONFIG_PROC_FS was defined. This patch mark print_unload_info() inline to solve the problem. Signed-off-by: Jianjun Kong <jianjun@zeuux.org> CC: Rusty Russell <rusty@rustcorp.com.au> CC: Ingo Molnar <mingo@elte.hu> CC: Américo Wang <xiyou.wangcong@gmail.com> --- kernel/module.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/module.c b/kernel/module.c index 1f4cc00..e67f2f8 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -820,7 +820,7 @@ sys_delete_module(const char __user *name_user, unsigned int flags) return ret; } -static void print_unload_info(struct seq_file *m, struct module *mod) +static inline void print_unload_info(struct seq_file *m, struct module *mod) { struct module_use *use; int printed_something = 0; @@ -893,7 +893,7 @@ void module_put(struct module *module) EXPORT_SYMBOL(module_put); #else /* !CONFIG_MODULE_UNLOAD */ -static void print_unload_info(struct seq_file *m, struct module *mod) +static inline void print_unload_info(struct seq_file *m, struct module *mod) { /* We don't know the usage count, or what modules are using. */ seq_printf(m, " - -"); -- 1.5.6.3 -- Jianjun Kong | Happy Hacking HOMEPAGE: http://kongove.cn/ GTALK: kongjianjun@gmail.com ^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2008-12-06 2:29 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2008-12-04 1:00 [PATCH 2/3] fix warning of not used variable Jianjun Kong 2008-12-04 10:12 ` Ingo Molnar 2008-12-04 11:34 ` Américo Wang 2008-12-04 11:36 ` Américo Wang 2008-12-05 0:01 ` Rusty Russell 2008-12-06 0:52 ` Américo Wang 2008-12-06 2:29 ` Jianjun Kong
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox