From 493f26ca4fb6e69acc47779bb04d0901b1018290 Mon Sep 17 00:00:00 2001 From: Kenneth Aafloy Date: Wed, 9 Mar 2005 15:11:05 +0000 Subject: - FIX: don't do av7110_ir_exit if init was not done --- linux/drivers/media/dvb/ttpci/av7110.c | 9 +-------- linux/drivers/media/dvb/ttpci/av7110_ir.c | 8 ++++++++ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/linux/drivers/media/dvb/ttpci/av7110.c b/linux/drivers/media/dvb/ttpci/av7110.c index 06958d966..71bff8b7e 100644 --- a/linux/drivers/media/dvb/ttpci/av7110.c +++ b/linux/drivers/media/dvb/ttpci/av7110.c @@ -2485,14 +2485,7 @@ static int av7110_attach(struct saa7146_dev* dev, struct saa7146_pci_extension_d goto err_av7110_exit_v4l_12; #if defined(CONFIG_INPUT_EVDEV) || defined(CONFIG_INPUT_EVDEV_MODULE) - /* FIXME: this is a hack, just like av7110_setup_irc_config() is */ - { - static int ir_initialized; - if (!ir_initialized) { - av7110_ir_init(); - ++ir_initialized; - } - } + av7110_ir_init(); #endif printk(KERN_INFO "dvb-ttpci: found av7110-%d.\n", av7110_num); av7110_num++; diff --git a/linux/drivers/media/dvb/ttpci/av7110_ir.c b/linux/drivers/media/dvb/ttpci/av7110_ir.c index 10df56b54..e5fa5b08a 100644 --- a/linux/drivers/media/dvb/ttpci/av7110_ir.c +++ b/linux/drivers/media/dvb/ttpci/av7110_ir.c @@ -12,6 +12,7 @@ /* enable ir debugging by or'ing av7110_debug with 16 */ +static int ir_initialized; static struct input_dev input_dev; static u32 ir_config; @@ -160,6 +161,9 @@ static int av7110_ir_write_proc(struct file *file, const char __user *buffer, int __init av7110_ir_init(void) { + if (ir_initialized) + return 0; + static struct proc_dir_entry *e; init_timer(&keyup_timer); @@ -187,16 +191,20 @@ int __init av7110_ir_init(void) e->size = 4 + 256 * sizeof(u16); } + ir_initialized = 1; return 0; } void __exit av7110_ir_exit(void) { + if (ir_initialized == 0) + return; del_timer_sync(&keyup_timer); remove_proc_entry("av7110_ir", NULL); av7110_unregister_irc_handler(av7110_emit_key); input_unregister_device(&input_dev); + ir_initialized = 0; } //MODULE_AUTHOR("Holger Waechtler "); -- cgit v1.2.3