Received: by 10.192.165.148 with SMTP id m20csp465073imm; Fri, 27 Apr 2018 01:58:38 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoXObmKOIqFng6rpmHiIWG7iGsM8EF6lHbhUped/8DIqgngJHxqWs+7KemLhkRvXrVWa1Ik X-Received: by 2002:a17:902:5a88:: with SMTP id r8-v6mr1546578pli.78.1524819518180; Fri, 27 Apr 2018 01:58:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524819518; cv=none; d=google.com; s=arc-20160816; b=VXNhbIHt0zDLqB5xShx5oRONR2ViLzgmGuH2w//EH+6Q/xbywqfRBKcvgyXkXYJNd8 OoJB7j8aVk5CnbF0xkeYpyczElf2Je8W26v/48vfL4PL8xiMihebev50Vcsqt76b/419 lh2S0AjZaFF/VIkzmanlOie7YYS44o1Rt5k94owdk3n05pcTuHQ4ucpd2vVF8fmTuejg nWZGFO0f/gSebbpV4yEUkOLsbsObmAQfiIPonZnern2s99ZKkxsE6caJMrbTuDBW33fw NU++OQbK0O2cR7I794JJAPJWB6h6aWxz5le/PLZ39x/8b0vUM8Lh/iBnPpUkZuNG6p8S QcBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=SvYzr6Lh8q0mHT8VyeR286dXCO//F2JISJhyU6eKAHc=; b=llcQ7+iXs2Nyf8RjDOtPNyD9P9fqXYWqMJe4er3MZFsxqMvVvleRyRofoXxYfHcJvu g27N7QI46YlqqJUBs1hbQ3raCoHahYbWpMn2OZxcDlXd1uJ7pt7DzIkSdMlpiznmDMjX h+4jBnL3e52V/2uW93EXpXurNNeuHy7OVC0TnDIP0nnUxvcOlNjixdKtQ9eXnJJOOwvb ebZ/VPud84BSWH4NsP2BHfsm8rKrCINTB7i9oNuwOS9FQtIgaI7lIMQ+FyGnfI+cclFT Dw6/xKkFn6HfDPSAJa56/2n4gZkQFOZ1R1QsfA6J4ysk2g3KbCQUYovi7RAvbcQS3USp jaww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ohGAINLe; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l2-v6si872274pgc.438.2018.04.27.01.58.23; Fri, 27 Apr 2018 01:58:38 -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=@gmail.com header.s=20161025 header.b=ohGAINLe; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932478AbeD0I5C (ORCPT + 99 others); Fri, 27 Apr 2018 04:57:02 -0400 Received: from mail-pg0-f67.google.com ([74.125.83.67]:33789 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932434AbeD0I4d (ORCPT ); Fri, 27 Apr 2018 04:56:33 -0400 Received: by mail-pg0-f67.google.com with SMTP id i194-v6so1074257pgd.0; Fri, 27 Apr 2018 01:56:32 -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=hX6qxUpEa8BpOtdUV7orRVFIvSzmyVmwBoDVMZmwyOy/8cH2Ep1iUoj5EI18H7rDow LiKwpdqvEtlBlP7Qt6zWAFIQzXVoXREiRMkEAy8mG+wGYnq9/GMSSGfrzw2KoWjrA60+ FyLSWfVF8D/36KTnSxPHLyJMINRKBTiZpzBkVJZI1s4uvm0WSpTgAfRxOQcErmE2NEQP yHZCkpQrME4qzZnYL1Rj0DWq0lhGb5ASjePcmCNbOWrogOlSyy89ob4yWCX6iiU6KCu7 IoE0yqoq/GsmmbQfBaSYuGM5sUFbf7epAYKzqEG9oOA8NsQdyOU51/vDcjHxSeC5U4Za /PLw== X-Gm-Message-State: ALQs6tCyYObQXYpca+EQfIf2dC5Ta72uIPZFiROSzQ2nXbZxQD6wX7gX 3iyhpxctjAeDvP8zLd3O6plqag== 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 Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, alsa-devel@alsa-project.org Subject: [PATCH 2/3] ASoC: tpa6130a2: Use gpio_is_valid() 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: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Replace the manual validity checks for the GPIO with the gpio_is_valid(). 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) { -- 1.9.1