* [PATCH 3/9] ivtv: test below 0 on unsigned has_ir
@ 2008-07-22 0:29 roel kluin
2008-07-22 4:50 ` Hans Verkuil
0 siblings, 1 reply; 3+ messages in thread
From: roel kluin @ 2008-07-22 0:29 UTC (permalink / raw)
To: hverkuil, ivtv-devel, video4linux-list; +Cc: linux-kernel
u32 has_ir, member of struct tveeprom is unsigned,
so assignment of -1 and subsequent tests fail
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
diff --git a/drivers/media/video/ivtv/ivtv-driver.c b/drivers/media/video/ivtv/ivtv-driver.c
index 797e636..7d909f9 100644
--- a/drivers/media/video/ivtv/ivtv-driver.c
+++ b/drivers/media/video/ivtv/ivtv-driver.c
@@ -465,7 +465,7 @@ static void ivtv_process_eeprom(struct ivtv *itv)
itv->options.radio = (tv.has_radio != 0);
/* 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 != -1 && tv.has_ir != 2) {
+ if (itv->options.newi2c == -1 && tv.has_ir != ~0 && tv.has_ir != 2) {
itv->options.newi2c = (tv.has_ir & 2) ? 1 : 0;
if (itv->options.newi2c) {
IVTV_INFO("Reopen i2c bus for IR-blaster support\n");
diff --git a/drivers/media/video/tveeprom.c b/drivers/media/video/tveeprom.c
index 9da0e18..41c22a7 100644
--- a/drivers/media/video/tveeprom.c
+++ b/drivers/media/video/tveeprom.c
@@ -483,7 +483,7 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee,
tvee->has_radio = eeprom_data[i+len-1];
/* old style tag, don't know how to detect
IR presence, mark as unknown. */
- tvee->has_ir = -1;
+ tvee->has_ir = ~0;
tvee->model =
eeprom_data[i+8] +
(eeprom_data[i+9] << 8);
@@ -703,7 +703,7 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee,
tveeprom_info("decoder processor is %s (idx %d)\n",
STRM(decoderIC, tvee->decoder_processor),
tvee->decoder_processor);
- if (tvee->has_ir == -1)
+ if (tvee->has_ir == ~0)
tveeprom_info("has %sradio\n",
tvee->has_radio ? "" : "no ");
else
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 3/9] ivtv: test below 0 on unsigned has_ir
2008-07-22 0:29 [PATCH 3/9] ivtv: test below 0 on unsigned has_ir roel kluin
@ 2008-07-22 4:50 ` Hans Verkuil
0 siblings, 0 replies; 3+ messages in thread
From: Hans Verkuil @ 2008-07-22 4:50 UTC (permalink / raw)
To: roel kluin; +Cc: ivtv-devel, video4linux-list, linux-kernel
On Tuesday 22 July 2008 02:29:08 roel kluin wrote:
> u32 has_ir, member of struct tveeprom is unsigned,
> so assignment of -1 and subsequent tests fail
Thank you for this report, but I'm going to NAK this patch. I will take
a closer look at this tonight and I will make a new patch for this.
First to take care of the FIXME that's just before the first change
below and secondly I'll see if it isn't better to change has_ir to an
int: I don't like using ~0 like this.
So expect to see a new patch later today.
Regards,
Hans
>
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> ---
>
> diff --git a/drivers/media/video/ivtv/ivtv-driver.c
> b/drivers/media/video/ivtv/ivtv-driver.c index 797e636..7d909f9
> 100644
> --- a/drivers/media/video/ivtv/ivtv-driver.c
> +++ b/drivers/media/video/ivtv/ivtv-driver.c
> @@ -465,7 +465,7 @@ static void ivtv_process_eeprom(struct ivtv *itv)
> itv->options.radio = (tv.has_radio != 0);
> /* 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 != -1 && tv.has_ir != 2)
> { + if (itv->options.newi2c == -1 && tv.has_ir != ~0 && tv.has_ir !=
> 2) { itv->options.newi2c = (tv.has_ir & 2) ? 1 : 0;
> if (itv->options.newi2c) {
> IVTV_INFO("Reopen i2c bus for IR-blaster support\n");
> diff --git a/drivers/media/video/tveeprom.c
> b/drivers/media/video/tveeprom.c index 9da0e18..41c22a7 100644
> --- a/drivers/media/video/tveeprom.c
> +++ b/drivers/media/video/tveeprom.c
> @@ -483,7 +483,7 @@ void tveeprom_hauppauge_analog(struct i2c_client
> *c, struct tveeprom *tvee, tvee->has_radio = eeprom_data[i+len-1];
> /* old style tag, don't know how to detect
> IR presence, mark as unknown. */
> - tvee->has_ir = -1;
> + tvee->has_ir = ~0;
> tvee->model =
> eeprom_data[i+8] +
> (eeprom_data[i+9] << 8);
> @@ -703,7 +703,7 @@ void tveeprom_hauppauge_analog(struct i2c_client
> *c, struct tveeprom *tvee, tveeprom_info("decoder processor is %s
> (idx %d)\n",
> STRM(decoderIC, tvee->decoder_processor),
> tvee->decoder_processor);
> - if (tvee->has_ir == -1)
> + if (tvee->has_ir == ~0)
> tveeprom_info("has %sradio\n",
> tvee->has_radio ? "" : "no ");
> else
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 3/9] ivtv: test below 0 on unsigned has_ir
@ 2008-07-22 4:50 ` Hans Verkuil
0 siblings, 0 replies; 3+ messages in thread
From: Hans Verkuil @ 2008-07-22 4:50 UTC (permalink / raw)
To: roel kluin; +Cc: video4linux-list, linux-kernel, ivtv-devel
On Tuesday 22 July 2008 02:29:08 roel kluin wrote:
> u32 has_ir, member of struct tveeprom is unsigned,
> so assignment of -1 and subsequent tests fail
Thank you for this report, but I'm going to NAK this patch. I will take
a closer look at this tonight and I will make a new patch for this.
First to take care of the FIXME that's just before the first change
below and secondly I'll see if it isn't better to change has_ir to an
int: I don't like using ~0 like this.
So expect to see a new patch later today.
Regards,
Hans
>
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> ---
>
> diff --git a/drivers/media/video/ivtv/ivtv-driver.c
> b/drivers/media/video/ivtv/ivtv-driver.c index 797e636..7d909f9
> 100644
> --- a/drivers/media/video/ivtv/ivtv-driver.c
> +++ b/drivers/media/video/ivtv/ivtv-driver.c
> @@ -465,7 +465,7 @@ static void ivtv_process_eeprom(struct ivtv *itv)
> itv->options.radio = (tv.has_radio != 0);
> /* 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 != -1 && tv.has_ir != 2)
> { + if (itv->options.newi2c == -1 && tv.has_ir != ~0 && tv.has_ir !=
> 2) { itv->options.newi2c = (tv.has_ir & 2) ? 1 : 0;
> if (itv->options.newi2c) {
> IVTV_INFO("Reopen i2c bus for IR-blaster support\n");
> diff --git a/drivers/media/video/tveeprom.c
> b/drivers/media/video/tveeprom.c index 9da0e18..41c22a7 100644
> --- a/drivers/media/video/tveeprom.c
> +++ b/drivers/media/video/tveeprom.c
> @@ -483,7 +483,7 @@ void tveeprom_hauppauge_analog(struct i2c_client
> *c, struct tveeprom *tvee, tvee->has_radio = eeprom_data[i+len-1];
> /* old style tag, don't know how to detect
> IR presence, mark as unknown. */
> - tvee->has_ir = -1;
> + tvee->has_ir = ~0;
> tvee->model =
> eeprom_data[i+8] +
> (eeprom_data[i+9] << 8);
> @@ -703,7 +703,7 @@ void tveeprom_hauppauge_analog(struct i2c_client
> *c, struct tveeprom *tvee, tveeprom_info("decoder processor is %s
> (idx %d)\n",
> STRM(decoderIC, tvee->decoder_processor),
> tvee->decoder_processor);
> - if (tvee->has_ir == -1)
> + if (tvee->has_ir == ~0)
> tveeprom_info("has %sradio\n",
> tvee->has_radio ? "" : "no ");
> else
--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-07-22 4:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-22 0:29 [PATCH 3/9] ivtv: test below 0 on unsigned has_ir roel kluin
2008-07-22 4:50 ` Hans Verkuil
2008-07-22 4:50 ` Hans Verkuil
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.