From patchwork Fri Apr 27 08:56:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arvind Yadav X-Patchwork-Id: 10367751 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 8D43C601D3 for ; Fri, 27 Apr 2018 09:02:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7D61D29334 for ; Fri, 27 Apr 2018 09:02:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 722122933A; Fri, 27 Apr 2018 09:02: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 B8D9C29334 for ; Fri, 27 Apr 2018 09:02:25 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 854C52678A6; Fri, 27 Apr 2018 10:56:36 +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 6C662267872; Fri, 27 Apr 2018 10:56:31 +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 C461A267860 for ; Fri, 27 Apr 2018 10:56:29 +0200 (CEST) Received: by mail-pg0-f68.google.com with SMTP id i6-v6so1074531pgv.3 for ; Fri, 27 Apr 2018 01:56:29 -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=dHsNKOFLPl+ywSEfgqc5eQ0fAJ64I5GL5ffAQ413ORs=; b=hcCOEXV+XPExu+aK41Av2mUA8h6xHQsjmrh1qgQC8sA012zEkqzpOlgq2eqruyEW+u ZG9clze6cfsnQUfHGjjieoMU6lZiKeuX04l7hAzqVo23K3bQR1h1fnTtLvLWg3GSPQ0Z pPmEj3Z16yVNyP+4LO312gQ63PKvjB96Qtq9jlNiCdvnOsAJiZLkCZron61lfnnsLJuy jB/pYB+Q3YImijbseA83StHsbmFI9tAGPbqMs1YG9Kk3pzxfrfL2QDco9kVjA3fZYAKF /da9IYHISjmZQ32fzrcysVB02lPo2+PeYfc9froLnhjJidy9gRR9RboOMSd0HCnX0iz/ 5SrQ== 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=dHsNKOFLPl+ywSEfgqc5eQ0fAJ64I5GL5ffAQ413ORs=; b=q6Dj9ljfGK06Y62jVSp/f9Ojo9Wf8fHvV0VB538OB3zSE9+MUKQLjisX8R5i5Hn3RO DsiL4zYILtkCazNXLSfbRLjozAFVU+0rOhLUym4c3UFWMRit3P3b0BprzhCPlczYOMEX XA8rCcssShHG9ouVPID5eO1mIiOJbEVGBN2rGqXp0zSoYOSe3NUcbsBYIgsiLEfMG+1A aws23pg69x+TMq2veCzZ+THDEwrrTzTWKgcwEASCWW/GlxVx9jXS16HKQc5BrcjVlzo+ GO0rWisYBpRCdxhb74r6prD+T6QATpEEQpeLGBjXRBHlcj6lWKPsKcJUHJsf3f6ahrg6 Gl8g== X-Gm-Message-State: ALQs6tBJJ4nJXbv7jVJ5d6bWSdDJ+H1zSDnXNQadZYHa93QY6iCCIZTX kqLf0xM/tA3Kvf+Fm02fZ5Q= X-Google-Smtp-Source: AB8JxZqSAv+HOsSh5J3UgCCvKKM7ETtZj/1Os4YGdkTXbMgxZ/P6ByDI7wT8Y7xCwmqQuZ1SLSZRYA== X-Received: by 10.98.72.209 with SMTP id q78mr1455742pfi.70.1524819389091; Fri, 27 Apr 2018 01:56:29 -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.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 27 Apr 2018 01:56:28 -0700 (PDT) From: Arvind Yadav To: jikos@kernel.org, benjamin.tissoires@redhat.com, jkosina@suse.cz Date: Fri, 27 Apr 2018 14:26:09 +0530 Message-Id: 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 1/3] ASoC: tlv320dac33: 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/tlv320dac33.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sound/soc/codecs/tlv320dac33.c b/sound/soc/codecs/tlv320dac33.c index a957eae..c23b9db 100644 --- a/sound/soc/codecs/tlv320dac33.c +++ b/sound/soc/codecs/tlv320dac33.c @@ -397,13 +397,13 @@ static int dac33_hard_power(struct snd_soc_component *component, int power) goto exit; } - if (dac33->power_gpio >= 0) + if (gpio_is_valid(dac33->power_gpio)) gpio_set_value(dac33->power_gpio, 1); dac33->chip_power = 1; } else { dac33_soft_power(component, 0); - if (dac33->power_gpio >= 0) + if (gpio_is_valid(dac33->power_gpio)) gpio_set_value(dac33->power_gpio, 0); ret = regulator_bulk_disable(ARRAY_SIZE(dac33->supplies), @@ -1519,7 +1519,7 @@ static int dac33_i2c_probe(struct i2c_client *client, dac33->fifo_mode = DAC33_FIFO_BYPASS; /* Check if the reset GPIO number is valid and request it */ - if (dac33->power_gpio >= 0) { + if (gpio_is_valid(dac33->power_gpio)) { ret = gpio_request(dac33->power_gpio, "tlv320dac33 reset"); if (ret < 0) { dev_err(&client->dev, @@ -1548,7 +1548,7 @@ static int dac33_i2c_probe(struct i2c_client *client, return ret; err_get: - if (dac33->power_gpio >= 0) + if (gpio_is_valid(dac33->power_gpio)) gpio_free(dac33->power_gpio); err_gpio: return ret; @@ -1561,7 +1561,7 @@ static int dac33_i2c_remove(struct i2c_client *client) if (unlikely(dac33->chip_power)) dac33_hard_power(dac33->component, 0); - if (dac33->power_gpio >= 0) + if (gpio_is_valid(dac33->power_gpio)) gpio_free(dac33->power_gpio); return 0;