linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] mtd: rawnand: macronix: Use match_string() helper to simplify the code
@ 2019-12-30  2:52 YueHaibing
  2019-12-30 12:37 ` kbuild test robot
  2019-12-31  1:36 ` [PATCH v2 " YueHaibing
  0 siblings, 2 replies; 4+ messages in thread
From: YueHaibing @ 2019-12-30  2:52 UTC (permalink / raw)
  To: miquel.raynal, richard, vigneshr, frieder.schrempf, masonccyang,
	allison, yuehaibing, tglx
  Cc: linux-mtd, linux-kernel

match_string() returns the array index of a matching string.
Use it instead of the open-coded implementation.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/mtd/nand/raw/nand_macronix.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/mtd/nand/raw/nand_macronix.c b/drivers/mtd/nand/raw/nand_macronix.c
index 58511ae..5619289 100644
--- a/drivers/mtd/nand/raw/nand_macronix.c
+++ b/drivers/mtd/nand/raw/nand_macronix.c
@@ -80,12 +80,9 @@ static void macronix_nand_fix_broken_get_timings(struct nand_chip *chip)
 	if (!chip->parameters.supports_set_get_features)
 		return;
 
-	for (i = 0; i < ARRAY_SIZE(broken_get_timings); i++) {
-		if (!strcmp(broken_get_timings[i], chip->parameters.model))
-			break;
-	}
-
-	if (i == ARRAY_SIZE(broken_get_timings))
+	i = match_string(broken_get_timings, ARRAY_SIZE(broken_get_timings),
+			 chip->parameters.model);
+	if (i < 0)
 		return;
 
 	bitmap_clear(chip->parameters.get_feature_list,
-- 
2.7.4



______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-01-14 17:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-30  2:52 [PATCH -next] mtd: rawnand: macronix: Use match_string() helper to simplify the code YueHaibing
2019-12-30 12:37 ` kbuild test robot
2019-12-31  1:36 ` [PATCH v2 " YueHaibing
2020-01-14 17:04   ` Miquel Raynal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).