* [PATCH] staging: silicom: hide conditionally used function in condition
@ 2014-03-26 5:58 SeongJae Park
2014-03-26 12:27 ` Greg KH
2014-03-26 14:24 ` [PATCH v2] staging: silicom: remove BP_PROC_SUPPORT dependant code SeongJae Park
0 siblings, 2 replies; 4+ messages in thread
From: SeongJae Park @ 2014-03-26 5:58 UTC (permalink / raw)
To: gregkh, chad, viro; +Cc: devel, linux-kernel, SeongJae Park
bp_proc_create() be called only when BP_PROC_SUPPORT defined but its
definition live outside of #ifdef BP_PROC_SUPPORT and cause following
trivial build warning:
drivers/staging/silicom/bpctl_mod.c:6786:12: warning:
‘bp_proc_create’ defined but not used [-Wunused-function]
static int bp_proc_create(void)
^
Fix the warning by hide the definition inside #ifdef BP_PROC_SUPPORT.
Signed-off-by: SeongJae Park <sj38.park@gmail.com>
---
drivers/staging/silicom/bpctl_mod.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/staging/silicom/bpctl_mod.c b/drivers/staging/silicom/bpctl_mod.c
index 6b9365b..beff280 100644
--- a/drivers/staging/silicom/bpctl_mod.c
+++ b/drivers/staging/silicom/bpctl_mod.c
@@ -119,7 +119,9 @@ static void if_scan_init(void);
static int bypass_proc_create_dev_sd(struct bpctl_dev *pbp_device_block);
static int bypass_proc_remove_dev_sd(struct bpctl_dev *pbp_device_block);
+#ifdef BP_PROC_SUPPORT
static int bp_proc_create(void);
+#endif
static int is_bypass_fn(struct bpctl_dev *pbpctl_dev);
static int get_dev_idx_bsf(int bus, int slot, int func);
@@ -6783,6 +6785,7 @@ EXPORT_SYMBOL(bp_if_scan_sd);
static struct proc_dir_entry *bp_procfs_dir;
+#ifdef BP_PROC_SUPPORT
static int bp_proc_create(void)
{
bp_procfs_dir = proc_mkdir(BP_PROC_DIR, init_net.proc_net);
@@ -6794,6 +6797,7 @@ static int bp_proc_create(void)
}
return 0;
}
+#endif
static int procfs_add(char *proc_name, const struct file_operations *fops,
struct bpctl_dev *dev)
--
1.8.3.2
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] staging: silicom: hide conditionally used function in condition
2014-03-26 5:58 [PATCH] staging: silicom: hide conditionally used function in condition SeongJae Park
@ 2014-03-26 12:27 ` Greg KH
2014-03-26 12:34 ` SeongJae Park
2014-03-26 14:24 ` [PATCH v2] staging: silicom: remove BP_PROC_SUPPORT dependant code SeongJae Park
1 sibling, 1 reply; 4+ messages in thread
From: Greg KH @ 2014-03-26 12:27 UTC (permalink / raw)
To: SeongJae Park; +Cc: chad, viro, devel, linux-kernel
On Wed, Mar 26, 2014 at 02:58:50PM +0900, SeongJae Park wrote:
> bp_proc_create() be called only when BP_PROC_SUPPORT defined but its
> definition live outside of #ifdef BP_PROC_SUPPORT and cause following
> trivial build warning:
> drivers/staging/silicom/bpctl_mod.c:6786:12: warning:
> ‘bp_proc_create’ defined but not used [-Wunused-function]
> static int bp_proc_create(void)
> ^
>
> Fix the warning by hide the definition inside #ifdef BP_PROC_SUPPORT.
But no one can define that value, so why add more usages, it should just
be ripped out. Just remove everything "hidden" by this option as no
one is obviously using it, and no driver should be messing around in
/proc anyway.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] staging: silicom: hide conditionally used function in condition
2014-03-26 12:27 ` Greg KH
@ 2014-03-26 12:34 ` SeongJae Park
0 siblings, 0 replies; 4+ messages in thread
From: SeongJae Park @ 2014-03-26 12:34 UTC (permalink / raw)
To: Greg KH; +Cc: Chad Williamson, viro, devel, linux-kernel
On Wed, Mar 26, 2014 at 9:27 PM, Greg KH <gregkh@linuxfoundation.org> wrote:
> On Wed, Mar 26, 2014 at 02:58:50PM +0900, SeongJae Park wrote:
>> bp_proc_create() be called only when BP_PROC_SUPPORT defined but its
>> definition live outside of #ifdef BP_PROC_SUPPORT and cause following
>> trivial build warning:
>> drivers/staging/silicom/bpctl_mod.c:6786:12: warning:
>> ‘bp_proc_create’ defined but not used [-Wunused-function]
>> static int bp_proc_create(void)
>> ^
>>
>> Fix the warning by hide the definition inside #ifdef BP_PROC_SUPPORT.
>
> But no one can define that value, so why add more usages, it should just
> be ripped out. Just remove everything "hidden" by this option as no
> one is obviously using it, and no driver should be messing around in
> /proc anyway.
Good point. I also thought in that way but hesitated big change.
Maybe I should be more brave and patient.
I will make and send patch with your opinion again in couple of hours.
Thanks.
>
> thanks,
>
> greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2] staging: silicom: remove BP_PROC_SUPPORT dependant code
2014-03-26 5:58 [PATCH] staging: silicom: hide conditionally used function in condition SeongJae Park
2014-03-26 12:27 ` Greg KH
@ 2014-03-26 14:24 ` SeongJae Park
1 sibling, 0 replies; 4+ messages in thread
From: SeongJae Park @ 2014-03-26 14:24 UTC (permalink / raw)
To: gregkh, chad, viro; +Cc: devel, linux-kernel, SeongJae Park
Some code is hide inside #ifdef BP_PROC_SUPPORT and it never defined
anywhere. And, it made defined but not used function which calling
code was hide inside #ifdef BP_PROC_SUPPORT and caused following
build warning:
drivers/staging/silicom/bpctl_mod.c:6786:12: warning:
‘bp_proc_create’ defined but not used [-Wunused-function]
static int bp_proc_create(void)
^
Fix the warning and remove code complexity by remove whole code
inside #ifdef BP_PROC_SUPPORT.
Signed-off-by: SeongJae Park <sj38.park@gmail.com>
---
drivers/staging/silicom/bpctl_mod.c | 39 -------------------------------------
1 file changed, 39 deletions(-)
diff --git a/drivers/staging/silicom/bpctl_mod.c b/drivers/staging/silicom/bpctl_mod.c
index 6b9365b..530d621 100644
--- a/drivers/staging/silicom/bpctl_mod.c
+++ b/drivers/staging/silicom/bpctl_mod.c
@@ -119,7 +119,6 @@ static void if_scan_init(void);
static int bypass_proc_create_dev_sd(struct bpctl_dev *pbp_device_block);
static int bypass_proc_remove_dev_sd(struct bpctl_dev *pbp_device_block);
-static int bp_proc_create(void);
static int is_bypass_fn(struct bpctl_dev *pbpctl_dev);
static int get_dev_idx_bsf(int bus, int slot, int func);
@@ -6399,25 +6398,6 @@ static int __init bypass_init_module(void)
}
register_netdevice_notifier(&bp_notifier_block);
-#ifdef BP_PROC_SUPPORT
- {
- int i = 0;
- /* unsigned long flags; */
- /* rcu_read_lock(); */
- bp_proc_create();
- for (i = 0; i < device_num; i++) {
- if (bpctl_dev_arr[i].ifindex) {
- /* spin_lock_irqsave(&bpvm_lock, flags); */
- bypass_proc_remove_dev_sd(&bpctl_dev_arr[i]);
- bypass_proc_create_dev_sd(&bpctl_dev_arr[i]);
- /* spin_unlock_irqrestore(&bpvm_lock, flags); */
- }
-
- }
- /* rcu_read_unlock(); */
- }
-#endif
-
return 0;
}
@@ -6431,13 +6411,6 @@ static void __exit bypass_cleanup_module(void)
for (i = 0; i < device_num; i++) {
/* unsigned long flags; */
-#ifdef BP_PROC_SUPPORT
-/* spin_lock_irqsave(&bpvm_lock, flags);
- rcu_read_lock(); */
- bypass_proc_remove_dev_sd(&bpctl_dev_arr[i]);
-/* spin_unlock_irqrestore(&bpvm_lock, flags);
- rcu_read_unlock(); */
-#endif
remove_bypass_wd_auto(&bpctl_dev_arr[i]);
bpctl_dev_arr[i].reset_time = 0;
@@ -6783,18 +6756,6 @@ EXPORT_SYMBOL(bp_if_scan_sd);
static struct proc_dir_entry *bp_procfs_dir;
-static int bp_proc_create(void)
-{
- bp_procfs_dir = proc_mkdir(BP_PROC_DIR, init_net.proc_net);
- if (bp_procfs_dir == (struct proc_dir_entry *)0) {
- printk(KERN_DEBUG
- "Could not create procfs nicinfo directory %s\n",
- BP_PROC_DIR);
- return -1;
- }
- return 0;
-}
-
static int procfs_add(char *proc_name, const struct file_operations *fops,
struct bpctl_dev *dev)
{
--
1.8.3.2
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-03-26 14:21 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-26 5:58 [PATCH] staging: silicom: hide conditionally used function in condition SeongJae Park
2014-03-26 12:27 ` Greg KH
2014-03-26 12:34 ` SeongJae Park
2014-03-26 14:24 ` [PATCH v2] staging: silicom: remove BP_PROC_SUPPORT dependant code SeongJae Park
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®