From patchwork Fri Dec 30 16:59:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 37716 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2981851wrt; Fri, 30 Dec 2022 09:01:01 -0800 (PST) X-Google-Smtp-Source: AMrXdXs0OoPBFMqkvjv9kJ6+CNttbnyUGm/N+447jzt3gi/1rgKJHIuWOldawvoeR0zXEpn+Imt6 X-Received: by 2002:a05:6402:1948:b0:470:1f1:257a with SMTP id f8-20020a056402194800b0047001f1257amr28976329edz.25.1672419660851; Fri, 30 Dec 2022 09:01:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672419660; cv=none; d=google.com; s=arc-20160816; b=i659zn6ZnsnOTUMGOppQYOkx78DNaJ8WCwoTjMlqc3NawdkRkg/wzTw8ihpNnchJn2 wGfjEsKOfgUXF7rEqaGURTGhI9Y+48hsjvApZxvZWgV+BGAT6roBUcEaMnO0s/e+IW9o baCeGfs6FOb/TX4aiKu98Wf443JidcGniMciuKnXoqkWSeBFCsXATpB4A2Wj/WEHAgpk dBET2CNoCu0HBYRHP9/Tqj48C80B0RaMJOpkrtpsq0fVf7//xz5xVOMWHg+K82wmw3CC gkaJ53HrK/GdV5WNerF7B/07k/cZFca+3lhYEF1j6mHP0GD53cJ4PPWWEMk/DSIkBiFS 0EIg== 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; bh=zd2FvxoMZ1/AtM1AtHDwhnE6pibm8EY8hbg8dbBNy8Q=; b=djG0REXslk7B+egLkOnjrSI5TpHzk8R5+sHr4it8AomBJpSKjrI7NvgxHw/OyF7KJQ WF49yoLIZ3xzMHtbHARPvBSizvGy8O/h5emAr+RsTrjN293VKOx4yZqb5xmGEsHIYatp g7tzubpNwI7M76s22JC0aUN9BxkNx5KcuJvB6okHR4KzBkuk2Doeve2PI89DiAFGLbK3 86OG5rp7JeHnoq487cx+gWqj4tlVT0dXYsNKRCA9GRS0N9W6zu3s8+oRLb21chhgswTY THcpNngyOMnjWmEJHvpbxqH9JWgo038H/4XpdDxteuHk9jW24w5jWUceDz9B4m1fDyAV rPnQ== ARC-Authentication-Results: i=1; mx.google.com; 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 bq10-20020a056402214a00b0047da6021798si15780922edb.93.2022.12.30.09.00.36; Fri, 30 Dec 2022 09:01:00 -0800 (PST) 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; 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 S229527AbiL3RAD (ORCPT + 99 others); Fri, 30 Dec 2022 12:00:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230468AbiL3RAB (ORCPT ); Fri, 30 Dec 2022 12:00:01 -0500 Received: from smtp.smtpout.orange.fr (smtp-21.smtpout.orange.fr [80.12.242.21]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2765A1902A for ; Fri, 30 Dec 2022 09:00:00 -0800 (PST) Received: from pop-os.home ([86.243.100.34]) by smtp.orange.fr with ESMTPA id BIjepxxYHqMfRBIjepeWsm; Fri, 30 Dec 2022 17:59:59 +0100 X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Fri, 30 Dec 2022 17:59:59 +0100 X-ME-IP: 86.243.100.34 From: Christophe JAILLET To: Greg Kroah-Hartman , Jiri Slaby Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-serial@vger.kernel.org Subject: [PATCH] serial: sccnxp: Use devm_clk_get_enabled() helper Date: Fri, 30 Dec 2022 17:59:56 +0100 Message-Id: <735a807c2df835aa436dcbc76b374f983f89a9af.1672419577.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,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS 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?1753659118753981941?= X-GMAIL-MSGID: =?utf-8?q?1753659118753981941?= The devm_clk_get_enabled() helper: - calls devm_clk_get() - calls clk_prepare_enable() and registers what is needed in order to call clk_disable_unprepare() when needed, as a managed resource. This simplifies the code. This also avoids some other warnings/issues. (see [1]) [1]: https://lore.kernel.org/all/20221118233101.never.215-kees@kernel.org/ Signed-off-by: Christophe JAILLET --- drivers/tty/serial/sccnxp.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/drivers/tty/serial/sccnxp.c b/drivers/tty/serial/sccnxp.c index 7df687822634..4f2fc5f7bb19 100644 --- a/drivers/tty/serial/sccnxp.c +++ b/drivers/tty/serial/sccnxp.c @@ -913,23 +913,13 @@ static int sccnxp_probe(struct platform_device *pdev) } else if (PTR_ERR(s->regulator) == -EPROBE_DEFER) return -EPROBE_DEFER; - clk = devm_clk_get(&pdev->dev, NULL); + clk = devm_clk_get_enabled(&pdev->dev, NULL); if (IS_ERR(clk)) { ret = PTR_ERR(clk); if (ret == -EPROBE_DEFER) goto err_out; uartclk = 0; } else { - ret = clk_prepare_enable(clk); - if (ret) - goto err_out; - - ret = devm_add_action_or_reset(&pdev->dev, - (void(*)(void *))clk_disable_unprepare, - clk); - if (ret) - goto err_out; - uartclk = clk_get_rate(clk); }