platform/x86: acer-wmi: refactor function has_cap
Subsystems (2)
PATCH 1/1 platform/x86: acer-wmi: refactor function has_cap
Refactor function has_cap in order to avoid returning integer values, when instead it should return booleans.
This code was detected with the help of Coccinelle.
--- drivers/platform/x86/acer-wmi.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/platform/x86/acer-wmi.c +1 -4
@@ -672,10 +672,7 @@ static void __init find_quirks(void)static bool has_cap (u32 cap) { -if ((interface->capability & cap) !=0 ) -return 1 ; - -return 0 ; +return (interface->capability & cap) !=0 ; }/*
Signature · 1 line
2.7.4
Quoted 15 lines · Gustavo A. R. Silva
Refactor function
has_capin order to avoid returning integer values, when instead it should return booleans.This code was detected with the help of Coccinelle.
Signed-off-by Gustavo A. R. Silva <[email protected]>--- drivers/platform/x86/acer-wmi.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)drivers/platform/x86/acer-wmi.c +0
-0
drivers/platform/x86/acer-wmi.c static void __init find_quirks(void) · line 676
Quoted 9 lines
drivers/platform/x86/acer-wmi.c +1
-4@@ -672,10 +672,7 @@ static void __init find_quirks(void)static bool has_cap (u32 cap) { -if ((interface->capability & cap) !=0 ) -return 1 ; - -return 0 ; +return (interface->capability & cap) !=0 ; }
Thanks, as Joe mentioned even != 0 part is not needed (followed by unneeded parens), though I would let it be (one line is good enough to me) if there will be no strong preferences.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 18 lines · Andy Shevchenko
Quoted 16 lines · Gustavo A. R. Silva
Refactor function
has_capin order to avoid returning integer values, when instead it should return booleans.This code was detected with the help of Coccinelle.
Signed-off-by Gustavo A. R. Silva <[email protected]>--- drivers/platform/x86/acer-wmi.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)drivers/platform/x86/acer-wmi.c +0
-0@@ -672,10 +672,7 @@ static void __init find_quirks(void)
Quoted 13 lines
drivers/platform/x86/acer-wmi.c static void __init find_quirks(void) · line 676
Quoted 8 lines
drivers/platform/x86/acer-wmi.c +1
-4static bool has_cap (u32 cap) { -if ((interface->capability & cap) !=0 ) -return 1 ; - -return 0 ; +return (interface->capability & cap) !=0 ; }Thanks, as Joe mentioned even != 0 part is not needed (followed by unneeded parens), though I would let it be (one line is good enough to me) if there will be no strong preferences.
Oh, yeah. I like it better what Joe suggested.
Let me send v2, shortly.
Thanks
--
Gustavo