[PATCH v1] mtd: nand: brcmnand: replace manual string choices with standard helpers

Yuesong Li posted 1 patch 3 months, 3 weeks ago
drivers/mtd/nand/raw/brcmnand/brcmnand.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
[PATCH v1] mtd: nand: brcmnand: replace manual string choices with standard helpers
Posted by Yuesong Li 3 months, 3 weeks ago
Use kernel provided standard helper function to replace hard-coded
strings

Signed-off-by: Yuesong Li <liyuesong@vivo.com>
---
 drivers/mtd/nand/raw/brcmnand/brcmnand.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
index 62bdda3be92f..dc836b141024 100644
--- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c
+++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
@@ -29,6 +29,7 @@
 #include <linux/static_key.h>
 #include <linux/list.h>
 #include <linux/log2.h>
+#include <linux/string_choices.h>
 
 #include "brcmnand.h"
 
@@ -1462,7 +1463,7 @@ static void brcmnand_wp(struct mtd_info *mtd, int wp)
 		int ret;
 
 		if (old_wp != wp) {
-			dev_dbg(ctrl->dev, "WP %s\n", wp ? "on" : "off");
+			dev_dbg(ctrl->dev, "WP %s\n", str_on_off(wp));
 			old_wp = wp;
 		}
 
@@ -1492,7 +1493,7 @@ static void brcmnand_wp(struct mtd_info *mtd, int wp)
 		if (ret)
 			dev_err_ratelimited(&host->pdev->dev,
 					    "nand #WP expected %s\n",
-					    wp ? "on" : "off");
+					    str_on_off(wp));
 	}
 }
 
@@ -1869,8 +1870,8 @@ static int brcmnand_edu_trans(struct brcmnand_host *host, u64 addr, u32 *buf,
 	unsigned int trans = len >> FC_SHIFT;
 	dma_addr_t pa;
 
-	dev_dbg(ctrl->dev, "EDU %s %p:%p\n", ((edu_cmd == EDU_CMD_READ) ?
-					      "read" : "write"), buf, oob);
+	dev_dbg(ctrl->dev, "EDU %s %p:%p\n",
+		str_read_write(edu_cmd == EDU_CMD_READ), buf, oob);
 
 	pa = dma_map_single(ctrl->dev, buf, len, dir);
 	if (dma_mapping_error(ctrl->dev, pa)) {
-- 
2.34.1
Re: [PATCH v1] mtd: nand: brcmnand: replace manual string choices with standard helpers
Posted by Miquel Raynal 3 months, 3 weeks ago
On Wed, 18 Jun 2025 20:49:47 +0800, Yuesong Li wrote:
> Use kernel provided standard helper function to replace hard-coded
> strings
> 
> 

Applied to nand/next, thanks!

[1/1] mtd: nand: brcmnand: replace manual string choices with standard helpers
      commit: 4b5532d4581d0e0639023268eeb08f1a31a402d3

Patche(s) should be available on mtd/linux.git and will be
part of the next PR (provided that no robot complains by then).

Kind regards,
Miquèl