Commit 971e8298dee4835fc2dfbd207a9786702aa01666

Authored by Mauro Carvalho Chehab
1 parent 3f831107ed

V4L/DVB (13680): ir: use unsigned long instead of enum

When preparing the linux-next patches, I got those errors:

include/media/ir-core.h:29: warning: left shift count >= width of type
In file included from include/media/ir-common.h:29,
                 from drivers/media/video/ir-kbd-i2c.c:50:
drivers/media/video/ir-kbd-i2c.c: In function ‘ir_probe’:
drivers/media/video/ir-kbd-i2c.c:324: warning: left shift count >= width of type

Unfortunately, enum is 32 bits on i386. As we define IR_TYPE_OTHER as 1<<63,
it won't work on non 64 bits arch.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>

Showing 11 changed files with 26 additions and 25 deletions Side-by-side Diff

drivers/media/IR/ir-functions.c
... ... @@ -52,7 +52,7 @@
52 52 /* -------------------------------------------------------------------------- */
53 53  
54 54 int ir_input_init(struct input_dev *dev, struct ir_input_state *ir,
55   - const enum ir_type ir_type)
  55 + const u64 ir_type)
56 56 {
57 57 ir->ir_type = ir_type;
58 58  
drivers/media/IR/ir-sysfs.c
... ... @@ -39,9 +39,9 @@
39 39 {
40 40 char *s;
41 41 struct ir_input_dev *ir_dev = dev_get_drvdata(d);
42   - enum ir_type ir_type = ir_dev->rc_tab.ir_type;
  42 + u64 ir_type = ir_dev->rc_tab.ir_type;
43 43  
44   - IR_dprintk(1, "Current protocol is %ld\n", ir_type);
  44 + IR_dprintk(1, "Current protocol is %lld\n", (long long)ir_type);
45 45  
46 46 /* FIXME: doesn't support multiple protocols at the same time */
47 47 if (ir_type == IR_TYPE_UNKNOWN)
... ... @@ -77,7 +77,7 @@
77 77 size_t len)
78 78 {
79 79 struct ir_input_dev *ir_dev = dev_get_drvdata(d);
80   - enum ir_type ir_type = IR_TYPE_UNKNOWN;
  80 + u64 ir_type = IR_TYPE_UNKNOWN;
81 81 int rc = -EINVAL;
82 82 unsigned long flags;
83 83 char *buf;
... ... @@ -92,7 +92,8 @@
92 92 ir_type = IR_TYPE_NEC;
93 93  
94 94 if (ir_type == IR_TYPE_UNKNOWN) {
95   - IR_dprintk(1, "Error setting protocol to %ld\n", ir_type);
  95 + IR_dprintk(1, "Error setting protocol to %lld\n",
  96 + (long long)ir_type);
96 97 return -EINVAL;
97 98 }
98 99  
... ... @@ -101,7 +102,8 @@
101 102 ir_type);
102 103  
103 104 if (rc < 0) {
104   - IR_dprintk(1, "Error setting protocol to %ld\n", ir_type);
  105 + IR_dprintk(1, "Error setting protocol to %lld\n",
  106 + (long long)ir_type);
105 107 return -EINVAL;
106 108 }
107 109  
... ... @@ -109,7 +111,8 @@
109 111 ir_dev->rc_tab.ir_type = ir_type;
110 112 spin_unlock_irqrestore(&ir_dev->rc_tab.lock, flags);
111 113  
112   - IR_dprintk(1, "Current protocol is %ld\n", ir_type);
  114 + IR_dprintk(1, "Current protocol is %lld\n",
  115 + (long long)ir_type);
113 116  
114 117 return len;
115 118 }
drivers/media/dvb/dm1105/dm1105.c
... ... @@ -578,7 +578,7 @@
578 578 {
579 579 struct input_dev *input_dev;
580 580 struct ir_scancode_table *ir_codes = &ir_codes_dm1105_nec_table;
581   - enum ir_type ir_type = IR_TYPE_OTHER;
  581 + u64 ir_type = IR_TYPE_OTHER;
582 582 int err = -ENOMEM;
583 583  
584 584 input_dev = input_allocate_device();
drivers/media/video/bt8xx/bttv-input.c
... ... @@ -247,7 +247,7 @@
247 247 struct card_ir *ir;
248 248 struct ir_scancode_table *ir_codes = NULL;
249 249 struct input_dev *input_dev;
250   - enum ir_type ir_type = IR_TYPE_OTHER;
  250 + u64 ir_type = IR_TYPE_OTHER;
251 251 int err = -ENOMEM;
252 252  
253 253 if (!btv->has_remote)
drivers/media/video/cx88/cx88-input.c
... ... @@ -192,7 +192,7 @@
192 192 struct cx88_IR *ir;
193 193 struct input_dev *input_dev;
194 194 struct ir_scancode_table *ir_codes = NULL;
195   - enum ir_type ir_type = IR_TYPE_OTHER;
  195 + u64 ir_type = IR_TYPE_OTHER;
196 196 int err = -ENOMEM;
197 197  
198 198 ir = kzalloc(sizeof(*ir), GFP_KERNEL);
drivers/media/video/em28xx/em28xx-input.c
... ... @@ -340,7 +340,7 @@
340 340 cancel_delayed_work_sync(&ir->work);
341 341 }
342 342  
343   -int em28xx_ir_change_protocol(void *priv, enum ir_type ir_type)
  343 +int em28xx_ir_change_protocol(void *priv, u64 ir_type)
344 344 {
345 345 int rc = 0;
346 346 struct em28xx_IR *ir = priv;
drivers/media/video/ir-kbd-i2c.c
... ... @@ -299,7 +299,7 @@
299 299 {
300 300 struct ir_scancode_table *ir_codes = NULL;
301 301 const char *name = NULL;
302   - enum ir_type ir_type = 0;
  302 + u64 ir_type = 0;
303 303 struct IR_i2c *ir;
304 304 struct input_dev *input_dev;
305 305 struct i2c_adapter *adap = client->adapter;
drivers/media/video/saa7134/saa7134-input.c
... ... @@ -460,7 +460,7 @@
460 460 int polling = 0;
461 461 int rc5_gpio = 0;
462 462 int nec_gpio = 0;
463   - enum ir_type ir_type = IR_TYPE_OTHER;
  463 + u64 ir_type = IR_TYPE_OTHER;
464 464 int err;
465 465  
466 466 if (dev->has_remote != SAA7134_REMOTE_GPIO)
include/media/ir-common.h
... ... @@ -35,7 +35,7 @@
35 35  
36 36 struct ir_input_state {
37 37 /* configuration */
38   - enum ir_type ir_type;
  38 + u64 ir_type;
39 39  
40 40 /* key info */
41 41 u32 ir_key; /* ir scancode */
... ... @@ -84,7 +84,7 @@
84 84 /* Routines from ir-functions.c */
85 85  
86 86 int ir_input_init(struct input_dev *dev, struct ir_input_state *ir,
87   - const enum ir_type ir_type);
  87 + const u64 ir_type);
88 88 void ir_input_nokey(struct input_dev *dev, struct ir_input_state *ir);
89 89 void ir_input_keydown(struct input_dev *dev, struct ir_input_state *ir,
90 90 u32 ir_key);
include/media/ir-core.h
... ... @@ -21,13 +21,11 @@
21 21 #define IR_dprintk(level, fmt, arg...) if (ir_core_debug >= level) \
22 22 printk(KERN_DEBUG "%s: " fmt , __func__, ## arg)
23 23  
24   -enum ir_type {
25   - IR_TYPE_UNKNOWN = 0,
26   - IR_TYPE_RC5 = 1L << 0, /* Philips RC5 protocol */
27   - IR_TYPE_PD = 1L << 1, /* Pulse distance encoded IR */
28   - IR_TYPE_NEC = 1L << 2,
29   - IR_TYPE_OTHER = 1L << 63,
30   -};
  24 +#define IR_TYPE_UNKNOWN 0
  25 +#define IR_TYPE_RC5 (1 << 0) /* Philips RC5 protocol */
  26 +#define IR_TYPE_PD (1 << 1) /* Pulse distance encoded IR */
  27 +#define IR_TYPE_NEC (1 << 2)
  28 +#define IR_TYPE_OTHER (((u64)1) << 63l)
31 29  
32 30 struct ir_scancode {
33 31 u16 scancode;
34 32  
... ... @@ -37,14 +35,14 @@
37 35 struct ir_scancode_table {
38 36 struct ir_scancode *scan;
39 37 int size;
40   - enum ir_type ir_type;
  38 + u64 ir_type;
41 39 spinlock_t lock;
42 40 };
43 41  
44 42 struct ir_dev_props {
45 43 unsigned long allowed_protos;
46 44 void *priv;
47   - int (*change_protocol)(void *priv, enum ir_type ir_type);
  45 + int (*change_protocol)(void *priv, u64 ir_type);
48 46 };
49 47  
50 48  
include/media/ir-kbd-i2c.h
... ... @@ -36,7 +36,7 @@
36 36 struct IR_i2c_init_data {
37 37 struct ir_scancode_table *ir_codes;
38 38 const char *name;
39   - enum ir_type type; /* IR_TYPE_RC5, IR_TYPE_PD, etc */
  39 + u64 type; /* IR_TYPE_RC5, IR_TYPE_PD, etc */
40 40 /*
41 41 * Specify either a function pointer or a value indicating one of
42 42 * ir_kbd_i2c's internal get_key functions