From patchwork Sat May 20 14:48:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 96796 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp407269vqo; Sat, 20 May 2023 07:56:42 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5OJQvosboetRfqkY7IjPl9WzVdCbSpkFykPmPA93Ai2Fj5vpqdyey2OXAyqk1fD70VyEjE X-Received: by 2002:a05:6a21:6811:b0:e9:5b0a:deff with SMTP id wr17-20020a056a21681100b000e95b0adeffmr5069129pzb.22.1684594602314; Sat, 20 May 2023 07:56:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684594602; cv=none; d=google.com; s=arc-20160816; b=M94KLI5mmh3qm6dcj0oqhtLW62Po9U6t6tFNHOymS2XIYVqi7iPKKZGF72Dxh8BXUi 1ItygkQdlpHlcdYONSx6J7hFA0JfnKTgDTalDKGtDd0C2XsPb/DAmKgbeGqvzelPdYXX VC/mCKrvjbHSuRE5BebIre5ggNKL+anHdQAZ+XEQiNzcITgT05iiR3IhAFIgfzTr1hOu r5dEyXuRKrSCEXT82yMJ66LRq5lEIUR7VwJKmViGQDLd35akKTXNidPW5s7J7GPWFEgL u3ncrtMZtnA9Z1C8KnEwPW3oi5dAJZGKW3kzFtiMmidvfLYJ5Fw/xGjifnofUj9x+1ly U8oQ== 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=xlCNSpYIx4Q8P0eGlPFP+zmi7PyQkFEulkiKsfmFMe0=; b=TU0bkxDUY++TrjPt6QeMIQqJOQGJwQuQSmiWZdhOrf/dgTnA2LQK8FHys+tCzelWSJ IAlemvFkpMZPyW8eZHd0bM1CAKm+EHOVNxgmonq52adTvJ2D9QAO3ULHrRjNsqt95yVk 5i4Q6rcT9Ha0XdgvlM0c9IW4LNAOfrzXe9j5Oe8g1pxYCdpbiGQi06Qt94WmLClpLx0/ +t5tlekSYgsXdmiFlRMPfkpzueMv6XItSMXpuNmf6clqpUOL79LXeyHHRGO7TVNqPk7+ TUBDh7aedPugMgXqyw/B6RNofCnO2SSnYsxe+3QZpWyjp0adwIhWogcBSsM2B69gj3rE oIXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b="kyxN6/xc"; 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 v24-20020a63f218000000b005186bbfb286si1685415pgh.308.2023.05.20.07.56.28; Sat, 20 May 2023 07:56:42 -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="kyxN6/xc"; 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 S231180AbjETOsa (ORCPT + 99 others); Sat, 20 May 2023 10:48:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229464AbjETOs1 (ORCPT ); Sat, 20 May 2023 10:48:27 -0400 Received: from smtp.smtpout.orange.fr (smtp-16.smtpout.orange.fr [80.12.242.16]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 276D1115 for ; Sat, 20 May 2023 07:48:26 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id 0NsaqFMzTeM6M0NsaqgBHC; Sat, 20 May 2023 16:48:24 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1684594104; bh=xlCNSpYIx4Q8P0eGlPFP+zmi7PyQkFEulkiKsfmFMe0=; h=From:To:Cc:Subject:Date; b=kyxN6/xcEUZaNVqZX14x0TxlXwiJz7wRFmXY2e5XyX4ujmXgp4CsKYz3gg6Ak1Gjh LfGy732H4WrerhkumLSW82tnOjo6wByee5faFkuYOQZ4qwlh/9b0Y380N1WMsSrO+3 5rIM6bfS5qjNbMPNN739Jf6rFydfI9pxUW1sxOMr5VWUuaiL3dExT6COVb6Atd8/e3 BkMfcUF2QheLavBdtfQ1QQuvTSZIOKJ5GdDxHAi6M0FuBWKHfW7YJ7rp0zoapPkV1K UUbalI5DbIrYLRX2nRtyPlQxh7E5NBvuCRi38G56PmEJEWP4sbKSxspC6NJP+cOu8T l9YG/DKrYWBzQ== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sat, 20 May 2023 16:48:24 +0200 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: Lars-Peter Clausen , =?utf-8?q?Nuno_S=C3=A1?= , 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: adau1761: Use the devm_clk_get_optional() helper Date: Sat, 20 May 2023 16:48:19 +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=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?1766425469831485843?= X-GMAIL-MSGID: =?utf-8?q?1766425469831485843?= 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/adau17x1.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/sound/soc/codecs/adau17x1.c b/sound/soc/codecs/adau17x1.c index 634d4dbca5ec..f2932713b4de 100644 --- a/sound/soc/codecs/adau17x1.c +++ b/sound/soc/codecs/adau17x1.c @@ -1059,13 +1059,12 @@ int adau17x1_probe(struct device *dev, struct regmap *regmap, if (!adau) return -ENOMEM; - adau->mclk = devm_clk_get(dev, "mclk"); - if (IS_ERR(adau->mclk)) { - if (PTR_ERR(adau->mclk) != -ENOENT) - return PTR_ERR(adau->mclk); - /* Clock is optional (for the driver) */ - adau->mclk = NULL; - } else if (adau->mclk) { + /* Clock is optional (for the driver) */ + adau->mclk = devm_clk_get_optional(dev, "mclk"); + if (IS_ERR(adau->mclk)) + return PTR_ERR(adau->mclk); + + if (adau->mclk) { adau->clk_src = ADAU17X1_CLK_SRC_PLL_AUTO; /*