All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Remove macros and use BIT macros
@ 2019-03-22  1:26 Madhumitha Prabakaran
  2019-03-22  1:26 ` [PATCH 1/2] Staging: media: davinci_vpfe: Remove SETBIT macro and use BIT macro Madhumitha Prabakaran
  2019-03-22  1:26 ` [PATCH 2/2] Staging: media: davinci_vpfe: Remove RESETBIT " Madhumitha Prabakaran
  0 siblings, 2 replies; 8+ messages in thread
From: Madhumitha Prabakaran @ 2019-03-22  1:26 UTC (permalink / raw)
  To: mchehab, gregkh, outreachy-kernel; +Cc: Madhumitha Prabakaran

This patchset does as follows :
1) Remove SETBIT macro and use BIT macro
2) Remove RESETBIT macro and use BIT macro

Madhumitha Prabakaran (2):
  Staging: media: davinci_vpfe: Remove SETBIT macro and use BIT macro
  Staging: media: davinci_vpfe: Remove RESETBIT macro and use BIT macro

 .../staging/media/davinci_vpfe/dm365_ipipeif.c   | 16 ++++++++--------
 .../staging/media/davinci_vpfe/dm365_ipipeif.h   |  2 --
 2 files changed, 8 insertions(+), 10 deletions(-)

-- 
2.17.1



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

* [PATCH 1/2] Staging: media: davinci_vpfe: Remove SETBIT macro and use BIT macro
  2019-03-22  1:26 [PATCH 0/2] Remove macros and use BIT macros Madhumitha Prabakaran
@ 2019-03-22  1:26 ` Madhumitha Prabakaran
  2019-03-22  5:26   ` Greg KH
  2019-03-22  1:26 ` [PATCH 2/2] Staging: media: davinci_vpfe: Remove RESETBIT " Madhumitha Prabakaran
  1 sibling, 1 reply; 8+ messages in thread
From: Madhumitha Prabakaran @ 2019-03-22  1:26 UTC (permalink / raw)
  To: mchehab, gregkh, outreachy-kernel; +Cc: Madhumitha Prabakaran

Remove SETBIT macro and use BIT(x) instead of (1 << x) to maintain Linux
kernel coding style.

Signed-off-by: Madhumitha Prabakaran <madhumithabiw@gmail.com>
---
 drivers/staging/media/davinci_vpfe/dm365_ipipeif.c | 8 ++++----
 drivers/staging/media/davinci_vpfe/dm365_ipipeif.h | 1 -
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/media/davinci_vpfe/dm365_ipipeif.c b/drivers/staging/media/davinci_vpfe/dm365_ipipeif.c
index 4380e0a8e6dc..382d88bee5a7 100644
--- a/drivers/staging/media/davinci_vpfe/dm365_ipipeif.c
+++ b/drivers/staging/media/davinci_vpfe/dm365_ipipeif.c
@@ -297,7 +297,7 @@ static int ipipeif_hw_setup(struct v4l2_subdev *sd)
 		case MEDIA_BUS_FMT_UYVY8_2X8:
 		case MEDIA_BUS_FMT_Y8_1X8:
 			RESETBIT(val, IPIPEIF_CFG2_YUV8_SHIFT);
-			SETBIT(val, IPIPEIF_CFG2_YUV16_SHIFT);
+			val |= BIT(IPIPEIF_CFG2_YUV16_SHIFT);
 			ipipeif_write(val, ipipeif_base_addr, IPIPEIF_CFG2);
 			break;
 
@@ -345,15 +345,15 @@ static int ipipeif_hw_setup(struct v4l2_subdev *sd)
 		case MEDIA_BUS_FMT_YUYV8_1X16:
 		case MEDIA_BUS_FMT_YUYV10_1X20:
 			RESETBIT(val, IPIPEIF_CFG2_YUV8_SHIFT);
-			SETBIT(val, IPIPEIF_CFG2_YUV16_SHIFT);
+			val |= BIT(IPIPEIF_CFG2_YUV16_SHIFT);
 			break;
 
 		case MEDIA_BUS_FMT_YUYV8_2X8:
 		case MEDIA_BUS_FMT_UYVY8_2X8:
 		case MEDIA_BUS_FMT_Y8_1X8:
 		case MEDIA_BUS_FMT_YUYV10_2X10:
-			SETBIT(val, IPIPEIF_CFG2_YUV8_SHIFT);
-			SETBIT(val, IPIPEIF_CFG2_YUV16_SHIFT);
+			val |= BIT(IPIPEIF_CFG2_YUV8_SHIFT);
+			val |= BIT(IPIPEIF_CFG2_YUV16_SHIFT);
 			val |= IPIPEIF_CBCR_Y << IPIPEIF_CFG2_YUV8P_SHIFT;
 			break;
 
diff --git a/drivers/staging/media/davinci_vpfe/dm365_ipipeif.h b/drivers/staging/media/davinci_vpfe/dm365_ipipeif.h
index 4685d64016de..7bbe7a932b30 100644
--- a/drivers/staging/media/davinci_vpfe/dm365_ipipeif.h
+++ b/drivers/staging/media/davinci_vpfe/dm365_ipipeif.h
@@ -166,7 +166,6 @@ struct vpfe_ipipeif_device {
 #define IPIPEIF_RSZ_MIN			16
 #define IPIPEIF_RSZ_MAX			112
 #define IPIPEIF_RSZ_CONST		16
-#define SETBIT(reg, bit)   (reg = ((reg) | ((0x00000001)<<(bit))))
 #define RESETBIT(reg, bit) (reg = ((reg) & (~(0x00000001<<(bit)))))
 
 #define IPIPEIF_ADOFS_LSB_MASK		0x1ff
-- 
2.17.1



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

* [PATCH 2/2] Staging: media: davinci_vpfe: Remove RESETBIT macro and use BIT macro
  2019-03-22  1:26 [PATCH 0/2] Remove macros and use BIT macros Madhumitha Prabakaran
  2019-03-22  1:26 ` [PATCH 1/2] Staging: media: davinci_vpfe: Remove SETBIT macro and use BIT macro Madhumitha Prabakaran
@ 2019-03-22  1:26 ` Madhumitha Prabakaran
  2019-03-22  5:26   ` Greg KH
  2019-03-22  6:23   ` [Outreachy kernel] " Julia Lawall
  1 sibling, 2 replies; 8+ messages in thread
From: Madhumitha Prabakaran @ 2019-03-22  1:26 UTC (permalink / raw)
  To: mchehab, gregkh, outreachy-kernel; +Cc: Madhumitha Prabakaran

Remove RESETBIT macro and use BIT(x) instead of (1 << x) to improve
codebase.

Signed-off-by: Madhumitha Prabakaran <madhumithabiw@gmail.com>
---
 drivers/staging/media/davinci_vpfe/dm365_ipipeif.c | 8 ++++----
 drivers/staging/media/davinci_vpfe/dm365_ipipeif.h | 1 -
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/media/davinci_vpfe/dm365_ipipeif.c b/drivers/staging/media/davinci_vpfe/dm365_ipipeif.c
index 382d88bee5a7..4f18db127caf 100644
--- a/drivers/staging/media/davinci_vpfe/dm365_ipipeif.c
+++ b/drivers/staging/media/davinci_vpfe/dm365_ipipeif.c
@@ -296,14 +296,14 @@ static int ipipeif_hw_setup(struct v4l2_subdev *sd)
 		case MEDIA_BUS_FMT_YUYV8_1X16:
 		case MEDIA_BUS_FMT_UYVY8_2X8:
 		case MEDIA_BUS_FMT_Y8_1X8:
-			RESETBIT(val, IPIPEIF_CFG2_YUV8_SHIFT);
+			val &= ~BIT(IPIPEIF_CFG2_YUV8_SHIFT);
 			val |= BIT(IPIPEIF_CFG2_YUV16_SHIFT);
 			ipipeif_write(val, ipipeif_base_addr, IPIPEIF_CFG2);
 			break;
 
 		default:
-			RESETBIT(val, IPIPEIF_CFG2_YUV8_SHIFT);
-			RESETBIT(val, IPIPEIF_CFG2_YUV16_SHIFT);
+			val &= ~BIT(IPIPEIF_CFG2_YUV8_SHIFT);
+			val &= ~BIT(IPIPEIF_CFG2_YUV16_SHIFT);
 			ipipeif_write(val, ipipeif_base_addr, IPIPEIF_CFG2);
 			break;
 		}
@@ -344,7 +344,7 @@ static int ipipeif_hw_setup(struct v4l2_subdev *sd)
 		switch (isif_port_if) {
 		case MEDIA_BUS_FMT_YUYV8_1X16:
 		case MEDIA_BUS_FMT_YUYV10_1X20:
-			RESETBIT(val, IPIPEIF_CFG2_YUV8_SHIFT);
+			val &= ~BIT(val, IPIPEIF_CFG2_YUV8_SHIFT);
 			val |= BIT(IPIPEIF_CFG2_YUV16_SHIFT);
 			break;
 
diff --git a/drivers/staging/media/davinci_vpfe/dm365_ipipeif.h b/drivers/staging/media/davinci_vpfe/dm365_ipipeif.h
index 7bbe7a932b30..4d126fc871f3 100644
--- a/drivers/staging/media/davinci_vpfe/dm365_ipipeif.h
+++ b/drivers/staging/media/davinci_vpfe/dm365_ipipeif.h
@@ -166,7 +166,6 @@ struct vpfe_ipipeif_device {
 #define IPIPEIF_RSZ_MIN			16
 #define IPIPEIF_RSZ_MAX			112
 #define IPIPEIF_RSZ_CONST		16
-#define RESETBIT(reg, bit) (reg = ((reg) & (~(0x00000001<<(bit)))))
 
 #define IPIPEIF_ADOFS_LSB_MASK		0x1ff
 #define IPIPEIF_ADOFS_LSB_SHIFT		5
-- 
2.17.1



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

* Re: [PATCH 1/2] Staging: media: davinci_vpfe: Remove SETBIT macro and use BIT macro
  2019-03-22  1:26 ` [PATCH 1/2] Staging: media: davinci_vpfe: Remove SETBIT macro and use BIT macro Madhumitha Prabakaran
@ 2019-03-22  5:26   ` Greg KH
  0 siblings, 0 replies; 8+ messages in thread
From: Greg KH @ 2019-03-22  5:26 UTC (permalink / raw)
  To: Madhumitha Prabakaran; +Cc: mchehab, outreachy-kernel

On Thu, Mar 21, 2019 at 08:26:05PM -0500, Madhumitha Prabakaran wrote:
> Remove SETBIT macro and use BIT(x) instead of (1 << x) to maintain Linux
> kernel coding style.
> 
> Signed-off-by: Madhumitha Prabakaran <madhumithabiw@gmail.com>
> ---
>  drivers/staging/media/davinci_vpfe/dm365_ipipeif.c | 8 ++++----
>  drivers/staging/media/davinci_vpfe/dm365_ipipeif.h | 1 -
>  2 files changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/staging/media/davinci_vpfe/dm365_ipipeif.c b/drivers/staging/media/davinci_vpfe/dm365_ipipeif.c
> index 4380e0a8e6dc..382d88bee5a7 100644
> --- a/drivers/staging/media/davinci_vpfe/dm365_ipipeif.c
> +++ b/drivers/staging/media/davinci_vpfe/dm365_ipipeif.c
> @@ -297,7 +297,7 @@ static int ipipeif_hw_setup(struct v4l2_subdev *sd)
>  		case MEDIA_BUS_FMT_UYVY8_2X8:
>  		case MEDIA_BUS_FMT_Y8_1X8:
>  			RESETBIT(val, IPIPEIF_CFG2_YUV8_SHIFT);
> -			SETBIT(val, IPIPEIF_CFG2_YUV16_SHIFT);
> +			val |= BIT(IPIPEIF_CFG2_YUV16_SHIFT);

Ick, that's harder to read now, right?

Why not just use the set_bit() function instead?  That seems like the
easier thing to do here, right?

thanks,

greg k-h


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

* Re: [PATCH 2/2] Staging: media: davinci_vpfe: Remove RESETBIT macro and use BIT macro
  2019-03-22  1:26 ` [PATCH 2/2] Staging: media: davinci_vpfe: Remove RESETBIT " Madhumitha Prabakaran
@ 2019-03-22  5:26   ` Greg KH
  2019-03-22  6:31     ` [Outreachy kernel] " Julia Lawall
  2019-03-22  6:23   ` [Outreachy kernel] " Julia Lawall
  1 sibling, 1 reply; 8+ messages in thread
From: Greg KH @ 2019-03-22  5:26 UTC (permalink / raw)
  To: Madhumitha Prabakaran; +Cc: mchehab, outreachy-kernel

On Thu, Mar 21, 2019 at 08:26:06PM -0500, Madhumitha Prabakaran wrote:
> Remove RESETBIT macro and use BIT(x) instead of (1 << x) to improve
> codebase.
> 
> Signed-off-by: Madhumitha Prabakaran <madhumithabiw@gmail.com>
> ---
>  drivers/staging/media/davinci_vpfe/dm365_ipipeif.c | 8 ++++----
>  drivers/staging/media/davinci_vpfe/dm365_ipipeif.h | 1 -
>  2 files changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/staging/media/davinci_vpfe/dm365_ipipeif.c b/drivers/staging/media/davinci_vpfe/dm365_ipipeif.c
> index 382d88bee5a7..4f18db127caf 100644
> --- a/drivers/staging/media/davinci_vpfe/dm365_ipipeif.c
> +++ b/drivers/staging/media/davinci_vpfe/dm365_ipipeif.c
> @@ -296,14 +296,14 @@ static int ipipeif_hw_setup(struct v4l2_subdev *sd)
>  		case MEDIA_BUS_FMT_YUYV8_1X16:
>  		case MEDIA_BUS_FMT_UYVY8_2X8:
>  		case MEDIA_BUS_FMT_Y8_1X8:
> -			RESETBIT(val, IPIPEIF_CFG2_YUV8_SHIFT);
> +			val &= ~BIT(IPIPEIF_CFG2_YUV8_SHIFT);

clear_bit()?

>  			val |= BIT(IPIPEIF_CFG2_YUV16_SHIFT);

set_bit()?

thanks,

greg k-h


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

* Re: [Outreachy kernel] [PATCH 2/2] Staging: media: davinci_vpfe: Remove RESETBIT macro and use BIT macro
  2019-03-22  1:26 ` [PATCH 2/2] Staging: media: davinci_vpfe: Remove RESETBIT " Madhumitha Prabakaran
  2019-03-22  5:26   ` Greg KH
@ 2019-03-22  6:23   ` Julia Lawall
  1 sibling, 0 replies; 8+ messages in thread
From: Julia Lawall @ 2019-03-22  6:23 UTC (permalink / raw)
  To: Madhumitha Prabakaran; +Cc: mchehab, gregkh, outreachy-kernel



On Thu, 21 Mar 2019, Madhumitha Prabakaran wrote:

> Remove RESETBIT macro and use BIT(x) instead of (1 << x) to improve
> codebase.

These could be just one patch, since it is basically the same thing.

The reason offered is not very clear.  Probably all patches have the goal
of improving the codebase.

The original reason was that it is not very convenient to turn the macro
into a function.  You could, however, have just left it as a macro.  Or
you could have changed the macro to use BIT.  The proposed approach makes
it more apparent in the source code what is going on.  There are a lot of
occurrences of eg ... |= BIT(...) in the kernel, and there doesn't seem to
be an established macro for this, so the change is probably fine.

julia

>
> Signed-off-by: Madhumitha Prabakaran <madhumithabiw@gmail.com>
> ---
>  drivers/staging/media/davinci_vpfe/dm365_ipipeif.c | 8 ++++----
>  drivers/staging/media/davinci_vpfe/dm365_ipipeif.h | 1 -
>  2 files changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/staging/media/davinci_vpfe/dm365_ipipeif.c b/drivers/staging/media/davinci_vpfe/dm365_ipipeif.c
> index 382d88bee5a7..4f18db127caf 100644
> --- a/drivers/staging/media/davinci_vpfe/dm365_ipipeif.c
> +++ b/drivers/staging/media/davinci_vpfe/dm365_ipipeif.c
> @@ -296,14 +296,14 @@ static int ipipeif_hw_setup(struct v4l2_subdev *sd)
>  		case MEDIA_BUS_FMT_YUYV8_1X16:
>  		case MEDIA_BUS_FMT_UYVY8_2X8:
>  		case MEDIA_BUS_FMT_Y8_1X8:
> -			RESETBIT(val, IPIPEIF_CFG2_YUV8_SHIFT);
> +			val &= ~BIT(IPIPEIF_CFG2_YUV8_SHIFT);
>  			val |= BIT(IPIPEIF_CFG2_YUV16_SHIFT);
>  			ipipeif_write(val, ipipeif_base_addr, IPIPEIF_CFG2);
>  			break;
>
>  		default:
> -			RESETBIT(val, IPIPEIF_CFG2_YUV8_SHIFT);
> -			RESETBIT(val, IPIPEIF_CFG2_YUV16_SHIFT);
> +			val &= ~BIT(IPIPEIF_CFG2_YUV8_SHIFT);
> +			val &= ~BIT(IPIPEIF_CFG2_YUV16_SHIFT);
>  			ipipeif_write(val, ipipeif_base_addr, IPIPEIF_CFG2);
>  			break;
>  		}
> @@ -344,7 +344,7 @@ static int ipipeif_hw_setup(struct v4l2_subdev *sd)
>  		switch (isif_port_if) {
>  		case MEDIA_BUS_FMT_YUYV8_1X16:
>  		case MEDIA_BUS_FMT_YUYV10_1X20:
> -			RESETBIT(val, IPIPEIF_CFG2_YUV8_SHIFT);
> +			val &= ~BIT(val, IPIPEIF_CFG2_YUV8_SHIFT);
>  			val |= BIT(IPIPEIF_CFG2_YUV16_SHIFT);
>  			break;
>
> diff --git a/drivers/staging/media/davinci_vpfe/dm365_ipipeif.h b/drivers/staging/media/davinci_vpfe/dm365_ipipeif.h
> index 7bbe7a932b30..4d126fc871f3 100644
> --- a/drivers/staging/media/davinci_vpfe/dm365_ipipeif.h
> +++ b/drivers/staging/media/davinci_vpfe/dm365_ipipeif.h
> @@ -166,7 +166,6 @@ struct vpfe_ipipeif_device {
>  #define IPIPEIF_RSZ_MIN			16
>  #define IPIPEIF_RSZ_MAX			112
>  #define IPIPEIF_RSZ_CONST		16
> -#define RESETBIT(reg, bit) (reg = ((reg) & (~(0x00000001<<(bit)))))
>
>  #define IPIPEIF_ADOFS_LSB_MASK		0x1ff
>  #define IPIPEIF_ADOFS_LSB_SHIFT		5
> --
> 2.17.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/a64c7dd0bf44cc3ac0270a382209e592c8a05987.1553217781.git.madhumithabiw%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>


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

* Re: [Outreachy kernel] Re: [PATCH 2/2] Staging: media: davinci_vpfe: Remove RESETBIT macro and use BIT macro
  2019-03-22  5:26   ` Greg KH
@ 2019-03-22  6:31     ` Julia Lawall
  2019-03-22  7:07       ` Greg KH
  0 siblings, 1 reply; 8+ messages in thread
From: Julia Lawall @ 2019-03-22  6:31 UTC (permalink / raw)
  To: Greg KH; +Cc: Madhumitha Prabakaran, mchehab, outreachy-kernel



On Fri, 22 Mar 2019, Greg KH wrote:

> On Thu, Mar 21, 2019 at 08:26:06PM -0500, Madhumitha Prabakaran wrote:
> > Remove RESETBIT macro and use BIT(x) instead of (1 << x) to improve
> > codebase.
> >
> > Signed-off-by: Madhumitha Prabakaran <madhumithabiw@gmail.com>
> > ---
> >  drivers/staging/media/davinci_vpfe/dm365_ipipeif.c | 8 ++++----
> >  drivers/staging/media/davinci_vpfe/dm365_ipipeif.h | 1 -
> >  2 files changed, 4 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/staging/media/davinci_vpfe/dm365_ipipeif.c b/drivers/staging/media/davinci_vpfe/dm365_ipipeif.c
> > index 382d88bee5a7..4f18db127caf 100644
> > --- a/drivers/staging/media/davinci_vpfe/dm365_ipipeif.c
> > +++ b/drivers/staging/media/davinci_vpfe/dm365_ipipeif.c
> > @@ -296,14 +296,14 @@ static int ipipeif_hw_setup(struct v4l2_subdev *sd)
> >  		case MEDIA_BUS_FMT_YUYV8_1X16:
> >  		case MEDIA_BUS_FMT_UYVY8_2X8:
> >  		case MEDIA_BUS_FMT_Y8_1X8:
> > -			RESETBIT(val, IPIPEIF_CFG2_YUV8_SHIFT);
> > +			val &= ~BIT(IPIPEIF_CFG2_YUV8_SHIFT);
>
> clear_bit()?
>
> >  			val |= BIT(IPIPEIF_CFG2_YUV16_SHIFT);
>
> set_bit()?

OK, I see that the definition of these things is much more complicated
than what I was looking for.  These are atomic operations.  There is also
__set_bit, which is not atomic.  But set_bit does seem to be commonly
used.

julia


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

* Re: [Outreachy kernel] Re: [PATCH 2/2] Staging: media: davinci_vpfe: Remove RESETBIT macro and use BIT macro
  2019-03-22  6:31     ` [Outreachy kernel] " Julia Lawall
@ 2019-03-22  7:07       ` Greg KH
  0 siblings, 0 replies; 8+ messages in thread
From: Greg KH @ 2019-03-22  7:07 UTC (permalink / raw)
  To: Julia Lawall; +Cc: Madhumitha Prabakaran, mchehab, outreachy-kernel

On Fri, Mar 22, 2019 at 07:31:01AM +0100, Julia Lawall wrote:
> 
> 
> On Fri, 22 Mar 2019, Greg KH wrote:
> 
> > On Thu, Mar 21, 2019 at 08:26:06PM -0500, Madhumitha Prabakaran wrote:
> > > Remove RESETBIT macro and use BIT(x) instead of (1 << x) to improve
> > > codebase.
> > >
> > > Signed-off-by: Madhumitha Prabakaran <madhumithabiw@gmail.com>
> > > ---
> > >  drivers/staging/media/davinci_vpfe/dm365_ipipeif.c | 8 ++++----
> > >  drivers/staging/media/davinci_vpfe/dm365_ipipeif.h | 1 -
> > >  2 files changed, 4 insertions(+), 5 deletions(-)
> > >
> > > diff --git a/drivers/staging/media/davinci_vpfe/dm365_ipipeif.c b/drivers/staging/media/davinci_vpfe/dm365_ipipeif.c
> > > index 382d88bee5a7..4f18db127caf 100644
> > > --- a/drivers/staging/media/davinci_vpfe/dm365_ipipeif.c
> > > +++ b/drivers/staging/media/davinci_vpfe/dm365_ipipeif.c
> > > @@ -296,14 +296,14 @@ static int ipipeif_hw_setup(struct v4l2_subdev *sd)
> > >  		case MEDIA_BUS_FMT_YUYV8_1X16:
> > >  		case MEDIA_BUS_FMT_UYVY8_2X8:
> > >  		case MEDIA_BUS_FMT_Y8_1X8:
> > > -			RESETBIT(val, IPIPEIF_CFG2_YUV8_SHIFT);
> > > +			val &= ~BIT(IPIPEIF_CFG2_YUV8_SHIFT);
> >
> > clear_bit()?
> >
> > >  			val |= BIT(IPIPEIF_CFG2_YUV16_SHIFT);
> >
> > set_bit()?
> 
> OK, I see that the definition of these things is much more complicated
> than what I was looking for.  These are atomic operations.  There is also
> __set_bit, which is not atomic.  But set_bit does seem to be commonly
> used.

Only use __set_bit() if you know you are safe doing the operation in an
"unordered" fashion.  Given that these originally were "open coded",
it's probably safe, but it's simpler to use the ordered calls for now.

thanks,

greg k-h


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

end of thread, other threads:[~2019-03-22  7:07 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-22  1:26 [PATCH 0/2] Remove macros and use BIT macros Madhumitha Prabakaran
2019-03-22  1:26 ` [PATCH 1/2] Staging: media: davinci_vpfe: Remove SETBIT macro and use BIT macro Madhumitha Prabakaran
2019-03-22  5:26   ` Greg KH
2019-03-22  1:26 ` [PATCH 2/2] Staging: media: davinci_vpfe: Remove RESETBIT " Madhumitha Prabakaran
2019-03-22  5:26   ` Greg KH
2019-03-22  6:31     ` [Outreachy kernel] " Julia Lawall
2019-03-22  7:07       ` Greg KH
2019-03-22  6:23   ` [Outreachy kernel] " Julia Lawall

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.