From patchwork Sat May 9 13:38:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 6369431 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 518FDBEEE1 for ; Sat, 9 May 2015 13:39:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3917E20340 for ; Sat, 9 May 2015 13:39:08 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 8FD5B202EC for ; Sat, 9 May 2015 13:39:06 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id C1E29260502; Sat, 9 May 2015 15:39:04 +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, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 68B10260504; Sat, 9 May 2015 15:38:56 +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 3AB87260509; Sat, 9 May 2015 15:38:55 +0200 (CEST) Received: from mail-pa0-f45.google.com (mail-pa0-f45.google.com [209.85.220.45]) by alsa0.perex.cz (Postfix) with ESMTP id 02F16260502 for ; Sat, 9 May 2015 15:38:47 +0200 (CEST) Received: by pacyx8 with SMTP id yx8so72756039pac.1 for ; Sat, 09 May 2015 06:38:46 -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=RIHW5hLgYqf51Zz8GgABaUigQofKZ8hEB2Yac41E4tU=; b=HbugmDnU5N3W5Xmn0jLe7jkux6ygejjNsQLlDM35g7eq8ss4RD3m0fSAbYVrUzPdtd Vwn/rlFZCNyUVBhNYdvvHmTA7+ue7zf3s39cc/w7wvJRLp4tHZQ9vrP9M+T+CNKtA7j4 vPXS0/IqfghwazVISuemLrpyImIUlj2bxINfo4OECB9HJ1bG70mvpP0VTQZIwIUHGra7 Httty1W0xerDsEu4bM12Wi6w1Z8DEpWoiZsk7lim1j/f3PvBbqrzKiB+AEAi8hwK6Lmu A9f3PaO2Ev+rKYNApcX5T7ynjMh8xJBEuNXRQXIh69Bx3By6bd2s/3W3Y/UNxNLsbdCf V4Xw== X-Gm-Message-State: ALoCoQlmz+N09iFww8FrldfscnzMeaZ9yRV27GdQqwJVQ2FuDM1ru8h9I/SomXi2uAxNwokDMo4z X-Received: by 10.69.31.106 with SMTP id kl10mr4603200pbd.155.1431178726598; Sat, 09 May 2015 06:38:46 -0700 (PDT) Received: from phoenix.local (218-164-135-86.dynamic.hinet.net. [218.164.135.86]) by mx.google.com with ESMTPSA id m2sm8114087pdp.4.2015.05.09.06.38.43 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 09 May 2015 06:38:45 -0700 (PDT) Message-ID: <1431178721.23049.0.camel@ingics.com> From: Axel Lin To: Mark Brown Date: Sat, 09 May 2015 21:38:41 +0800 X-Mailer: Evolution 3.12.10-0ubuntu1~14.10.1 Mime-Version: 1.0 Cc: Johannes Stezenbach , Sven Brandau , Liam Girdwood , "alsa-devel@alsa-project.org" Subject: [alsa-devel] [PATCH 1/2] ASoC: sta32x: Use devm_gpiod_get_optional appropriate place 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 devm_gpiod_get_optional() is equivalent to devm_gpiod_get(), except that when no GPIO was assigned to the requested function it will return NULL. This is convenient for drivers that need to handle optional GPIOs. Signed-off-by: Axel Lin --- sound/soc/codecs/sta32x.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/sound/soc/codecs/sta32x.c b/sound/soc/codecs/sta32x.c index 033b7d9..847fb20 100644 --- a/sound/soc/codecs/sta32x.c +++ b/sound/soc/codecs/sta32x.c @@ -1095,16 +1095,10 @@ static int sta32x_i2c_probe(struct i2c_client *i2c, #endif /* GPIOs */ - sta32x->gpiod_nreset = devm_gpiod_get(dev, "reset"); - if (IS_ERR(sta32x->gpiod_nreset)) { - ret = PTR_ERR(sta32x->gpiod_nreset); - if (ret != -ENOENT && ret != -ENOSYS) - return ret; - - sta32x->gpiod_nreset = NULL; - } else { - gpiod_direction_output(sta32x->gpiod_nreset, 0); - } + sta32x->gpiod_nreset = devm_gpiod_get_optional(dev, "reset", + GPIOD_OUT_LOW); + if (IS_ERR(sta32x->gpiod_nreset)) + return PTR_ERR(sta32x->gpiod_nreset); /* regulators */ for (i = 0; i < ARRAY_SIZE(sta32x->supplies); i++)