Commit 579e7d60 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

V4L/DVB (13617): ir: move input_register_device() to happen inside ir_input_register()

We'll need to register a sysfs class for the IR devices. As such, the better
is to have the input_register_device()/input_unregister_device() inside
the ir register/unregister functions.

Also, solves a naming problem with V4L ir_input_init() function, that were,
in fact, registering a device.

While here, do a few cleanups at budget-ci IR logic.
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 38ef6aa8
...@@ -52,15 +52,13 @@ static void ir_input_key_event(struct input_dev *dev, struct ir_input_state *ir) ...@@ -52,15 +52,13 @@ 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,
int ir_type, struct ir_scancode_table *ir_codes) int ir_type)
{ {
ir->ir_type = ir_type; ir->ir_type = ir_type;
if (repeat) if (repeat)
set_bit(EV_REP, dev->evbit); set_bit(EV_REP, dev->evbit);
ir_input_register(dev, ir_codes);
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(ir_input_init); EXPORT_SYMBOL_GPL(ir_input_init);
......
...@@ -12,8 +12,8 @@ ...@@ -12,8 +12,8 @@
* GNU General Public License for more details. * GNU General Public License for more details.
*/ */
#include <linux/usb/input.h>
#include <linux/usb/input.h>
#include <media/ir-common.h> #include <media/ir-common.h>
#define IR_TAB_MIN_SIZE 32 #define IR_TAB_MIN_SIZE 32
...@@ -408,7 +408,7 @@ int ir_input_register(struct input_dev *input_dev, ...@@ -408,7 +408,7 @@ int ir_input_register(struct input_dev *input_dev,
{ {
struct ir_input_dev *ir_dev; struct ir_input_dev *ir_dev;
struct ir_scancode *keymap = rc_tab->scan; struct ir_scancode *keymap = rc_tab->scan;
int i; int i, rc;
if (rc_tab->scan == NULL || !rc_tab->size) if (rc_tab->scan == NULL || !rc_tab->size)
return -EINVAL; return -EINVAL;
...@@ -446,26 +446,34 @@ int ir_input_register(struct input_dev *input_dev, ...@@ -446,26 +446,34 @@ int ir_input_register(struct input_dev *input_dev,
input_dev->setkeycode = ir_setkeycode; input_dev->setkeycode = ir_setkeycode;
input_set_drvdata(input_dev, ir_dev); input_set_drvdata(input_dev, ir_dev);
return 0; rc = input_register_device(input_dev);
if (rc < 0) {
kfree(rc_tab->scan);
kfree(ir_dev);
input_set_drvdata(input_dev, NULL);
}
return rc;
} }
EXPORT_SYMBOL_GPL(ir_input_register); EXPORT_SYMBOL_GPL(ir_input_register);
void ir_input_unregister(struct input_dev *dev) void ir_input_unregister(struct input_dev *dev)
{ {
struct ir_input_dev *ir_dev = input_get_drvdata(dev); struct ir_input_dev *ir_dev = input_get_drvdata(dev);
struct ir_scancode_table *rc_tab = &ir_dev->rc_tab; struct ir_scancode_table *rc_tab;
if (!rc_tab) if (!ir_dev)
return; return;
IR_dprintk(1, "Freed keycode table\n"); IR_dprintk(1, "Freed keycode table\n");
rc_tab = &ir_dev->rc_tab;
rc_tab->size = 0; rc_tab->size = 0;
kfree(rc_tab->scan); kfree(rc_tab->scan);
rc_tab->scan = NULL; rc_tab->scan = NULL;
kfree(ir_dev); kfree(ir_dev);
input_set_drvdata(dev, NULL); input_unregister_device(dev);
} }
EXPORT_SYMBOL_GPL(ir_input_unregister); EXPORT_SYMBOL_GPL(ir_input_unregister);
......
...@@ -589,7 +589,7 @@ int __devinit dm1105_ir_init(struct dm1105dvb *dm1105) ...@@ -589,7 +589,7 @@ int __devinit dm1105_ir_init(struct dm1105dvb *dm1105)
snprintf(dm1105->ir.input_phys, sizeof(dm1105->ir.input_phys), snprintf(dm1105->ir.input_phys, sizeof(dm1105->ir.input_phys),
"pci-%s/ir0", pci_name(dm1105->pdev)); "pci-%s/ir0", pci_name(dm1105->pdev));
err = ir_input_init(input_dev, &dm1105->ir.ir, ir_type, ir_codes); err = ir_input_init(input_dev, &dm1105->ir.ir, ir_type);
if (err < 0) { if (err < 0) {
input_free_device(input_dev); input_free_device(input_dev);
return err; return err;
...@@ -611,20 +611,14 @@ int __devinit dm1105_ir_init(struct dm1105dvb *dm1105) ...@@ -611,20 +611,14 @@ int __devinit dm1105_ir_init(struct dm1105dvb *dm1105)
INIT_WORK(&dm1105->ir.work, dm1105_emit_key); INIT_WORK(&dm1105->ir.work, dm1105_emit_key);
err = input_register_device(input_dev); err = ir_input_register(input_dev, ir_codes);
if (err) {
ir_input_unregister(input_dev);
input_free_device(input_dev);
return err;
}
return 0; return err;
} }
void __devexit dm1105_ir_exit(struct dm1105dvb *dm1105) void __devexit dm1105_ir_exit(struct dm1105dvb *dm1105)
{ {
ir_input_unregister(dm1105->ir.input_dev); ir_input_unregister(dm1105->ir.input_dev);
input_unregister_device(dm1105->ir.input_dev);
} }
static int __devinit dm1105dvb_hw_init(struct dm1105dvb *dm1105dvb) static int __devinit dm1105dvb_hw_init(struct dm1105dvb *dm1105dvb)
......
...@@ -190,12 +190,13 @@ static int msp430_ir_init(struct budget_ci *budget_ci) ...@@ -190,12 +190,13 @@ static int msp430_ir_init(struct budget_ci *budget_ci)
struct saa7146_dev *saa = budget_ci->budget.dev; struct saa7146_dev *saa = budget_ci->budget.dev;
struct input_dev *input_dev = budget_ci->ir.dev; struct input_dev *input_dev = budget_ci->ir.dev;
int error; int error;
struct ir_scancode_table *ir_codes;
budget_ci->ir.dev = input_dev = input_allocate_device(); budget_ci->ir.dev = input_dev = input_allocate_device();
if (!input_dev) { if (!input_dev) {
printk(KERN_ERR "budget_ci: IR interface initialisation failed\n"); printk(KERN_ERR "budget_ci: IR interface initialisation failed\n");
error = -ENOMEM; return -ENOMEM;
goto out1;
} }
snprintf(budget_ci->ir.name, sizeof(budget_ci->ir.name), snprintf(budget_ci->ir.name, sizeof(budget_ci->ir.name),
...@@ -217,6 +218,11 @@ static int msp430_ir_init(struct budget_ci *budget_ci) ...@@ -217,6 +218,11 @@ static int msp430_ir_init(struct budget_ci *budget_ci)
} }
input_dev->dev.parent = &saa->pci->dev; input_dev->dev.parent = &saa->pci->dev;
if (rc5_device < 0)
budget_ci->ir.rc5_device = IR_DEVICE_ANY;
else
budget_ci->ir.rc5_device = rc5_device;
/* Select keymap and address */ /* Select keymap and address */
switch (budget_ci->budget.dev->pci->subsystem_device) { switch (budget_ci->budget.dev->pci->subsystem_device) {
case 0x100c: case 0x100c:
...@@ -224,53 +230,34 @@ static int msp430_ir_init(struct budget_ci *budget_ci) ...@@ -224,53 +230,34 @@ static int msp430_ir_init(struct budget_ci *budget_ci)
case 0x1011: case 0x1011:
case 0x1012: case 0x1012:
/* The hauppauge keymap is a superset of these remotes */ /* The hauppauge keymap is a superset of these remotes */
error = ir_input_init(input_dev, &budget_ci->ir.state, ir_codes = &ir_codes_hauppauge_new_table;
IR_TYPE_RC5, &ir_codes_hauppauge_new_table);
if (error < 0)
goto out2;
if (rc5_device < 0) if (rc5_device < 0)
budget_ci->ir.rc5_device = 0x1f; budget_ci->ir.rc5_device = 0x1f;
else
budget_ci->ir.rc5_device = rc5_device;
break; break;
case 0x1010: case 0x1010:
case 0x1017: case 0x1017:
case 0x101a: case 0x101a:
/* for the Technotrend 1500 bundled remote */ /* for the Technotrend 1500 bundled remote */
error = ir_input_init(input_dev, &budget_ci->ir.state, ir_codes = &ir_codes_tt_1500_table;
IR_TYPE_RC5, &ir_codes_tt_1500_table);
if (error < 0)
goto out2;
if (rc5_device < 0)
budget_ci->ir.rc5_device = IR_DEVICE_ANY;
else
budget_ci->ir.rc5_device = rc5_device;
break; break;
default: default:
/* unknown remote */ /* unknown remote */
error = ir_input_init(input_dev, &budget_ci->ir.state, ir_codes = &ir_codes_budget_ci_old_table;
IR_TYPE_RC5, &ir_codes_budget_ci_old_table);
if (error < 0)
goto out2;
if (rc5_device < 0)
budget_ci->ir.rc5_device = IR_DEVICE_ANY;
else
budget_ci->ir.rc5_device = rc5_device;
break; break;
} }
ir_input_init(input_dev, &budget_ci->ir.state, IR_TYPE_RC5);
/* initialise the key-up timeout handler */ /* initialise the key-up timeout handler */
init_timer(&budget_ci->ir.timer_keyup); init_timer(&budget_ci->ir.timer_keyup);
budget_ci->ir.timer_keyup.function = msp430_ir_keyup; budget_ci->ir.timer_keyup.function = msp430_ir_keyup;
budget_ci->ir.timer_keyup.data = (unsigned long) &budget_ci->ir; budget_ci->ir.timer_keyup.data = (unsigned long) &budget_ci->ir;
budget_ci->ir.last_raw = 0xffff; /* An impossible value */ budget_ci->ir.last_raw = 0xffff; /* An impossible value */
error = input_register_device(input_dev); error = ir_input_register(input_dev, ir_codes);
if (error) { if (error) {
printk(KERN_ERR "budget_ci: could not init driver for IR device (code %d)\n", error); printk(KERN_ERR "budget_ci: could not init driver for IR device (code %d)\n", error);
goto out2; return error;
} }
/* note: these must be after input_register_device */ /* note: these must be after input_register_device */
...@@ -284,12 +271,6 @@ static int msp430_ir_init(struct budget_ci *budget_ci) ...@@ -284,12 +271,6 @@ static int msp430_ir_init(struct budget_ci *budget_ci)
saa7146_setgpio(saa, 3, SAA7146_GPIO_IRQHI); saa7146_setgpio(saa, 3, SAA7146_GPIO_IRQHI);
return 0; return 0;
out2:
ir_input_unregister(input_dev);
input_free_device(input_dev);
out1:
return error;
} }
static void msp430_ir_deinit(struct budget_ci *budget_ci) static void msp430_ir_deinit(struct budget_ci *budget_ci)
...@@ -305,7 +286,6 @@ static void msp430_ir_deinit(struct budget_ci *budget_ci) ...@@ -305,7 +286,6 @@ static void msp430_ir_deinit(struct budget_ci *budget_ci)
ir_input_nokey(dev, &budget_ci->ir.state); ir_input_nokey(dev, &budget_ci->ir.state);
ir_input_unregister(dev); ir_input_unregister(dev);
input_unregister_device(dev);
} }
static int ciintf_read_attribute_mem(struct dvb_ca_en50221 *ca, int slot, int address) static int ciintf_read_attribute_mem(struct dvb_ca_en50221 *ca, int slot, int address)
......
...@@ -368,7 +368,7 @@ int bttv_input_init(struct bttv *btv) ...@@ -368,7 +368,7 @@ int bttv_input_init(struct bttv *btv)
snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0",
pci_name(btv->c.pci)); pci_name(btv->c.pci));
err = ir_input_init(input_dev, &ir->ir, ir_type, ir_codes); err = ir_input_init(input_dev, &ir->ir, ir_type);
if (err < 0) if (err < 0)
goto err_out_free; goto err_out_free;
...@@ -389,7 +389,7 @@ int bttv_input_init(struct bttv *btv) ...@@ -389,7 +389,7 @@ int bttv_input_init(struct bttv *btv)
bttv_ir_start(btv, ir); bttv_ir_start(btv, ir);
/* all done */ /* all done */
err = input_register_device(btv->remote->dev); err = ir_input_register(btv->remote->dev, ir_codes);
if (err) if (err)
goto err_out_stop; goto err_out_stop;
...@@ -403,8 +403,6 @@ int bttv_input_init(struct bttv *btv) ...@@ -403,8 +403,6 @@ int bttv_input_init(struct bttv *btv)
bttv_ir_stop(btv); bttv_ir_stop(btv);
btv->remote = NULL; btv->remote = NULL;
err_out_free: err_out_free:
ir_input_unregister(input_dev);
input_free_device(input_dev);
kfree(ir); kfree(ir);
return err; return err;
} }
...@@ -416,7 +414,6 @@ void bttv_input_fini(struct bttv *btv) ...@@ -416,7 +414,6 @@ void bttv_input_fini(struct bttv *btv)
bttv_ir_stop(btv); bttv_ir_stop(btv);
ir_input_unregister(btv->remote->dev); ir_input_unregister(btv->remote->dev);
input_unregister_device(btv->remote->dev);
kfree(btv->remote); kfree(btv->remote);
btv->remote = NULL; btv->remote = NULL;
} }
......
...@@ -197,8 +197,7 @@ int cx231xx_ir_init(struct cx231xx *dev) ...@@ -197,8 +197,7 @@ int cx231xx_ir_init(struct cx231xx *dev)
usb_make_path(dev->udev, ir->phys, sizeof(ir->phys)); usb_make_path(dev->udev, ir->phys, sizeof(ir->phys));
strlcat(ir->phys, "/input0", sizeof(ir->phys)); strlcat(ir->phys, "/input0", sizeof(ir->phys));
err = ir_input_init(input_dev, &ir->ir, IR_TYPE_OTHER, err = ir_input_init(input_dev, &ir->ir, IR_TYPE_OTHER);
dev->board.ir_codes);
if (err < 0) if (err < 0)
goto err_out_free; goto err_out_free;
...@@ -217,7 +216,7 @@ int cx231xx_ir_init(struct cx231xx *dev) ...@@ -217,7 +216,7 @@ int cx231xx_ir_init(struct cx231xx *dev)
cx231xx_ir_start(ir); cx231xx_ir_start(ir);
/* all done */ /* all done */
err = input_register_device(ir->input); err = ir_input_register(ir->input, dev->board.ir_codes);
if (err) if (err)
goto err_out_stop; goto err_out_stop;
...@@ -226,8 +225,6 @@ int cx231xx_ir_init(struct cx231xx *dev) ...@@ -226,8 +225,6 @@ int cx231xx_ir_init(struct cx231xx *dev)
cx231xx_ir_stop(ir); cx231xx_ir_stop(ir);
dev->ir = NULL; dev->ir = NULL;
err_out_free: err_out_free:
ir_input_unregister(input_dev);
input_free_device(input_dev);
kfree(ir); kfree(ir);
return err; return err;
} }
...@@ -242,7 +239,6 @@ int cx231xx_ir_fini(struct cx231xx *dev) ...@@ -242,7 +239,6 @@ int cx231xx_ir_fini(struct cx231xx *dev)
cx231xx_ir_stop(ir); cx231xx_ir_stop(ir);
ir_input_unregister(ir->input); ir_input_unregister(ir->input);
input_unregister_device(ir->input);
kfree(ir); kfree(ir);
/* done */ /* done */
......
...@@ -377,7 +377,7 @@ int cx23885_input_init(struct cx23885_dev *dev) ...@@ -377,7 +377,7 @@ int cx23885_input_init(struct cx23885_dev *dev)
cx23885_boards[dev->board].name); cx23885_boards[dev->board].name);
snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", pci_name(dev->pci)); snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", pci_name(dev->pci));
ret = ir_input_init(input_dev, &ir->ir, ir_type, ir_codes); ret = ir_input_init(input_dev, &ir->ir, ir_type);
if (ret < 0) if (ret < 0)
goto err_out_free; goto err_out_free;
...@@ -397,7 +397,7 @@ int cx23885_input_init(struct cx23885_dev *dev) ...@@ -397,7 +397,7 @@ int cx23885_input_init(struct cx23885_dev *dev)
dev->ir_input = ir; dev->ir_input = ir;
cx23885_input_ir_start(dev); cx23885_input_ir_start(dev);
ret = input_register_device(ir->dev); ret = ir_input_register(ir->dev, ir_codes);
if (ret) if (ret)
goto err_out_stop; goto err_out_stop;
...@@ -407,8 +407,6 @@ int cx23885_input_init(struct cx23885_dev *dev) ...@@ -407,8 +407,6 @@ int cx23885_input_init(struct cx23885_dev *dev)
cx23885_input_ir_stop(dev); cx23885_input_ir_stop(dev);
dev->ir_input = NULL; dev->ir_input = NULL;
err_out_free: err_out_free:
ir_input_unregister(input_dev);
input_free_device(input_dev);
kfree(ir); kfree(ir);
return ret; return ret;
} }
...@@ -421,7 +419,6 @@ void cx23885_input_fini(struct cx23885_dev *dev) ...@@ -421,7 +419,6 @@ void cx23885_input_fini(struct cx23885_dev *dev)
if (dev->ir_input == NULL) if (dev->ir_input == NULL)
return; return;
ir_input_unregister(dev->ir_input->dev); ir_input_unregister(dev->ir_input->dev);
input_unregister_device(dev->ir_input->dev);
kfree(dev->ir_input); kfree(dev->ir_input);
dev->ir_input = NULL; dev->ir_input = NULL;
} }
...@@ -360,7 +360,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) ...@@ -360,7 +360,7 @@ 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->name, sizeof(ir->name), "cx88 IR (%s)", core->board.name);
snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", pci_name(pci)); snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", pci_name(pci));
err = ir_input_init(input_dev, &ir->ir, ir_type, ir_codes); err = ir_input_init(input_dev, &ir->ir, ir_type);
if (err < 0) if (err < 0)
goto err_out_free; goto err_out_free;
...@@ -383,7 +383,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) ...@@ -383,7 +383,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)
cx88_ir_start(core, ir); cx88_ir_start(core, ir);
/* all done */ /* all done */
err = input_register_device(ir->input); err = ir_input_register(ir->input, ir_codes);
if (err) if (err)
goto err_out_stop; goto err_out_stop;
...@@ -393,8 +393,6 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) ...@@ -393,8 +393,6 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)
cx88_ir_stop(core, ir); cx88_ir_stop(core, ir);
core->ir = NULL; core->ir = NULL;
err_out_free: err_out_free:
ir_input_unregister(input_dev);
input_free_device(input_dev);
kfree(ir); kfree(ir);
return err; return err;
} }
...@@ -409,7 +407,6 @@ int cx88_ir_fini(struct cx88_core *core) ...@@ -409,7 +407,6 @@ int cx88_ir_fini(struct cx88_core *core)
cx88_ir_stop(core, ir); cx88_ir_stop(core, ir);
ir_input_unregister(ir->input); ir_input_unregister(ir->input);
input_unregister_device(ir->input);
kfree(ir); kfree(ir);
/* done */ /* done */
......
...@@ -393,8 +393,7 @@ int em28xx_ir_init(struct em28xx *dev) ...@@ -393,8 +393,7 @@ int em28xx_ir_init(struct em28xx *dev)
usb_make_path(dev->udev, ir->phys, sizeof(ir->phys)); usb_make_path(dev->udev, ir->phys, sizeof(ir->phys));
strlcat(ir->phys, "/input0", sizeof(ir->phys)); strlcat(ir->phys, "/input0", sizeof(ir->phys));
err = ir_input_init(input_dev, &ir->ir, IR_TYPE_OTHER, err = ir_input_init(input_dev, &ir->ir, IR_TYPE_OTHER);
dev->board.ir_codes);
if (err < 0) if (err < 0)
goto err_out_free; goto err_out_free;
...@@ -413,7 +412,7 @@ int em28xx_ir_init(struct em28xx *dev) ...@@ -413,7 +412,7 @@ int em28xx_ir_init(struct em28xx *dev)
em28xx_ir_start(ir); em28xx_ir_start(ir);
/* all done */ /* all done */
err = input_register_device(ir->input); err = ir_input_register(ir->input, dev->board.ir_codes);
if (err) if (err)
goto err_out_stop; goto err_out_stop;
...@@ -422,8 +421,6 @@ int em28xx_ir_init(struct em28xx *dev) ...@@ -422,8 +421,6 @@ int em28xx_ir_init(struct em28xx *dev)
em28xx_ir_stop(ir); em28xx_ir_stop(ir);
dev->ir = NULL; dev->ir = NULL;
err_out_free: err_out_free:
ir_input_unregister(input_dev);
input_free_device(input_dev);
kfree(ir); kfree(ir);
return err; return err;
} }
...@@ -438,7 +435,6 @@ int em28xx_ir_fini(struct em28xx *dev) ...@@ -438,7 +435,6 @@ int em28xx_ir_fini(struct em28xx *dev)
em28xx_ir_stop(ir); em28xx_ir_stop(ir);
ir_input_unregister(ir->input); ir_input_unregister(ir->input);
input_unregister_device(ir->input);
kfree(ir); kfree(ir);
/* done */ /* done */
......
...@@ -438,7 +438,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) ...@@ -438,7 +438,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
dev_name(&client->dev)); dev_name(&client->dev));
/* init + register input device */ /* init + register input device */
err = ir_input_init(input_dev, &ir->ir, ir_type, ir->ir_codes); err = ir_input_init(input_dev, &ir->ir, ir_type);
if (err < 0) if (err < 0)
goto err_out_free; goto err_out_free;
...@@ -446,7 +446,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) ...@@ -446,7 +446,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
input_dev->name = ir->name; input_dev->name = ir->name;
input_dev->phys = ir->phys; input_dev->phys = ir->phys;
err = input_register_device(ir->input); err = ir_input_register(ir->input, ir->ir_codes);
if (err) if (err)
goto err_out_free; goto err_out_free;
...@@ -460,8 +460,6 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) ...@@ -460,8 +460,6 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
return 0; return 0;
err_out_free: err_out_free:
ir_input_unregister(input_dev);
input_free_device(input_dev);
kfree(ir); kfree(ir);
return err; return err;
} }
...@@ -475,7 +473,6 @@ static int ir_remove(struct i2c_client *client) ...@@ -475,7 +473,6 @@ static int ir_remove(struct i2c_client *client)
/* unregister device */ /* unregister device */
ir_input_unregister(ir->input); ir_input_unregister(ir->input);
input_unregister_device(ir->input);
/* free memory */ /* free memory */
kfree(ir); kfree(ir);
......
...@@ -708,7 +708,7 @@ int saa7134_input_init1(struct saa7134_dev *dev) ...@@ -708,7 +708,7 @@ int saa7134_input_init1(struct saa7134_dev *dev)
snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0",
pci_name(dev->pci)); pci_name(dev->pci));
err = ir_input_init(input_dev, &ir->ir, ir_type, ir_codes); err = ir_input_init(input_dev, &ir->ir, ir_type);
if (err < 0) if (err < 0)
goto err_out_free; goto err_out_free;
...@@ -728,7 +728,7 @@ int saa7134_input_init1(struct saa7134_dev *dev) ...@@ -728,7 +728,7 @@ int saa7134_input_init1(struct saa7134_dev *dev)
dev->remote = ir; dev->remote = ir;
saa7134_ir_start(dev, ir); saa7134_ir_start(dev, ir);
err = input_register_device(ir->dev); err = ir_input_register(ir->dev, ir_codes);
if (err) if (err)
goto err_out_stop; goto err_out_stop;
...@@ -742,8 +742,6 @@ int saa7134_input_init1(struct saa7134_dev *dev) ...@@ -742,8 +742,6 @@ int saa7134_input_init1(struct saa7134_dev *dev)
saa7134_ir_stop(dev); saa7134_ir_stop(dev);
dev->remote = NULL; dev->remote = NULL;
err_out_free: err_out_free:
ir_input_unregister(input_dev);
input_free_device(input_dev);
kfree(ir); kfree(ir);
return err; return err;
} }
...@@ -755,7 +753,6 @@ void saa7134_input_fini(struct saa7134_dev *dev) ...@@ -755,7 +753,6 @@ void saa7134_input_fini(struct saa7134_dev *dev)
saa7134_ir_stop(dev); saa7134_ir_stop(dev);
ir_input_unregister(dev->remote->dev); ir_input_unregister(dev->remote->dev);
input_unregister_device(dev->remote->dev);
kfree(dev->remote); kfree(dev->remote);
dev->remote = NULL; dev->remote = NULL;
} }
......
...@@ -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,
int ir_type, struct ir_scancode_table *ir_codes); int 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);
......
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