staging: cxt1e1: Fix static symbol sparse warnings for global vars in linux.c
PATCH 1/1 staging: cxt1e1: Fix static symbol sparse warnings for global vars in linux.c
Put extern declarations in cxt1e1_common.h to reduce sparse warnings for linux.c:drivers/staging/cxt1e1/linux.c:86:13: warning:
symbol 'error_flag' was not declared. Should it be static?drivers/staging/cxt1e1/linux.c:91:13: warning:
symbol 'cxt1e1_max_mru' was not declared. Should it be static?drivers/staging/cxt1e1/linux.c:95:13: warning:
symbol 'cxt1e1_max_mtu' was not declared. Should it be static?drivers/staging/cxt1e1/linux.c:96:13: warning:
symbol 'max_mtu_default' was not declared. Should it be static?drivers/staging/cxt1e1/linux.c:99:13: warning:
symbol 'max_txdesc_used' was not declared. Should it be static?drivers/staging/cxt1e1/linux.c:100:13: warning:
symbol 'max_txd:esc_default' was not declared. Should it be static?drivers/staging/cxt1e1/linux.c:103:13: warning:
symbol 'max_rxdesc_used' was not declared. Should it be static?drivers/staging/cxt1e1/linux.c:104:13: warning:
symbol 'max_rxdesc_default' was not declared. Should it be static?drivers/staging/cxt1e1/linux.c:153:1: warning:
symbol 'c4_wk_chan_restart' was not declared. Should it be static?drivers/staging/cxt1e1/linux.c:171:1: warning:
symbol 'c4_wk_chan_init' was not declared. Should it be static?drivers/staging/cxt1e1/linux.c:186:1: warning:
symbol 'c4_wq_port_init' was not declared. Should it be static?drivers/staging/cxt1e1/linux.c:208:1: warning:
symbol 'c4_wq_port_cleanup' was not declared. Should it be static?
--- drivers/staging/cxt1e1/cxt1e1_common.h | 15 +++++++++++++++ drivers/staging/cxt1e1/hwprobe.c | 2 +- drivers/staging/cxt1e1/linux.c | 2 +- drivers/staging/cxt1e1/musycc.c | 7 +------ drivers/staging/cxt1e1/pmcc4_drv.c | 5 +---- 5 files changed, 19 insertions(+), 12 deletions(-) create mode 100644 drivers/staging/cxt1e1/cxt1e1_common.h
drivers/staging/cxt1e1/cxt1e1_common.h new file +15 -0
@@ -0,0 +1,15 @@ +#ifndef __CXT1E1_COMMON_H +#define __CXT1E1_COMMON_H + +#include "pmcc4.h" + +extern int error_flag; +extern int cxt1e1_max_mru; +extern int cxt1e1_max_mtu; +extern int max_mtu_default; +extern int max_txdesc_used; +extern int max_txdesc_default; +extern int max_rxdesc_used; +extern int max_rxdesc_default; + +#endif
drivers/staging/cxt1e1/hwprobe.c +1 -1
@@ -30,8 +30,8 @@#ifdef CONFIG_PROC_FS #include "sbeproc.h" #endif +#include "cxt1e1_common.h" -extern int error_flag;extern int drvr_state;/* forward references */
drivers/staging/cxt1e1/linux.c +1 -1
@@ -30,7 +30,7 @@#include "pmcc4_ioctls.h" #include "pmcc4_private.h" #include "sbeproc.h" - +#include "cxt1e1_common.h" /******************************************************************************* * Error out early if we have compiler trouble. *
drivers/staging/cxt1e1/musycc.c +1 -6
@@ -34,7 +34,7 @@ static unsigned int max_bh;#include "pmcc4_private.h" #include "pmcc4.h" #include "musycc.h" - +#include "cxt1e1_common.h" #define sd_find_chan (ci,ch) c4_find_chan(ch)
@@ -42,11 +42,6 @@ static unsigned int max_bh;/* global driver variables */ extern ci_t *c4_list;extern int drvr_state; - -extern int cxt1e1_max_mru; -extern int cxt1e1_max_mtu; -extern int max_rxdesc_used; -extern int max_txdesc_used;extern ci_t *CI ;/* dummy pointr to board ZEROE's data - DEBUG * USAGE */
drivers/staging/cxt1e1/pmcc4_drv.c +1 -4
@@ -38,6 +38,7 @@#include "musycc.h" #include "comet.h" #include "sbe_bid.h" +#include "cxt1e1_common.h" #define KERN_WARN KERN_WARNING
@@ -59,10 +60,6 @@ void musycc_update_timeslots (mpi_t *);extern void musycc_update_tx_thp (mch_t *);extern int cxt1e1_log_level; -extern int cxt1e1_max_mru; -extern int cxt1e1_max_mtu; -extern int max_rxdesc_used, max_rxdesc_default; -extern int max_txdesc_used, max_txdesc_default;#if defined (__powerpc__)extern void *memset (void *s,int c,size_t n);
Signature · 1 line
1.9.1
Greg KH
maintainerQuoted 42 lines · Jeff Oczek
Put extern declarations in
cxt1e1_common.hto reduce sparse warnings forlinux.c:drivers/staging/cxt1e1/linux.c:86:13: warning:
symbol 'error_flag' was not declared. Should it be static?drivers/staging/cxt1e1/linux.c:91:13: warning:
symbol 'cxt1e1_max_mru' was not declared. Should it be static?drivers/staging/cxt1e1/linux.c:95:13: warning:
symbol 'cxt1e1_max_mtu' was not declared. Should it be static?drivers/staging/cxt1e1/linux.c:96:13: warning:
symbol 'max_mtu_default' was not declared. Should it be static?drivers/staging/cxt1e1/linux.c:99:13: warning:
symbol 'max_txdesc_used' was not declared. Should it be static?drivers/staging/cxt1e1/linux.c:100:13: warning:
symbol 'max_txd:esc_default' was not declared. Should it be static?drivers/staging/cxt1e1/linux.c:103:13: warning:
symbol 'max_rxdesc_used' was not declared. Should it be static?drivers/staging/cxt1e1/linux.c:104:13: warning:
symbol 'max_rxdesc_default' was not declared. Should it be static?drivers/staging/cxt1e1/linux.c:153:1: warning:
symbol 'c4_wk_chan_restart' was not declared. Should it be static?drivers/staging/cxt1e1/linux.c:171:1: warning:
symbol 'c4_wk_chan_init' was not declared. Should it be static?drivers/staging/cxt1e1/linux.c:186:1: warning:
symbol 'c4_wq_port_init' was not declared. Should it be static?drivers/staging/cxt1e1/linux.c:208:1: warning:
symbol 'c4_wq_port_cleanup' was not declared. Should it be static?Signed-off-by Jeff Oczek <[email protected]>--- drivers/staging/cxt1e1/cxt1e1_common.h | 15 +++++++++++++++ drivers/staging/cxt1e1/hwprobe.c | 2 +- drivers/staging/cxt1e1/linux.c | 2 +- drivers/staging/cxt1e1/musycc.c | 7 +------ drivers/staging/cxt1e1/pmcc4_drv.c | 5 +---- 5 files changed, 19 insertions(+), 12 deletions(-) create mode 100644 drivers/staging/cxt1e1/cxt1e1_common.hdrivers/staging/cxt1e1/cxt1e1_common.h new file +0
-0
drivers/staging/cxt1e1/cxt1e1_common.h line 6
Quoted 6 lines
drivers/staging/cxt1e1/cxt1e1_common.h new file +6
-0@@ -0,0 +1,15 @@ +#ifndef __CXT1E1_COMMON_H +#define __CXT1E1_COMMON_H + +#include "pmcc4.h" + +extern int error_flag;
I know you didn't name this variable, but wow, that's a horrid name for a global variable :)
Any way you could change this to first fix up the name of the variable to something a bit more "device-specific" first, before this patch?
Perhaps "cxt1e1_error_flag"?
drivers/staging/cxt1e1/cxt1e1_common.h line 8
Quoted 2 lines
drivers/staging/cxt1e1/cxt1e1_common.h new file +2
-0+extern int cxt1e1_max_mru; +extern int cxt1e1_max_mtu;
These are fine.
drivers/staging/cxt1e1/cxt1e1_common.h line 13
Quoted 5 lines
drivers/staging/cxt1e1/cxt1e1_common.h new file +5
-0+extern int max_mtu_default; +extern int max_txdesc_used; +extern int max_txdesc_default; +extern int max_rxdesc_used; +extern int max_rxdesc_default;
Again, these are bad names, can you do the same thing here?
thanks,
greg k-h
Quoted 24 lines · Greg KH
Quoted 1 line · Jeff Oczek
Put extern declarations in
cxt1e1_common.hto reduce sparse warnings forlinux.c:I know you didn't name this variable, but wow, that's a horrid name for a global variable :)
Any way you could change this to first fix up the name of the variable to something a bit more "device-specific" first, before this patch?
Perhaps "
cxt1e1_error_flag"?drivers/staging/cxt1e1/cxt1e1_common.h line 8
Quoted 2 lines
drivers/staging/cxt1e1/cxt1e1_common.h new file +2
-0+extern int cxt1e1_max_mru; +extern int cxt1e1_max_mtu;These are fine.
drivers/staging/cxt1e1/cxt1e1_common.h line 13
Quoted 5 lines
drivers/staging/cxt1e1/cxt1e1_common.h new file +5
-0+extern int max_mtu_default; +extern int max_txdesc_used; +extern int max_txdesc_default; +extern int max_rxdesc_used; +extern int max_rxdesc_default;Again, these are bad names, can you do the same thing here?
Quoted 3 lines
thanks,
greg k-h
Hi Greg,
max_txdesc_used and max_rxdesc_used are module parameters, is it ok to change them? I'm quite new to this -- I don't know if that would count as breaking userspace or not.
If not allowed, I could go the route of changing these less descriptive ones to static in the main file and then make an assignment to the global vars during the module init.
Or I can just leave the module params be and change the other globals.
Any of those sound good?
Thanks,
Jeff
Greg KH
maintainerQuoted 25 lines · Jeff Oczek
Quoted 24 lines · Greg KH
Quoted 1 line · Jeff Oczek
Put extern declarations in
cxt1e1_common.hto reduce sparse warnings forlinux.c:I know you didn't name this variable, but wow, that's a horrid name for a global variable :)
Any way you could change this to first fix up the name of the variable to something a bit more "device-specific" first, before this patch?
Perhaps "
cxt1e1_error_flag"?drivers/staging/cxt1e1/cxt1e1_common.h line 8
Quoted 2 lines
drivers/staging/cxt1e1/cxt1e1_common.h new file +2
-0+extern int cxt1e1_max_mru; +extern int cxt1e1_max_mtu;These are fine.
drivers/staging/cxt1e1/cxt1e1_common.h line 13
Quoted 5 lines
drivers/staging/cxt1e1/cxt1e1_common.h new file +5
-0+extern int max_mtu_default; +extern int max_txdesc_used; +extern int max_txdesc_default; +extern int max_rxdesc_used; +extern int max_rxdesc_default;Again, these are bad names, can you do the same thing here?
Quoted 7 lines
Quoted 3 lines
thanks,
greg k-h
Hi Greg,
max_txdesc_usedandmax_rxdesc_usedare module parameters,
Ugh :(
Quoted 2 lines
is it ok to change them? I'm quite new to this -- I don't know if that would count as breaking userspace or not.
Yeah, we can't change them, good catch.
Quoted 3 lines
If not allowed, I could go the route of changing these less descriptive ones to static in the main file and then make an assignment to the global vars during the module init.
That would be the best thing to do.
thanks,
greg k-h
v2 cover staging: cxt1e1: Fix ambiguous global var names, reduce sparse warnings
In reply to Jeff OczekThis patch set:
changes ambiguous global names, such as "error_flag" to "cxt1e1_error_flag" puts globals in header file to reduce externs used in c files as well as sparse warnings
Jeff Oczek (2):
staging: cxt1e1: Prefix ambiguous variable names with 'cxt1e1_' for
clarity
staging: cxt1e1: Fix static symbol sparse warnings for global vars in
linux.c
drivers/staging/cxt1e1/cxt1e1_common.h | 14 +++++++++ drivers/staging/cxt1e1/hwprobe.c | 7 +++-- drivers/staging/cxt1e1/linux.c | 54 +++++++++++++++++++--------------- drivers/staging/cxt1e1/musycc.c | 5 +--- drivers/staging/cxt1e1/pmcc4_drv.c | 23 +++++++-------- drivers/staging/cxt1e1/sbeproc.c | 6 ++-- 6 files changed, 64 insertions(+), 45 deletions(-) create mode 100644 drivers/staging/cxt1e1/cxt1e1_common.h
Signature · 1 line
1.9.1
PATCH v2 1/2 staging: cxt1e1: Prefix ambiguous variable names with 'cxt1e1_' for clarity
Changed names of ambiguous sounding variable names as follows
error_flag -> cxt1e1_error_flag max_mtu_default -> cxt1e1_max_mtu_default max_txdesc_used -> cxt1e1_max_txdesc_used max_txdesc_default -> cxt1e1_max_txdesc_default max_rxdesc_used -> cxt1e1_max_rxdesc_used max_rxdesc_default -> cxt1e1_max_rxdesc_default
Since max_txdesc_used, max_rxdesc_used are module parameters, these were changed from global to static and the module init function assigns the values to the newly named global variables
--- drivers/staging/cxt1e1/hwprobe.c | 7 ++--- drivers/staging/cxt1e1/linux.c | 53 +++++++++++++++++++++----------------- drivers/staging/cxt1e1/musycc.c | 4 +-- drivers/staging/cxt1e1/pmcc4_drv.c | 22 +++++++++------- drivers/staging/cxt1e1/sbeproc.c | 6 ++--- 5 files changed, 51 insertions(+), 41 deletions(-)
drivers/staging/cxt1e1/hwprobe.c +4 -3
@@ -31,7 +31,7 @@#include "sbeproc.h" #endif -extern int error_flag; +extern int cxt1e1_error_flag;extern int drvr_state;/* forward references */
@@ -294,7 +294,7 @@ c4hw_attach_all(void)struct pci_dev *pdev =NULL ;int found =0 , i, j; - error_flag =0 ; + cxt1e1_error_flag =0 ;prep_hdw_info ();/*** scan PCI bus for all possible boards */ while ((pdev = pci_get_device(PCI_VENDOR_ID_CONEXANT,
@@ -372,7 +372,8 @@ c4hw_attach_all(void)#if 0 cleanup_devs ();#endif -return error_flag;/* error_flag set w/in add_dev() */ +/* cxt1e1_error_flag set w/in add_dev() */ +return cxt1e1_error_flag; }show_two (hi, i);/* displays found information */ }
drivers/staging/cxt1e1/linux.c +30 -23
121 lines not on this page · raw message
drivers/staging/cxt1e1/musycc.c +2 -2
@@ -45,8 +45,8 @@ extern int drvr_state;extern int cxt1e1_max_mru;extern int cxt1e1_max_mtu; -extern int max_rxdesc_used; -extern int max_txdesc_used; +extern int cxt1e1_max_rxdesc_used; +extern int cxt1e1_max_txdesc_used;extern ci_t *CI ;/* dummy pointr to board ZEROE's data - DEBUG * USAGE */
drivers/staging/cxt1e1/pmcc4_drv.c +12 -10
@@ -61,8 +61,8 @@ extern void musycc_update_tx_thp (mch_t *);extern int cxt1e1_log_level;extern int cxt1e1_max_mru;extern int cxt1e1_max_mtu; -extern int max_rxdesc_used, max_rxdesc_default; -extern int max_txdesc_used, max_txdesc_default; +extern int cxt1e1_max_rxdesc_used, cxt1e1_max_rxdesc_default; +extern int cxt1e1_max_txdesc_used, cxt1e1_max_txdesc_default;#if defined (__powerpc__)extern void *memset (void *s,int c,size_t n);
@@ -1314,25 +1314,27 @@ c4_chan_up (ci_t *ci, int channum)*/ if (ch->p.chan_mode ==CFG_CH_PROTO_TRANS ) { -if (max_rxdesc_used == max_rxdesc_default)/* use default setting */ - max_rxdesc_used =MUSYCC_RXDESC_TRANS ; -if (max_txdesc_used == max_txdesc_default)/* use default setting */ - max_txdesc_used =MUSYCC_TXDESC_TRANS ; +if (cxt1e1_max_rxdesc_used == cxt1e1_max_rxdesc_default) +/* use default setting */ + cxt1e1_max_rxdesc_used =MUSYCC_RXDESC_TRANS ; +if (cxt1e1_max_txdesc_used == cxt1e1_max_txdesc_default) +/* use default setting */ + cxt1e1_max_txdesc_used =MUSYCC_TXDESC_TRANS ; }/* * Increase counts when hyperchanneling, since this implies an increase * in throughput per channel */ - rxnum = max_rxdesc_used + (nts /4 ); - txnum = max_txdesc_used + (nts /4 ); + rxnum = cxt1e1_max_rxdesc_used + (nts /4 ); + txnum = cxt1e1_max_txdesc_used + (nts /4 );#if 0 /* DEBUG INFO */ if (cxt1e1_log_level >=LOG_MONITOR )pr_info ("%s: mode %x rxnum %d (rxused %d def %d) txnum %d (txused %d def %d)\n" , ci->devname, ch->p.chan_mode, - rxnum, max_rxdesc_used, max_rxdesc_default, - txnum, max_txdesc_used, max_txdesc_default); + rxnum, cxt1e1_max_rxdesc_used, cxt1e1_max_rxdesc_default, + txnum, cxt1e1_max_txdesc_used, cxt1e1_max_txdesc_default);#endif ch->rxd_num = rxnum;
drivers/staging/cxt1e1/sbeproc.c +3 -3
@@ -159,15 +159,15 @@ static int sbecom_proc_get_sbe_info(struct seq_file *m, void *v)extern int max_chans_used;extern int cxt1e1_max_mtu;#endif -extern int max_rxdesc_used, max_txdesc_used; +extern int cxt1e1_max_rxdesc_used, cxt1e1_max_txdesc_used;seq_printf (m,"\ncxt1e1_max_mru: %d\n" , cxt1e1_max_mru);#if 0 seq_printf (m,"\nmax_chans_used: %d\n" , max_chans_used);seq_printf (m,"cxt1e1_max_mtu: %d\n" , cxt1e1_max_mtu);#endif -seq_printf (m,"max_rxdesc_used: %d\n" , max_rxdesc_used); - seq_printf(m, "max_txdesc_used: %d\n", max_txdesc_used); +seq_printf (m,"max_rxdesc_used: %d\n" , cxt1e1_max_rxdesc_used); + seq_printf(m, "max_txdesc_used: %d\n", cxt1e1_max_txdesc_used); }#endif
Signature · 1 line
1.9.1
PATCH v2 2/2 staging: cxt1e1: Fix static symbol sparse warnings for global vars in linux.c
Put extern declarations in cxt1e1_common.h to reduce sparse warnings for linux.c:
drivers/staging/cxt1e1/linux.c:86:13: warning:
symbol 'cxt1e1_error_flag' was not declared. Should it be static?drivers/staging/cxt1e1/linux.c:91:13: warning:
symbol 'cxt1e1_max_mru' was not declared. Should it be static?drivers/staging/cxt1e1/linux.c:95:13: warning:
symbol 'cxt1e1_max_mtu' was not declared. Should it be static?drivers/staging/cxt1e1/linux.c:96:13: warning:
symbol 'cxt1e1_max_mtu_default' was not declared. Should it be static?drivers/staging/cxt1e1/linux.c:100:13: warning:
symbol 'cxt1e1_max_txdesc_default' was not declared. Should it be static?drivers/staging/cxt1e1/linux.c:101:13: warning:
symbol 'cxt1e1_max_txdesc_used' was not declared. Should it be static?drivers/staging/cxt1e1/linux.c:105:13: warning:
symbol 'cxt1e1_max_rxdesc_default' was not declared. Should it be static?drivers/staging/cxt1e1/linux.c:106:13: warning:
symbol 'cxt1e1_max_rxdesc_used' was not declared. Should it be static?
--- drivers/staging/cxt1e1/cxt1e1_common.h | 14 ++++++++++++++ drivers/staging/cxt1e1/hwprobe.c | 2 +- drivers/staging/cxt1e1/linux.c | 1 + drivers/staging/cxt1e1/musycc.c | 5 +---- drivers/staging/cxt1e1/pmcc4_drv.c | 5 +---- 5 files changed, 18 insertions(+), 9 deletions(-) create mode 100644 drivers/staging/cxt1e1/cxt1e1_common.h
drivers/staging/cxt1e1/cxt1e1_common.h new file +14 -0
@@ -0,0 +1,14 @@ +#ifndef __CXT1E1_COMMON_H +#define __CXT1E1_COMMON_H + +extern int cxt1e1_error_flag; +extern int cxt1e1_max_mru; +extern int cxt1e1_max_mtu; +extern int cxt1e1_max_mtu_default; +extern int cxt1e1_max_txdesc_used; +extern int cxt1e1_max_txdesc_default; +extern int cxt1e1_max_rxdesc_used; +extern int cxt1e1_max_rxdesc_default; + +#endif +
drivers/staging/cxt1e1/hwprobe.c +1 -1
@@ -30,8 +30,8 @@#ifdef CONFIG_PROC_FS #include "sbeproc.h" #endif +#include "cxt1e1_common.h" -extern int cxt1e1_error_flag;extern int drvr_state;/* forward references */
drivers/staging/cxt1e1/linux.c +1 -0
@@ -30,6 +30,7 @@#include "pmcc4_ioctls.h" #include "pmcc4_private.h" #include "sbeproc.h" +#include "cxt1e1_common.h" /******************************************************************************* * Error out early if we have compiler trouble.
drivers/staging/cxt1e1/musycc.c +1 -4
@@ -34,6 +34,7 @@ static unsigned int max_bh;#include "pmcc4_private.h" #include "pmcc4.h" #include "musycc.h" +#include "cxt1e1_common.h" #define sd_find_chan (ci,ch) c4_find_chan(ch)
@@ -43,10 +44,6 @@ static unsigned int max_bh;extern ci_t *c4_list;extern int drvr_state; -extern int cxt1e1_max_mru; -extern int cxt1e1_max_mtu; -extern int cxt1e1_max_rxdesc_used; -extern int cxt1e1_max_txdesc_used;extern ci_t *CI ;/* dummy pointr to board ZEROE's data - DEBUG * USAGE */
drivers/staging/cxt1e1/pmcc4_drv.c +1 -4
@@ -38,6 +38,7 @@#include "musycc.h" #include "comet.h" #include "sbe_bid.h" +#include "cxt1e1_common.h" #define KERN_WARN KERN_WARNING
@@ -59,10 +60,6 @@ void musycc_update_timeslots (mpi_t *);extern void musycc_update_tx_thp (mch_t *);extern int cxt1e1_log_level; -extern int cxt1e1_max_mru; -extern int cxt1e1_max_mtu; -extern int cxt1e1_max_rxdesc_used, cxt1e1_max_rxdesc_default; -extern int cxt1e1_max_txdesc_used, cxt1e1_max_txdesc_default;#if defined (__powerpc__)extern void *memset (void *s,int c,size_t n);
Signature · 1 line
1.9.1
Greg KH
maintainerRe: [PATCH v2 1/2] staging: cxt1e1: Prefix ambiguous variable names with 'cxt1e1_' for clarity
In reply to Jeff OczekQuoted 13 lines · Jeff Oczek
Changed names of ambiguous sounding variable names as follows
error_flag -> cxt1e1_error_flag max_mtu_default -> cxt1e1_max_mtu_default max_txdesc_used -> cxt1e1_max_txdesc_used max_txdesc_default -> cxt1e1_max_txdesc_default max_rxdesc_used -> cxt1e1_max_rxdesc_used max_rxdesc_default -> cxt1e1_max_rxdesc_defaultSince
max_txdesc_used,max_rxdesc_usedare module parameters, these were changed from global to static and the module init function assigns the values to the newly named global variables
Quoted 8 lines
Signed-off-by Jeff Oczek <[email protected]>--- drivers/staging/cxt1e1/hwprobe.c | 7 ++--- drivers/staging/cxt1e1/linux.c | 53 +++++++++++++++++++++----------------- drivers/staging/cxt1e1/musycc.c | 4 +-- drivers/staging/cxt1e1/pmcc4_drv.c | 22 +++++++++------- drivers/staging/cxt1e1/sbeproc.c | 6 ++--- 5 files changed, 51 insertions(+), 41 deletions(-)
This driver isn't even in my kernel tree anymore, so how can I apply it?
What kernel branch/version did you make it against? Please always work against linux-next, or my staging-next of my staging.git kernel tree when sending patches.
thanks,
greg k-h