From patchwork Sat May 9 15:09:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 6369751 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 098DABEEE1 for ; Sat, 9 May 2015 15:09:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 36FB020340 for ; Sat, 9 May 2015 15:09:51 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 44ACF20265 for ; Sat, 9 May 2015 15:09:49 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 57DF2260541; Sat, 9 May 2015 17:09:48 +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,NO_DNS_FOR_FROM, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 25062260515; Sat, 9 May 2015 17:09:44 +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 3B355260515; Sat, 9 May 2015 17:09:43 +0200 (CEST) Received: from mail-pd0-f177.google.com (mail-pd0-f177.google.com [209.85.192.177]) by alsa0.perex.cz (Postfix) with ESMTP id 454E826051D for ; Sat, 9 May 2015 17:09:37 +0200 (CEST) Received: by pdbqa5 with SMTP id qa5so109211617pdb.1 for ; Sat, 09 May 2015 08:09:36 -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:in-reply-to :references:content-type:mime-version:content-transfer-encoding; bh=NxZeApqVYK5P2yUrohiU18InzXHTPeHpUvtY1jV774c=; b=L37qear689XrxWULercQbPufAU0Ud7I30Nh2as1lifrCbtzhJCTJCoOVY5GQHpiNsB QSVmiRKGxTI10aQy0vcZv1lPfGtQBdxCxVXFaQtLe2HD0Sl93ZuB2lI4qMQaF+askllX 0hMzR9wXM1rRUCe+/O0SCQNWzpDs7mOCGrfF83RHGiuPJXdz0WyCAxF77OtOGSM3AK3z Gpn+5SQS4r3EhUwQ4UmSnXdXAZvB1RuoSj+F7ucYk/yqCIB4wOFN4Xa1S01aZgyk3RhD Ufse5DIgMNDv2ogDxgzHGClQ/TBkmBzYsUevITn+Y0iLvplzNxMN4Pa6ZLBKhhKgzyJs zWNQ== X-Gm-Message-State: ALoCoQlu+R5/6CGEPvF9CP4CGfBirJreNKRjZDvB3E/Qps/z8HkWvdvnDIBK6Pf4KyBpNK1AlcIG X-Received: by 10.68.69.105 with SMTP id d9mr5236037pbu.144.1431184176455; Sat, 09 May 2015 08:09:36 -0700 (PDT) Received: from phoenix.local (218-164-135-86.dynamic.hinet.net. [218.164.135.86]) by mx.google.com with ESMTPSA id af1sm8303947pad.34.2015.05.09.08.09.33 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 09 May 2015 08:09:35 -0700 (PDT) Message-ID: <1431184172.5393.2.camel@ingics.com> From: Axel Lin To: Mark Brown Date: Sat, 09 May 2015 23:09:32 +0800 In-Reply-To: <1431184113.5393.1.camel@ingics.com> References: <1431184113.5393.1.camel@ingics.com> 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 v2 2/2] ASoC: sta350: Use devm_gpiod_get_optional at 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. I just checked the code in commit 34d7c3905adb9a9 ("ASoC: improve usage of gpiod API") and found that it should use devm_gpiod_get_optional rather than devm_gpiod_get here. Signed-off-by: Axel Lin --- v2: Fixup subject line sound/soc/codecs/sta350.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/sta350.c b/sound/soc/codecs/sta350.c index 50d8bbf..0cea8f9 100644 --- a/sound/soc/codecs/sta350.c +++ b/sound/soc/codecs/sta350.c @@ -1217,8 +1217,8 @@ static int sta350_i2c_probe(struct i2c_client *i2c, if (IS_ERR(sta350->gpiod_nreset)) return PTR_ERR(sta350->gpiod_nreset); - sta350->gpiod_power_down = devm_gpiod_get(dev, "power-down", - GPIOD_OUT_LOW); + sta350->gpiod_power_down = devm_gpiod_get_optional(dev, "power-down", + GPIOD_OUT_LOW); if (IS_ERR(sta350->gpiod_power_down)) return PTR_ERR(sta350->gpiod_power_down);