From patchwork Sat May 20 14:58:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 96801 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp418786vqo; Sat, 20 May 2023 08:15:05 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4psfIn2FKRGI5skti+uCgAPPbKm+IaEoDO+6X0BG4OxvbdwjQ2JCWcCXpHuXkFChbCJ6Zi X-Received: by 2002:a05:6a00:1408:b0:647:5409:5d08 with SMTP id l8-20020a056a00140800b0064754095d08mr7971303pfu.17.1684595704824; Sat, 20 May 2023 08:15:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684595704; cv=none; d=google.com; s=arc-20160816; b=j+6fQvgt2Na/0ag9wRvXlBsp+vW1u/69XExoNaYorQwpqlXKuru2FOI+RDHbXG6ccv 2GrW8qxCfjkBt2BcFkJvAGaFeuqKDv1ziGU70MA9lD7ADgAEpsWXhIOv+Jb+ecqGt543 94NgDYMGnNOY9d4ntjgr4JuShTxyIYWZkHZiaAKxXOfOicf3QY4Uwal0n8VLPrc3SFuq fl81C1ubV6PzjvuHJtLpAS5BcrNfnybM0+K+Nql9b9s6vuQMHELU187xHuRSgsy3eufE fYI2xwO6wxs6KrbTqkuN07syBzbmGb5iPRb78a7gms1eEWDxuHLWq5opnNfg8/QO35xe Kgtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=an1jU7hzklQhAPlftBGuyvpE99sqJqwyCvQdIs09g5U=; b=NFXspVaGoaBYEogwS9zYgKtiYrkO946vb2cArMhQB98HjyFPGMg4iwSORUKsrel/Jr mmZe6ZOHl/mkakXMnksKueYxsZlZgyVid5ByMA/JBzWkeTx7kHCmipiVDoZNburh7ZjR CRKDSwYIjswwkvou93P3dKhATR7nI5QH5NwQ735hUSBijpQ7dNMh9P6dijokh+BDWTIM 3B52TGCyOy9Sc5XtkhwBPjUnnPqZvJHw7ILYw2VvS1caYVob0c4HRsmWSpJdf2W5jqoo 0b2UE8ekq1/ZV1Mqd6a+h9ya7xIVLMvUW+ygL9szXiQVNzfR4LK1GriNfXrGijAy8Pzy xC5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=nww41qSi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k14-20020a62840e000000b0064d2a385c1csi1657008pfd.252.2023.05.20.08.14.47; Sat, 20 May 2023 08:15:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=nww41qSi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229523AbjETO6c (ORCPT + 99 others); Sat, 20 May 2023 10:58:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230040AbjETO6b (ORCPT ); Sat, 20 May 2023 10:58:31 -0400 Received: from smtp.smtpout.orange.fr (smtp-25.smtpout.orange.fr [80.12.242.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C3AD116 for ; Sat, 20 May 2023 07:58:30 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id 0O2LqG7MhArAu0O2Mqmq31; Sat, 20 May 2023 16:58:28 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1684594708; bh=an1jU7hzklQhAPlftBGuyvpE99sqJqwyCvQdIs09g5U=; h=From:To:Cc:Subject:Date; b=nww41qSiv8Xnw/kdeokRlCyp37wJMyyNKn/rHP5EU6NjljbHg+hmJ01LiuLbO0pKH /Iakel18zuGasaCdwlZu22ApMilwLlHdOsE0qBNq8FvjfNJpXGt+920OZabAu0JwyX OJlaC0BE7W0vuNoHk0iLmNDq8J3AWigVeHJfaQIDoWAk9RzWnOxOBMif75sLDgjDwy iseb/rFVaqYryiAmIkOr4J/tgkpAceavcc4j3xDZhVB2TLjsFvY6pbzA8HBfJ87DtY c0LMzQxzMoilvaNA2pwR3hJWgYUnValLS7L43uQzPiqIc5H1Au0Cm+Mzr20YjEjE/Z MW4RFEfSFQTJQ== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sat, 20 May 2023 16:58:28 +0200 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: Oder Chiou , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , alsa-devel@alsa-project.org Subject: [PATCH] ASoC: rt5682s: Use the devm_clk_get_optional() helper Date: Sat, 20 May 2023 16:58:24 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766426625285775859?= X-GMAIL-MSGID: =?utf-8?q?1766426625285775859?= Use devm_clk_get_optional() instead of hand writing it. This saves some LoC and improves the semantic. Signed-off-by: Christophe JAILLET --- sound/soc/codecs/rt5682s.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/sound/soc/codecs/rt5682s.c b/sound/soc/codecs/rt5682s.c index 81163b026b9e..a01de405c22c 100644 --- a/sound/soc/codecs/rt5682s.c +++ b/sound/soc/codecs/rt5682s.c @@ -2848,14 +2848,9 @@ static int rt5682s_dai_probe_clks(struct snd_soc_component *component) int ret; /* Check if MCLK provided */ - rt5682s->mclk = devm_clk_get(component->dev, "mclk"); - if (IS_ERR(rt5682s->mclk)) { - if (PTR_ERR(rt5682s->mclk) != -ENOENT) { - ret = PTR_ERR(rt5682s->mclk); - return ret; - } - rt5682s->mclk = NULL; - } + rt5682s->mclk = devm_clk_get_optional(component->dev, "mclk"); + if (IS_ERR(rt5682s->mclk)) + return PTR_ERR(rt5682s->mclk); /* Register CCF DAI clock control */ ret = rt5682s_register_dai_clks(component);