Skip to contentSkip to conversation

em28xx-core.c: add missing parentheses in em28xx_write_ac97()

PATCH In review Roel Kluin 3 participants 4 messages Mar 5, 2008 – Mar 10, 2008 Media (V4L/DVB)

lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

PATCH 1/1 em28xx-core.c: add missing parentheses in em28xx_write_ac97()

Mind that the patch below was not yet tested
---
! has a higher priority than &

---

drivers/media/video/em28xx/em28xx-core.c +1 -1
index 7d1537c..da8189a 100644
@@ -267,7 +267,7 @@ static int em28xx_write_ac97(struct em28xx *dev, u8 reg, u8 *val)
 	for (i = 0; i < 10; i++) {
 		if ((ret = em28xx_read_reg(dev, AC97BUSY_REG)) < 0)
 			return ret;
-		if (!((u8) ret) & 0x01)
+		if (!(((u8) ret) & 0x01))
 			return 0;
 		msleep(5);
 	}
#1 lore raw

drivers/media/video/em28xx/em28xx-core.c static int em28xx_write_ac97(struct em28xx *dev, u8 reg, u8 *val) · line 270

Quoted 10 lines · Roel Kluin
drivers/media/video/em28xx/em28xx-core.c +1 -1
index 7d1537c..da8189a 100644
@@ -267,7 +267,7 @@ static int em28xx_write_ac97(struct em28xx *dev, u8 reg, u8 *val)
 	for (i = 0; i < 10; i++) {
 		if ((ret = em28xx_read_reg(dev, AC97BUSY_REG)) < 0)
 			return ret;
-		if (!((u8) ret) & 0x01)
+		if (!(((u8) ret) & 0x01))

I think it'd be clearer without the cast to (u8)
which is then implicit cast back to int anyway

	if (!(ret & 1))
author
#2 lore raw
Quoted 7 lines · Joe Perches

Review

Quoted 2 lines
(quoted diff) +1 -1
-		if (!((u8) ret) & 0x01)
+		if (!(((u8) ret) & 0x01))

I think it'd be clearer without the cast to (u8)
which is then implicit cast back to int anyway

	if (!(ret & 1))

ok.
---

---

drivers/media/video/em28xx/em28xx-core.c +1 -1
index 7d1537c..c797472 100644
@@ -267,7 +267,7 @@ static int em28xx_write_ac97(struct em28xx *dev, u8 reg, u8 *val)
 	for (i = 0; i < 10; i++) {
 		if ((ret = em28xx_read_reg(dev, AC97BUSY_REG)) < 0)
 			return ret;
-		if (!((u8) ret) & 0x01)
+		if (!(ret & 1))
 			return 0;
 		msleep(5);
 	}
#3 lore raw

Roel and Joe,

Thanks for your patches.

I've already received and committed two patches with your proposed changes:

http://linuxtv.org/hg/v4l-dvb/rev/127f67dea087
http://linuxtv.org/hg/v4l-dvb/rev/f83ed13f5bf5

Cheers,
Mauro

Quoted 20 lines · On Wed, 05 Mar 2008 19:43:46 +0100 Roel Kluin <[email protected]> wrote:
Quoted 7 lines · Joe Perches

Review

Quoted 2 lines
(quoted diff) +1 -1
-		if (!((u8) ret) & 0x01)
+		if (!(((u8) ret) & 0x01))

I think it'd be clearer without the cast to (u8)
which is then implicit cast back to int anyway

	if (!(ret & 1))

ok.
---

---

drivers/media/video/em28xx/em28xx-core.c +0 -0
index 7d1537c..c797472 100644

drivers/media/video/em28xx/em28xx-core.c static int em28xx_write_ac97(struct em28xx *dev, u8 reg, u8 *val) · line 273

Quoted 8 lines
drivers/media/video/em28xx/em28xx-core.c +1 -1
@@ -267,7 +267,7 @@ static int em28xx_write_ac97(struct em28xx *dev, u8 reg, u8 *val)
 	for (i = 0; i < 10; i++) {
 		if ((ret = em28xx_read_reg(dev, AC97BUSY_REG)) < 0)
 			return ret;
-		if (!((u8) ret) & 0x01)
+		if (!(ret & 1))
 			return 0;
 		msleep(5);
 	}

Cheers,
Mauro

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list