All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] staging: zoran remove braces and replace BIT macro
@ 2018-11-04  3:02 Ioannis Valasakis
  2018-11-04  3:02 ` [PATCH 1/2] staging: zoran: replace masking with " Ioannis Valasakis
  2018-11-04  3:03 ` [PATCH 2/2] staging: zoran: remove unnecessary braces Ioannis Valasakis
  0 siblings, 2 replies; 5+ messages in thread
From: Ioannis Valasakis @ 2018-11-04  3:02 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: gregkh

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(-)

-- 
2.19.1




^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] staging: zoran: replace masking with  BIT macro
  2018-11-04  3:02 [PATCH 0/2] staging: zoran remove braces and replace BIT macro Ioannis Valasakis
@ 2018-11-04  3:02 ` Ioannis Valasakis
  2018-11-04  6:34   ` [Outreachy kernel] " Julia Lawall
  2018-11-04  3:03 ` [PATCH 2/2] staging: zoran: remove unnecessary braces Ioannis Valasakis
  1 sibling, 1 reply; 5+ messages in thread
From: Ioannis Valasakis @ 2018-11-04  3:02 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: gregkh

Replace bit masking with the more preferable BIT macro.

Signed-off-by: Ioannis Valasakis <code@wizofe.uk>
---
 drivers/staging/media/zoran/zoran_device.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/media/zoran/zoran_device.c b/drivers/staging/media/zoran/zoran_device.c
index 40adceebca7e..1e6782b72369 100644
--- a/drivers/staging/media/zoran/zoran_device.c
+++ b/drivers/staging/media/zoran/zoran_device.c
@@ -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);
-- 
2.19.1




^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] staging: zoran: remove unnecessary braces
  2018-11-04  3:02 [PATCH 0/2] staging: zoran remove braces and replace BIT macro Ioannis Valasakis
  2018-11-04  3:02 ` [PATCH 1/2] staging: zoran: replace masking with " Ioannis Valasakis
@ 2018-11-04  3:03 ` Ioannis Valasakis
  2018-11-05 13:54   ` Greg KH
  1 sibling, 1 reply; 5+ messages in thread
From: Ioannis Valasakis @ 2018-11-04  3:03 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: gregkh

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

Signed-off-by: Ioannis Valasakis <code@wizofe.uk>
---
 drivers/staging/media/zoran/zoran_device.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/media/zoran/zoran_device.c b/drivers/staging/media/zoran/zoran_device.c
index 1e6782b72369..47214e2de04c 100644
--- a/drivers/staging/media/zoran/zoran_device.c
+++ b/drivers/staging/media/zoran/zoran_device.c
@@ -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;
 	}
-- 
2.19.1




^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Outreachy kernel] [PATCH 1/2] staging: zoran: replace masking with BIT macro
  2018-11-04  3:02 ` [PATCH 1/2] staging: zoran: replace masking with " Ioannis Valasakis
@ 2018-11-04  6:34   ` Julia Lawall
  0 siblings, 0 replies; 5+ messages in thread
From: Julia Lawall @ 2018-11-04  6:34 UTC (permalink / raw)
  To: Ioannis Valasakis; +Cc: outreachy-kernel, gregkh



On Sun, 4 Nov 2018, Ioannis Valasakis wrote:

> Replace bit masking with the more preferable BIT macro.
>
> Signed-off-by: Ioannis Valasakis <code@wizofe.uk>
> ---
>  drivers/staging/media/zoran/zoran_device.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/staging/media/zoran/zoran_device.c b/drivers/staging/media/zoran/zoran_device.c
> index 40adceebca7e..1e6782b72369 100644
> --- a/drivers/staging/media/zoran/zoran_device.c
> +++ b/drivers/staging/media/zoran/zoran_device.c
> @@ -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;

In addition to not needing the parentheses around the call to BIT, you
also don't need the extra parentheses around the argument.  Macros should
be written in a defensive way, which is the case of BIT:

#define BIT(nr)			(1UL << (nr))

If the macro is not written in a defensive way, then you should fix the
macro instead of adding extra parentheses at all of the call sites.

julia

>  	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);
> --
> 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 outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/e1f47470988dd3e5a8e7d39bf6a051e6de2637a3.1541300498.git.code%40wizofe.uk.
> For more options, visit https://groups.google.com/d/optout.
>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] staging: zoran: remove unnecessary braces
  2018-11-04  3:03 ` [PATCH 2/2] staging: zoran: remove unnecessary braces Ioannis Valasakis
@ 2018-11-05 13:54   ` Greg KH
  0 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2018-11-05 13:54 UTC (permalink / raw)
  To: Ioannis Valasakis; +Cc: outreachy-kernel

On Sun, Nov 04, 2018 at 03:03:00AM +0000, Ioannis Valasakis wrote:
> Braces are not necessary for single statement blocks therefore there
> were removed. Reported by checkpatch.
> 
> Signed-off-by: Ioannis Valasakis <code@wizofe.uk>
> ---
>  drivers/staging/media/zoran/zoran_device.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)

This patch does not apply to my tree at all :(

Please rebase and resend it.

thanks,

greg k-h


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-11-05 13:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-04  3:02 [PATCH 0/2] staging: zoran remove braces and replace BIT macro Ioannis Valasakis
2018-11-04  3:02 ` [PATCH 1/2] staging: zoran: replace masking with " Ioannis Valasakis
2018-11-04  6:34   ` [Outreachy kernel] " Julia Lawall
2018-11-04  3:03 ` [PATCH 2/2] staging: zoran: remove unnecessary braces Ioannis Valasakis
2018-11-05 13:54   ` Greg KH

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.