diff options
author | Ricardo Cerqueira <devnull@localhost> | 2005-12-04 01:12:43 +0000 |
---|---|---|
committer | Ricardo Cerqueira <devnull@localhost> | 2005-12-04 01:12:43 +0000 |
commit | ca739c0f5e983380bc1021dac8c309c0729ce0f5 (patch) | |
tree | 25f3f73acb5754a158406815bf8a82f86d43f10c /linux/drivers/media/video/saa7134 | |
parent | 25ef5b3135b8a5dd7f9faa8c2709f8e7bddf6cfc (diff) | |
download | mediapointer-dvb-s2-ca739c0f5e983380bc1021dac8c309c0729ce0f5.tar.gz mediapointer-dvb-s2-ca739c0f5e983380bc1021dac8c309c0729ce0f5.tar.bz2 |
Backport of Dmitry Torokhov's input layer changes at mainline kernel
From: Ricardo Cerqueira <v4l@cerqueira.org>
kernel-sync
Ported changes by Dmitry Torokhov <dtor_core@ameritech.net> and added
backwards compatibility checks for kernels < 2.6.15
Signed-off-by: Ricardo Cerqueira <v4l@cerqueira.org>
Diffstat (limited to 'linux/drivers/media/video/saa7134')
-rw-r--r-- | linux/drivers/media/video/saa7134/saa7134-input.c | 47 | ||||
-rw-r--r-- | linux/drivers/media/video/saa7134/saa7134.h | 4 |
2 files changed, 30 insertions, 21 deletions
diff --git a/linux/drivers/media/video/saa7134/saa7134-input.c b/linux/drivers/media/video/saa7134/saa7134-input.c index fbb3d24b4..d4f547fe9 100644 --- a/linux/drivers/media/video/saa7134/saa7134-input.c +++ b/linux/drivers/media/video/saa7134/saa7134-input.c @@ -1,5 +1,5 @@ /* - * $Id: saa7134-input.c,v 1.44 2005/11/27 23:27:25 mkrufky Exp $ + * $Id: saa7134-input.c,v 1.45 2005/12/04 01:12:43 rmcc Exp $ * * handle saa7134 IR remotes via linux kernel input layer. * @@ -558,9 +558,9 @@ static int build_key(struct saa7134_dev *dev) if ((ir->mask_keydown && (0 != (gpio & ir->mask_keydown))) || (ir->mask_keyup && (0 == (gpio & ir->mask_keyup)))) { - ir_input_keydown(&ir->dev,&ir->ir,data,data); + ir_input_keydown(ir->dev, &ir->ir, data, data); } else { - ir_input_nokey(&ir->dev,&ir->ir); + ir_input_nokey(ir->dev, &ir->ir); } return 0; } @@ -612,6 +612,7 @@ static void saa7134_input_timer(unsigned long data) int saa7134_input_init1(struct saa7134_dev *dev) { struct saa7134_ir *ir; + struct input_dev *input_dev; IR_KEYTAB_TYPE *ir_codes = NULL; u32 mask_keycode = 0; u32 mask_keydown = 0; @@ -717,10 +718,13 @@ int saa7134_input_init1(struct saa7134_dev *dev) return -ENODEV; } - ir = kmalloc(sizeof(*ir),GFP_KERNEL); - if (NULL == ir) + ir = kzalloc(sizeof(*ir), GFP_KERNEL); + input_dev = input_allocate_device(); + if (!ir || !input_dev) { + kfree(ir); + input_free_device(input_dev); return -ENOMEM; - memset(ir,0,sizeof(*ir)); + } /* init hardware-specific stuff */ ir->mask_keycode = mask_keycode; @@ -728,26 +732,32 @@ int saa7134_input_init1(struct saa7134_dev *dev) ir->mask_keyup = mask_keyup; ir->polling = polling; + ir->dev = input_dev; + /* init input device */ snprintf(ir->name, sizeof(ir->name), "saa7134 IR (%s)", saa7134_boards[dev->board].name); snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", pci_name(dev->pci)); - ir_input_init(&ir->dev, &ir->ir, ir_type, ir_codes); - ir->dev.name = ir->name; + ir_input_init(input_dev, &ir->ir, ir_type, ir_codes); + input_dev->name = ir->name; #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) - ir->dev.phys = ir->phys; - ir->dev.id.bustype = BUS_PCI; - ir->dev.id.version = 1; + input_dev->phys = ir->phys; + input_dev->id.bustype = BUS_PCI; + input_dev->id.version = 1; if (dev->pci->subsystem_vendor) { - ir->dev.id.vendor = dev->pci->subsystem_vendor; - ir->dev.id.product = dev->pci->subsystem_device; + input_dev->id.vendor = dev->pci->subsystem_vendor; + input_dev->id.product = dev->pci->subsystem_device; } else { - ir->dev.id.vendor = dev->pci->vendor; - ir->dev.id.product = dev->pci->device; + input_dev->id.vendor = dev->pci->vendor; + input_dev->id.product = dev->pci->device; } - ir->dev.dev = &dev->pci->dev; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15) + input_dev->cdev.dev = &dev->pci->dev; +#else + input_dev->dev = &dev->pci->dev; +#endif #endif /* all done */ @@ -760,8 +770,7 @@ int saa7134_input_init1(struct saa7134_dev *dev) add_timer(&ir->timer); } - input_register_device(&dev->remote->dev); - printk("%s: registered input device for IR\n",dev->name); + input_register_device(ir->dev); return 0; } @@ -770,9 +779,9 @@ void saa7134_input_fini(struct saa7134_dev *dev) if (NULL == dev->remote) return; - input_unregister_device(&dev->remote->dev); if (dev->remote->polling) del_timer_sync(&dev->remote->timer); + input_unregister_device(dev->remote->dev); kfree(dev->remote); dev->remote = NULL; } diff --git a/linux/drivers/media/video/saa7134/saa7134.h b/linux/drivers/media/video/saa7134/saa7134.h index ac9025697..87372b160 100644 --- a/linux/drivers/media/video/saa7134/saa7134.h +++ b/linux/drivers/media/video/saa7134/saa7134.h @@ -1,5 +1,5 @@ /* - * $Id: saa7134.h,v 1.83 2005/11/25 10:50:14 mchehab Exp $ + * $Id: saa7134.h,v 1.84 2005/12/04 01:12:43 rmcc Exp $ * * v4l2 device driver for philips saa7134 based TV cards * @@ -400,7 +400,7 @@ struct saa7134_dmasound { /* IR input */ struct saa7134_ir { - struct input_dev dev; + struct input_dev *dev; struct ir_input_state ir; char name[32]; char phys[32]; |