aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/bt8xx/bttv-input.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/bt8xx/bttv-input.c')
-rw-r--r--drivers/media/video/bt8xx/bttv-input.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/media/video/bt8xx/bttv-input.c b/drivers/media/video/bt8xx/bttv-input.c
index ebd51afe8761..84a957e52c4b 100644
--- a/drivers/media/video/bt8xx/bttv-input.c
+++ b/drivers/media/video/bt8xx/bttv-input.c
@@ -73,12 +73,12 @@ static void ir_handle_key(struct bttv *btv)
73 73
74 if ((ir->mask_keydown && (0 != (gpio & ir->mask_keydown))) || 74 if ((ir->mask_keydown && (0 != (gpio & ir->mask_keydown))) ||
75 (ir->mask_keyup && (0 == (gpio & ir->mask_keyup)))) { 75 (ir->mask_keyup && (0 == (gpio & ir->mask_keyup)))) {
76 ir_input_keydown(ir->dev,&ir->ir,data,data); 76 ir_input_keydown(ir->dev, &ir->ir, data);
77 } else { 77 } else {
78 /* HACK: Probably, ir->mask_keydown is missing 78 /* HACK: Probably, ir->mask_keydown is missing
79 for this board */ 79 for this board */
80 if (btv->c.type == BTTV_BOARD_WINFAST2000) 80 if (btv->c.type == BTTV_BOARD_WINFAST2000)
81 ir_input_keydown(ir->dev, &ir->ir, data, data); 81 ir_input_keydown(ir->dev, &ir->ir, data);
82 82
83 ir_input_nokey(ir->dev,&ir->ir); 83 ir_input_nokey(ir->dev,&ir->ir);
84 } 84 }
@@ -104,7 +104,7 @@ static void ir_enltv_handle_key(struct bttv *btv)
104 gpio, data, 104 gpio, data,
105 (gpio & ir->mask_keyup) ? " up" : "up/down"); 105 (gpio & ir->mask_keyup) ? " up" : "up/down");
106 106
107 ir_input_keydown(ir->dev, &ir->ir, data, data); 107 ir_input_keydown(ir->dev, &ir->ir, data);
108 if (keyup) 108 if (keyup)
109 ir_input_nokey(ir->dev, &ir->ir); 109 ir_input_nokey(ir->dev, &ir->ir);
110 } else { 110 } else {
@@ -118,7 +118,7 @@ static void ir_enltv_handle_key(struct bttv *btv)
118 if (keyup) 118 if (keyup)
119 ir_input_nokey(ir->dev, &ir->ir); 119 ir_input_nokey(ir->dev, &ir->ir);
120 else 120 else
121 ir_input_keydown(ir->dev, &ir->ir, data, data); 121 ir_input_keydown(ir->dev, &ir->ir, data);
122 } 122 }
123 123
124 ir->last_gpio = data | keyup; 124 ir->last_gpio = data | keyup;
@@ -368,7 +368,10 @@ int bttv_input_init(struct bttv *btv)
368 snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", 368 snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0",
369 pci_name(btv->c.pci)); 369 pci_name(btv->c.pci));
370 370
371 ir_input_init(input_dev, &ir->ir, ir_type, ir_codes); 371 err = ir_input_init(input_dev, &ir->ir, ir_type, ir_codes);
372 if (err < 0)
373 goto err_out_free;
374
372 input_dev->name = ir->name; 375 input_dev->name = ir->name;
373 input_dev->phys = ir->phys; 376 input_dev->phys = ir->phys;
374 input_dev->id.bustype = BUS_PCI; 377 input_dev->id.bustype = BUS_PCI;
@@ -400,6 +403,7 @@ int bttv_input_init(struct bttv *btv)
400 bttv_ir_stop(btv); 403 bttv_ir_stop(btv);
401 btv->remote = NULL; 404 btv->remote = NULL;
402 err_out_free: 405 err_out_free:
406 ir_input_free(input_dev);
403 input_free_device(input_dev); 407 input_free_device(input_dev);
404 kfree(ir); 408 kfree(ir);
405 return err; 409 return err;
@@ -411,6 +415,7 @@ void bttv_input_fini(struct bttv *btv)
411 return; 415 return;
412 416
413 bttv_ir_stop(btv); 417 bttv_ir_stop(btv);
418 ir_input_free(btv->remote->dev);
414 input_unregister_device(btv->remote->dev); 419 input_unregister_device(btv->remote->dev);
415 kfree(btv->remote); 420 kfree(btv->remote);
416 btv->remote = NULL; 421 btv->remote = NULL;