From patchwork Fri Jun 9 12:06:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 9778309 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C4087603B4 for ; Fri, 9 Jun 2017 12:07:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B34A12810E for ; Fri, 9 Jun 2017 12:07:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A81522860A; Fri, 9 Jun 2017 12:07:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E2ED02810E for ; Fri, 9 Jun 2017 12:07:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751543AbdFIMHA (ORCPT ); Fri, 9 Jun 2017 08:07:00 -0400 Received: from mga14.intel.com ([192.55.52.115]:39786 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751528AbdFIMG7 (ORCPT ); Fri, 9 Jun 2017 08:06:59 -0400 Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Jun 2017 05:06:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.39,317,1493708400"; d="scan'208";a="978771797" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga003.jf.intel.com with ESMTP; 09 Jun 2017 05:06:56 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 83E0D1E7; Fri, 9 Jun 2017 15:06:55 +0300 (EEST) From: Andy Shevchenko To: alsa-devel@alsa-project.org, linux-omap@vger.kernel.org Cc: Andy Shevchenko , Peter Ujfalusi , Jarkko Nikula , Mark Brown Subject: [PATCH v1] ASoC: omap-mcbsp: Use sysfs_match_string() helper Date: Fri, 9 Jun 2017 15:06:54 +0300 Message-Id: <20170609120654.21809-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.11.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use sysfs_match_string() helper instead of open coded variant. Cc: Peter Ujfalusi Cc: Jarkko Nikula Cc: Mark Brown Signed-off-by: Andy Shevchenko --- sound/soc/omap/mcbsp.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/sound/soc/omap/mcbsp.c b/sound/soc/omap/mcbsp.c index 06fec5699cc8..7a54e3083203 100644 --- a/sound/soc/omap/mcbsp.c +++ b/sound/soc/omap/mcbsp.c @@ -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) {