diff mbox series

jffs2: Use str_yes_no() helper function

Message ID 20241026111903.112647-2-thorsten.blum@linux.dev
State New
Headers show
Series jffs2: Use str_yes_no() helper function | expand

Commit Message

Thorsten Blum Oct. 26, 2024, 11:19 a.m. UTC
Remove hard-coded strings by using the str_yes_no() helper function.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 fs/jffs2/nodemgmt.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Comments

Zhihao Cheng Oct. 28, 2024, 1:13 a.m. UTC | #1
在 2024/10/26 19:19, Thorsten Blum 写道:
> Remove hard-coded strings by using the str_yes_no() helper function.
> 
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
>   fs/jffs2/nodemgmt.c | 9 +++++----
>   1 file changed, 5 insertions(+), 4 deletions(-)
> 

Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com>
> diff --git a/fs/jffs2/nodemgmt.c b/fs/jffs2/nodemgmt.c
> index bbab2bdc71b6..69569864630e 100644
> --- a/fs/jffs2/nodemgmt.c
> +++ b/fs/jffs2/nodemgmt.c
> @@ -15,6 +15,7 @@
>   #include <linux/mtd/mtd.h>
>   #include <linux/compiler.h>
>   #include <linux/sched/signal.h>
> +#include <linux/string_choices.h>
>   #include "nodelist.h"
>   #include "debug.h"
>   
> @@ -317,9 +318,9 @@ static int jffs2_find_nextblock(struct jffs2_sb_info *c)
>   			   And there's no space left. At all. */
>   			pr_crit("Argh. No free space left for GC. nr_erasing_blocks is %d. nr_free_blocks is %d. (erasableempty: %s, erasingempty: %s, erasependingempty: %s)\n",
>   				c->nr_erasing_blocks, c->nr_free_blocks,
> -				list_empty(&c->erasable_list) ? "yes" : "no",
> -				list_empty(&c->erasing_list) ? "yes" : "no",
> -				list_empty(&c->erase_pending_list) ? "yes" : "no");
> +				str_yes_no(list_empty(&c->erasable_list)),
> +				str_yes_no(list_empty(&c->erasing_list)),
> +				str_yes_no(list_empty(&c->erase_pending_list)));
>   			return -ENOSPC;
>   		}
>   
> @@ -883,7 +884,7 @@ int jffs2_thread_should_wake(struct jffs2_sb_info *c)
>   
>   	jffs2_dbg(1, "%s(): nr_free_blocks %d, nr_erasing_blocks %d, dirty_size 0x%x, vdirty_blocks %d: %s\n",
>   		  __func__, c->nr_free_blocks, c->nr_erasing_blocks,
> -		  c->dirty_size, nr_very_dirty, ret ? "yes" : "no");
> +		  c->dirty_size, nr_very_dirty, str_yes_no(ret));
>   
>   	return ret;
>   }
>
diff mbox series

Patch

diff --git a/fs/jffs2/nodemgmt.c b/fs/jffs2/nodemgmt.c
index bbab2bdc71b6..69569864630e 100644
--- a/fs/jffs2/nodemgmt.c
+++ b/fs/jffs2/nodemgmt.c
@@ -15,6 +15,7 @@ 
 #include <linux/mtd/mtd.h>
 #include <linux/compiler.h>
 #include <linux/sched/signal.h>
+#include <linux/string_choices.h>
 #include "nodelist.h"
 #include "debug.h"
 
@@ -317,9 +318,9 @@  static int jffs2_find_nextblock(struct jffs2_sb_info *c)
 			   And there's no space left. At all. */
 			pr_crit("Argh. No free space left for GC. nr_erasing_blocks is %d. nr_free_blocks is %d. (erasableempty: %s, erasingempty: %s, erasependingempty: %s)\n",
 				c->nr_erasing_blocks, c->nr_free_blocks,
-				list_empty(&c->erasable_list) ? "yes" : "no",
-				list_empty(&c->erasing_list) ? "yes" : "no",
-				list_empty(&c->erase_pending_list) ? "yes" : "no");
+				str_yes_no(list_empty(&c->erasable_list)),
+				str_yes_no(list_empty(&c->erasing_list)),
+				str_yes_no(list_empty(&c->erase_pending_list)));
 			return -ENOSPC;
 		}
 
@@ -883,7 +884,7 @@  int jffs2_thread_should_wake(struct jffs2_sb_info *c)
 
 	jffs2_dbg(1, "%s(): nr_free_blocks %d, nr_erasing_blocks %d, dirty_size 0x%x, vdirty_blocks %d: %s\n",
 		  __func__, c->nr_free_blocks, c->nr_erasing_blocks,
-		  c->dirty_size, nr_very_dirty, ret ? "yes" : "no");
+		  c->dirty_size, nr_very_dirty, str_yes_no(ret));
 
 	return ret;
 }