* [PATCH] iio: adc: qcom-spmi-adc5-gen3: remove redundant OR with zero
@ 2026-03-19 8:57 Giorgi Tchankvetadze
2026-03-19 9:16 ` Andy Shevchenko
0 siblings, 1 reply; 5+ messages in thread
From: Giorgi Tchankvetadze @ 2026-03-19 8:57 UTC (permalink / raw)
To: antoniu.miclaus, lars, Michael.Hennerich, jic23
Cc: dlechner, nuno.sa, andy, linux-iio, Giorgi Tchankvetadze
The expression 'ADC5_GEN3_CHAN_CONV_REQ | 0' is redundant because
OR-ing any value with zero does nothing. Remove the pointless '| 0'
to simplify the code.
This cleanup has no functional change.
Signed-off-by: Giorgi Tchankvetadze <giorgitchankvetadze1997@gmail.com>
---
drivers/iio/adc/qcom-spmi-adc5-gen3.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/adc/qcom-spmi-adc5-gen3.c b/drivers/iio/adc/qcom-spmi-adc5-gen3.c
index f8168a14b907..b3af28ad729d 100644
--- a/drivers/iio/adc/qcom-spmi-adc5-gen3.c
+++ b/drivers/iio/adc/qcom-spmi-adc5-gen3.c
@@ -144,7 +144,7 @@ static int adc5_gen3_configure(struct adc5_chip *adc,
* Use channel 0 by default for immediate conversion and to indicate
* there is an actual conversion request
*/
- buf[1] = ADC5_GEN3_CHAN_CONV_REQ | 0;
+ buf[1] = ADC5_GEN3_CHAN_CONV_REQ;
buf[2] = ADC5_GEN3_TIME_IMMEDIATE;
--
2.52.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] iio: adc: qcom-spmi-adc5-gen3: remove redundant OR with zero
2026-03-19 8:57 [PATCH] iio: adc: qcom-spmi-adc5-gen3: remove redundant OR with zero Giorgi Tchankvetadze
@ 2026-03-19 9:16 ` Andy Shevchenko
2026-03-19 9:20 ` Andy Shevchenko
2026-03-19 19:50 ` Jonathan Cameron
0 siblings, 2 replies; 5+ messages in thread
From: Andy Shevchenko @ 2026-03-19 9:16 UTC (permalink / raw)
To: Giorgi Tchankvetadze
Cc: antoniu.miclaus, lars, Michael.Hennerich, jic23, dlechner,
nuno.sa, andy, linux-iio
On Thu, Mar 19, 2026 at 12:57:42PM +0400, Giorgi Tchankvetadze wrote:
> The expression 'ADC5_GEN3_CHAN_CONV_REQ | 0' is redundant because
> OR-ing any value with zero does nothing. Remove the pointless '| 0'
> to simplify the code.
Have you read the comment above?
...
> * Use channel 0 by default for immediate conversion and to indicate
^^^
> * there is an actual conversion request
> */
I believe this is done for clarity. No need to have this patch, but I won't
object going it in, since the comment still stays. I leave it to Jonathan,
but I'm not going to give any tag here.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] iio: adc: qcom-spmi-adc5-gen3: remove redundant OR with zero
2026-03-19 9:16 ` Andy Shevchenko
@ 2026-03-19 9:20 ` Andy Shevchenko
2026-03-19 9:58 ` Giorgi Tchankvetadze
2026-03-19 19:50 ` Jonathan Cameron
1 sibling, 1 reply; 5+ messages in thread
From: Andy Shevchenko @ 2026-03-19 9:20 UTC (permalink / raw)
To: Giorgi Tchankvetadze
Cc: antoniu.miclaus, lars, Michael.Hennerich, jic23, dlechner,
nuno.sa, andy, linux-iio
On Thu, Mar 19, 2026 at 11:16:15AM +0200, Andy Shevchenko wrote:
> On Thu, Mar 19, 2026 at 12:57:42PM +0400, Giorgi Tchankvetadze wrote:
> > The expression 'ADC5_GEN3_CHAN_CONV_REQ | 0' is redundant because
> > OR-ing any value with zero does nothing. Remove the pointless '| 0'
> > to simplify the code.
>
> Have you read the comment above?
...
> > * Use channel 0 by default for immediate conversion and to indicate
>
> ^^^
>
> > * there is an actual conversion request
> > */
>
> I believe this is done for clarity. No need to have this patch, but I won't
> object going it in, since the comment still stays. I leave it to Jonathan,
> but I'm not going to give any tag here.
FWIW to add is that I personally do stuff like this (*) from time to time
and see nothing wrong with the code that gets optimised just at compile-time
even by some dumb and old compilers.
*)
IIRC I have done something like 'foo = BAR | (0 << 20) | BAZ;' for the clarity
of the value that gets into bit 20 of the register.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] iio: adc: qcom-spmi-adc5-gen3: remove redundant OR with zero
2026-03-19 9:20 ` Andy Shevchenko
@ 2026-03-19 9:58 ` Giorgi Tchankvetadze
0 siblings, 0 replies; 5+ messages in thread
From: Giorgi Tchankvetadze @ 2026-03-19 9:58 UTC (permalink / raw)
To: Andy Shevchenko
Cc: antoniu.miclaus, lars, Michael.Hennerich, jic23, dlechner,
nuno.sa, andy, linux-iio
On Thu, Mar 19, 2026 at 1:20 PM Andy Shevchenko
<andriy.shevchenko@intel.com> wrote:
> Have you read the comment above?
> I believe this is done for clarity. No need to have this patch, but I won't
> object going it in, since the comment still stays. I leave it to Jonathan,
> but I'm not going to give any tag here.
Hey Andy. Yes, I did read and consider the comment. My intent was to
remove what is technically a no-op at the C level, but I agree that in
this context it also serves a purpose. I might have misprioritized the
situation or trusted Coccinelle a little too hard (Yes, I remember the
first thing with such tools - warnings are just recommendations :P ).
Thanks for the review !
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] iio: adc: qcom-spmi-adc5-gen3: remove redundant OR with zero
2026-03-19 9:16 ` Andy Shevchenko
2026-03-19 9:20 ` Andy Shevchenko
@ 2026-03-19 19:50 ` Jonathan Cameron
1 sibling, 0 replies; 5+ messages in thread
From: Jonathan Cameron @ 2026-03-19 19:50 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Giorgi Tchankvetadze, antoniu.miclaus, lars, Michael.Hennerich,
dlechner, nuno.sa, andy, linux-iio
On Thu, 19 Mar 2026 11:16:11 +0200
Andy Shevchenko <andriy.shevchenko@intel.com> wrote:
> On Thu, Mar 19, 2026 at 12:57:42PM +0400, Giorgi Tchankvetadze wrote:
> > The expression 'ADC5_GEN3_CHAN_CONV_REQ | 0' is redundant because
> > OR-ing any value with zero does nothing. Remove the pointless '| 0'
> > to simplify the code.
>
> Have you read the comment above?
>
> ...
>
> > * Use channel 0 by default for immediate conversion and to indicate
>
> ^^^
>
> > * there is an actual conversion request
> > */
>
> I believe this is done for clarity. No need to have this patch, but I won't
> object going it in, since the comment still stays. I leave it to Jonathan,
> but I'm not going to give any tag here.
>
Without the 0 it might appear that the comment was talking about what was
explicitly set in what was left. So ADC5_GEN3_CHAN_CONV_REQ hich would be
misleading. So short of saying in the comment that the 0 is another field
in the same register I don't see this being conveyed as well by comments as
the code is doing.
Thanks,
Jonathan
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-03-19 19:50 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-19 8:57 [PATCH] iio: adc: qcom-spmi-adc5-gen3: remove redundant OR with zero Giorgi Tchankvetadze
2026-03-19 9:16 ` Andy Shevchenko
2026-03-19 9:20 ` Andy Shevchenko
2026-03-19 9:58 ` Giorgi Tchankvetadze
2026-03-19 19:50 ` Jonathan Cameron
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.