Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1662367

[PATCH v1] zram: Use __sysfs_match_string() helper

From Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Newsgroups linux.kernel
Subject [PATCH v1] zram: Use __sysfs_match_string() helper
Date 2017-06-09 14:20 +0200
Message-ID <tQr3s-1p7-9@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


Use __sysfs_match_string() helper instead of open coded variant.

Cc: Minchan Kim <minchan@kernel.org>
Cc: Nitin Gupta <ngupta@vflare.org>
Cc: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/block/zram/zcomp.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/block/zram/zcomp.c b/drivers/block/zram/zcomp.c
index 12046f4f00e4..5b8992beffec 100644
--- a/drivers/block/zram/zcomp.c
+++ b/drivers/block/zram/zcomp.c
@@ -68,13 +68,11 @@ static struct zcomp_strm *zcomp_strm_alloc(struct zcomp *comp)
 
 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,
-- 
2.11.0

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH v1] zram: Use __sysfs_match_string() helper Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2017-06-09 14:20 +0200
  Re: [PATCH v1] zram: Use __sysfs_match_string() helper Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2017-06-12 04:00 +0200
    Re: [PATCH v1] zram: Use __sysfs_match_string() helper Minchan Kim <minchan@kernel.org> - 2017-06-12 10:00 +0200

csiph-web