From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 76B35C52D7C for ; Thu, 22 Aug 2024 13:20:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To: Content-Type:MIME-Version:References:Message-ID:Subject:To:From:Date:Reply-To :Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=/fcBy2VcDmRZn5/pX5PAawh5pcGM8vUbSseJRVaff6Q=; b=XdFLH+ZvnWStXzXVAIIGF5OVhS hqcgp/TED1B3fJvDnhgZVrboRdurGEQ59Y8SIhR7WGPlyvkUO8KT+6R6Wbiwd1phTYQQ1HG4hOuwj y39l44gv5bDkdjQajDDiub7TaYAtgYREROabouZpb57IB5EPLeN9WBUBGzlSvEtkbTwJFt9t582oq ifIAmjYvTGIPwCXa8eQWc0OGrSK3cVRBD3frNhdIp/sbu+n5v1DVHqxwNdP6iPgmee5Ue1iCy4dGP 1rAVC3VxB7U7qtPPOyms5ceIDD2CdgufKx/jbHUGfQGjwNcecUo2hmP2QCKv5VcFC5i3kwWauM+sh g5aeYJYg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sh7jq-0000000Ctm8-1itm; Thu, 22 Aug 2024 13:20:30 +0000 Received: from mgamail.intel.com ([198.175.65.15]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sh7j6-0000000CteA-2ZL2; Thu, 22 Aug 2024 13:19:46 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1724332784; x=1755868784; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=AOwS0wzy6B8Bvq3MTZmnJ0ymFayaCPe5P2yYx0ql3J8=; b=H+vpwglVWgoC/avrB9DxIKxx/gLjCi1f26Jth7Tn6TVSim397GhaBmmX vt3pFT/TRuPf3lJQxu9MUWmLxMHFmewQJQ9OFLSkxxQV+hkcfOXuLBdl4 RPfakzSMcf1MZoA6KFjGZUPf39O8FAzrN4+zeZc3XOJ1HYCFtxXkPmcUc Bml/vLniXieAhzffi8Hk6f/7pxvcHA3lCuQ24mQj5EeMrMQnF4HtvMgtB scy+5KKqT5EmfjQe3QJ5rr9YHoKCU49kquLLLbA/JmxIPhUipFgstrmum eXw1gnr7DYbQ6nwvWINd6bZgz9eUPxRBmRC0EUsXffvor04mCVnOCoLZU Q==; X-CSE-ConnectionGUID: dO/pszL2SkuRM/YLeM1IZA== X-CSE-MsgGUID: fNg11h4lSySXNJVJScGzUw== X-IronPort-AV: E=McAfee;i="6700,10204,11172"; a="26495210" X-IronPort-AV: E=Sophos;i="6.10,167,1719903600"; d="scan'208";a="26495210" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Aug 2024 06:19:43 -0700 X-CSE-ConnectionGUID: aZqIIPrXQmaC3bF8xGIB7w== X-CSE-MsgGUID: cjWQAwxoQza2rxDC3PVRCw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,167,1719903600"; d="scan'208";a="61110275" Received: from smile.fi.intel.com ([10.237.72.54]) by fmviesa006.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Aug 2024 06:19:35 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.98) (envelope-from ) id 1sh7it-00000000Sdx-13zx; Thu, 22 Aug 2024 16:19:31 +0300 Date: Thu, 22 Aug 2024 16:19:31 +0300 From: Andy Shevchenko To: Lei Liu Subject: Re: [PATCH 5/8] tty: mps2-uart: Use devm_clk_get_enabled() helpers Message-ID: References: <20240822033924.32397-1-liulei.rjpt@vivo.com> <20240822033924.32397-6-liulei.rjpt@vivo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240822033924.32397-6-liulei.rjpt@vivo.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240822_061944_837996_12AB8666 X-CRM114-Status: GOOD ( 13.58 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexandre Belloni , Valentin Caron , Geert Uytterhoeven , Lorenzo Pieralisi , Liviu Dudau , Alexandre Torgue , Claudiu Beznea , Paul Cercueil , Thierry Reding , Manivannan Sadhasivam , Jiri Slaby , linux-stm32@st-md-mailman.stormreply.com, opensource.kernel@vivo.com, Kunihiko Hayashi , Jonathan Hunter , linux-arm-kernel@lists.infradead.org, linux-serial@vger.kernel.org, Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= , linux-mips@vger.kernel.org, Patrice Chotard , John Ogness , linux-kernel@vger.kernel.org, linux-actions@lists.infradead.org, Amelie Delaunay , linux-tegra@vger.kernel.org, Thomas Gleixner , Richard Genoud , Sebastian Andrzej Siewior , AngeloGioacchino Del Regno , Greg Kroah-Hartman , Lino Sanfilippo , Masami Hiramatsu , Maxime Coquelin , Sudeep Holla , Jeff Johnson , Andreas =?iso-8859-1?Q?F=E4rber?= Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Aug 22, 2024 at 11:39:09AM +0800, Lei Liu wrote: > The devm_clk_get_enabled() helpers: > - call devm_clk_get() > - call clk_prepare_enable() and register what is needed in order to > call clk_disable_unprepare() when needed, as a managed resource. > > This simplifies the code and avoids calls to clk_disable_unprepare(). ... > - mps_port->clk = devm_clk_get(&pdev->dev, NULL); > + mps_port->clk = devm_clk_get_enabled(&pdev->dev, NULL); > if (IS_ERR(mps_port->clk)) > return PTR_ERR(mps_port->clk); > > - ret = clk_prepare_enable(mps_port->clk); > - if (ret) > - return ret; > - > mps_port->port.uartclk = clk_get_rate(mps_port->clk); > > - clk_disable_unprepare(mps_port->clk); Your change is not equivalent. In case this clock is shared this may lead to run-time issues. Hence I don't think this patch is needed in this case. Instead, you may add a comment on top of devm_clk_get() to explain that we only need it be enabled to get clock rate in the probe. -- With Best Regards, Andy Shevchenko