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: 10367745 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 997A1602B3 for ; Fri, 27 Apr 2018 08:57:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 879E02926A for ; Fri, 27 Apr 2018 08:57:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7B85D29308; Fri, 27 Apr 2018 08:57:02 +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=-7.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 27DC72926A for ; Fri, 27 Apr 2018 08:57:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932435AbeD0I4d (ORCPT ); Fri, 27 Apr 2018 04:56:33 -0400 Received: from mail-pg0-f65.google.com ([74.125.83.65]:33780 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932282AbeD0I43 (ORCPT ); Fri, 27 Apr 2018 04:56:29 -0400 Received: by mail-pg0-f65.google.com with SMTP id i194-v6so1074150pgd.0; 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=Ad8FOgXdrTijf+DZ8z1U1Imikvq88nlQyT+O/d3AuSLSDVDR3ThT3Dpf30S+TjvQdH Tl18xJXPr1rMwpc/zJ0PRQ0nkYtxhZcBvqFDh4fCVPkel0YON3XE84pXPfnVYoM2+lfT ut94I+Hnz285GUVgm0jiodNBKQBFVs/Br4Lgjd3821fRXGIDN/eWISTK8kGwU8t1sWaf mqd0mwEw8kWJE/73m991mO6j/lADk7rWgtWV+Hq5/s/TosGWPWGKS3tJIpjUnzM6u3WI adHflXfBQfxTvLN2K7lWtIZTLP11St4acEJMr8kKYeQx15vEUI6/fCNxHGNFm/qUf7uV THNA== X-Gm-Message-State: ALQs6tAFRxemqqR4a7M3/uxe5ZIGTP1NmShJuuzDc4EUmopnZmoDGyvd QU9IeuCM2jE0fVItI8EAHLg= 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 Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, alsa-devel@alsa-project.org Subject: [PATCH 1/3] ASoC: tlv320dac33: Use gpio_is_valid() 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: Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.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;