Commit 651c7a5f authored by David Härdeman's avatar David Härdeman Committed by Mauro Carvalho Chehab

[media] saa7134: some minor cleanups

Mostly using appropriate data types and constants (e.g. int -> bool).
Signed-off-by: default avatarDavid Härdeman <david@hardeman.nu>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent b0ddb0f3
...@@ -407,17 +407,16 @@ static int __saa7134_ir_start(void *priv) ...@@ -407,17 +407,16 @@ static int __saa7134_ir_start(void *priv)
struct saa7134_dev *dev = priv; struct saa7134_dev *dev = priv;
struct saa7134_card_ir *ir; struct saa7134_card_ir *ir;
if (!dev) if (!dev || !dev->remote)
return -EINVAL; return -EINVAL;
ir = dev->remote; ir = dev->remote;
if (!ir)
return -EINVAL;
if (ir->running) if (ir->running)
return 0; return 0;
ir->running = true; ir->running = true;
ir->active = false;
if (ir->polling) { if (ir->polling) {
setup_timer(&ir->timer, saa7134_input_timer, setup_timer(&ir->timer, saa7134_input_timer,
(unsigned long)dev); (unsigned long)dev);
...@@ -425,10 +424,8 @@ static int __saa7134_ir_start(void *priv) ...@@ -425,10 +424,8 @@ static int __saa7134_ir_start(void *priv)
add_timer(&ir->timer); add_timer(&ir->timer);
} else if (ir->raw_decode) { } else if (ir->raw_decode) {
/* set timer_end for code completion */ /* set timer_end for code completion */
init_timer(&ir->timer_end); setup_timer(&ir->timer_end, ir_raw_decode_timer_end,
ir->timer_end.function = ir_raw_decode_timer_end; (unsigned long)dev);
ir->timer_end.data = (unsigned long)dev;
ir->active = false;
} }
return 0; return 0;
...@@ -439,22 +436,19 @@ static void __saa7134_ir_stop(void *priv) ...@@ -439,22 +436,19 @@ static void __saa7134_ir_stop(void *priv)
struct saa7134_dev *dev = priv; struct saa7134_dev *dev = priv;
struct saa7134_card_ir *ir; struct saa7134_card_ir *ir;
if (!dev) if (!dev || !dev->remote)
return; return;
ir = dev->remote; ir = dev->remote;
if (!ir)
return;
if (!ir->running) if (!ir->running)
return; return;
if (dev->remote->polling)
del_timer_sync(&dev->remote->timer); if (ir->polling)
else if (ir->raw_decode) { del_timer_sync(&ir->timer);
else if (ir->raw_decode)
del_timer_sync(&ir->timer_end); del_timer_sync(&ir->timer_end);
ir->active = false;
}
ir->active = false;
ir->running = false; ir->running = false;
return; return;
...@@ -499,8 +493,8 @@ int saa7134_input_init1(struct saa7134_dev *dev) ...@@ -499,8 +493,8 @@ int saa7134_input_init1(struct saa7134_dev *dev)
u32 mask_keycode = 0; u32 mask_keycode = 0;
u32 mask_keydown = 0; u32 mask_keydown = 0;
u32 mask_keyup = 0; u32 mask_keyup = 0;
int polling = 0; unsigned polling = 0;
int raw_decode = 0; bool raw_decode = false;
int err; int err;
if (dev->has_remote != SAA7134_REMOTE_GPIO) if (dev->has_remote != SAA7134_REMOTE_GPIO)
...@@ -565,14 +559,14 @@ int saa7134_input_init1(struct saa7134_dev *dev) ...@@ -565,14 +559,14 @@ int saa7134_input_init1(struct saa7134_dev *dev)
mask_keydown = 0x0040000; /* Enable GPIO18 line on both edges */ mask_keydown = 0x0040000; /* Enable GPIO18 line on both edges */
mask_keyup = 0x0040000; mask_keyup = 0x0040000;
mask_keycode = 0xffff; mask_keycode = 0xffff;
raw_decode = 1; raw_decode = true;
break; break;
case SAA7134_BOARD_AVERMEDIA_M733A: case SAA7134_BOARD_AVERMEDIA_M733A:
ir_codes = RC_MAP_AVERMEDIA_M733A_RM_K6; ir_codes = RC_MAP_AVERMEDIA_M733A_RM_K6;
mask_keydown = 0x0040000; mask_keydown = 0x0040000;
mask_keyup = 0x0040000; mask_keyup = 0x0040000;
mask_keycode = 0xffff; mask_keycode = 0xffff;
raw_decode = 1; raw_decode = true;
break; break;
case SAA7134_BOARD_AVERMEDIA_777: case SAA7134_BOARD_AVERMEDIA_777:
case SAA7134_BOARD_AVERMEDIA_A16AR: case SAA7134_BOARD_AVERMEDIA_A16AR:
...@@ -679,7 +673,7 @@ int saa7134_input_init1(struct saa7134_dev *dev) ...@@ -679,7 +673,7 @@ int saa7134_input_init1(struct saa7134_dev *dev)
mask_keydown = 0x0040000; /* Enable GPIO18 line on both edges */ mask_keydown = 0x0040000; /* Enable GPIO18 line on both edges */
mask_keyup = 0x0040000; mask_keyup = 0x0040000;
mask_keycode = 0xffff; mask_keycode = 0xffff;
raw_decode = 1; raw_decode = true;
break; break;
case SAA7134_BOARD_ENCORE_ENLTV: case SAA7134_BOARD_ENCORE_ENLTV:
case SAA7134_BOARD_ENCORE_ENLTV_FM: case SAA7134_BOARD_ENCORE_ENLTV_FM:
...@@ -693,7 +687,7 @@ int saa7134_input_init1(struct saa7134_dev *dev) ...@@ -693,7 +687,7 @@ int saa7134_input_init1(struct saa7134_dev *dev)
mask_keydown = 0x0040000; /* Enable GPIO18 line on both edges */ mask_keydown = 0x0040000; /* Enable GPIO18 line on both edges */
mask_keyup = 0x0040000; mask_keyup = 0x0040000;
mask_keycode = 0xffff; mask_keycode = 0xffff;
raw_decode = 1; raw_decode = true;
break; break;
case SAA7134_BOARD_10MOONSTVMASTER3: case SAA7134_BOARD_10MOONSTVMASTER3:
ir_codes = RC_MAP_ENCORE_ENLTV; ir_codes = RC_MAP_ENCORE_ENLTV;
...@@ -746,8 +740,6 @@ int saa7134_input_init1(struct saa7134_dev *dev) ...@@ -746,8 +740,6 @@ int saa7134_input_init1(struct saa7134_dev *dev)
ir->dev = rc; ir->dev = rc;
dev->remote = ir; dev->remote = ir;
ir->running = false;
/* init hardware-specific stuff */ /* init hardware-specific stuff */
ir->mask_keycode = mask_keycode; ir->mask_keycode = mask_keycode;
ir->mask_keydown = mask_keydown; ir->mask_keydown = mask_keydown;
...@@ -809,14 +801,12 @@ void saa7134_input_fini(struct saa7134_dev *dev) ...@@ -809,14 +801,12 @@ void saa7134_input_fini(struct saa7134_dev *dev)
void saa7134_probe_i2c_ir(struct saa7134_dev *dev) void saa7134_probe_i2c_ir(struct saa7134_dev *dev)
{ {
struct i2c_board_info info; struct i2c_board_info info;
struct i2c_msg msg_msi = { struct i2c_msg msg_msi = {
.addr = 0x50, .addr = 0x50,
.flags = I2C_M_RD, .flags = I2C_M_RD,
.len = 0, .len = 0,
.buf = NULL, .buf = NULL,
}; };
int rc; int rc;
if (disable_ir) { if (disable_ir) {
...@@ -916,8 +906,8 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev) ...@@ -916,8 +906,8 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev)
static int saa7134_raw_decode_irq(struct saa7134_dev *dev) static int saa7134_raw_decode_irq(struct saa7134_dev *dev)
{ {
struct saa7134_card_ir *ir = dev->remote; struct saa7134_card_ir *ir = dev->remote;
unsigned long timeout; unsigned long timeout;
int space; int space;
/* Generate initial event */ /* Generate initial event */
...@@ -926,7 +916,6 @@ static int saa7134_raw_decode_irq(struct saa7134_dev *dev) ...@@ -926,7 +916,6 @@ static int saa7134_raw_decode_irq(struct saa7134_dev *dev)
space = saa_readl(SAA7134_GPIO_GPSTATUS0 >> 2) & ir->mask_keydown; space = saa_readl(SAA7134_GPIO_GPSTATUS0 >> 2) & ir->mask_keydown;
ir_raw_event_store_edge(dev->remote->dev, space ? IR_SPACE : IR_PULSE); ir_raw_event_store_edge(dev->remote->dev, space ? IR_SPACE : IR_PULSE);
/* /*
* Wait 15 ms from the start of the first IR event before processing * Wait 15 ms from the start of the first IR event before processing
* the event. This time is enough for NEC protocol. May need adjustments * the event. This time is enough for NEC protocol. May need adjustments
......
...@@ -124,7 +124,7 @@ struct saa7134_card_ir { ...@@ -124,7 +124,7 @@ struct saa7134_card_ir {
char name[32]; char name[32];
char phys[32]; char phys[32];
int users; unsigned users;
u32 polling; u32 polling;
u32 last_gpio; u32 last_gpio;
...@@ -551,7 +551,7 @@ struct saa7134_dev { ...@@ -551,7 +551,7 @@ struct saa7134_dev {
/* infrared remote */ /* infrared remote */
int has_remote; int has_remote;
struct saa7134_card_ir *remote; struct saa7134_card_ir *remote;
/* pci i/o */ /* pci i/o */
char name[32]; char name[32];
......
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