Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp183083rwd; Wed, 14 Jun 2023 14:17:37 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6uDrVLrpTWtzQySWMlwN2uCdHsQsLWevFFpjoUrA4BnkNIX2SoubnxSUqCl5+B45Cdiw4J X-Received: by 2002:aa7:cd95:0:b0:514:95d5:3994 with SMTP id x21-20020aa7cd95000000b0051495d53994mr9638936edv.32.1686777457022; Wed, 14 Jun 2023 14:17:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686777457; cv=none; d=google.com; s=arc-20160816; b=VezacjPIjPZYoSn0L8HHAVztcA8FDZApV/93bjFwqzlVcgANFubV1+pBFKQojup9k3 yG+B29OHI5T2foxRx6Igv/FZZ80/zNXY8jUrFs/EN3v1BjB74bralurTFXL18FmDSn7I jO/ahhyvF0yJXX1BZyYuaX/0frsNF+Y+7Fbb6M4QfdbLgnINx+rxy3NBV1PLXNQlMePT Hjf5BkT6pYviy/EHUGkvD3K5kbh4yLoCkCKgAJtwlEZKhFraPihujc0fGfDOmD6JOinB 0f14D3tF2Q274OuZJOVrTYZQFNGSkkWbVNOS3mFl8bW0ZZ3ADjEveTNwMt/jIkcBdDQ7 uxYA== 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=K4LJUPD0skruLm7yHJrG7KQ6uvH9CtyWKlTfipvO1Lo=; b=xIPXDbUYbheQ5gssNZkTWYIM+Iwu9HqJLdmOdJpgg+slHIJ5gkmvkU3RjL8w3V3Y4L jzDGa7HrIVPc2MT1zAsbJnAeIAM6ig3ECJgEEAyOAeniKNkvE/LCXoUbbPHFbQ/r1JyG nW//NffJDvbykVJXgIcTWMcy44vz6Rjnl4ZiwfgIJ306IQpSWdDsr03Xvv5eOQ1Lp7r7 QyYeCUsa0evgQylBnxHJUEkLyd/3frKDh5uIZEUjjZCWEP0KfT9w7iBxXe3bz6X/T4Cq f4yyzMMy3SK99kmd07nqq1V7qgQJGOLBeK5jAvcJKgc2VRRdyZ0oV2xF2cTvV0oDH1Wq R32Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=DdQVwEyC; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c20-20020aa7df14000000b005163939286bsi9879512edy.612.2023.06.14.14.17.11; Wed, 14 Jun 2023 14:17:37 -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=DdQVwEyC; 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 S230195AbjFNU0N (ORCPT + 99 others); Wed, 14 Jun 2023 16:26:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229889AbjFNU0K (ORCPT ); Wed, 14 Jun 2023 16:26:10 -0400 Received: from smtp.smtpout.orange.fr (smtp-27.smtpout.orange.fr [80.12.242.27]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E97C8211D for ; Wed, 14 Jun 2023 13:26:08 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id 9X49qJzAr4jPd9X49qRAft; Wed, 14 Jun 2023 22:26:06 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1686774366; bh=K4LJUPD0skruLm7yHJrG7KQ6uvH9CtyWKlTfipvO1Lo=; h=From:To:Cc:Subject:Date; b=DdQVwEyCPQeNkV3XKl0QQvAdK7pKxp0g2BdKAipl5f/cV9Ov+swXrvCVzI50H+pV2 DUhTKxRleH6bMIrcb+6tfEZ9ysf0AR0ISujujQzZB1WVic0MmkhdrNlNRghvAwQdi7 42hYdVK6aCx7ilKuRy9H/uX/dgMAGqyv7nyHO2Kv/WP+Vz2ed5T65SWqq+iW8oNgqT ig8Mr7jORjkQDRSCDspHH/RSX3Qa9xdPD4XpXhPcFkCPnzARJHyCWPI7c4FbD/ocfp bTnzCIeO2tzMLgkgwl7Y9HnQxQ2BlAO6hO0/SzfXhBRFKksSpwTW5mCpkQyJgkLURd np/nhoI2Vi4Iw== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Wed, 14 Jun 2023 22:26:06 +0200 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: Lars-Peter Clausen , Michael Hennerich , Alexandru Tachici , Jonathan Cameron Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-iio@vger.kernel.org Subject: [PATCH] iio: adc: ad7192: Simplify using devm_clk_get_optional_enabled() Date: Wed, 14 Jun 2023 22:26:04 +0200 Message-Id: <7dbe973905f1fdae5d2f5ae5a3b01dd1d6a9925b.1686774340.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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_H5,RCVD_IN_MSPIKE_WL,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 If st->mclk is not NULL, then st->clock_sel is either AD7192_CLK_EXT_MCLK2 or AD7192_CLK_EXT_MCLK1_2. So devm_clk_get_optional_enabled() can be used instead of hand writing it. This saves some line of code. Signed-off-by: Christophe JAILLET --- drivers/iio/adc/ad7192.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/drivers/iio/adc/ad7192.c b/drivers/iio/adc/ad7192.c index 8685e0b58a83..5dcb257ad754 100644 --- a/drivers/iio/adc/ad7192.c +++ b/drivers/iio/adc/ad7192.c @@ -972,11 +972,6 @@ static void ad7192_reg_disable(void *reg) regulator_disable(reg); } -static void ad7192_clk_disable(void *clk) -{ - clk_disable_unprepare(clk); -} - static int ad7192_probe(struct spi_device *spi) { struct ad7192_state *st; @@ -1044,7 +1039,7 @@ static int ad7192_probe(struct spi_device *spi) st->fclk = AD7192_INT_FREQ_MHZ; - st->mclk = devm_clk_get_optional(&spi->dev, "mclk"); + st->mclk = devm_clk_get_optional_enabled(&spi->dev, "mclk"); if (IS_ERR(st->mclk)) return PTR_ERR(st->mclk); @@ -1052,15 +1047,6 @@ static int ad7192_probe(struct spi_device *spi) if (st->clock_sel == AD7192_CLK_EXT_MCLK1_2 || st->clock_sel == AD7192_CLK_EXT_MCLK2) { - ret = clk_prepare_enable(st->mclk); - if (ret < 0) - return ret; - - ret = devm_add_action_or_reset(&spi->dev, ad7192_clk_disable, - st->mclk); - if (ret) - return ret; - st->fclk = clk_get_rate(st->mclk); if (!ad7192_valid_external_frequency(st->fclk)) { dev_err(&spi->dev, -- 2.34.1