From patchwork Sun Apr 16 09:02:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 83810 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1458986vqo; Sun, 16 Apr 2023 02:20:31 -0700 (PDT) X-Google-Smtp-Source: AKy350YzIJATDpjok7moCch+t7Bgpgj/KbZee441xPFblJ2E5ldevz1/iPVne+XP3y/HqOq1Qq1D X-Received: by 2002:a05:6a00:1a09:b0:636:e52f:631e with SMTP id g9-20020a056a001a0900b00636e52f631emr15580918pfv.1.1681636831257; Sun, 16 Apr 2023 02:20:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681636831; cv=none; d=google.com; s=arc-20160816; b=oCDyunRMC0PaMyJpyFlOasS0n6rhn2XcMQGQJRYtPP7P84LQswBwWxt1f9ljcdhzri N7x/IWXWikbBTueAhpvhMoILGOqsAxDL/cLAWU8qoPOo+qfzCBxl3SbVZAH5/pt0wdcc SNL2KuYzmAYwScLwil7nMRneVwGkkspUM1IajtCLpkd+RTqNnSXgoo/ATGbuy5DuRxvo sKe/52ZzJvGZGH+icJrNMegf+AAwQjwIqOuADRjcv/bKlKDebLqkDUEpUBIVkLLgIWtg D+KA69Mxofzub79vFxchPHLBBpnxjK2RPqebOHuszuwb61u5xM/yBl2SRm30lTB68Po2 8x6Q== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k29-20020aa7999d000000b005808bb470a0si8834175pfh.180.2023.04.16.02.20.16; Sun, 16 Apr 2023 02:20:31 -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 S230457AbjDPJCX (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_Kleine-K=C3=B6n?= =?utf-8?q?ig?= 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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763324022272510191?= X-GMAIL-MSGID: =?utf-8?q?1763324022272510191?= Use the devm_clk_get_prepared() helper function instead of hand-writing it. It saves some line of codes. Signed-off-by: Christophe JAILLET Acked-by: Uwe Kleine-König --- 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[] = {