diff mbox series

[34/34] sh: rework ilsel_enable()

Message ID 20231118155105.25678-35-yury.norov@gmail.com (mailing list archive)
State New
Headers show
Series biops: add atomig find_bit() operations | expand

Commit Message

Yury Norov Nov. 18, 2023, 3:51 p.m. UTC
Fix opencoded find_and_set_bit(), which also suppresses potential
KCSAN warning.

Signed-off-by: Yury Norov <yury.norov@gmail.com>
---
 arch/sh/boards/mach-x3proto/ilsel.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

John Paul Adrian Glaubitz Nov. 18, 2023, 4:15 p.m. UTC | #1
Hello Yury!

On Sat, 2023-11-18 at 07:51 -0800, Yury Norov wrote:
> Fix opencoded find_and_set_bit(), which also suppresses potential
> KCSAN warning.
> 
> Signed-off-by: Yury Norov <yury.norov@gmail.com>
> ---
>  arch/sh/boards/mach-x3proto/ilsel.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/sh/boards/mach-x3proto/ilsel.c b/arch/sh/boards/mach-x3proto/ilsel.c
> index f0d5eb41521a..7fadc479a80b 100644
> --- a/arch/sh/boards/mach-x3proto/ilsel.c
> +++ b/arch/sh/boards/mach-x3proto/ilsel.c
> @@ -99,8 +99,8 @@ int ilsel_enable(ilsel_source_t set)
>  	}
>  
>  	do {
> -		bit = find_first_zero_bit(&ilsel_level_map, ILSEL_LEVELS);
> -	} while (test_and_set_bit(bit, &ilsel_level_map));
> +		bit = find_and_set_bit(&ilsel_level_map, ILSEL_LEVELS);
> +	} while (bit >= ILSEL_LEVELS);
>  
>  	__ilsel_enable(set, bit);
>  

The subject should mention the subsystem, i.e. "sh: mach-x3proto:".

Adrian
Yury Norov Nov. 21, 2023, 1:43 p.m. UTC | #2
On Sat, Nov 18, 2023 at 05:15:57PM +0100, John Paul Adrian Glaubitz wrote:
> Hello Yury!
> 
> On Sat, 2023-11-18 at 07:51 -0800, Yury Norov wrote:
> > Fix opencoded find_and_set_bit(), which also suppresses potential
> > KCSAN warning.
> > 
> > Signed-off-by: Yury Norov <yury.norov@gmail.com>
> > ---
> >  arch/sh/boards/mach-x3proto/ilsel.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/arch/sh/boards/mach-x3proto/ilsel.c b/arch/sh/boards/mach-x3proto/ilsel.c
> > index f0d5eb41521a..7fadc479a80b 100644
> > --- a/arch/sh/boards/mach-x3proto/ilsel.c
> > +++ b/arch/sh/boards/mach-x3proto/ilsel.c
> > @@ -99,8 +99,8 @@ int ilsel_enable(ilsel_source_t set)
> >  	}
> >  
> >  	do {
> > -		bit = find_first_zero_bit(&ilsel_level_map, ILSEL_LEVELS);
> > -	} while (test_and_set_bit(bit, &ilsel_level_map));
> > +		bit = find_and_set_bit(&ilsel_level_map, ILSEL_LEVELS);
> > +	} while (bit >= ILSEL_LEVELS);
> >  
> >  	__ilsel_enable(set, bit);
> >  
> 
> The subject should mention the subsystem, i.e. "sh: mach-x3proto:".

OK, will do in v2
diff mbox series

Patch

diff --git a/arch/sh/boards/mach-x3proto/ilsel.c b/arch/sh/boards/mach-x3proto/ilsel.c
index f0d5eb41521a..7fadc479a80b 100644
--- a/arch/sh/boards/mach-x3proto/ilsel.c
+++ b/arch/sh/boards/mach-x3proto/ilsel.c
@@ -99,8 +99,8 @@  int ilsel_enable(ilsel_source_t set)
 	}
 
 	do {
-		bit = find_first_zero_bit(&ilsel_level_map, ILSEL_LEVELS);
-	} while (test_and_set_bit(bit, &ilsel_level_map));
+		bit = find_and_set_bit(&ilsel_level_map, ILSEL_LEVELS);
+	} while (bit >= ILSEL_LEVELS);
 
 	__ilsel_enable(set, bit);