Skip to contentSkip to conversation

zram: use __sysfs_match_string() helper

PATCH New [email protected] 1 participant 1 message Jul 10, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 28/115 zram: use __sysfs_match_string() helper

From: Andy Shevchenko <[email protected]>
Subject: zram: use __sysfs_match_string() helper

Use __sysfs_match_string() helper instead of open coded variant.

---

 drivers/block/zram/zcomp.c |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/block/zram/zcomp.c renamed from drivers/block/zram/zcomp.c~zram-use-__sysfs_match_string-helper +4 -6
diff -puN drivers/block/zram/zcomp.c~zram-use-__sysfs_match_string-helper drivers/block/zram/zcomp.c
@@ -68,13 +68,11 @@ static struct zcomp_strm *zcomp_strm_all
 
 bool zcomp_available_algorithm(const char *comp)
 {
-	int i = 0;
+	int i;
 
-	while (backends[i]) {
-		if (sysfs_streq(comp, backends[i]))
-			return true;
-		i++;
-	}
+	i = __sysfs_match_string(backends, -1, comp);
+	if (i >= 0)
+		return true;
 
 	/*
 	 * Crypto does not ignore a trailing new line symbol,

_