ASoC: omap-mcbsp: Use sysfs_match_string() helper
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Fri, 9 Jun 2017 12:06:54 +0000 (15:06 +0300)
committerMark Brown <broonie@kernel.org>
Fri, 9 Jun 2017 17:38:35 +0000 (18:38 +0100)
Use sysfs_match_string() helper instead of open coded variant.

Cc: Peter Ujfalusi <peter.ujfalusi@ti.com>
Cc: Jarkko Nikula <jarkko.nikula@bitmer.com>
Cc: Mark Brown <broonie@kernel.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/omap/mcbsp.c

index 06fec5699cc8bd984e110a6b82b115b019e8f576..7a54e30832033eec9527f2750b01fd9e7a3ad4ee 100644 (file)
@@ -835,15 +835,11 @@ static ssize_t dma_op_mode_store(struct device *dev,
                                const char *buf, size_t size)
 {
        struct omap_mcbsp *mcbsp = dev_get_drvdata(dev);
-       const char * const *s;
-       int i = 0;
-
-       for (s = &dma_op_modes[i]; i < ARRAY_SIZE(dma_op_modes); s++, i++)
-               if (sysfs_streq(buf, *s))
-                       break;
+       int i;
 
-       if (i == ARRAY_SIZE(dma_op_modes))
-               return -EINVAL;
+       i = sysfs_match_string(dma_op_modes, buf);
+       if (i < 0)
+               return i;
 
        spin_lock_irq(&mcbsp->lock);
        if (!mcbsp->free) {