From patchwork Thu Jul 23 15:32:04 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 6854371 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 834519F38B for ; Thu, 23 Jul 2015 15:32:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B9A3D20783 for ; Thu, 23 Jul 2015 15:32:39 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 809AC2078D for ; Thu, 23 Jul 2015 15:32:38 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 3FB5F2606F9; Thu, 23 Jul 2015 17:32:32 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 67E9926128B; Thu, 23 Jul 2015 17:32:22 +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 BBFCC260711; Thu, 23 Jul 2015 17:32:18 +0200 (CEST) Received: from mail-pd0-f180.google.com (mail-pd0-f180.google.com [209.85.192.180]) by alsa0.perex.cz (Postfix) with ESMTP id 70EDC261A8C for ; Thu, 23 Jul 2015 17:32:10 +0200 (CEST) Received: by pdjr16 with SMTP id r16so161605027pdj.3 for ; Thu, 23 Jul 2015 08:32:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:subject:from:to:cc:date:content-type :mime-version:content-transfer-encoding; bh=11gYFb8IhjKtSdbh/naAa1UyU+9BKdx4MP8lUiFTjo0=; b=eO/zQM4hwhXaKivZw7c8yLMk3NVAQl2eLxjySvPel9YaoHhvo9/JXzLWL5LAlffrgw wnkJ7AEa2+ew9iZ/wWOQIhxxghwpWYaeOuud+6KHbRRhP37d55qgZ06R/BpzbK8YXiKV 1ZgAjJjQanp1ESoNUppZifAPZ5xxOmQfYh6YFHtYcuBvuiMCZxijm06fKYHs9wgB4SRh VbMI6lbiK4rT3Cqrqza6rOm7Y6ksvx6dEyx4jRmLlRBV5dk1NEBVNnFneHxqUSso3cX1 IJhgqJxFhsuB4r+MGdcj4M2cWmz7y18CEFHZTCYaYGhmNw+MUbHaNfb3eSLP+H51vmKG qIFg== X-Gm-Message-State: ALoCoQk4EcbSJqsediDzfwy9LszVkr/ETZx+BeSQtYwi3y/PGvBVQH2NnewL6Cnc6GzSlkb9uCAJ X-Received: by 10.70.88.2 with SMTP id bc2mr19576259pdb.153.1437665529478; Thu, 23 Jul 2015 08:32:09 -0700 (PDT) Received: from phoenix.local (218-164-29-101.dynamic.hinet.net. [218.164.29.101]) by smtp.gmail.com with ESMTPSA id xo14sm9695775pac.24.2015.07.23.08.32.06 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Jul 2015 08:32:08 -0700 (PDT) Message-ID: <1437665524.20606.8.camel@ingics.com> From: Axel Lin To: Mark Brown Date: Thu, 23 Jul 2015 23:32:04 +0800 X-Mailer: Evolution 3.12.10-0ubuntu1~14.10.1 Mime-Version: 1.0 Cc: Oder Chiou , Bard Liao , alsa-devel@alsa-project.org, Liam Girdwood Subject: [alsa-devel] [PATCH] ASoC: rt5677: Remove NULL test for desc before gpiod_set_value_cansleep call 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP It's safe to call gpiod_set_value_cansleep() with NULL desc. Signed-off-by: Axel Lin --- sound/soc/codecs/rt5677.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/sound/soc/codecs/rt5677.c b/sound/soc/codecs/rt5677.c index 016db7d..8d70911 100644 --- a/sound/soc/codecs/rt5677.c +++ b/sound/soc/codecs/rt5677.c @@ -4763,10 +4763,8 @@ static int rt5677_remove(struct snd_soc_codec *codec) struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); regmap_write(rt5677->regmap, RT5677_RESET, 0x10ec); - if (rt5677->pow_ldo2) - gpiod_set_value_cansleep(rt5677->pow_ldo2, 0); - if (rt5677->reset_pin) - gpiod_set_value_cansleep(rt5677->reset_pin, 0); + gpiod_set_value_cansleep(rt5677->pow_ldo2, 0); + gpiod_set_value_cansleep(rt5677->reset_pin, 0); return 0; } @@ -4780,10 +4778,8 @@ static int rt5677_suspend(struct snd_soc_codec *codec) regcache_cache_only(rt5677->regmap, true); regcache_mark_dirty(rt5677->regmap); - if (rt5677->pow_ldo2) - gpiod_set_value_cansleep(rt5677->pow_ldo2, 0); - if (rt5677->reset_pin) - gpiod_set_value_cansleep(rt5677->reset_pin, 0); + gpiod_set_value_cansleep(rt5677->pow_ldo2, 0); + gpiod_set_value_cansleep(rt5677->reset_pin, 0); } return 0; @@ -4794,10 +4790,8 @@ static int rt5677_resume(struct snd_soc_codec *codec) struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); if (!rt5677->dsp_vad_en) { - if (rt5677->pow_ldo2) - gpiod_set_value_cansleep(rt5677->pow_ldo2, 1); - if (rt5677->reset_pin) - gpiod_set_value_cansleep(rt5677->reset_pin, 1); + gpiod_set_value_cansleep(rt5677->pow_ldo2, 1); + gpiod_set_value_cansleep(rt5677->reset_pin, 1); if (rt5677->pow_ldo2 || rt5677->reset_pin) msleep(10);