lib/string_choices: Add str_locked_unlocked()/str_unlocked_locked() helper
PATCH 1/1 lib/string_choices: Add str_locked_unlocked()/str_unlocked_locked() helper
Add str_locked_unlocked()/str_unlocked_locked() helper to return "locked" or "unlocked" string literal
---
https://lore.kernel.org/all/[email protected]/
https://lore.kernel.org/all/[email protected]/
There are about 9 occurence for locked and unlocked string combination.
include/linux/string_choices.h | 6 ++++++ 1 file changed, 6 insertions(+)
include/linux/string_choices.h +6 -0
@@ -82,4 +82,10 @@ static inline const char *str_plural(size_t num) return num == 1 ? "" : "s"; } +static inline const char *str_locked_unlocked (bool v) +{ +return v ?"locked" :"unlocked" ; +} +#define str_unlocked_locked (v) str_locked_unlocked(!(v)) +#endif
Signature · 1 line
2.34.1
Quoted 3 lines · R Sundar
Add str_locked_unlocked()/str_unlocked_locked() helper to return "locked" or "unlocked" string literal
Missing period.
...
include/linux/string_choices.h static inline const char *str_plural(size_t num) · line 89
Quoted 11 lines
include/linux/string_choices.h +5
-0@@ -82,4 +82,10 @@ static inline const char *str_plural(size_t num)return num ==1 ?"" :"s" ; } +static inline const char *str_locked_unlocked (bool v) +{ +return v ?"locked" :"unlocked" ; +} +#define str_unlocked_locked (v) str_locked_unlocked(!(v))
The rest is sorted (okay, read_write() seems to be misplaced, fix that in a separate change if you wish), please keep it that way (I believe it should go before on_off).
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 1 line · Andy Shevchenko
On Fri, Nov 15, 2024 at 4:47 PM R Sundar <[email protected]> wrote:
...
Quoted 6 lines
Quoted 6 lines
include/linux/string_choices.h +0
-0@@ -82,4 +82,10 @@ static inline const char *str_plural(size_t num)return num ==1 ?"" :"s" ; }
Quoted 9 lines
include/linux/string_choices.h static inline const char *str_plural(size_t num) · line 89
Quoted 5 lines
include/linux/string_choices.h +5
-0+static inline const char *str_locked_unlocked (bool v) +{ +return v ?"locked" :"unlocked" ; +} +#define str_unlocked_locked (v) str_locked_unlocked(!(v))The rest is sorted (okay,
read_write()seems to be misplaced, fix that in a separate change if you wish), please keep it that way (I believe it should go beforeon_off).
Oh, I looked in v6.11 code, in v6.12 there are a couple of more misplacements. Can you fix them all, please?
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 12 lines · Andy Shevchenko
Quoted 1 line · Andy Shevchenko
On Fri, Nov 15, 2024 at 4:47 PM R Sundar <[email protected]> wrote:
...
Quoted 6 lines
Quoted 6 lines
include/linux/string_choices.h +0
-0@@ -82,4 +82,10 @@ static inline const char *str_plural(size_t num)return num ==1 ?"" :"s" ; }
Quoted 10 lines
Quoted 9 lines
include/linux/string_choices.h static inline const char *str_plural(size_t num) · line 89
Quoted 5 lines
include/linux/string_choices.h +5
-0+static inline const char *str_locked_unlocked (bool v) +{ +return v ?"locked" :"unlocked" ; +} +#define str_unlocked_locked (v) str_locked_unlocked(!(v))The rest is sorted (okay,
read_write()seems to be misplaced, fix that in a separate change if you wish), please keep it that way (I believe it should go beforeon_off).
Hi,
Thanks for the Review and Comments provided.
Please correct me, If I am wrong.
The function name should be in sorted order means, str_read_write() will go after str_on_off().
For example, the sorted order of function will be like:
str_on_off()str_plural()str_read_write()
Quoted 3 lines
Oh, I looked in v6.11 code, in v6.12 there are a couple of more misplacements. Can you fix them all, please?
Sure, Will sort it and send as seperate patch.
Thanks,
Sundar
Quoted 4 lines · R Sundar
Quoted 3 lines · Andy Shevchenko
Quoted 1 line · Andy Shevchenko
On Fri, Nov 15, 2024 at 4:47 PM R Sundar <[email protected]> wrote:
...
Quoted 14 lines
Quoted 9 lines
Quoted 9 lines
include/linux/string_choices.h static inline const char *str_plural(size_t num) · line 89
Quoted 5 lines
include/linux/string_choices.h +5
-0+static inline const char *str_locked_unlocked (bool v) +{ +return v ?"locked" :"unlocked" ; +} +#define str_unlocked_locked (v) str_locked_unlocked(!(v))The rest is sorted (okay,
read_write()seems to be misplaced, fix that in a separate change if you wish), please keep it that way (I believe it should go beforeon_off).Thanks for the Review and Comments provided.
Please correct me, If I am wrong.
Quoted 8 lines
The function name should be in sorted order means,
str_read_write()will go afterstr_on_off().For example, the sorted order of function will be like:
str_on_off()
str_plural()
Leave this one to be last, it's special in comparison to the rest. See what the type of the parameter it has for the details.
Quoted 6 lines
str_read_write()Quoted 3 lines
Oh, I looked in v6.11 code, in v6.12 there are a couple of more misplacements. Can you fix them all, please?
Sure, Will sort it and send as seperate patch.
Thank you!
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 25 lines · Andy Shevchenko
Quoted 4 lines · R Sundar
Quoted 3 lines · Andy Shevchenko
Quoted 1 line · Andy Shevchenko
On Fri, Nov 15, 2024 at 4:47 PM R Sundar <[email protected]> wrote:
...
Quoted 17 lines
Quoted 9 lines
Quoted 9 lines
include/linux/string_choices.h static inline const char *str_plural(size_t num) · line 89
Quoted 5 lines
include/linux/string_choices.h +5
-0+static inline const char *str_locked_unlocked (bool v) +{ +return v ?"locked" :"unlocked" ; +} +#define str_unlocked_locked (v) str_locked_unlocked(!(v))The rest is sorted (okay,
read_write()seems to be misplaced, fix that in a separate change if you wish), please keep it that way (I believe it should go beforeon_off).Thanks for the Review and Comments provided.
Please correct me, If I am wrong.
The function name should be in sorted order means,
str_read_write()will go afterstr_on_off().
Quoted 9 lines
Quoted 5 lines
For example, the sorted order of function will be like:
str_on_off()
str_plural()Leave this one to be last, it's special in comparison to the rest. See what the type of the parameter it has for the details.
Hi,
Noted. Thanks for clarifying it.
With Regards,
Sundar
Quoted 9 lines
Quoted 6 lines
str_read_write()Quoted 3 lines
Oh, I looked in v6.11 code, in v6.12 there are a couple of more misplacements. Can you fix them all, please?
Sure, Will sort it and send as seperate patch.
Thank you!