lib/string_choices: Sorting function order
v2 cover lib/string_choices: Sorting function order
This patch series rearrange misplaced functions in sorted order and add str_locked_unlocked() helper.
---
Changes in v2: Rearrange functions in sorted order as seperate patch.
Changes in v1: Add str_locked_unlocked helper function alone.
link to v1: https://lore.kernel.org/all/[email protected]/
---
R Sundar (2):
lib/string_choices: Rearrange functions in sorted order lib/string_choices: Add str_locked_unlocked()/str_unlocked_locked()
helper
include/linux/string_choices.h | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-)
Signature · 1 line
2.34.1
PATCH v2 1/2 lib/string_choices: Rearrange functions in sorted order
Rearrange misplaced functions in sorted order.
--- include/linux/string_choices.h | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
include/linux/string_choices.h +12 -12
@@ -41,23 +41,23 @@ static inline const char *str_high_low(bool v) }#define str_low_high (v) str_high_low(!(v)) -static inline const char *str_read_write (bool v) -{ -return v ?"read" :"write" ; -} -#define str_write_read (v) str_read_write(!(v)) -static inline const char *str_on_off (bool v) {return v ?"on" :"off" ; }#define str_off_on (v) str_on_off(!(v)) -static inline const char *str_yes_no (bool v) +static inline const char *str_read_write (bool v) { -return v ?"yes" :"no" ; +return v ?"read" :"write" ; } -#define str_no_yes (v) str_yes_no(!(v)) +#define str_write_read (v) str_read_write(!(v)) + +static inline const char *str_true_false (bool v) +{ +return v ?"true" :"false" ; +} +#define str_false_true (v) str_true_false(!(v))static inline const char *str_up_down (bool v) {
@@ -65,11 +65,11 @@ static inline const char *str_up_down(bool v) }#define str_down_up (v) str_up_down(!(v)) -static inline const char *str_true_false (bool v) +static inline const char *str_yes_no (bool v) { -return v ?"true" :"false" ; +return v ?"yes" :"no" ; } -#define str_false_true (v) str_true_false(!(v)) +#define str_no_yes (v) str_yes_no(!(v))/** * str_plural - Return the simple pluralization based on English counts
Signature · 1 line
2.34.1
PATCH v2 2/2 lib/string_choices: Add str_locked_unlocked()/str_unlocked_locked() helper
In reply to R SundarAdd str_locked_unlocked()/str_unlocked_locked() helper to return "locked" or "unlocked" string literal.
--- include/linux/string_choices.h | 6 ++++++ 1 file changed, 6 insertions(+)
include/linux/string_choices.h +6 -0
@@ -41,6 +41,12 @@ static inline const char *str_high_low(bool v) }#define str_low_high (v) str_high_low(!(v)) +static inline const char *str_locked_unlocked (bool v) +{ +return v ?"locked" :"unlocked" ; +} +#define str_unlocked_locked (v) str_locked_unlocked(!(v)) +static inline const char *str_on_off (bool v) {return v ?"on" :"off" ;
Signature · 1 line
2.34.1
Quoted 3 lines · R Sundar
This patch series rearrange misplaced functions in sorted order and add
str_locked_unlocked()helper.
LGTM,
Signature · 2 lines
With Best Regards, Andy Shevchenko
Andy Shevchenko
reviewerQuoted 2 lines · R Sundar
This patch series rearrange misplaced functions in sorted order and add
str_locked_unlocked()helper.
Kees, anything preventing us to apply the first patch from the series?
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v2 linux-next 1/2] lib/string_choices: Rearrange functions in sorted order
In reply to R SundarQuoted 4 lines · R Sundar
Rearrange misplaced functions in sorted order.
Suggested-by Andy Shevchenko <[email protected]>Signed-off-by R Sundar <[email protected]>
This is a much-needed patch.
R Sundar,
Can I pick it into my series in case it will not be accepted in the nearest future? (I do not promise this, but there is a chance)
Quoted 59 lines
--- include/linux/string_choices.h | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)include/linux/string_choices.h +12
-12@@ -41,23 +41,23 @@ static inline const char *str_high_low(bool v) }#define str_low_high (v) str_high_low(!(v)) -static inline const char *str_read_write (bool v) -{ -return v ?"read" :"write" ; -} -#define str_write_read (v) str_read_write(!(v)) -static inline const char *str_on_off (bool v) {return v ?"on" :"off" ; }#define str_off_on (v) str_on_off(!(v)) -static inline const char *str_yes_no (bool v) +static inline const char *str_read_write (bool v) { -return v ?"yes" :"no" ; +return v ?"read" :"write" ; } -#define str_no_yes (v) str_yes_no(!(v)) +#define str_write_read (v) str_read_write(!(v)) + +static inline const char *str_true_false (bool v) +{ +return v ?"true" :"false" ; +} +#define str_false_true (v) str_true_false(!(v))static inline const char *str_up_down (bool v) {@@ -65,11 +65,11 @@ static inline const char *str_up_down(bool v) }#define str_down_up (v) str_up_down(!(v)) -static inline const char *str_true_false (bool v) +static inline const char *str_yes_no (bool v) { -return v ?"true" :"false" ; +return v ?"yes" :"no" ; } -#define str_false_true (v) str_true_false(!(v)) +#define str_no_yes (v) str_yes_no(!(v))/** * str_plural - Return the simple pluralization based on English counts Signature · 1 line
2.34.1
Re: [PATCH v2 linux-next 1/2] lib/string_choices: Rearrange functions in sorted order
Quoted 6 lines · Larysa Zaremba
Quoted 4 lines · R Sundar
Rearrange misplaced functions in sorted order.
Suggested-by Andy Shevchenko <[email protected]>Signed-off-by R Sundar <[email protected]>
Quoted 8 lines
Reviewed-by Larysa Zaremba <[email protected]>This is a much-needed patch.
R Sundar,
Can I pick it into my series in case it will not be accepted in the nearest future? (I do not promise this, but there is a chance)
Hi,
Yes, Please.
Thanks.
Best Regards,
Sundar
Quoted 59 lines
Quoted 59 lines
--- include/linux/string_choices.h | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)include/linux/string_choices.h +12
-12@@ -41,23 +41,23 @@ static inline const char *str_high_low(bool v) }#define str_low_high (v) str_high_low(!(v)) -static inline const char *str_read_write (bool v) -{ -return v ?"read" :"write" ; -} -#define str_write_read (v) str_read_write(!(v)) -static inline const char *str_on_off (bool v) {return v ?"on" :"off" ; }#define str_off_on (v) str_on_off(!(v)) -static inline const char *str_yes_no (bool v) +static inline const char *str_read_write (bool v) { -return v ?"yes" :"no" ; +return v ?"read" :"write" ; } -#define str_no_yes (v) str_yes_no(!(v)) +#define str_write_read (v) str_read_write(!(v)) + +static inline const char *str_true_false (bool v) +{ +return v ?"true" :"false" ; +} +#define str_false_true (v) str_true_false(!(v))static inline const char *str_up_down (bool v) {@@ -65,11 +65,11 @@ static inline const char *str_up_down(bool v) }#define str_down_up (v) str_up_down(!(v)) -static inline const char *str_true_false (bool v) +static inline const char *str_yes_no (bool v) { -return v ?"true" :"false" ; +return v ?"yes" :"no" ; } -#define str_false_true (v) str_true_false(!(v)) +#define str_no_yes (v) str_yes_no(!(v))/** * str_plural - Return the simple pluralization based on English counts Signature · 1 line
2.34.1
Re: (subset) [PATCH v2 linux-next 1/2] lib/string_choices: Rearrange functions in sorted order
In reply to R SundarQuoted 3 lines · R Sundar
Rearrange misplaced functions in sorted order.
Applied to for-next/hardening, thanks!
[1/2] lib/string_choices: Rearrange functions in sorted order
https://git.kernel.org/kees/c/e8cd61e403ea
Take care,
Signature · 1 line
Kees Cook