From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751711AbdFIMID (ORCPT ); Fri, 9 Jun 2017 08:08:03 -0400 Received: from mga05.intel.com ([192.55.52.43]:54878 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751541AbdFIMIC (ORCPT ); Fri, 9 Jun 2017 08:08:02 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.39,317,1493708400"; d="scan'208";a="1180357701" From: Andy Shevchenko To: linux-kernel@vger.kernel.org Cc: Andy Shevchenko , Arnd Bergmann , Greg Kroah-Hartman Subject: [PATCH v1] misc: apds990x: Use sysfs_match_string() helper Date: Fri, 9 Jun 2017 15:07:58 +0300 Message-Id: <20170609120758.22008-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.11.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use sysfs_match_string() helper instead of open coded variant. Cc: Arnd Bergmann Cc: Greg Kroah-Hartman Signed-off-by: Andy Shevchenko --- drivers/misc/apds990x.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/misc/apds990x.c b/drivers/misc/apds990x.c index c341164edaad..e9298f9d1588 100644 --- a/drivers/misc/apds990x.c +++ b/drivers/misc/apds990x.c @@ -856,13 +856,13 @@ static ssize_t apds990x_prox_reporting_mode_store(struct device *dev, const char *buf, size_t len) { struct apds990x_chip *chip = dev_get_drvdata(dev); + int ret; - if (sysfs_streq(buf, reporting_modes[0])) - chip->prox_continuous_mode = 0; - else if (sysfs_streq(buf, reporting_modes[1])) - chip->prox_continuous_mode = 1; - else - return -EINVAL; + ret = sysfs_match_string(reporting_modes, buf); + if (ret < 0) + return ret; + + chip->prox_continuous_mode = ret; return len; } -- 2.11.0