Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wirel...
[sfrench/cifs-2.6.git] / drivers / media / video / cx88 / cx88-input.c
index 47c03019357d28a831083d51ac001a50baae21df..92b8cdf9fb815296ee102cffe98666416bafe192 100644 (file)
@@ -118,13 +118,13 @@ static void cx88_ir_handle_key(struct cx88_IR *ir)
 
                data = (data << 4) | ((gpio_key & 0xf0) >> 4);
 
-               ir_input_keydown(ir->input, &ir->ir, data, data);
+               ir_input_keydown(ir->input, &ir->ir, data);
                ir_input_nokey(ir->input, &ir->ir);
 
        } else if (ir->mask_keydown) {
                /* bit set on keydown */
                if (gpio & ir->mask_keydown) {
-                       ir_input_keydown(ir->input, &ir->ir, data, data);
+                       ir_input_keydown(ir->input, &ir->ir, data);
                } else {
                        ir_input_nokey(ir->input, &ir->ir);
                }
@@ -132,14 +132,14 @@ static void cx88_ir_handle_key(struct cx88_IR *ir)
        } else if (ir->mask_keyup) {
                /* bit cleared on keydown */
                if (0 == (gpio & ir->mask_keyup)) {
-                       ir_input_keydown(ir->input, &ir->ir, data, data);
+                       ir_input_keydown(ir->input, &ir->ir, data);
                } else {
                        ir_input_nokey(ir->input, &ir->ir);
                }
 
        } else {
                /* can't distinguish keydown/up :-/ */
-               ir_input_keydown(ir->input, &ir->ir, data, data);
+               ir_input_keydown(ir->input, &ir->ir, data);
                ir_input_nokey(ir->input, &ir->ir);
        }
 }
@@ -360,7 +360,10 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)
        snprintf(ir->name, sizeof(ir->name), "cx88 IR (%s)", core->board.name);
        snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", pci_name(pci));
 
-       ir_input_init(input_dev, &ir->ir, ir_type, ir_codes);
+       err = ir_input_init(input_dev, &ir->ir, ir_type, ir_codes);
+       if (err < 0)
+               goto err_out_free;
+
        input_dev->name = ir->name;
        input_dev->phys = ir->phys;
        input_dev->id.bustype = BUS_PCI;
@@ -390,6 +393,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)
        cx88_ir_stop(core, ir);
        core->ir = NULL;
  err_out_free:
+       ir_input_free(input_dev);
        input_free_device(input_dev);
        kfree(ir);
        return err;
@@ -404,6 +408,7 @@ int cx88_ir_fini(struct cx88_core *core)
                return 0;
 
        cx88_ir_stop(core, ir);
+       ir_input_free(ir->input);
        input_unregister_device(ir->input);
        kfree(ir);
 
@@ -487,7 +492,7 @@ void cx88_ir_irq(struct cx88_core *core)
 
                ir_dprintk("Key Code: %x\n", (ircode >> 16) & 0x7f);
 
-               ir_input_keydown(ir->input, &ir->ir, (ircode >> 16) & 0x7f, (ircode >> 16) & 0xff);
+               ir_input_keydown(ir->input, &ir->ir, (ircode >> 16) & 0x7f);
                ir->release = jiffies + msecs_to_jiffies(120);
                break;
        case CX88_BOARD_HAUPPAUGE:
@@ -524,7 +529,7 @@ void cx88_ir_irq(struct cx88_core *core)
                if ( dev != 0x1e && dev != 0x1f )
                        /* not a hauppauge remote */
                        break;
-               ir_input_keydown(ir->input, &ir->ir, code, ircode);
+               ir_input_keydown(ir->input, &ir->ir, code);
                ir->release = jiffies + msecs_to_jiffies(120);
                break;
        case CX88_BOARD_PINNACLE_PCTV_HD_800i:
@@ -532,7 +537,7 @@ void cx88_ir_irq(struct cx88_core *core)
                ir_dprintk("biphase decoded: %x\n", ircode);
                if ((ircode & 0xfffff000) != 0x3000)
                        break;
-               ir_input_keydown(ir->input, &ir->ir, ircode & 0x3f, ircode);
+               ir_input_keydown(ir->input, &ir->ir, ircode & 0x3f);
                ir->release = jiffies + msecs_to_jiffies(120);
                break;
        }