All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: cxt1e1: Fix static symbol sparse warnings for global vars in linux.c
@ 2014-07-22 20:07 Jeff Oczek
  2014-07-22 20:17 ` Greg KH
  2014-07-23  0:34 ` [PATCH v2 0/2] staging: cxt1e1: Fix ambiguous global var names, reduce sparse warnings Jeff Oczek
  0 siblings, 2 replies; 8+ messages in thread
From: Jeff Oczek @ 2014-07-22 20:07 UTC (permalink / raw
  To: gregkh; +Cc: devel, linux-kernel, Jeff Oczek

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?

Signed-off-by: Jeff Oczek <jeffoczek@gmail.com>
---
 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

diff --git a/drivers/staging/cxt1e1/cxt1e1_common.h b/drivers/staging/cxt1e1/cxt1e1_common.h
new file mode 100644
index 0000000..ac6b974
--- /dev/null
+++ b/drivers/staging/cxt1e1/cxt1e1_common.h
@@ -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
diff --git a/drivers/staging/cxt1e1/hwprobe.c b/drivers/staging/cxt1e1/hwprobe.c
index 4fa27c8..45bc161 100644
--- a/drivers/staging/cxt1e1/hwprobe.c
+++ b/drivers/staging/cxt1e1/hwprobe.c
@@ -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 */
diff --git a/drivers/staging/cxt1e1/linux.c b/drivers/staging/cxt1e1/linux.c
index 09f3d5c..3ba0245 100644
--- a/drivers/staging/cxt1e1/linux.c
+++ b/drivers/staging/cxt1e1/linux.c
@@ -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.
  *
diff --git a/drivers/staging/cxt1e1/musycc.c b/drivers/staging/cxt1e1/musycc.c
index 0bcbd8a..4f8b137 100644
--- a/drivers/staging/cxt1e1/musycc.c
+++ b/drivers/staging/cxt1e1/musycc.c
@@ -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 */
 
diff --git a/drivers/staging/cxt1e1/pmcc4_drv.c b/drivers/staging/cxt1e1/pmcc4_drv.c
index 76bebdd..e053b60 100644
--- a/drivers/staging/cxt1e1/pmcc4_drv.c
+++ b/drivers/staging/cxt1e1/pmcc4_drv.c
@@ -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);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] staging: cxt1e1: Fix static symbol sparse warnings for global vars in linux.c
  2014-07-22 20:07 [PATCH] staging: cxt1e1: Fix static symbol sparse warnings for global vars in linux.c Jeff Oczek
@ 2014-07-22 20:17 ` Greg KH
  2014-07-22 20:56   ` Jeff Oczek
  2014-07-23  0:34 ` [PATCH v2 0/2] staging: cxt1e1: Fix ambiguous global var names, reduce sparse warnings Jeff Oczek
  1 sibling, 1 reply; 8+ messages in thread
From: Greg KH @ 2014-07-22 20:17 UTC (permalink / raw
  To: Jeff Oczek; +Cc: devel, linux-kernel

On Tue, Jul 22, 2014 at 04:07:51PM -0400, Jeff Oczek wrote:
> 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?
> 
> Signed-off-by: Jeff Oczek <jeffoczek@gmail.com>
> ---
>  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
> 
> diff --git a/drivers/staging/cxt1e1/cxt1e1_common.h b/drivers/staging/cxt1e1/cxt1e1_common.h
> new file mode 100644
> index 0000000..ac6b974
> --- /dev/null
> +++ b/drivers/staging/cxt1e1/cxt1e1_common.h
> @@ -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"?

> +extern int cxt1e1_max_mru;
> +extern int cxt1e1_max_mtu;

These are fine.

> +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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] staging: cxt1e1: Fix static symbol sparse warnings for global vars in linux.c
  2014-07-22 20:17 ` Greg KH
@ 2014-07-22 20:56   ` Jeff Oczek
  2014-07-22 21:23     ` Greg KH
  0 siblings, 1 reply; 8+ messages in thread
From: Jeff Oczek @ 2014-07-22 20:56 UTC (permalink / raw
  To: Greg KH; +Cc: devel, linux-kernel

On Tue, Jul 22, 2014 at 01:17:22PM -0700, Greg KH wrote:
> On Tue, Jul 22, 2014 at 04:07:51PM -0400, Jeff Oczek wrote:
> > Put extern declarations in cxt1e1_common.h to reduce sparse warnings for linux.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"?
> 
> > +extern int cxt1e1_max_mru;
> > +extern int cxt1e1_max_mtu;
> 
> These are fine.
> 
> > +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

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] staging: cxt1e1: Fix static symbol sparse warnings for global vars in linux.c
  2014-07-22 20:56   ` Jeff Oczek
@ 2014-07-22 21:23     ` Greg KH
  0 siblings, 0 replies; 8+ messages in thread
From: Greg KH @ 2014-07-22 21:23 UTC (permalink / raw
  To: Jeff Oczek; +Cc: devel, linux-kernel

On Tue, Jul 22, 2014 at 04:56:59PM -0400, Jeff Oczek wrote:
> On Tue, Jul 22, 2014 at 01:17:22PM -0700, Greg KH wrote:
> > On Tue, Jul 22, 2014 at 04:07:51PM -0400, Jeff Oczek wrote:
> > > Put extern declarations in cxt1e1_common.h to reduce sparse warnings for linux.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"?
> > 
> > > +extern int cxt1e1_max_mru;
> > > +extern int cxt1e1_max_mtu;
> > 
> > These are fine.
> > 
> > > +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
> 
> Hi Greg,
> 
> max_txdesc_used and max_rxdesc_used are module parameters, 

Ugh :(

> 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.

> 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2 0/2] staging: cxt1e1: Fix ambiguous global var names, reduce sparse warnings
  2014-07-22 20:07 [PATCH] staging: cxt1e1: Fix static symbol sparse warnings for global vars in linux.c Jeff Oczek
  2014-07-22 20:17 ` Greg KH
@ 2014-07-23  0:34 ` Jeff Oczek
  2014-07-23  0:34   ` [PATCH v2 1/2] staging: cxt1e1: Prefix ambiguous variable names with 'cxt1e1_' for clarity Jeff Oczek
  1 sibling, 1 reply; 8+ messages in thread
From: Jeff Oczek @ 2014-07-23  0:34 UTC (permalink / raw
  To: gregkh; +Cc: devel, linux-kernel, Jeff Oczek

This 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

-- 
1.9.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2 1/2] staging: cxt1e1: Prefix ambiguous variable names with 'cxt1e1_' for clarity
  2014-07-23  0:34 ` [PATCH v2 0/2] staging: cxt1e1: Fix ambiguous global var names, reduce sparse warnings Jeff Oczek
@ 2014-07-23  0:34   ` Jeff Oczek
  2014-07-23  0:34     ` [PATCH v2 2/2] staging: cxt1e1: Fix static symbol sparse warnings for global vars in linux.c Jeff Oczek
  2014-07-24  1:20     ` [PATCH v2 1/2] staging: cxt1e1: Prefix ambiguous variable names with 'cxt1e1_' for clarity Greg KH
  0 siblings, 2 replies; 8+ messages in thread
From: Jeff Oczek @ 2014-07-23  0:34 UTC (permalink / raw
  To: gregkh; +Cc: devel, linux-kernel, 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_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

Signed-off-by: Jeff Oczek <jeffoczek@gmail.com>
---
 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(-)

diff --git a/drivers/staging/cxt1e1/hwprobe.c b/drivers/staging/cxt1e1/hwprobe.c
index 4fa27c8..9eb0313 100644
--- a/drivers/staging/cxt1e1/hwprobe.c
+++ b/drivers/staging/cxt1e1/hwprobe.c
@@ -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 */
 	}
diff --git a/drivers/staging/cxt1e1/linux.c b/drivers/staging/cxt1e1/linux.c
index 09f3d5c..07cc142 100644
--- a/drivers/staging/cxt1e1/linux.c
+++ b/drivers/staging/cxt1e1/linux.c
@@ -83,7 +83,7 @@ int         musycc_start_xmit(ci_t *, int, void *);
 extern ci_t *CI;
 extern struct s_hdw_info hdw_info[];
 
-int         error_flag;         /* module load error reporting */
+int         cxt1e1_error_flag;         /* module load error reporting */
 int         cxt1e1_log_level = LOG_ERROR;
 static int  log_level_default = LOG_ERROR;
 module_param(cxt1e1_log_level, int, 0444);
@@ -93,15 +93,17 @@ static int  max_mru_default = MUSYCC_MRU;
 module_param(cxt1e1_max_mru, int, 0444);
 
 int         cxt1e1_max_mtu = MUSYCC_MTU;
-int         max_mtu_default = MUSYCC_MTU;
+int         cxt1e1_max_mtu_default = MUSYCC_MTU;
 module_param(cxt1e1_max_mtu, int, 0444);
 
-int         max_txdesc_used = MUSYCC_TXDESC_MIN;
-int         max_txdesc_default = MUSYCC_TXDESC_MIN;
+static int  max_txdesc_used = MUSYCC_TXDESC_MIN;
+int         cxt1e1_max_txdesc_default = MUSYCC_TXDESC_MIN;
+int	    cxt1e1_max_txdesc_used = MUSYCC_TXDESC_MIN;
 module_param(max_txdesc_used, int, 0444);
 
-int         max_rxdesc_used = MUSYCC_RXDESC_MIN;
-int         max_rxdesc_default = MUSYCC_RXDESC_MIN;
+static int  max_rxdesc_used = MUSYCC_RXDESC_MIN;
+int         cxt1e1_max_rxdesc_default = MUSYCC_RXDESC_MIN;
+int	    cxt1e1_max_rxdesc_used = MUSYCC_RXDESC_MIN;
 module_param(max_rxdesc_used, int, 0444);
 
 /****************************************************************************/
@@ -921,7 +923,7 @@ c4_add_dev(hdw_info_t *hi, int brdno, unsigned long f0, unsigned long f1,
 	if (!ndev) {
 		pr_warning("%s: no memory for struct net_device !\n",
 			   hi->devname);
-		error_flag = -ENOMEM;
+		cxt1e1_error_flag = -ENOMEM;
 		return NULL;
 	}
 	ci = (ci_t *)(netdev_priv(ndev));
@@ -956,7 +958,7 @@ c4_add_dev(hdw_info_t *hi, int brdno, unsigned long f0, unsigned long f1,
 		(c4_init(ci, (u_char *) f0, (u_char *) f1) != SBE_DRVR_SUCCESS)) {
 		kfree(netdev_priv(ndev));
 		kfree(ndev);
-		error_flag = -ENODEV;
+		cxt1e1_error_flag = -ENODEV;
 		return NULL;
 	}
 	/*************************************************************
@@ -982,7 +984,7 @@ c4_add_dev(hdw_info_t *hi, int brdno, unsigned long f0, unsigned long f1,
 		unregister_netdev(ndev);
 		kfree(netdev_priv(ndev));
 		kfree(ndev);
-		error_flag = -EIO;
+		cxt1e1_error_flag = -EIO;
 		return NULL;
 	}
 #ifdef CONFIG_SBE_PMCC4_NCOMM
@@ -992,7 +994,7 @@ c4_add_dev(hdw_info_t *hi, int brdno, unsigned long f0, unsigned long f1,
 		free_irq(irq0, ndev);
 		kfree(netdev_priv(ndev));
 		kfree(ndev);
-		error_flag = -EIO;
+		cxt1e1_error_flag = -EIO;
 		return NULL;
 	}
 #endif
@@ -1042,8 +1044,8 @@ c4_add_dev(hdw_info_t *hi, int brdno, unsigned long f0, unsigned long f1,
 	tasklet_enable(&ci->ci_musycc_isr_tasklet);
 #endif
 
-	error_flag = c4_init2(ci);
-	if (error_flag != SBE_DRVR_SUCCESS) {
+	cxt1e1_error_flag = c4_init2(ci);
+	if (cxt1e1_error_flag != SBE_DRVR_SUCCESS) {
 #ifdef CONFIG_PROC_FS
 		sbecom_proc_brd_cleanup(ci);
 #endif
@@ -1052,7 +1054,7 @@ c4_add_dev(hdw_info_t *hi, int brdno, unsigned long f0, unsigned long f1,
 		free_irq(irq0, ndev);
 		kfree(netdev_priv(ndev));
 		kfree(ndev);
-		/* failure, error_flag is set */
+		/* failure, cxt1e1_error_flag is set */
 		return NULL;
 	}
 	return ndev;
@@ -1063,6 +1065,11 @@ c4_mod_init(void)
 {
 	int         rtn;
 
+	/* cxt1e1_max vars are used globally but have to avoid changing
+	existing these module parameter names */
+	cxt1e1_max_txdesc_used = max_txdesc_used;
+	cxt1e1_max_rxdesc_used = max_rxdesc_used;
+
 	rtn = c4hw_attach_all();
 	if (rtn)
 		return -rtn; /* installation failure - see system log */
@@ -1074,20 +1081,20 @@ c4_mod_init(void)
 	if (cxt1e1_max_mru != max_mru_default)
 		pr_info("NOTE: driver parameter <cxt1e1_max_mru> changed from default %d to %d.\n",
 			max_mru_default, cxt1e1_max_mru);
-	if (cxt1e1_max_mtu != max_mtu_default)
+	if (cxt1e1_max_mtu != cxt1e1_max_mtu_default)
 		pr_info("NOTE: driver parameter <cxt1e1_max_mtu> changed from default %d to %d.\n",
-			max_mtu_default, cxt1e1_max_mtu);
-	if (max_rxdesc_used != max_rxdesc_default) {
-		if (max_rxdesc_used > 2000)
-			max_rxdesc_used = 2000; /* out-of-bounds reset */
+			cxt1e1_max_mtu_default, cxt1e1_max_mtu);
+	if (cxt1e1_max_rxdesc_used != cxt1e1_max_rxdesc_default) {
+		if (cxt1e1_max_rxdesc_used > 2000)
+			cxt1e1_max_rxdesc_used = 2000; /* out-of-bounds reset */
 		pr_info("NOTE: driver parameter <max_rxdesc_used> changed from default %d to %d.\n",
-			max_rxdesc_default, max_rxdesc_used);
+			cxt1e1_max_rxdesc_default, cxt1e1_max_rxdesc_used);
 	}
-	if (max_txdesc_used != max_txdesc_default) {
-		if (max_txdesc_used > 1000)
-			max_txdesc_used = 1000; /* out-of-bounds reset */
+	if (cxt1e1_max_txdesc_used != cxt1e1_max_txdesc_default) {
+		if (cxt1e1_max_txdesc_used > 1000)
+			cxt1e1_max_txdesc_used = 1000; /* out-of-bounds reset */
 		pr_info("NOTE: driver parameter <max_txdesc_used> changed from default %d to %d.\n",
-			max_txdesc_default, max_txdesc_used);
+			cxt1e1_max_txdesc_default, cxt1e1_max_txdesc_used);
 	}
 	return 0;                       /* installation success */
 }
diff --git a/drivers/staging/cxt1e1/musycc.c b/drivers/staging/cxt1e1/musycc.c
index 0bcbd8a..5b9b482 100644
--- a/drivers/staging/cxt1e1/musycc.c
+++ b/drivers/staging/cxt1e1/musycc.c
@@ -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 */
 
diff --git a/drivers/staging/cxt1e1/pmcc4_drv.c b/drivers/staging/cxt1e1/pmcc4_drv.c
index 76bebdd..99b02a0 100644
--- a/drivers/staging/cxt1e1/pmcc4_drv.c
+++ b/drivers/staging/cxt1e1/pmcc4_drv.c
@@ -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;
diff --git a/drivers/staging/cxt1e1/sbeproc.c b/drivers/staging/cxt1e1/sbeproc.c
index 1c2e52e..a02b259 100644
--- a/drivers/staging/cxt1e1/sbeproc.c
+++ b/drivers/staging/cxt1e1/sbeproc.c
@@ -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
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 2/2] staging: cxt1e1: Fix static symbol sparse warnings for global vars in linux.c
  2014-07-23  0:34   ` [PATCH v2 1/2] staging: cxt1e1: Prefix ambiguous variable names with 'cxt1e1_' for clarity Jeff Oczek
@ 2014-07-23  0:34     ` Jeff Oczek
  2014-07-24  1:20     ` [PATCH v2 1/2] staging: cxt1e1: Prefix ambiguous variable names with 'cxt1e1_' for clarity Greg KH
  1 sibling, 0 replies; 8+ messages in thread
From: Jeff Oczek @ 2014-07-23  0:34 UTC (permalink / raw
  To: gregkh; +Cc: devel, linux-kernel, Jeff Oczek

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?

Signed-off-by: Jeff Oczek <jeffoczek@gmail.com>
---
 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

diff --git a/drivers/staging/cxt1e1/cxt1e1_common.h b/drivers/staging/cxt1e1/cxt1e1_common.h
new file mode 100644
index 0000000..c6634ea
--- /dev/null
+++ b/drivers/staging/cxt1e1/cxt1e1_common.h
@@ -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
+
diff --git a/drivers/staging/cxt1e1/hwprobe.c b/drivers/staging/cxt1e1/hwprobe.c
index 9eb0313..3f7bf70 100644
--- a/drivers/staging/cxt1e1/hwprobe.c
+++ b/drivers/staging/cxt1e1/hwprobe.c
@@ -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 */
diff --git a/drivers/staging/cxt1e1/linux.c b/drivers/staging/cxt1e1/linux.c
index 07cc142..3dd09a3 100644
--- a/drivers/staging/cxt1e1/linux.c
+++ b/drivers/staging/cxt1e1/linux.c
@@ -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.
diff --git a/drivers/staging/cxt1e1/musycc.c b/drivers/staging/cxt1e1/musycc.c
index 5b9b482..aeb8a21 100644
--- a/drivers/staging/cxt1e1/musycc.c
+++ b/drivers/staging/cxt1e1/musycc.c
@@ -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 */
 
diff --git a/drivers/staging/cxt1e1/pmcc4_drv.c b/drivers/staging/cxt1e1/pmcc4_drv.c
index 99b02a0..a3ec7f9 100644
--- a/drivers/staging/cxt1e1/pmcc4_drv.c
+++ b/drivers/staging/cxt1e1/pmcc4_drv.c
@@ -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);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 1/2] staging: cxt1e1: Prefix ambiguous variable names with 'cxt1e1_' for clarity
  2014-07-23  0:34   ` [PATCH v2 1/2] staging: cxt1e1: Prefix ambiguous variable names with 'cxt1e1_' for clarity Jeff Oczek
  2014-07-23  0:34     ` [PATCH v2 2/2] staging: cxt1e1: Fix static symbol sparse warnings for global vars in linux.c Jeff Oczek
@ 2014-07-24  1:20     ` Greg KH
  1 sibling, 0 replies; 8+ messages in thread
From: Greg KH @ 2014-07-24  1:20 UTC (permalink / raw
  To: Jeff Oczek; +Cc: devel, linux-kernel

On Tue, Jul 22, 2014 at 08:34:55PM -0400, Jeff Oczek wrote:
> 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
> 
> Signed-off-by: Jeff Oczek <jeffoczek@gmail.com>
> ---
>  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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-07-24  1:20 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-22 20:07 [PATCH] staging: cxt1e1: Fix static symbol sparse warnings for global vars in linux.c Jeff Oczek
2014-07-22 20:17 ` Greg KH
2014-07-22 20:56   ` Jeff Oczek
2014-07-22 21:23     ` Greg KH
2014-07-23  0:34 ` [PATCH v2 0/2] staging: cxt1e1: Fix ambiguous global var names, reduce sparse warnings Jeff Oczek
2014-07-23  0:34   ` [PATCH v2 1/2] staging: cxt1e1: Prefix ambiguous variable names with 'cxt1e1_' for clarity Jeff Oczek
2014-07-23  0:34     ` [PATCH v2 2/2] staging: cxt1e1: Fix static symbol sparse warnings for global vars in linux.c Jeff Oczek
2014-07-24  1:20     ` [PATCH v2 1/2] staging: cxt1e1: Prefix ambiguous variable names with 'cxt1e1_' for clarity Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.