提交 b654fcdc 编写于 作者: H Hans Verkuil 提交者: Mauro Carvalho Chehab

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: NHans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: NMauro Carvalho Chehab <mchehab@infradead.org>
上级 38f9d308
...@@ -465,9 +465,8 @@ static void ivtv_process_eeprom(struct ivtv *itv) ...@@ -465,9 +465,8 @@ static void ivtv_process_eeprom(struct ivtv *itv)
if (itv->options.radio == -1) if (itv->options.radio == -1)
itv->options.radio = (tv.has_radio != 0); itv->options.radio = (tv.has_radio != 0);
/* only enable newi2c if an IR blaster is present */ /* only enable newi2c if an IR blaster is present */
/* FIXME: for 2.6.20 the test against 2 should be removed */ if (itv->options.newi2c == -1 && tv.has_ir) {
if (itv->options.newi2c == -1 && tv.has_ir != -1 && tv.has_ir != 2) { itv->options.newi2c = (tv.has_ir & 4) ? 1 : 0;
itv->options.newi2c = (tv.has_ir & 2) ? 1 : 0;
if (itv->options.newi2c) { if (itv->options.newi2c) {
IVTV_INFO("Reopen i2c bus for IR-blaster support\n"); IVTV_INFO("Reopen i2c bus for IR-blaster support\n");
exit_ivtv_i2c(itv); exit_ivtv_i2c(itv);
......
...@@ -485,7 +485,7 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee, ...@@ -485,7 +485,7 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee,
tvee->has_radio = eeprom_data[i+len-1]; tvee->has_radio = eeprom_data[i+len-1];
/* old style tag, don't know how to detect /* old style tag, don't know how to detect
IR presence, mark as unknown. */ IR presence, mark as unknown. */
tvee->has_ir = -1; tvee->has_ir = 0;
tvee->model = tvee->model =
eeprom_data[i+8] + eeprom_data[i+8] +
(eeprom_data[i+9] << 8); (eeprom_data[i+9] << 8);
...@@ -605,7 +605,7 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee, ...@@ -605,7 +605,7 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee,
case 0x0f: case 0x0f:
/* tag 'IRInfo' */ /* tag 'IRInfo' */
tvee->has_ir = eeprom_data[i+1]; tvee->has_ir = 1 | (eeprom_data[i+1] << 1);
break; break;
/* case 0x10: tag 'VBIInfo' */ /* case 0x10: tag 'VBIInfo' */
...@@ -705,14 +705,14 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee, ...@@ -705,14 +705,14 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee,
tveeprom_info("decoder processor is %s (idx %d)\n", tveeprom_info("decoder processor is %s (idx %d)\n",
STRM(decoderIC, tvee->decoder_processor), STRM(decoderIC, tvee->decoder_processor),
tvee->decoder_processor); tvee->decoder_processor);
if (tvee->has_ir == -1) if (tvee->has_ir)
tveeprom_info("has %sradio\n",
tvee->has_radio ? "" : "no ");
else
tveeprom_info("has %sradio, has %sIR receiver, has %sIR transmitter\n", tveeprom_info("has %sradio, has %sIR receiver, has %sIR transmitter\n",
tvee->has_radio ? "" : "no ", tvee->has_radio ? "" : "no ",
(tvee->has_ir & 1) ? "" : "no ", (tvee->has_ir & 2) ? "" : "no ",
(tvee->has_ir & 2) ? "" : "no "); (tvee->has_ir & 4) ? "" : "no ");
else
tveeprom_info("has %sradio\n",
tvee->has_radio ? "" : "no ");
} }
EXPORT_SYMBOL(tveeprom_hauppauge_analog); EXPORT_SYMBOL(tveeprom_hauppauge_analog);
......
...@@ -3,7 +3,12 @@ ...@@ -3,7 +3,12 @@
struct tveeprom { struct tveeprom {
u32 has_radio; u32 has_radio;
u32 has_ir; /* bit 0: IR receiver present, bit 1: IR transmitter (blaster) present. -1 == unknown */ /* If has_ir == 0, then it is unknown what the IR capabilities are,
otherwise:
bit 0: 1 (= IR capabilities are known)
bit 1: IR receiver present
bit 2: IR transmitter (blaster) present */
u32 has_ir;
u32 has_MAC_address; /* 0: no MAC, 1: MAC present, 2: unknown */ u32 has_MAC_address; /* 0: no MAC, 1: MAC present, 2: unknown */
u32 tuner_type; u32 tuner_type;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册