staging: zoran remove braces and replace BIT macro
Subsystems (2)
cover staging: zoran remove braces and replace BIT macro
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
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
@@ -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
Re: [Outreachy kernel] [PATCH 1/2] staging: zoran: replace masking with BIT macro
Quoted 12 lines · Ioannis Valasakis
Replace bit masking with the more preferable BIT macro.
Signed-off-by Ioannis Valasakis <[email protected]>--- drivers/staging/media/zoran/zoran_device.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)drivers/staging/media/zoran/zoran_device.c +0
-0
drivers/staging/media/zoran/zoran_device.c GPIO (struct zoran *zr, · line 95
Quoted 5 lines
drivers/staging/media/zoran/zoran_device.c +1
-1@@ -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
Quoted 45 lines
drivers/staging/media/zoran/zoran_device.c +5
-6reg =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 [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/e1f47470988dd3e5a8e7d39bf6a051e6de2637a3.1541300498.git.code%40wizofe.uk.
For more options, visit https://groups.google.com/d/optout.
PATCH 2/2 staging: zoran: remove unnecessary braces
In reply to Ioannis ValasakisBraces 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
@@ -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
Greg KH
maintainerRe: [PATCH 2/2] staging: zoran: remove unnecessary braces
Quoted 7 lines · Ioannis Valasakis
Braces are not necessary for single statement blocks therefore there were removed. Reported by checkpatch.
Signed-off-by Ioannis Valasakis <[email protected]>--- 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