Skip to contentSkip to conversation

staging: zoran: replace bit mask and fix styling

PATCH In review Ioannis Valasakis 2 participants 4 messages Nov 5, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover staging: zoran: replace bit mask and fix styling

staging: zoran: replace bit mask and fix styling issues reported by checkpatch.

Ioannis Valasakis (2):
staging: zoran: replace masking with BIT macro
staging: zoran: remove unnecessary braces

 drivers/staging/media/zoran/zoran_device.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
Signature · 1 line
2.19.1
#1 lore raw

PATCH 1/2 staging: zoran: replace masking with BIT macro

Replace bit masking with the more preferable BIT macro.

---
 drivers/staging/media/zoran/zoran_device.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/staging/media/zoran/zoran_device.c +6 -6
index 40adceebca7e..1e6782b72369 100644
@@ -92,7 +92,7 @@ GPIO (struct zoran *zr,
 	/* Make sure the bit number is legal
 	 * A bit number of -1 (lacking) gives a mask of 0,
 	 * making it harmless */
-	mask = (1 << (24 + bit)) & 0xff000000;
+	mask = (BIT((24 + bit))) & 0xff000000;
 	reg = btread(ZR36057_GPPGCR1) & ~mask;
 	if (value) {
 		reg |= mask;
@@ -285,8 +285,8 @@ zr36057_adjust_vfe (struct zoran          *zr,
 	case BUZ_MODE_MOTION_DECOMPRESS:
 		btand(~ZR36057_VFESPFR_ExtFl, ZR36057_VFESPFR);
 		reg = btread(ZR36057_VFEHCR);
-		if ((reg & (1 << 10)) && zr->card.type != LML33R10) {
-			reg += ((1 << 10) | 1);
+		if ((reg & (BIT(10))) && zr->card.type != LML33R10) {
+			reg += ((BIT(10)) | 1);
 		}
 		btwrite(reg, ZR36057_VFEHCR);
 		break;
@@ -300,8 +300,8 @@ zr36057_adjust_vfe (struct zoran          *zr,
 		else
 			btor(ZR36057_VFESPFR_ExtFl, ZR36057_VFESPFR);
 		reg = btread(ZR36057_VFEHCR);
-		if (!(reg & (1 << 10)) && zr->card.type != LML33R10) {
-			reg -= ((1 << 10) | 1);
+		if (!(reg & (BIT(10))) && zr->card.type != LML33R10) {
+			reg -= ((BIT(10)) | 1);
 		}
 		btwrite(reg, ZR36057_VFEHCR);
 		break;
@@ -407,7 +407,7 @@ zr36057_set_vfe (struct zoran              *zr,
 	} else if (HorDcm >= 32) {
 		reg |= 2 << ZR36057_VFESPFR_HFilter;	/* 4 tap filter */
 	} else if (HorDcm >= 16) {
-		reg |= 1 << ZR36057_VFESPFR_HFilter;	/* 3 tap filter */
+		reg |= BIT(ZR36057_VFESPFR_HFilter);	/* 3 tap filter */
 	}
 	reg |= format->vfespfr;
 	btwrite(reg, ZR36057_VFESPFR);
Signature · 1 line
2.19.1
#3 lore raw

PATCH 2/2 staging: zoran: remove unnecessary braces

In reply to Ioannis Valasakis

Braces are not necessary for single statement blocks therefore there were removed. Reported by checkpatch.

---
 drivers/staging/media/zoran/zoran_device.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/staging/media/zoran/zoran_device.c +2 -4
index 1e6782b72369..47214e2de04c 100644
@@ -285,9 +285,8 @@ zr36057_adjust_vfe (struct zoran          *zr,
 	case BUZ_MODE_MOTION_DECOMPRESS:
 		btand(~ZR36057_VFESPFR_ExtFl, ZR36057_VFESPFR);
 		reg = btread(ZR36057_VFEHCR);
-		if ((reg & (BIT(10))) && zr->card.type != LML33R10) {
+		if ((reg & (BIT(10))) && zr->card.type != LML33R10)
 			reg += ((BIT(10)) | 1);
-		}
 		btwrite(reg, ZR36057_VFEHCR);
 		break;
 	case BUZ_MODE_MOTION_COMPRESS:
@@ -300,9 +299,8 @@ zr36057_adjust_vfe (struct zoran          *zr,
 		else
 			btor(ZR36057_VFESPFR_ExtFl, ZR36057_VFESPFR);
 		reg = btread(ZR36057_VFEHCR);
-		if (!(reg & (BIT(10))) && zr->card.type != LML33R10) {
+		if (!(reg & (BIT(10))) && zr->card.type != LML33R10)
 			reg -= ((BIT(10)) | 1);
-		}
 		btwrite(reg, ZR36057_VFEHCR);
 		break;
 	}
Signature · 1 line
2.19.1
#2 lore raw

Re: [Outreachy kernel] [PATCH 1/2] staging: zoran: replace masking with BIT macro

In reply to Ioannis Valasakis
Quoted 21 lines · Ioannis Valasakis

Replace bit masking with the more preferable BIT macro.

---
 drivers/staging/media/zoran/zoran_device.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/staging/media/zoran/zoran_device.c +1 -1
index 40adceebca7e..1e6782b72369 100644
@@ -92,7 +92,7 @@ GPIO (struct zoran *zr,
 	/* Make sure the bit number is legal
 	 * A bit number of -1 (lacking) gives a mask of 0,
 	 * making it harmless */
-	mask = (1 << (24 + bit)) & 0xff000000;
+	mask = (BIT((24 + bit))) & 0xff000000;
 	reg = btread(ZR36057_GPPGCR1) & ~mask;
 	if (value) {
 		reg |= mask;

drivers/staging/media/zoran/zoran_device.c zr36057_adjust_vfe (struct zoran *zr, · line 289

Quoted 7 lines
drivers/staging/media/zoran/zoran_device.c +2 -2
@@ -285,8 +285,8 @@ zr36057_adjust_vfe (struct zoran          *zr,
 	case BUZ_MODE_MOTION_DECOMPRESS:
 		btand(~ZR36057_VFESPFR_ExtFl, ZR36057_VFESPFR);
 		reg = btread(ZR36057_VFEHCR);
-		if ((reg & (1 << 10)) && zr->card.type != LML33R10) {
-			reg += ((1 << 10) | 1);
+		if ((reg & (BIT(10))) && zr->card.type != LML33R10) {
+			reg += ((BIT(10)) | 1);

Theer is no need for parentheses around a call to BIT.

julia

Quoted 34 lines
drivers/staging/media/zoran/zoran_device.c +3 -4
 		}
 		btwrite(reg, ZR36057_VFEHCR);
 		break;
@@ -300,8 +300,8 @@ zr36057_adjust_vfe (struct zoran          *zr,
 		else
 			btor(ZR36057_VFESPFR_ExtFl, ZR36057_VFESPFR);
 		reg = btread(ZR36057_VFEHCR);
-		if (!(reg & (1 << 10)) && zr->card.type != LML33R10) {
-			reg -= ((1 << 10) | 1);
+		if (!(reg & (BIT(10))) && zr->card.type != LML33R10) {
+			reg -= ((BIT(10)) | 1);
 		}
 		btwrite(reg, ZR36057_VFEHCR);
 		break;
@@ -407,7 +407,7 @@ zr36057_set_vfe (struct zoran              *zr,
 	} else if (HorDcm >= 32) {
 		reg |= 2 << ZR36057_VFESPFR_HFilter;	/* 4 tap filter */
 	} else if (HorDcm >= 16) {
-		reg |= 1 << ZR36057_VFESPFR_HFilter;	/* 3 tap filter */
+		reg |= BIT(ZR36057_VFESPFR_HFilter);	/* 3 tap filter */
 	}
 	reg |= format->vfespfr;
 	btwrite(reg, ZR36057_VFESPFR);
--

2.19.1

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/f5cb20814f9f4ce4d4de2b1b5b972aca741eafd2.1541427136.git.code%40wizofe.uk.
For more options, visit https://groups.google.com/d/optout.