* [PATCH] staging: media: atomisp: Use GENMASK instead of manual masking
@ 2022-02-06 18:58 Moses Christopher Bollavarapu
2022-02-07 12:31 ` Andy Shevchenko
0 siblings, 1 reply; 2+ messages in thread
From: Moses Christopher Bollavarapu @ 2022-02-06 18:58 UTC (permalink / raw)
To: mosescb.dev
Cc: andriy.shevchenko, gregkh, joe, kitakar, laurent.pinchart,
linux-kernel, linux-media, linux-staging, mchehab, sakari.ailus,
tomi.valkeinen, dan.carpenter
There is a GENMASK macro available in linux/bits.h, for masking.
Example: GENMASK(3, 0) = 0b00001111 (same as (1 << 4) - 1)
Signed-off-by: Moses Christopher Bollavarapu <mosescb.dev@gmail.com>
---
drivers/staging/media/atomisp/pci/atomisp_compat_css20.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
index 1173be0e72b0..a345fa1d7de9 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
@@ -40,6 +40,7 @@
#include <linux/io.h>
#include <linux/pm_runtime.h>
+#include <linux/bits.h>
/* Assume max number of ACC stages */
#define MAX_ACC_STAGES 20
@@ -1913,11 +1914,11 @@ void atomisp_css_input_set_mode(struct atomisp_sub_device *asd,
&asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL].stream_config;
s_config->mode = IA_CSS_INPUT_MODE_TPG;
s_config->source.tpg.mode = IA_CSS_TPG_MODE_CHECKERBOARD;
- s_config->source.tpg.x_mask = (1 << 4) - 1;
+ s_config->source.tpg.x_mask = GENMASK(3, 0);
s_config->source.tpg.x_delta = -2;
- s_config->source.tpg.y_mask = (1 << 4) - 1;
+ s_config->source.tpg.y_mask = GENMASK(3, 0);
s_config->source.tpg.y_delta = 3;
- s_config->source.tpg.xy_mask = (1 << 8) - 1;
+ s_config->source.tpg.xy_mask = GENMASK(7, 0);
return;
}
--
2.30.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] staging: media: atomisp: Use GENMASK instead of manual masking
2022-02-06 18:58 [PATCH] staging: media: atomisp: Use GENMASK instead of manual masking Moses Christopher Bollavarapu
@ 2022-02-07 12:31 ` Andy Shevchenko
0 siblings, 0 replies; 2+ messages in thread
From: Andy Shevchenko @ 2022-02-07 12:31 UTC (permalink / raw)
To: Moses Christopher Bollavarapu
Cc: gregkh, joe, kitakar, laurent.pinchart, linux-kernel, linux-media,
linux-staging, mchehab, sakari.ailus, tomi.valkeinen,
dan.carpenter
On Sun, Feb 06, 2022 at 07:58:30PM +0100, Moses Christopher Bollavarapu wrote:
> There is a GENMASK macro available in linux/bits.h, for masking.
>
> Example: GENMASK(3, 0) = 0b00001111 (same as (1 << 4) - 1)
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Signed-off-by: Moses Christopher Bollavarapu <mosescb.dev@gmail.com>
> ---
> drivers/staging/media/atomisp/pci/atomisp_compat_css20.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
> index 1173be0e72b0..a345fa1d7de9 100644
> --- a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
> +++ b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
> @@ -40,6 +40,7 @@
>
> #include <linux/io.h>
> #include <linux/pm_runtime.h>
> +#include <linux/bits.h>
Probably this can be still ordered.
> /* Assume max number of ACC stages */
> #define MAX_ACC_STAGES 20
> @@ -1913,11 +1914,11 @@ void atomisp_css_input_set_mode(struct atomisp_sub_device *asd,
> &asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL].stream_config;
> s_config->mode = IA_CSS_INPUT_MODE_TPG;
> s_config->source.tpg.mode = IA_CSS_TPG_MODE_CHECKERBOARD;
> - s_config->source.tpg.x_mask = (1 << 4) - 1;
> + s_config->source.tpg.x_mask = GENMASK(3, 0);
> s_config->source.tpg.x_delta = -2;
> - s_config->source.tpg.y_mask = (1 << 4) - 1;
> + s_config->source.tpg.y_mask = GENMASK(3, 0);
> s_config->source.tpg.y_delta = 3;
> - s_config->source.tpg.xy_mask = (1 << 8) - 1;
> + s_config->source.tpg.xy_mask = GENMASK(7, 0);
> return;
> }
>
> --
> 2.30.2
>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-02-07 12:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-06 18:58 [PATCH] staging: media: atomisp: Use GENMASK instead of manual masking Moses Christopher Bollavarapu
2022-02-07 12:31 ` Andy Shevchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).