linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] zram: Use __sysfs_match_string() helper
@ 2017-06-09 12:08 Andy Shevchenko
  2017-06-12  1:52 ` Sergey Senozhatsky
  0 siblings, 1 reply; 3+ messages in thread
From: Andy Shevchenko @ 2017-06-09 12:08 UTC (permalink / raw)
  To: linux-kernel
  Cc: Andy Shevchenko, Minchan Kim, Nitin Gupta, Sergey Senozhatsky

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

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

* Re: [PATCH v1] zram: Use __sysfs_match_string() helper
  2017-06-09 12:08 [PATCH v1] zram: Use __sysfs_match_string() helper Andy Shevchenko
@ 2017-06-12  1:52 ` Sergey Senozhatsky
  2017-06-12  7:53   ` Minchan Kim
  0 siblings, 1 reply; 3+ messages in thread
From: Sergey Senozhatsky @ 2017-06-12  1:52 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Andrew Morton, linux-kernel, Minchan Kim, Nitin Gupta,
	Sergey Senozhatsky

(Cc Andrew)

Link: lkml.kernel.org/r/20170609120835.22156-1-andriy.shevchenko@linux.intel.com


On (06/09/17 15:08), Andy Shevchenko wrote:
> 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>

Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>

	-ss

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

* Re: [PATCH v1] zram: Use __sysfs_match_string() helper
  2017-06-12  1:52 ` Sergey Senozhatsky
@ 2017-06-12  7:53   ` Minchan Kim
  0 siblings, 0 replies; 3+ messages in thread
From: Minchan Kim @ 2017-06-12  7:53 UTC (permalink / raw)
  To: Sergey Senozhatsky
  Cc: Andy Shevchenko, Andrew Morton, linux-kernel, Nitin Gupta

On Mon, Jun 12, 2017 at 10:52:45AM +0900, Sergey Senozhatsky wrote:
> (Cc Andrew)
> 
> Link: lkml.kernel.org/r/20170609120835.22156-1-andriy.shevchenko@linux.intel.com
> 
> 
> On (06/09/17 15:08), Andy Shevchenko wrote:
> > 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>
> 
> Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Acked-by: Minchan Kim <minchan@kernel.org>

Thanks.

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

end of thread, other threads:[~2017-06-12  7:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-09 12:08 [PATCH v1] zram: Use __sysfs_match_string() helper Andy Shevchenko
2017-06-12  1:52 ` Sergey Senozhatsky
2017-06-12  7:53   ` Minchan Kim

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).