From patchwork Thu May 3 17:10:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 908133 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-tegra-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.intel.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40cM9Z4dM3z9s37 for ; Fri, 4 May 2018 03:10:58 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751095AbeECRK5 (ORCPT ); Thu, 3 May 2018 13:10:57 -0400 Received: from mga14.intel.com ([192.55.52.115]:57153 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750947AbeECRK5 (ORCPT ); Thu, 3 May 2018 13:10:57 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 May 2018 10:10:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,359,1520924400"; d="scan'208";a="225539815" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga005.fm.intel.com with ESMTP; 03 May 2018 10:10:55 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 5B53AE0; Thu, 3 May 2018 20:10:54 +0300 (EEST) From: Andy Shevchenko To: Colin Ian King , linux-tegra@vger.kernel.org, Kishon Vijay Abraham I , Thierry Reding , Jonathan Hunter Cc: Andy Shevchenko Subject: [PATCH v1] phy: tegra: Convert to use match_string() helper Date: Thu, 3 May 2018 20:10:53 +0300 Message-Id: <20180503171053.20514-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.17.0 Sender: linux-tegra-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.org The new helper returns index of the matching string in an array. We are going to use it here. Signed-off-by: Andy Shevchenko Acked-by: Thierry Reding --- drivers/phy/tegra/xusb.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/drivers/phy/tegra/xusb.c b/drivers/phy/tegra/xusb.c index 11aa5902a9ac..de1b4ebe4de2 100644 --- a/drivers/phy/tegra/xusb.c +++ b/drivers/phy/tegra/xusb.c @@ -102,19 +102,6 @@ tegra_xusb_pad_find_phy_node(struct tegra_xusb_pad *pad, unsigned int index) return np; } -static int -tegra_xusb_lane_lookup_function(struct tegra_xusb_lane *lane, - const char *function) -{ - unsigned int i; - - for (i = 0; i < lane->soc->num_funcs; i++) - if (strcmp(function, lane->soc->funcs[i]) == 0) - return i; - - return -EINVAL; -} - int tegra_xusb_lane_parse_dt(struct tegra_xusb_lane *lane, struct device_node *np) { @@ -126,7 +113,7 @@ int tegra_xusb_lane_parse_dt(struct tegra_xusb_lane *lane, if (err < 0) return err; - err = tegra_xusb_lane_lookup_function(lane, function); + err = match_string(lane->soc->funcs, lane->soc->num_funcs, function); if (err < 0) { dev_err(dev, "invalid function \"%s\" for lane \"%s\"\n", function, np->name);