Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

V4L/DVB (8479): tveeprom/ivtv: fix usage of has_ir field

has_ir was set to and compared to -1 in several cases, even though it is
an u32. ivtv also contained a FIXME for an old kernel that could be
removed.

Thanks to Roel Kluin for creating an initial patch for this. Although
I chose a different solution here it did help in pointing out the problem.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
  • Loading branch information...
commit b654fcdc0ea3b6e5724c9873ae062bdfe7f28efe 1 parent 38f9d30
Hans Verkuil authored mchehab committed
5 drivers/media/video/ivtv/ivtv-driver.c
@@ -465,9 +465,8 @@ static void ivtv_process_eeprom(struct ivtv *itv)
465 465 if (itv->options.radio == -1)
466 466 itv->options.radio = (tv.has_radio != 0);
467 467 /* only enable newi2c if an IR blaster is present */
468   - /* FIXME: for 2.6.20 the test against 2 should be removed */
469   - if (itv->options.newi2c == -1 && tv.has_ir != -1 && tv.has_ir != 2) {
470   - itv->options.newi2c = (tv.has_ir & 2) ? 1 : 0;
  468 + if (itv->options.newi2c == -1 && tv.has_ir) {
  469 + itv->options.newi2c = (tv.has_ir & 4) ? 1 : 0;
471 470 if (itv->options.newi2c) {
472 471 IVTV_INFO("Reopen i2c bus for IR-blaster support\n");
473 472 exit_ivtv_i2c(itv);
16 drivers/media/video/tveeprom.c
@@ -485,7 +485,7 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee,
485 485 tvee->has_radio = eeprom_data[i+len-1];
486 486 /* old style tag, don't know how to detect
487 487 IR presence, mark as unknown. */
488   - tvee->has_ir = -1;
  488 + tvee->has_ir = 0;
489 489 tvee->model =
490 490 eeprom_data[i+8] +
491 491 (eeprom_data[i+9] << 8);
@@ -605,7 +605,7 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee,
605 605
606 606 case 0x0f:
607 607 /* tag 'IRInfo' */
608   - tvee->has_ir = eeprom_data[i+1];
  608 + tvee->has_ir = 1 | (eeprom_data[i+1] << 1);
609 609 break;
610 610
611 611 /* case 0x10: tag 'VBIInfo' */
@@ -705,14 +705,14 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee,
705 705 tveeprom_info("decoder processor is %s (idx %d)\n",
706 706 STRM(decoderIC, tvee->decoder_processor),
707 707 tvee->decoder_processor);
708   - if (tvee->has_ir == -1)
709   - tveeprom_info("has %sradio\n",
710   - tvee->has_radio ? "" : "no ");
711   - else
  708 + if (tvee->has_ir)
712 709 tveeprom_info("has %sradio, has %sIR receiver, has %sIR transmitter\n",
713 710 tvee->has_radio ? "" : "no ",
714   - (tvee->has_ir & 1) ? "" : "no ",
715   - (tvee->has_ir & 2) ? "" : "no ");
  711 + (tvee->has_ir & 2) ? "" : "no ",
  712 + (tvee->has_ir & 4) ? "" : "no ");
  713 + else
  714 + tveeprom_info("has %sradio\n",
  715 + tvee->has_radio ? "" : "no ");
716 716 }
717 717 EXPORT_SYMBOL(tveeprom_hauppauge_analog);
718 718
7 include/media/tveeprom.h
@@ -3,7 +3,12 @@
3 3
4 4 struct tveeprom {
5 5 u32 has_radio;
6   - u32 has_ir; /* bit 0: IR receiver present, bit 1: IR transmitter (blaster) present. -1 == unknown */
  6 + /* If has_ir == 0, then it is unknown what the IR capabilities are,
  7 + otherwise:
  8 + bit 0: 1 (= IR capabilities are known)
  9 + bit 1: IR receiver present
  10 + bit 2: IR transmitter (blaster) present */
  11 + u32 has_ir;
7 12 u32 has_MAC_address; /* 0: no MAC, 1: MAC present, 2: unknown */
8 13
9 14 u32 tuner_type;

0 comments on commit b654fcd

Please sign in to comment.
Something went wrong with that request. Please try again.