aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/saa7134
diff options
context:
space:
mode:
authorDavid Härdeman <david@hardeman.nu>2010-11-19 18:42:51 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-12-29 05:16:53 -0500
commit651c7a5f7f2f7277f8fc4fb38e89c79845ec9bf9 (patch)
treef2d1a0a333c37c49e0b554a4362339a2983b17e2 /drivers/media/video/saa7134
parentb0ddb0f364f926785f50a8cea8a399ba63e3c227 (diff)
[media] saa7134: some minor cleanups
Mostly using appropriate data types and constants (e.g. int -> bool). Signed-off-by: David Härdeman <david@hardeman.nu> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/saa7134')
-rw-r--r--drivers/media/video/saa7134/saa7134-input.c49
-rw-r--r--drivers/media/video/saa7134/saa7134.h4
2 files changed, 21 insertions, 32 deletions
diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c
index 10dc9ad2eae9..d75c307981bc 100644
--- a/drivers/media/video/saa7134/saa7134-input.c
+++ b/drivers/media/video/saa7134/saa7134-input.c
@@ -407,17 +407,16 @@ static int __saa7134_ir_start(void *priv)
407 struct saa7134_dev *dev = priv; 407 struct saa7134_dev *dev = priv;
408 struct saa7134_card_ir *ir; 408 struct saa7134_card_ir *ir;
409 409
410 if (!dev) 410 if (!dev || !dev->remote)
411 return -EINVAL; 411 return -EINVAL;
412 412
413 ir = dev->remote; 413 ir = dev->remote;
414 if (!ir)
415 return -EINVAL;
416
417 if (ir->running) 414 if (ir->running)
418 return 0; 415 return 0;
419 416
420 ir->running = true; 417 ir->running = true;
418 ir->active = false;
419
421 if (ir->polling) { 420 if (ir->polling) {
422 setup_timer(&ir->timer, saa7134_input_timer, 421 setup_timer(&ir->timer, saa7134_input_timer,
423 (unsigned long)dev); 422 (unsigned long)dev);
@@ -425,10 +424,8 @@ static int __saa7134_ir_start(void *priv)
425 add_timer(&ir->timer); 424 add_timer(&ir->timer);
426 } else if (ir->raw_decode) { 425 } else if (ir->raw_decode) {
427 /* set timer_end for code completion */ 426 /* set timer_end for code completion */
428 init_timer(&ir->timer_end); 427 setup_timer(&ir->timer_end, ir_raw_decode_timer_end,
429 ir->timer_end.function = ir_raw_decode_timer_end; 428 (unsigned long)dev);
430 ir->timer_end.data = (unsigned long)dev;
431 ir->active = false;
432 } 429 }
433 430
434 return 0; 431 return 0;
@@ -439,22 +436,19 @@ static void __saa7134_ir_stop(void *priv)
439 struct saa7134_dev *dev = priv; 436 struct saa7134_dev *dev = priv;
440 struct saa7134_card_ir *ir; 437 struct saa7134_card_ir *ir;
441 438
442 if (!dev) 439 if (!dev || !dev->remote)
443 return; 440 return;
444 441
445 ir = dev->remote; 442 ir = dev->remote;
446 if (!ir)
447 return;
448
449 if (!ir->running) 443 if (!ir->running)
450 return; 444 return;
451 if (dev->remote->polling) 445
452 del_timer_sync(&dev->remote->timer); 446 if (ir->polling)
453 else if (ir->raw_decode) { 447 del_timer_sync(&ir->timer);
448 else if (ir->raw_decode)
454 del_timer_sync(&ir->timer_end); 449 del_timer_sync(&ir->timer_end);
455 ir->active = false;
456 }
457 450
451 ir->active = false;
458 ir->running = false; 452 ir->running = false;
459 453
460 return; 454 return;
@@ -499,8 +493,8 @@ int saa7134_input_init1(struct saa7134_dev *dev)
499 u32 mask_keycode = 0; 493 u32 mask_keycode = 0;
500 u32 mask_keydown = 0; 494 u32 mask_keydown = 0;
501 u32 mask_keyup = 0; 495 u32 mask_keyup = 0;
502 int polling = 0; 496 unsigned polling = 0;
503 int raw_decode = 0; 497 bool raw_decode = false;
504 int err; 498 int err;
505 499
506 if (dev->has_remote != SAA7134_REMOTE_GPIO) 500 if (dev->has_remote != SAA7134_REMOTE_GPIO)
@@ -565,14 +559,14 @@ int saa7134_input_init1(struct saa7134_dev *dev)
565 mask_keydown = 0x0040000; /* Enable GPIO18 line on both edges */ 559 mask_keydown = 0x0040000; /* Enable GPIO18 line on both edges */
566 mask_keyup = 0x0040000; 560 mask_keyup = 0x0040000;
567 mask_keycode = 0xffff; 561 mask_keycode = 0xffff;
568 raw_decode = 1; 562 raw_decode = true;
569 break; 563 break;
570 case SAA7134_BOARD_AVERMEDIA_M733A: 564 case SAA7134_BOARD_AVERMEDIA_M733A:
571 ir_codes = RC_MAP_AVERMEDIA_M733A_RM_K6; 565 ir_codes = RC_MAP_AVERMEDIA_M733A_RM_K6;
572 mask_keydown = 0x0040000; 566 mask_keydown = 0x0040000;
573 mask_keyup = 0x0040000; 567 mask_keyup = 0x0040000;
574 mask_keycode = 0xffff; 568 mask_keycode = 0xffff;
575 raw_decode = 1; 569 raw_decode = true;
576 break; 570 break;
577 case SAA7134_BOARD_AVERMEDIA_777: 571 case SAA7134_BOARD_AVERMEDIA_777:
578 case SAA7134_BOARD_AVERMEDIA_A16AR: 572 case SAA7134_BOARD_AVERMEDIA_A16AR:
@@ -679,7 +673,7 @@ int saa7134_input_init1(struct saa7134_dev *dev)
679 mask_keydown = 0x0040000; /* Enable GPIO18 line on both edges */ 673 mask_keydown = 0x0040000; /* Enable GPIO18 line on both edges */
680 mask_keyup = 0x0040000; 674 mask_keyup = 0x0040000;
681 mask_keycode = 0xffff; 675 mask_keycode = 0xffff;
682 raw_decode = 1; 676 raw_decode = true;
683 break; 677 break;
684 case SAA7134_BOARD_ENCORE_ENLTV: 678 case SAA7134_BOARD_ENCORE_ENLTV:
685 case SAA7134_BOARD_ENCORE_ENLTV_FM: 679 case SAA7134_BOARD_ENCORE_ENLTV_FM:
@@ -693,7 +687,7 @@ int saa7134_input_init1(struct saa7134_dev *dev)
693 mask_keydown = 0x0040000; /* Enable GPIO18 line on both edges */ 687 mask_keydown = 0x0040000; /* Enable GPIO18 line on both edges */
694 mask_keyup = 0x0040000; 688 mask_keyup = 0x0040000;
695 mask_keycode = 0xffff; 689 mask_keycode = 0xffff;
696 raw_decode = 1; 690 raw_decode = true;
697 break; 691 break;
698 case SAA7134_BOARD_10MOONSTVMASTER3: 692 case SAA7134_BOARD_10MOONSTVMASTER3:
699 ir_codes = RC_MAP_ENCORE_ENLTV; 693 ir_codes = RC_MAP_ENCORE_ENLTV;
@@ -746,8 +740,6 @@ int saa7134_input_init1(struct saa7134_dev *dev)
746 ir->dev = rc; 740 ir->dev = rc;
747 dev->remote = ir; 741 dev->remote = ir;
748 742
749 ir->running = false;
750
751 /* init hardware-specific stuff */ 743 /* init hardware-specific stuff */
752 ir->mask_keycode = mask_keycode; 744 ir->mask_keycode = mask_keycode;
753 ir->mask_keydown = mask_keydown; 745 ir->mask_keydown = mask_keydown;
@@ -809,14 +801,12 @@ void saa7134_input_fini(struct saa7134_dev *dev)
809void saa7134_probe_i2c_ir(struct saa7134_dev *dev) 801void saa7134_probe_i2c_ir(struct saa7134_dev *dev)
810{ 802{
811 struct i2c_board_info info; 803 struct i2c_board_info info;
812
813 struct i2c_msg msg_msi = { 804 struct i2c_msg msg_msi = {
814 .addr = 0x50, 805 .addr = 0x50,
815 .flags = I2C_M_RD, 806 .flags = I2C_M_RD,
816 .len = 0, 807 .len = 0,
817 .buf = NULL, 808 .buf = NULL,
818 }; 809 };
819
820 int rc; 810 int rc;
821 811
822 if (disable_ir) { 812 if (disable_ir) {
@@ -916,8 +906,8 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev)
916 906
917static int saa7134_raw_decode_irq(struct saa7134_dev *dev) 907static int saa7134_raw_decode_irq(struct saa7134_dev *dev)
918{ 908{
919 struct saa7134_card_ir *ir = dev->remote; 909 struct saa7134_card_ir *ir = dev->remote;
920 unsigned long timeout; 910 unsigned long timeout;
921 int space; 911 int space;
922 912
923 /* Generate initial event */ 913 /* Generate initial event */
@@ -926,7 +916,6 @@ static int saa7134_raw_decode_irq(struct saa7134_dev *dev)
926 space = saa_readl(SAA7134_GPIO_GPSTATUS0 >> 2) & ir->mask_keydown; 916 space = saa_readl(SAA7134_GPIO_GPSTATUS0 >> 2) & ir->mask_keydown;
927 ir_raw_event_store_edge(dev->remote->dev, space ? IR_SPACE : IR_PULSE); 917 ir_raw_event_store_edge(dev->remote->dev, space ? IR_SPACE : IR_PULSE);
928 918
929
930 /* 919 /*
931 * Wait 15 ms from the start of the first IR event before processing 920 * Wait 15 ms from the start of the first IR event before processing
932 * the event. This time is enough for NEC protocol. May need adjustments 921 * the event. This time is enough for NEC protocol. May need adjustments
diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h
index 1923f3ca0eab..f93951acec41 100644
--- a/drivers/media/video/saa7134/saa7134.h
+++ b/drivers/media/video/saa7134/saa7134.h
@@ -124,7 +124,7 @@ struct saa7134_card_ir {
124 124
125 char name[32]; 125 char name[32];
126 char phys[32]; 126 char phys[32];
127 int users; 127 unsigned users;
128 128
129 u32 polling; 129 u32 polling;
130 u32 last_gpio; 130 u32 last_gpio;
@@ -551,7 +551,7 @@ struct saa7134_dev {
551 551
552 /* infrared remote */ 552 /* infrared remote */
553 int has_remote; 553 int has_remote;
554 struct saa7134_card_ir *remote; 554 struct saa7134_card_ir *remote;
555 555
556 /* pci i/o */ 556 /* pci i/o */
557 char name[32]; 557 char name[32];