Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp2639025rwe; Sun, 16 Apr 2023 02:06:32 -0700 (PDT) X-Google-Smtp-Source: AKy350ZSJP8Ps8DOd8gM2M5mr/CQ+zF1WwSYXnvrMsa6E8lA/h2+CzuFl5Hh2DOUiwMeQ0aHtA1J X-Received: by 2002:a17:90b:3b8c:b0:23f:9d83:ad76 with SMTP id pc12-20020a17090b3b8c00b0023f9d83ad76mr8175703pjb.23.1681635992555; Sun, 16 Apr 2023 02:06:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681635992; cv=none; d=google.com; s=arc-20160816; b=yBF20pzebx1Q9uTpZEEbgYd+4muJixTwAvgDpWIwFcf2akN7YJQuUiYmoj7PB4qLlK zVDYsf1RhefP68F50VQE3JpvAvUCfkRVv64nJ7jcPT510FUcstiLikPYth5L7uqfNWtE eWBh+Ywl3zz/iAbZV9BTkmiOuvHrAHeZ7/BfAB2nCGd9wb2QA5YNU5jpqS4yuiOPB9Gf fZw31tQ7s9YXmJcteN/3UwBOkVqnFkK+EnvEEP2oG/VJScmd9Q7hwJhviH0GmKRg9LFT 2Sw/oNRd32IfUKrUbyySlEX7ONlyxkiw/z6+9Ou77m1reXgTynz6bJDAcBSH6Tedww2X eLYw== 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=jElERW5oAW/BA/iWn/iMwYZcr8+bBQCwjgCK64tXWvg=; b=ApquTSHZ+orX0wBubI1ghbHTsqIbKsNWtBDRj+VgDyjPP0fyGggOCP8mLlHh3+0NMm lO3tOUNsHQ827DbjwYaCgce/Hf7gJbgnBXK32oj+PRxZbx7NQrsES73B+971cH8GQ+fc 85oPflm5fZDDrV77ypOQaNwws5skUQYpogu1E4UTsGUgfc9Qh9QN3kudRtMp71oqfcCy iEaHoL98sLBMWg9VhVAcreGI6Z4CSAMxIi2ar+7AOhUDagnz/YfzpjlF2QfwsOmOZRe/ KQjvNQIQZp27r69rllRwdniFOBfF/4YNLkxov5TKubF9/Y+vKxBsSk7NwtPfCAokroG7 n4VA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@orange.fr header.s=t20230301 header.b=AIFyl+4L; 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 b6-20020a656686000000b0051909d663desi9068489pgw.481.2023.04.16.02.06.21; Sun, 16 Apr 2023 02:06:32 -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=@orange.fr header.s=t20230301 header.b=AIFyl+4L; 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 S230312AbjDPJCX (ORCPT + 99 others); Sun, 16 Apr 2023 05:02:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230461AbjDPJCV (ORCPT ); Sun, 16 Apr 2023 05:02:21 -0400 Received: from smtp.smtpout.orange.fr (smtp-11.smtpout.orange.fr [80.12.242.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 570012693 for ; Sun, 16 Apr 2023 02:02:17 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id nyH0pbG1aZuz8nyH0pkDjf; Sun, 16 Apr 2023 11:02:15 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=orange.fr; s=t20230301; t=1681635735; bh=jElERW5oAW/BA/iWn/iMwYZcr8+bBQCwjgCK64tXWvg=; h=From:To:Cc:Subject:Date; b=AIFyl+4LMWAYJKXQSaTaP5fgyO1X8fiTU5MY+pi2PUbnxU7yuDCdbbAqrdvqIoC2h /Re8WzFeK5MuZBRZbUy9r5Cix6r43nGExGv8WCSS1eAQ+NgHVhiZkTN5DE4ewWCQDC NbVJ6cEGaHYvwFd32K5yLQ6bNHg5xfO73Jevs/tYWvkserBdeLMwZdlLpWrePByJWn XotY/Qt9wK/Om2MHEnD6yTzrjqBSz8r8V66GWYGXaF1q2DDJhWtr/82Az59vQsP4wj r1lqMEBTl29BivO+S4LZCIC4h0isnAtjiYXkTBL8RA6Kjfqg27z7+pUBLJhM1C3Bgs yLXACoYbAFv1w== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sun, 16 Apr 2023 11:02:15 +0200 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: Thierry Reding , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-pwm@vger.kernel.org Subject: [PATCH] pwm: clk: Use the devm_clk_get_prepared() helper function Date: Sun, 16 Apr 2023 11:02:13 +0200 Message-Id: <9281571825c365c1591fcf31527d45ec576c19b4.1681635694.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=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 Use the devm_clk_get_prepared() helper function instead of hand-writing it. It saves some line of codes. Signed-off-by: Christophe JAILLET --- drivers/pwm/pwm-clk.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/drivers/pwm/pwm-clk.c b/drivers/pwm/pwm-clk.c index f1da99881adf..0ee4d2aee4df 100644 --- a/drivers/pwm/pwm-clk.c +++ b/drivers/pwm/pwm-clk.c @@ -89,7 +89,7 @@ static int pwm_clk_probe(struct platform_device *pdev) if (!pcchip) return -ENOMEM; - pcchip->clk = devm_clk_get(&pdev->dev, NULL); + pcchip->clk = devm_clk_get_prepared(&pdev->dev, NULL); if (IS_ERR(pcchip->clk)) return dev_err_probe(&pdev->dev, PTR_ERR(pcchip->clk), "Failed to get clock\n"); @@ -98,15 +98,9 @@ static int pwm_clk_probe(struct platform_device *pdev) pcchip->chip.ops = &pwm_clk_ops; pcchip->chip.npwm = 1; - ret = clk_prepare(pcchip->clk); - if (ret < 0) - return dev_err_probe(&pdev->dev, ret, "Failed to prepare clock\n"); - ret = pwmchip_add(&pcchip->chip); - if (ret < 0) { - clk_unprepare(pcchip->clk); + if (ret < 0) return dev_err_probe(&pdev->dev, ret, "Failed to add pwm chip\n"); - } platform_set_drvdata(pdev, pcchip); return 0; @@ -120,8 +114,6 @@ static void pwm_clk_remove(struct platform_device *pdev) if (pcchip->clk_enabled) clk_disable(pcchip->clk); - - clk_unprepare(pcchip->clk); } static const struct of_device_id pwm_clk_dt_ids[] = { -- 2.34.1