From patchwork Fri Apr 27 08:56:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arvind Yadav X-Patchwork-Id: 10367743 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 42FB3601D3 for ; Fri, 27 Apr 2018 08:56:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 312E02926A for ; Fri, 27 Apr 2018 08:56:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 260B129308; Fri, 27 Apr 2018 08:56:50 +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 C6C182926A for ; Fri, 27 Apr 2018 08:56:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932459AbeD0I4i (ORCPT ); Fri, 27 Apr 2018 04:56:38 -0400 Received: from mail-pg0-f66.google.com ([74.125.83.66]:45578 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932282AbeD0I4g (ORCPT ); Fri, 27 Apr 2018 04:56:36 -0400 Received: by mail-pg0-f66.google.com with SMTP id i29-v6so1055414pgn.12; Fri, 27 Apr 2018 01:56:36 -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=ojsepjaiINVW1DwmrAqtv/lgEGBmgbaB0xde5oe+vAo=; b=PL8ihsbgKzl7XsLJ56UShBPVoNa9phfqA8u8kkw7LzUUUOW0OWXxuelnGQDvuVa+X+ 98DOvb/lZykCusk4q8jT1ccpwPE7FZzKD1gHWNxrg0PbbdJLU3w9WZNcNPWJsyG0tgAJ ak9cOi/Eqqjs5Zd+Z8HLjbBvjPoNapszyb9X9fPFNJimskWKIhOhQ2FECY/d/EnMJInA 5HW7PLEqt+1lvGXoqum1O0AxaQuqI+3iPe3ZXeNNFjHm4G2oiJHT+dpQaptJ6mdpXcip k26eg+UkYAg8/vf5TTrzp7lA++iPNbwtsS9rW4600MtBsW4WE7B0Y3UxxDTjmUrfegP8 hUBw== 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=ojsepjaiINVW1DwmrAqtv/lgEGBmgbaB0xde5oe+vAo=; b=uCtgxFqjr7pJ06At4jOLs8mf7MPpcHmSt7sQDX6sMsHZj9FPCTG2ZxDyuE3Ol4mycE bRBIlxzL+5ApsY0hYjGIQ9VRI1LiKa/aEIUppYDjTrIBl7AqEuyFh8KAB0DmBwLfQUCv OZ+K5QLjQ+evSve8d8JoE2vhowDqjtVhaW5vdVcSK/N3IfNEj1VNWFNrRIZ5/SyNzDR/ yReeWvaOTgpCkWhSfVQ4od/mAPyaWs92om6aYwVZascnzU5jf52XvF7tAAq3QmWzRnSW qNzYV9gQ8NBWzuybqiXWKwKFpCOIH0paM48z1b0UDWvc81aphAIrVOKGVwWItX7YjvIs VLGw== X-Gm-Message-State: ALQs6tDOqlJpcpZbWhw863R+Gf47Q3vOhw2hfIUz3ggIy68nC72aXShf FYZrzQu1ssylTss222wwx+s= X-Google-Smtp-Source: AB8JxZq8QNLG6QUAQ1vOlQRpIRHgrzrEA0wllc6YrqY4qe0pvn1nI/hVfn3rgIL2dc8er3MtnDcofw== X-Received: by 10.98.178.208 with SMTP id z77mr1447457pfl.122.1524819395770; Fri, 27 Apr 2018 01:56:35 -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.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 27 Apr 2018 01:56:35 -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 3/3] ASoC: samsung: Use gpio_is_valid() Date: Fri, 27 Apr 2018 14:26:11 +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 --- sound/soc/samsung/s3c24xx_simtec.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sound/soc/samsung/s3c24xx_simtec.c b/sound/soc/samsung/s3c24xx_simtec.c index 6de63f3..23e8ef9d 100644 --- a/sound/soc/samsung/s3c24xx_simtec.c +++ b/sound/soc/samsung/s3c24xx_simtec.c @@ -229,7 +229,7 @@ static int attach_gpio_amp(struct device *dev, int ret; /* attach gpio amp gain (if any) */ - if (pdata->amp_gain[0] > 0) { + if (gpio_is_valid(pdata->amp_gain[0])) { ret = gpio_request(pd->amp_gain[0], "gpio-amp-gain0"); if (ret) { dev_err(dev, "cannot get amp gpio gain0\n"); @@ -248,7 +248,7 @@ static int attach_gpio_amp(struct device *dev, } /* note, currently we assume GPA0 isn't valid amp */ - if (pdata->amp_gpio > 0) { + if (gpio_is_valid(pdata->amp_gpio)) { ret = gpio_request(pd->amp_gpio, "gpio-amp"); if (ret) { dev_err(dev, "cannot get amp gpio %d (%d)\n", @@ -263,7 +263,7 @@ static int attach_gpio_amp(struct device *dev, return 0; err_amp: - if (pd->amp_gain[0] > 0) { + if (gpio_is_valid(pd->amp_gain[0])) { gpio_free(pd->amp_gain[0]); gpio_free(pd->amp_gain[1]); } @@ -273,12 +273,12 @@ static int attach_gpio_amp(struct device *dev, static void detach_gpio_amp(struct s3c24xx_audio_simtec_pdata *pd) { - if (pd->amp_gain[0] > 0) { + if (gpio_is_valid(pd->amp_gain[0])) { gpio_free(pd->amp_gain[0]); gpio_free(pd->amp_gain[1]); } - if (pd->amp_gpio > 0) + if (gpio_is_valid(pd->amp_gpio)) gpio_free(pd->amp_gpio); }