[PATCH v2 linux-next 1/2] lib/string_choices: Rearrange functions in sorted order

R Sundar posted 2 patches 1 year, 2 months ago
[PATCH v2 linux-next 1/2] lib/string_choices: Rearrange functions in sorted order
Posted by R Sundar 1 year, 2 months ago
Rearrange misplaced functions in sorted order.

Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: R Sundar <prosunofficial@gmail.com>
---
 include/linux/string_choices.h | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/include/linux/string_choices.h b/include/linux/string_choices.h
index 120ca0f28e95..f3ba4f52ff26 100644
--- a/include/linux/string_choices.h
+++ b/include/linux/string_choices.h
@@ -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
-- 
2.34.1
Re: [PATCH v2 linux-next 1/2] lib/string_choices: Rearrange functions in sorted order
Posted by Larysa Zaremba 1 year ago
On Tue, Nov 19, 2024 at 07:47:18AM +0530, R Sundar wrote:
> Rearrange misplaced functions in sorted order.
> 
> Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> Signed-off-by: R Sundar <prosunofficial@gmail.com>

Reviewed-by: Larysa Zaremba <larysa.zaremba@intel.com>

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)

> ---
>  include/linux/string_choices.h | 24 ++++++++++++------------
>  1 file changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/include/linux/string_choices.h b/include/linux/string_choices.h
> index 120ca0f28e95..f3ba4f52ff26 100644
> --- a/include/linux/string_choices.h
> +++ b/include/linux/string_choices.h
> @@ -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
> -- 
> 2.34.1
>
Re: [PATCH v2 linux-next 1/2] lib/string_choices: Rearrange functions in sorted order
Posted by R Sundar 1 year ago
On 14/01/25 18:03, Larysa Zaremba wrote:
> On Tue, Nov 19, 2024 at 07:47:18AM +0530, R Sundar wrote:
>> Rearrange misplaced functions in sorted order.
>>
>> Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
>> Signed-off-by: R Sundar <prosunofficial@gmail.com>
> 
> Reviewed-by: Larysa Zaremba <larysa.zaremba@intel.com>
> 
> 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

>> ---
>>   include/linux/string_choices.h | 24 ++++++++++++------------
>>   1 file changed, 12 insertions(+), 12 deletions(-)
>>
>> diff --git a/include/linux/string_choices.h b/include/linux/string_choices.h
>> index 120ca0f28e95..f3ba4f52ff26 100644
>> --- a/include/linux/string_choices.h
>> +++ b/include/linux/string_choices.h
>> @@ -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
>> -- 
>> 2.34.1
>>
Re: (subset) [PATCH v2 linux-next 1/2] lib/string_choices: Rearrange functions in sorted order
Posted by Kees Cook 11 months, 1 week ago
On Tue, 19 Nov 2024 07:47:18 +0530, R Sundar wrote:
> 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,

-- 
Kees Cook