From patchwork Fri Apr 27 08:56:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arvind Yadav X-Patchwork-Id: 10367755 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 57ACA6053F for ; Fri, 27 Apr 2018 09:07:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 46EEA29337 for ; Fri, 27 Apr 2018 09:07:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3B4282934C; Fri, 27 Apr 2018 09:07:26 +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=-2.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8C1662934D for ; Fri, 27 Apr 2018 09:07:25 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id E07742678AF; Fri, 27 Apr 2018 10:56:37 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 100792678A6; Fri, 27 Apr 2018 10:56:35 +0200 (CEST) Received: from mail-pg0-f68.google.com (mail-pg0-f68.google.com [74.125.83.68]) by alsa0.perex.cz (Postfix) with ESMTP id 52AB72678A0 for ; Fri, 27 Apr 2018 10:56:33 +0200 (CEST) Received: by mail-pg0-f68.google.com with SMTP id p10-v6so1075816pgn.1 for ; Fri, 27 Apr 2018 01:56:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=SvYzr6Lh8q0mHT8VyeR286dXCO//F2JISJhyU6eKAHc=; b=ohGAINLeCN382HDgvoxklxKCM8RZ0DhCwtdOGmvL0pd/gBA1Y+BC5WhdbAasNtclVz YUqcL0aZiSTzoojItDUFgOAle7R1x//y/ode+x7Ct5JGS6hLYzKiNKGVyT+FoJ2SiFKz x5ZxfMj0TUAPsoPTN8AGgyJlqUv7mN+RLNxUqc9z11v8aVIKxvxcJsFQ648h36nQ9Wj1 S7y7usdAbiTjpdXWIkT6OX/7f/E5Hb3B9HJ9D6eEB3JlxtcdBPTL27jflGvziQBrLpCP uQoSb2canOS4YT0Wud6Lg7xum5lVp6iGYWzjsVQ/WQj2AMiETZH6yY8TgLHilbEM7TNg lBcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=SvYzr6Lh8q0mHT8VyeR286dXCO//F2JISJhyU6eKAHc=; b=aDZQNZKC3Cw9yR1sS1FgQjyHSDoorwpz0RQGZxB2O2innQqn++Gg0i2023SUU4UBYS llN0wlBI1k8nsFw0DYD8ftRcvv/tPuN8qUusE/kqRN0+O6KLxWPnwBn3a4L5jGzbEd8I G47+F71w2FmO9ctGuMwiIXxzQtC2221N/3SjpmLJ6XjgO5HHyFLUqVsPtZfC8nkBfF+Y kkiSdH3i6zMQhwxUyLPTA8LZUfPCY49HExrf9d2yJGjBC4V9tW8+5s3cirtkDxgWlWKz pe0sAPd5xTmnmNkjS126z47GnjorcXgeFK2yswmffS7BM9a1XQDthYiPmpT5eGaoyI6i v1iQ== X-Gm-Message-State: ALQs6tBHvf5BP6L6FixLo4cL9Raf0d6QIPkIQLYeocTAVjVCiOVTKgPB LqqYnRJBxro+IXVmntLEWwo= X-Google-Smtp-Source: AB8JxZrSFWQoEMyeRHfHAUnCQpGnaeVLYz/YByNAX7dolKqK1HL1JlGye9C68kbxd3lCh4HgCSpv5Q== X-Received: by 10.98.228.8 with SMTP id r8mr1445873pfh.172.1524819392485; Fri, 27 Apr 2018 01:56:32 -0700 (PDT) Received: from symbol-HP-Z420-Workstation.zebra.lan ([149.23.17.254]) by smtp.googlemail.com with ESMTPSA id q76sm2310583pfi.139.2018.04.27.01.56.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 27 Apr 2018 01:56:32 -0700 (PDT) From: Arvind Yadav To: jikos@kernel.org, benjamin.tissoires@redhat.com, jkosina@suse.cz Date: Fri, 27 Apr 2018 14:26:10 +0530 Message-Id: <195792a282b569037357ca17e4baad19893f0609.1524819052.git.arvind.yadav.cs@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: References: In-Reply-To: References: Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org Subject: [alsa-devel] [PATCH 2/3] ASoC: tpa6130a2: Use gpio_is_valid() X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Replace the manual validity checks for the GPIO with the gpio_is_valid(). Signed-off-by: Arvind Yadav Acked-by: Peter Ujfalusi --- sound/soc/codecs/tpa6130a2.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sound/soc/codecs/tpa6130a2.c b/sound/soc/codecs/tpa6130a2.c index 616cd4b..18f32b9 100644 --- a/sound/soc/codecs/tpa6130a2.c +++ b/sound/soc/codecs/tpa6130a2.c @@ -62,7 +62,7 @@ static int tpa6130a2_power(struct tpa6130a2_data *data, bool enable) return ret; } /* Power on */ - if (data->power_gpio >= 0) + if (gpio_is_valid(data->power_gpio)) gpio_set_value(data->power_gpio, 1); /* Sync registers */ @@ -72,7 +72,7 @@ static int tpa6130a2_power(struct tpa6130a2_data *data, bool enable) dev_err(data->dev, "Failed to sync registers: %d\n", ret); regcache_cache_only(data->regmap, true); - if (data->power_gpio >= 0) + if (gpio_is_valid(data->power_gpio)) gpio_set_value(data->power_gpio, 0); ret2 = regulator_disable(data->supply); if (ret2 != 0) @@ -89,7 +89,7 @@ static int tpa6130a2_power(struct tpa6130a2_data *data, bool enable) regcache_cache_only(data->regmap, true); /* Power off */ - if (data->power_gpio >= 0) + if (gpio_is_valid(data->power_gpio)) gpio_set_value(data->power_gpio, 0); ret = regulator_disable(data->supply); @@ -259,7 +259,7 @@ static int tpa6130a2_probe(struct i2c_client *client, data->id = id->driver_data; - if (data->power_gpio >= 0) { + if (gpio_is_valid(data->power_gpio)) { ret = devm_gpio_request(dev, data->power_gpio, "tpa6130a2 enable"); if (ret < 0) {