Received: by 10.192.165.148 with SMTP id m20csp494524imm; Fri, 27 Apr 2018 02:34:52 -0700 (PDT) X-Google-Smtp-Source: AB8JxZo5crlJNPMF/TCzvvbw0tG8AkLQlHeikExcyFsKpQY0VNdKo+7DBQYM8Na8u6nQerYwqR5g X-Received: by 10.98.137.219 with SMTP id n88mr1527738pfk.11.1524821692565; Fri, 27 Apr 2018 02:34:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524821692; cv=none; d=google.com; s=arc-20160816; b=q+tz7SySavOESytg6x8Fc3IZgLqPKAyLHG4M9GEG70eXPvaTlBZKrmR/fVlNaUflD0 7wp53mcR+YWCasTnEFcTqwvyrB6EHwpQjsQB/aSG+dkWq6MslbE4PvZ8ApxEshL9Zeqa huwZN6xeVe+e2SqqKAhab4qa2j7akEf12MleatFv4nB2zgWomY80bH1ZSuJx/8UVGSR4 6BOMR0BIGiWmHxVEEaKSJwX+F+BGnJP/6pKJoKe2GbAYCUswZdTAY6j7e9II8nxugu3c /DIqtapif/tz91fDIt6F06aw3cavCMmUTosw8t0vNmUqknFJwvzbegosa00hANAJI4YK HOxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=T5piv1ZOJ2rheA89oHq4METLzE6PKjrd0K5o62pCxzw=; b=whrLGceYMcqZsyDyI+TehkApT7dVqRxwnQ//fA7Fa3UlnO7IyA4ktrrJ8N6650kxMV ie+sKaBM5drZZxw7b+54oZRVO9OMBje+AKqmP5A8B8lLqg1VTwUO0cNzs+dMkt3K/2cr 9YCTIcu9Wsg6ZAfTNprvYQUEDy1vF/dz26ubt4auYcohwc6Kk4pFkFL4X34TrCeYEJXm +csQTG7Mq+58y141A/J1hPA/1M4yB2GAvgsj34lnqzSvKA7mvrSAO/Vc0NAI7RM5SuVP 3EaGxzLbvxPtMkYF9aR7lVTU1OClxb6eGw+QabnqUWSICY1uzPzDkl39LbyK6i57P1Ot 03UQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=Zt1VJ9iA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v4si894104pfe.306.2018.04.27.02.34.38; Fri, 27 Apr 2018 02:34:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=Zt1VJ9iA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757893AbeD0Jda (ORCPT + 99 others); Fri, 27 Apr 2018 05:33:30 -0400 Received: from fllnx209.ext.ti.com ([198.47.19.16]:57331 "EHLO fllnx209.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757361AbeD0Jd2 (ORCPT ); Fri, 27 Apr 2018 05:33:28 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by fllnx209.ext.ti.com (8.15.1/8.15.1) with ESMTP id w3R9XDrr014486; Fri, 27 Apr 2018 04:33:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1524821593; bh=f04XNe/wJE+lASFMhz0++t08Zzlzce+iF3QSITe7gfA=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=Zt1VJ9iAxZCmxh2M1faFiew4WOzobwcjlTQOAxVo2dENlUl5HwtbwXH6Kebisw4Nm WaL2Lb554aH/bbTIgI4ARqN0AEbXP3z08zOEbGFlA3h8ffBtON/p7r1a7LjpgaxmMN ENM8pNy6rEdu5YNiJ6/iGaruJbwjFoPAMCAx/xwI= Received: from DLEE108.ent.ti.com (dlee108.ent.ti.com [157.170.170.38]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w3R9XDB7010683; Fri, 27 Apr 2018 04:33:13 -0500 Received: from DLEE108.ent.ti.com (157.170.170.38) by DLEE108.ent.ti.com (157.170.170.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Fri, 27 Apr 2018 04:33:12 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DLEE108.ent.ti.com (157.170.170.38) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1466.3 via Frontend Transport; Fri, 27 Apr 2018 04:33:12 -0500 Received: from [192.168.2.6] (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w3R9XAhJ012612; Fri, 27 Apr 2018 04:33:11 -0500 Subject: Re: [alsa-devel] [PATCH 2/3] ASoC: tpa6130a2: Use gpio_is_valid() To: Arvind Yadav , , , CC: , , References: <195792a282b569037357ca17e4baad19893f0609.1524819052.git.arvind.yadav.cs@gmail.com> From: Peter Ujfalusi Message-ID: <2ed0acde-c4da-0e1d-a62a-433c858e14a6@ti.com> Date: Fri, 27 Apr 2018 12:33:43 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <195792a282b569037357ca17e4baad19893f0609.1524819052.git.arvind.yadav.cs@gmail.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018-04-27 11:56, Arvind Yadav wrote: > Replace the manual validity checks for the GPIO with the > gpio_is_valid(). Acked-by: Peter Ujfalusi > Signed-off-by: Arvind Yadav > --- > 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) { > - Péter Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki