aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/joystick
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor@insightbb.com>2007-05-03 00:52:51 -0400
committerDmitry Torokhov <dtor@insightbb.com>2007-05-03 00:52:51 -0400
commit78167236e23bb3c80d2b35b693e578a6e56b1171 (patch)
tree2287a478c80f5eaa79738d4b541bd5a0ddd42de5 /drivers/input/joystick
parentdec3eb01c2409ca8276c1152c167add66a37d1ba (diff)
Input: drivers/joystick - fix various sparse warnings
Fix various issues pointed by sparse: - module_param_array_named() takes unsigned int as number of parameters argument - shadowing of global variables is not healthy. I think there was once a bug in db9 caused by it. Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/joystick')
-rw-r--r--drivers/input/joystick/analog.c2
-rw-r--r--drivers/input/joystick/db9.c18
-rw-r--r--drivers/input/joystick/gamecon.c17
-rw-r--r--drivers/input/joystick/iforce/iforce.h2
-rw-r--r--drivers/input/joystick/turbografx.c18
5 files changed, 30 insertions, 27 deletions
diff --git a/drivers/input/joystick/analog.c b/drivers/input/joystick/analog.c
index 1c1afb5d4684..bdd157c1ebf8 100644
--- a/drivers/input/joystick/analog.c
+++ b/drivers/input/joystick/analog.c
@@ -53,7 +53,7 @@ MODULE_LICENSE("GPL");
53#define ANALOG_PORTS 16 53#define ANALOG_PORTS 16
54 54
55static char *js[ANALOG_PORTS]; 55static char *js[ANALOG_PORTS];
56static int js_nargs; 56static unsigned int js_nargs;
57static int analog_options[ANALOG_PORTS]; 57static int analog_options[ANALOG_PORTS];
58module_param_array_named(map, js, charp, &js_nargs, 0); 58module_param_array_named(map, js, charp, &js_nargs, 0);
59MODULE_PARM_DESC(map, "Describes analog joysticks type/capabilities"); 59MODULE_PARM_DESC(map, "Describes analog joysticks type/capabilities");
diff --git a/drivers/input/joystick/db9.c b/drivers/input/joystick/db9.c
index c27593bf9978..86ad1027e12a 100644
--- a/drivers/input/joystick/db9.c
+++ b/drivers/input/joystick/db9.c
@@ -46,17 +46,17 @@ MODULE_LICENSE("GPL");
46 46
47struct db9_config { 47struct db9_config {
48 int args[2]; 48 int args[2];
49 int nargs; 49 unsigned int nargs;
50}; 50};
51 51
52#define DB9_MAX_PORTS 3 52#define DB9_MAX_PORTS 3
53static struct db9_config db9[DB9_MAX_PORTS] __initdata; 53static struct db9_config db9_cfg[DB9_MAX_PORTS] __initdata;
54 54
55module_param_array_named(dev, db9[0].args, int, &db9[0].nargs, 0); 55module_param_array_named(dev, db9_cfg[0].args, int, &db9_cfg[0].nargs, 0);
56MODULE_PARM_DESC(dev, "Describes first attached device (<parport#>,<type>)"); 56MODULE_PARM_DESC(dev, "Describes first attached device (<parport#>,<type>)");
57module_param_array_named(dev2, db9[1].args, int, &db9[0].nargs, 0); 57module_param_array_named(dev2, db9_cfg[1].args, int, &db9_cfg[0].nargs, 0);
58MODULE_PARM_DESC(dev2, "Describes second attached device (<parport#>,<type>)"); 58MODULE_PARM_DESC(dev2, "Describes second attached device (<parport#>,<type>)");
59module_param_array_named(dev3, db9[2].args, int, &db9[2].nargs, 0); 59module_param_array_named(dev3, db9_cfg[2].args, int, &db9_cfg[2].nargs, 0);
60MODULE_PARM_DESC(dev3, "Describes third attached device (<parport#>,<type>)"); 60MODULE_PARM_DESC(dev3, "Describes third attached device (<parport#>,<type>)");
61 61
62#define DB9_ARG_PARPORT 0 62#define DB9_ARG_PARPORT 0
@@ -680,17 +680,17 @@ static int __init db9_init(void)
680 int err = 0; 680 int err = 0;
681 681
682 for (i = 0; i < DB9_MAX_PORTS; i++) { 682 for (i = 0; i < DB9_MAX_PORTS; i++) {
683 if (db9[i].nargs == 0 || db9[i].args[DB9_ARG_PARPORT] < 0) 683 if (db9_cfg[i].nargs == 0 || db9_cfg[i].args[DB9_ARG_PARPORT] < 0)
684 continue; 684 continue;
685 685
686 if (db9[i].nargs < 2) { 686 if (db9_cfg[i].nargs < 2) {
687 printk(KERN_ERR "db9.c: Device type must be specified.\n"); 687 printk(KERN_ERR "db9.c: Device type must be specified.\n");
688 err = -EINVAL; 688 err = -EINVAL;
689 break; 689 break;
690 } 690 }
691 691
692 db9_base[i] = db9_probe(db9[i].args[DB9_ARG_PARPORT], 692 db9_base[i] = db9_probe(db9_cfg[i].args[DB9_ARG_PARPORT],
693 db9[i].args[DB9_ARG_MODE]); 693 db9_cfg[i].args[DB9_ARG_MODE]);
694 if (IS_ERR(db9_base[i])) { 694 if (IS_ERR(db9_base[i])) {
695 err = PTR_ERR(db9_base[i]); 695 err = PTR_ERR(db9_base[i]);
696 break; 696 break;
diff --git a/drivers/input/joystick/gamecon.c b/drivers/input/joystick/gamecon.c
index c71b58fe225d..1a452e0e5f25 100644
--- a/drivers/input/joystick/gamecon.c
+++ b/drivers/input/joystick/gamecon.c
@@ -48,16 +48,16 @@ MODULE_LICENSE("GPL");
48 48
49struct gc_config { 49struct gc_config {
50 int args[GC_MAX_DEVICES + 1]; 50 int args[GC_MAX_DEVICES + 1];
51 int nargs; 51 unsigned int nargs;
52}; 52};
53 53
54static struct gc_config gc[GC_MAX_PORTS] __initdata; 54static struct gc_config gc_cfg[GC_MAX_PORTS] __initdata;
55 55
56module_param_array_named(map, gc[0].args, int, &gc[0].nargs, 0); 56module_param_array_named(map, gc_cfg[0].args, int, &gc_cfg[0].nargs, 0);
57MODULE_PARM_DESC(map, "Describes first set of devices (<parport#>,<pad1>,<pad2>,..<pad5>)"); 57MODULE_PARM_DESC(map, "Describes first set of devices (<parport#>,<pad1>,<pad2>,..<pad5>)");
58module_param_array_named(map2, gc[1].args, int, &gc[1].nargs, 0); 58module_param_array_named(map2, gc_cfg[1].args, int, &gc_cfg[1].nargs, 0);
59MODULE_PARM_DESC(map2, "Describes second set of devices"); 59MODULE_PARM_DESC(map2, "Describes second set of devices");
60module_param_array_named(map3, gc[2].args, int, &gc[2].nargs, 0); 60module_param_array_named(map3, gc_cfg[2].args, int, &gc_cfg[2].nargs, 0);
61MODULE_PARM_DESC(map3, "Describes third set of devices"); 61MODULE_PARM_DESC(map3, "Describes third set of devices");
62 62
63/* see also gs_psx_delay parameter in PSX support section */ 63/* see also gs_psx_delay parameter in PSX support section */
@@ -810,16 +810,17 @@ static int __init gc_init(void)
810 int err = 0; 810 int err = 0;
811 811
812 for (i = 0; i < GC_MAX_PORTS; i++) { 812 for (i = 0; i < GC_MAX_PORTS; i++) {
813 if (gc[i].nargs == 0 || gc[i].args[0] < 0) 813 if (gc_cfg[i].nargs == 0 || gc_cfg[i].args[0] < 0)
814 continue; 814 continue;
815 815
816 if (gc[i].nargs < 2) { 816 if (gc_cfg[i].nargs < 2) {
817 printk(KERN_ERR "gamecon.c: at least one device must be specified\n"); 817 printk(KERN_ERR "gamecon.c: at least one device must be specified\n");
818 err = -EINVAL; 818 err = -EINVAL;
819 break; 819 break;
820 } 820 }
821 821
822 gc_base[i] = gc_probe(gc[i].args[0], gc[i].args + 1, gc[i].nargs - 1); 822 gc_base[i] = gc_probe(gc_cfg[i].args[0],
823 gc_cfg[i].args + 1, gc_cfg[i].nargs - 1);
823 if (IS_ERR(gc_base[i])) { 824 if (IS_ERR(gc_base[i])) {
824 err = PTR_ERR(gc_base[i]); 825 err = PTR_ERR(gc_base[i]);
825 break; 826 break;
diff --git a/drivers/input/joystick/iforce/iforce.h b/drivers/input/joystick/iforce/iforce.h
index dadcf4fb92ae..40a853ac21c7 100644
--- a/drivers/input/joystick/iforce/iforce.h
+++ b/drivers/input/joystick/iforce/iforce.h
@@ -124,7 +124,7 @@ struct iforce {
124 /* Buffer used for asynchronous sending of bytes to the device */ 124 /* Buffer used for asynchronous sending of bytes to the device */
125 struct circ_buf xmit; 125 struct circ_buf xmit;
126 unsigned char xmit_data[XMIT_SIZE]; 126 unsigned char xmit_data[XMIT_SIZE];
127 long xmit_flags[1]; 127 unsigned long xmit_flags[1];
128 128
129 /* Force Feedback */ 129 /* Force Feedback */
130 wait_queue_head_t wait; 130 wait_queue_head_t wait;
diff --git a/drivers/input/joystick/turbografx.c b/drivers/input/joystick/turbografx.c
index 0f2c60823b0b..8381c6f14373 100644
--- a/drivers/input/joystick/turbografx.c
+++ b/drivers/input/joystick/turbografx.c
@@ -48,16 +48,16 @@ MODULE_LICENSE("GPL");
48 48
49struct tgfx_config { 49struct tgfx_config {
50 int args[TGFX_MAX_DEVICES + 1]; 50 int args[TGFX_MAX_DEVICES + 1];
51 int nargs; 51 unsigned int nargs;
52}; 52};
53 53
54static struct tgfx_config tgfx[TGFX_MAX_PORTS] __initdata; 54static struct tgfx_config tgfx_cfg[TGFX_MAX_PORTS] __initdata;
55 55
56module_param_array_named(map, tgfx[0].args, int, &tgfx[0].nargs, 0); 56module_param_array_named(map, tgfx_cfg[0].args, int, &tgfx_cfg[0].nargs, 0);
57MODULE_PARM_DESC(map, "Describes first set of devices (<parport#>,<js1>,<js2>,..<js7>"); 57MODULE_PARM_DESC(map, "Describes first set of devices (<parport#>,<js1>,<js2>,..<js7>");
58module_param_array_named(map2, tgfx[1].args, int, &tgfx[1].nargs, 0); 58module_param_array_named(map2, tgfx_cfg[1].args, int, &tgfx_cfg[1].nargs, 0);
59MODULE_PARM_DESC(map2, "Describes second set of devices"); 59MODULE_PARM_DESC(map2, "Describes second set of devices");
60module_param_array_named(map3, tgfx[2].args, int, &tgfx[2].nargs, 0); 60module_param_array_named(map3, tgfx_cfg[2].args, int, &tgfx_cfg[2].nargs, 0);
61MODULE_PARM_DESC(map3, "Describes third set of devices"); 61MODULE_PARM_DESC(map3, "Describes third set of devices");
62 62
63#define TGFX_REFRESH_TIME HZ/100 /* 10 ms */ 63#define TGFX_REFRESH_TIME HZ/100 /* 10 ms */
@@ -283,16 +283,18 @@ static int __init tgfx_init(void)
283 int err = 0; 283 int err = 0;
284 284
285 for (i = 0; i < TGFX_MAX_PORTS; i++) { 285 for (i = 0; i < TGFX_MAX_PORTS; i++) {
286 if (tgfx[i].nargs == 0 || tgfx[i].args[0] < 0) 286 if (tgfx_cfg[i].nargs == 0 || tgfx_cfg[i].args[0] < 0)
287 continue; 287 continue;
288 288
289 if (tgfx[i].nargs < 2) { 289 if (tgfx_cfg[i].nargs < 2) {
290 printk(KERN_ERR "turbografx.c: at least one joystick must be specified\n"); 290 printk(KERN_ERR "turbografx.c: at least one joystick must be specified\n");
291 err = -EINVAL; 291 err = -EINVAL;
292 break; 292 break;
293 } 293 }
294 294
295 tgfx_base[i] = tgfx_probe(tgfx[i].args[0], tgfx[i].args + 1, tgfx[i].nargs - 1); 295 tgfx_base[i] = tgfx_probe(tgfx_cfg[i].args[0],
296 tgfx_cfg[i].args + 1,
297 tgfx_cfg[i].nargs - 1);
296 if (IS_ERR(tgfx_base[i])) { 298 if (IS_ERR(tgfx_base[i])) {
297 err = PTR_ERR(tgfx_base[i]); 299 err = PTR_ERR(tgfx_base[i]);
298 break; 300 break;