From patchwork Sat May 20 14:56:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 96797 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp409334vqo; Sat, 20 May 2023 08:01:11 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ49AWohK5pYUFx329cO8JwjPLoKDAKtp10GeOV7gUj34llaJGDBx4k9FX+BxE2XPqfikuGn X-Received: by 2002:a17:902:d501:b0:1ae:2e0d:b38c with SMTP id b1-20020a170902d50100b001ae2e0db38cmr6980729plg.12.1684594871085; Sat, 20 May 2023 08:01:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684594871; cv=none; d=google.com; s=arc-20160816; b=oEx2H9uuSiXxAZSr2NH65NNzcognqLcv8xFdQcaZIQFq30bwSZJ0+SRfwauNfR2UYF g4qfbRAmyuItw+hqLddwrWVRQQ0aganmfQ5XNNJFNprZNyiuyqQOi2n9+wR9nuSfdDlJ 0urgCixr92T1AL/HSpks/7CXe6hoL52JOaGWxnJbb7v3s/61qliBZ3xv/UKHuLA6NAwn JJ5zt1dt2ZEE8d181so2PlWt7+O4dJ1v5enFxzRDwCs4T5TvHwpLsstIlw8hfavPy1fF iG94k2pF7DctAguzKh6mZcUzIou82f37uczfC0Vb5vJ3/3EJDPm1tiUKPoQ2Z6dfoKIT biJg== 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=bpLpYwHdElG8Zrz72XZdWqpkdWbasWrKHm81qJngWNM=; b=d7wXFUw9eHcSAtT6kr/zxqtxaQMOHjn7y/5zrdASNPRGjOYfv2XqoLlQl/44PO11JL 2tMiHbRhCLwcTBxaxr6u5NhWgdmRRh06pO6lig+3mkNSwWejzC7TXGdLAlQDPllmxwE2 fA4rkndvidDiUPvS+pPc4HDxxenxUUvvZOWNyT2CW82fl2VCa0iC2KMxy2/ZROUwW/75 dQWloL4yXOTzpOYuPa8HUbqPTWEKpJRMkTKScBY9rRaO1W05ufXuGp+FbEBgN76BG8eT c9fcKVLY4M/ZWMnmfAe9bgvES8N3taf5UviAqP/MjbGwqYzESz7Rv0yjO8eJXn3KzXjt kDVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=esUdMWBL; 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 t16-20020a170902e85000b001adf56751ccsi1620687plg.520.2023.05.20.08.00.58; Sat, 20 May 2023 08:01:11 -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=esUdMWBL; 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 S231626AbjETO4I (ORCPT + 99 others); Sat, 20 May 2023 10:56:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231582AbjETO4H (ORCPT ); Sat, 20 May 2023 10:56:07 -0400 Received: from smtp.smtpout.orange.fr (smtp-27.smtpout.orange.fr [80.12.242.27]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D00C115 for ; Sat, 20 May 2023 07:56:05 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id 0O00q7RjWHWsH0O01qRG48; Sat, 20 May 2023 16:56:03 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1684594563; bh=bpLpYwHdElG8Zrz72XZdWqpkdWbasWrKHm81qJngWNM=; h=From:To:Cc:Subject:Date; b=esUdMWBLA/phoUXHm4JrlWfMI2UdxVyfevFMmMduOK0jOBFkLSDf3VzJpbi/iO2Rj 9Jv1y74+6CMKzngQNBOl0ul5oJ2dlSxrYU/mJA3ZcNelQjj4wcZBpWrDDdNv/oP49q C2PTMQmDBu1OfRWeknabq78rfQE57kp8AWWXK1dXMuIzqIzn9OF34r5Hq76d+3oX3u BTa8VDKgyir2/HrIH5zN+xuhTQrmM/D6GyWdZn2lWHBaqblzqZHKY7jcCcRfebZ7il M/WvdvtmLtie2wXciOf/Ey6Xgi/3I3eV36zXk6ZfRr7WPx64IfaX+08f3glUi9AP1N 1yvBcMnrcPc7Q== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sat, 20 May 2023 16:56:03 +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: rt5659: Use the devm_clk_get_optional() helper Date: Sat, 20 May 2023 16:56:00 +0200 Message-Id: <5b44b2fddd8973e949e4ae2132971b147cfd1ec1.1684594544.git.christophe.jaillet@wanadoo.fr> 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=ham 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?1766425751290238096?= X-GMAIL-MSGID: =?utf-8?q?1766425751290238096?= 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/rt5659.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/sound/soc/codecs/rt5659.c b/sound/soc/codecs/rt5659.c index 22bb57029bc0..df6f0d769bbd 100644 --- a/sound/soc/codecs/rt5659.c +++ b/sound/soc/codecs/rt5659.c @@ -4141,13 +4141,9 @@ static int rt5659_i2c_probe(struct i2c_client *i2c) regmap_write(rt5659->regmap, RT5659_RESET, 0); /* Check if MCLK provided */ - rt5659->mclk = devm_clk_get(&i2c->dev, "mclk"); - if (IS_ERR(rt5659->mclk)) { - if (PTR_ERR(rt5659->mclk) != -ENOENT) - return PTR_ERR(rt5659->mclk); - /* Otherwise mark the mclk pointer to NULL */ - rt5659->mclk = NULL; - } + rt5659->mclk = devm_clk_get_optional(&i2c->dev, "mclk"); + if (IS_ERR(rt5659->mclk)) + return PTR_ERR(rt5659->mclk); rt5659_calibrate(rt5659);