Commit 971e8298 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

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: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 3f831107
...@@ -52,7 +52,7 @@ static void ir_input_key_event(struct input_dev *dev, struct ir_input_state *ir) ...@@ -52,7 +52,7 @@ static void ir_input_key_event(struct input_dev *dev, struct ir_input_state *ir)
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
int ir_input_init(struct input_dev *dev, struct ir_input_state *ir, int ir_input_init(struct input_dev *dev, struct ir_input_state *ir,
const enum ir_type ir_type) const u64 ir_type)
{ {
ir->ir_type = ir_type; ir->ir_type = ir_type;
......
...@@ -39,9 +39,9 @@ static ssize_t show_protocol(struct device *d, ...@@ -39,9 +39,9 @@ static ssize_t show_protocol(struct device *d,
{ {
char *s; char *s;
struct ir_input_dev *ir_dev = dev_get_drvdata(d); struct ir_input_dev *ir_dev = dev_get_drvdata(d);
enum ir_type ir_type = ir_dev->rc_tab.ir_type; u64 ir_type = ir_dev->rc_tab.ir_type;
IR_dprintk(1, "Current protocol is %ld\n", ir_type); IR_dprintk(1, "Current protocol is %lld\n", (long long)ir_type);
/* FIXME: doesn't support multiple protocols at the same time */ /* FIXME: doesn't support multiple protocols at the same time */
if (ir_type == IR_TYPE_UNKNOWN) if (ir_type == IR_TYPE_UNKNOWN)
...@@ -77,7 +77,7 @@ static ssize_t store_protocol(struct device *d, ...@@ -77,7 +77,7 @@ static ssize_t store_protocol(struct device *d,
size_t len) size_t len)
{ {
struct ir_input_dev *ir_dev = dev_get_drvdata(d); struct ir_input_dev *ir_dev = dev_get_drvdata(d);
enum ir_type ir_type = IR_TYPE_UNKNOWN; u64 ir_type = IR_TYPE_UNKNOWN;
int rc = -EINVAL; int rc = -EINVAL;
unsigned long flags; unsigned long flags;
char *buf; char *buf;
...@@ -92,7 +92,8 @@ static ssize_t store_protocol(struct device *d, ...@@ -92,7 +92,8 @@ static ssize_t store_protocol(struct device *d,
ir_type = IR_TYPE_NEC; ir_type = IR_TYPE_NEC;
if (ir_type == IR_TYPE_UNKNOWN) { if (ir_type == IR_TYPE_UNKNOWN) {
IR_dprintk(1, "Error setting protocol to %ld\n", ir_type); IR_dprintk(1, "Error setting protocol to %lld\n",
(long long)ir_type);
return -EINVAL; return -EINVAL;
} }
...@@ -101,7 +102,8 @@ static ssize_t store_protocol(struct device *d, ...@@ -101,7 +102,8 @@ static ssize_t store_protocol(struct device *d,
ir_type); ir_type);
if (rc < 0) { if (rc < 0) {
IR_dprintk(1, "Error setting protocol to %ld\n", ir_type); IR_dprintk(1, "Error setting protocol to %lld\n",
(long long)ir_type);
return -EINVAL; return -EINVAL;
} }
...@@ -109,7 +111,8 @@ static ssize_t store_protocol(struct device *d, ...@@ -109,7 +111,8 @@ static ssize_t store_protocol(struct device *d,
ir_dev->rc_tab.ir_type = ir_type; ir_dev->rc_tab.ir_type = ir_type;
spin_unlock_irqrestore(&ir_dev->rc_tab.lock, flags); spin_unlock_irqrestore(&ir_dev->rc_tab.lock, flags);
IR_dprintk(1, "Current protocol is %ld\n", ir_type); IR_dprintk(1, "Current protocol is %lld\n",
(long long)ir_type);
return len; return len;
} }
......
...@@ -578,7 +578,7 @@ int __devinit dm1105_ir_init(struct dm1105dvb *dm1105) ...@@ -578,7 +578,7 @@ int __devinit dm1105_ir_init(struct dm1105dvb *dm1105)
{ {
struct input_dev *input_dev; struct input_dev *input_dev;
struct ir_scancode_table *ir_codes = &ir_codes_dm1105_nec_table; struct ir_scancode_table *ir_codes = &ir_codes_dm1105_nec_table;
enum ir_type ir_type = IR_TYPE_OTHER; u64 ir_type = IR_TYPE_OTHER;
int err = -ENOMEM; int err = -ENOMEM;
input_dev = input_allocate_device(); input_dev = input_allocate_device();
......
...@@ -247,7 +247,7 @@ int bttv_input_init(struct bttv *btv) ...@@ -247,7 +247,7 @@ int bttv_input_init(struct bttv *btv)
struct card_ir *ir; struct card_ir *ir;
struct ir_scancode_table *ir_codes = NULL; struct ir_scancode_table *ir_codes = NULL;
struct input_dev *input_dev; struct input_dev *input_dev;
enum ir_type ir_type = IR_TYPE_OTHER; u64 ir_type = IR_TYPE_OTHER;
int err = -ENOMEM; int err = -ENOMEM;
if (!btv->has_remote) if (!btv->has_remote)
......
...@@ -192,7 +192,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) ...@@ -192,7 +192,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)
struct cx88_IR *ir; struct cx88_IR *ir;
struct input_dev *input_dev; struct input_dev *input_dev;
struct ir_scancode_table *ir_codes = NULL; struct ir_scancode_table *ir_codes = NULL;
enum ir_type ir_type = IR_TYPE_OTHER; u64 ir_type = IR_TYPE_OTHER;
int err = -ENOMEM; int err = -ENOMEM;
ir = kzalloc(sizeof(*ir), GFP_KERNEL); ir = kzalloc(sizeof(*ir), GFP_KERNEL);
......
...@@ -340,7 +340,7 @@ static void em28xx_ir_stop(struct em28xx_IR *ir) ...@@ -340,7 +340,7 @@ static void em28xx_ir_stop(struct em28xx_IR *ir)
cancel_delayed_work_sync(&ir->work); cancel_delayed_work_sync(&ir->work);
} }
int em28xx_ir_change_protocol(void *priv, enum ir_type ir_type) int em28xx_ir_change_protocol(void *priv, u64 ir_type)
{ {
int rc = 0; int rc = 0;
struct em28xx_IR *ir = priv; struct em28xx_IR *ir = priv;
......
...@@ -299,7 +299,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) ...@@ -299,7 +299,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
{ {
struct ir_scancode_table *ir_codes = NULL; struct ir_scancode_table *ir_codes = NULL;
const char *name = NULL; const char *name = NULL;
enum ir_type ir_type = 0; u64 ir_type = 0;
struct IR_i2c *ir; struct IR_i2c *ir;
struct input_dev *input_dev; struct input_dev *input_dev;
struct i2c_adapter *adap = client->adapter; struct i2c_adapter *adap = client->adapter;
......
...@@ -460,7 +460,7 @@ int saa7134_input_init1(struct saa7134_dev *dev) ...@@ -460,7 +460,7 @@ int saa7134_input_init1(struct saa7134_dev *dev)
int polling = 0; int polling = 0;
int rc5_gpio = 0; int rc5_gpio = 0;
int nec_gpio = 0; int nec_gpio = 0;
enum ir_type ir_type = IR_TYPE_OTHER; u64 ir_type = IR_TYPE_OTHER;
int err; int err;
if (dev->has_remote != SAA7134_REMOTE_GPIO) if (dev->has_remote != SAA7134_REMOTE_GPIO)
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
struct ir_input_state { struct ir_input_state {
/* configuration */ /* configuration */
enum ir_type ir_type; u64 ir_type;
/* key info */ /* key info */
u32 ir_key; /* ir scancode */ u32 ir_key; /* ir scancode */
...@@ -84,7 +84,7 @@ struct card_ir { ...@@ -84,7 +84,7 @@ struct card_ir {
/* Routines from ir-functions.c */ /* Routines from ir-functions.c */
int ir_input_init(struct input_dev *dev, struct ir_input_state *ir, int ir_input_init(struct input_dev *dev, struct ir_input_state *ir,
const enum ir_type ir_type); const u64 ir_type);
void ir_input_nokey(struct input_dev *dev, struct ir_input_state *ir); void ir_input_nokey(struct input_dev *dev, struct ir_input_state *ir);
void ir_input_keydown(struct input_dev *dev, struct ir_input_state *ir, void ir_input_keydown(struct input_dev *dev, struct ir_input_state *ir,
u32 ir_key); u32 ir_key);
......
...@@ -21,13 +21,11 @@ extern int ir_core_debug; ...@@ -21,13 +21,11 @@ extern int ir_core_debug;
#define IR_dprintk(level, fmt, arg...) if (ir_core_debug >= level) \ #define IR_dprintk(level, fmt, arg...) if (ir_core_debug >= level) \
printk(KERN_DEBUG "%s: " fmt , __func__, ## arg) printk(KERN_DEBUG "%s: " fmt , __func__, ## arg)
enum ir_type { #define IR_TYPE_UNKNOWN 0
IR_TYPE_UNKNOWN = 0, #define IR_TYPE_RC5 (1 << 0) /* Philips RC5 protocol */
IR_TYPE_RC5 = 1L << 0, /* Philips RC5 protocol */ #define IR_TYPE_PD (1 << 1) /* Pulse distance encoded IR */
IR_TYPE_PD = 1L << 1, /* Pulse distance encoded IR */ #define IR_TYPE_NEC (1 << 2)
IR_TYPE_NEC = 1L << 2, #define IR_TYPE_OTHER (((u64)1) << 63l)
IR_TYPE_OTHER = 1L << 63,
};
struct ir_scancode { struct ir_scancode {
u16 scancode; u16 scancode;
...@@ -37,14 +35,14 @@ struct ir_scancode { ...@@ -37,14 +35,14 @@ struct ir_scancode {
struct ir_scancode_table { struct ir_scancode_table {
struct ir_scancode *scan; struct ir_scancode *scan;
int size; int size;
enum ir_type ir_type; u64 ir_type;
spinlock_t lock; spinlock_t lock;
}; };
struct ir_dev_props { struct ir_dev_props {
unsigned long allowed_protos; unsigned long allowed_protos;
void *priv; void *priv;
int (*change_protocol)(void *priv, enum ir_type ir_type); int (*change_protocol)(void *priv, u64 ir_type);
}; };
......
...@@ -36,7 +36,7 @@ enum ir_kbd_get_key_fn { ...@@ -36,7 +36,7 @@ enum ir_kbd_get_key_fn {
struct IR_i2c_init_data { struct IR_i2c_init_data {
struct ir_scancode_table *ir_codes; struct ir_scancode_table *ir_codes;
const char *name; const char *name;
enum ir_type type; /* IR_TYPE_RC5, IR_TYPE_PD, etc */ u64 type; /* IR_TYPE_RC5, IR_TYPE_PD, etc */
/* /*
* Specify either a function pointer or a value indicating one of * Specify either a function pointer or a value indicating one of
* ir_kbd_i2c's internal get_key functions * ir_kbd_i2c's internal get_key functions
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment