aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/saa7134/saa7134-input.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor_core@ameritech.net>2005-09-15 03:01:53 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2005-10-28 12:52:53 -0400
commitb7df3910c1298fee8ed7b9dfd2da74b85df5539c (patch)
tree1948ee697c23a384dd0be625ebeee13062d73882 /drivers/media/video/saa7134/saa7134-input.c
parent76b7cddfd576331761e945a508254abad11039e9 (diff)
[PATCH] drivers/media: convert to dynamic input_dev allocation
Input: convert drivers/media to dynamic input_dev allocation This is required for input_dev sysfs integration Signed-off-by: Dmitry Torokhov <dtor@mail.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/media/video/saa7134/saa7134-input.c')
-rw-r--r--drivers/media/video/saa7134/saa7134-input.c39
1 files changed, 21 insertions, 18 deletions
diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c
index 1f456c4d76f2..242cb235cf92 100644
--- a/drivers/media/video/saa7134/saa7134-input.c
+++ b/drivers/media/video/saa7134/saa7134-input.c
@@ -425,9 +425,9 @@ static int build_key(struct saa7134_dev *dev)
425 425
426 if ((ir->mask_keydown && (0 != (gpio & ir->mask_keydown))) || 426 if ((ir->mask_keydown && (0 != (gpio & ir->mask_keydown))) ||
427 (ir->mask_keyup && (0 == (gpio & ir->mask_keyup)))) { 427 (ir->mask_keyup && (0 == (gpio & ir->mask_keyup)))) {
428 ir_input_keydown(&ir->dev,&ir->ir,data,data); 428 ir_input_keydown(ir->dev, &ir->ir, data, data);
429 } else { 429 } else {
430 ir_input_nokey(&ir->dev,&ir->ir); 430 ir_input_nokey(ir->dev, &ir->ir);
431 } 431 }
432 return 0; 432 return 0;
433} 433}
@@ -456,6 +456,7 @@ static void saa7134_input_timer(unsigned long data)
456int saa7134_input_init1(struct saa7134_dev *dev) 456int saa7134_input_init1(struct saa7134_dev *dev)
457{ 457{
458 struct saa7134_ir *ir; 458 struct saa7134_ir *ir;
459 struct input_dev *input_dev;
459 IR_KEYTAB_TYPE *ir_codes = NULL; 460 IR_KEYTAB_TYPE *ir_codes = NULL;
460 u32 mask_keycode = 0; 461 u32 mask_keycode = 0;
461 u32 mask_keydown = 0; 462 u32 mask_keydown = 0;
@@ -535,10 +536,13 @@ int saa7134_input_init1(struct saa7134_dev *dev)
535 return -ENODEV; 536 return -ENODEV;
536 } 537 }
537 538
538 ir = kmalloc(sizeof(*ir),GFP_KERNEL); 539 ir = kzalloc(sizeof(*ir), GFP_KERNEL);
539 if (NULL == ir) 540 input_dev = input_allocate_device();
541 if (!ir || !input_dev) {
542 kfree(ir);
543 input_free_device(input_dev);
540 return -ENOMEM; 544 return -ENOMEM;
541 memset(ir,0,sizeof(*ir)); 545 }
542 546
543 /* init hardware-specific stuff */ 547 /* init hardware-specific stuff */
544 ir->mask_keycode = mask_keycode; 548 ir->mask_keycode = mask_keycode;
@@ -552,19 +556,19 @@ int saa7134_input_init1(struct saa7134_dev *dev)
552 snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", 556 snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0",
553 pci_name(dev->pci)); 557 pci_name(dev->pci));
554 558
555 ir_input_init(&ir->dev, &ir->ir, ir_type, ir_codes); 559 ir_input_init(input_dev, &ir->ir, ir_type, ir_codes);
556 ir->dev.name = ir->name; 560 input_dev->name = ir->name;
557 ir->dev.phys = ir->phys; 561 input_dev->phys = ir->phys;
558 ir->dev.id.bustype = BUS_PCI; 562 input_dev->id.bustype = BUS_PCI;
559 ir->dev.id.version = 1; 563 input_dev->id.version = 1;
560 if (dev->pci->subsystem_vendor) { 564 if (dev->pci->subsystem_vendor) {
561 ir->dev.id.vendor = dev->pci->subsystem_vendor; 565 input_dev->id.vendor = dev->pci->subsystem_vendor;
562 ir->dev.id.product = dev->pci->subsystem_device; 566 input_dev->id.product = dev->pci->subsystem_device;
563 } else { 567 } else {
564 ir->dev.id.vendor = dev->pci->vendor; 568 input_dev->id.vendor = dev->pci->vendor;
565 ir->dev.id.product = dev->pci->device; 569 input_dev->id.product = dev->pci->device;
566 } 570 }
567 ir->dev.dev = &dev->pci->dev; 571 input_dev->cdev.dev = &dev->pci->dev;
568 572
569 /* all done */ 573 /* all done */
570 dev->remote = ir; 574 dev->remote = ir;
@@ -576,8 +580,7 @@ int saa7134_input_init1(struct saa7134_dev *dev)
576 add_timer(&ir->timer); 580 add_timer(&ir->timer);
577 } 581 }
578 582
579 input_register_device(&dev->remote->dev); 583 input_register_device(ir->dev);
580 printk("%s: registered input device for IR\n",dev->name);
581 return 0; 584 return 0;
582} 585}
583 586
@@ -586,9 +589,9 @@ void saa7134_input_fini(struct saa7134_dev *dev)
586 if (NULL == dev->remote) 589 if (NULL == dev->remote)
587 return; 590 return;
588 591
589 input_unregister_device(&dev->remote->dev);
590 if (dev->remote->polling) 592 if (dev->remote->polling)
591 del_timer_sync(&dev->remote->timer); 593 del_timer_sync(&dev->remote->timer);
594 input_unregister_device(dev->remote->dev);
592 kfree(dev->remote); 595 kfree(dev->remote);
593 dev->remote = NULL; 596 dev->remote = NULL;
594} 597}