From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3F6E226AC1; Thu, 22 Aug 2024 13:19:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.15 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724332785; cv=none; b=WiuDbwKArMOC9LILxOpAhZPnJ/gxlCJekwEQlgcgV5nOhs7mULyAr50l217qzQFB+PyFdg7IMoBvAe8vTSY3fXpRHrZhuF4qAywKXaGGmfvd6X1t8EbwFEBP0pezBmiGqX0bC+kHiXPiK47mxE1wL4697KC/Qrs5vQmSY6WyqZg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724332785; c=relaxed/simple; bh=AOwS0wzy6B8Bvq3MTZmnJ0ymFayaCPe5P2yYx0ql3J8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=c7FI/7OZbtQQ9hG3GddvEDM9XZ6gPDaObmF5fRf6Fy3ylbyJHG6TL9Lv1cwT9URM2udGKKwgpcY6QZnvkx4cn/AEc+byhG6LiXvoXI2WLdcv84C4Td9f+pRciLCD5KFcco0eCB6J0aP4LqzOwBRfgsm3l+qJs2Cx8dBYrKv4q+U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=H+vpwglV; arc=none smtp.client-ip=198.175.65.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="H+vpwglV" 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: xy4MgfQhSJOnSdcmQeJwWQ== X-CSE-MsgGUID: GC5IktyIQJm5SE03JqkdUA== X-IronPort-AV: E=McAfee;i="6700,10204,11172"; a="26495225" X-IronPort-AV: E=Sophos;i="6.10,167,1719903600"; d="scan'208";a="26495225" 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 Cc: Paul Cercueil , Greg Kroah-Hartman , Jiri Slaby , Thierry Reding , Jonathan Hunter , Kunihiko Hayashi , Masami Hiramatsu , Richard Genoud , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Liviu Dudau , Sudeep Holla , Lorenzo Pieralisi , Andreas =?iso-8859-1?Q?F=E4rber?= , Manivannan Sadhasivam , Patrice Chotard , Maxime Coquelin , Alexandre Torgue , AngeloGioacchino Del Regno , Geert Uytterhoeven , Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= , John Ogness , Thomas Gleixner , Sebastian Andrzej Siewior , Jeff Johnson , Valentin Caron , Lino Sanfilippo , Amelie Delaunay , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-actions@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, opensource.kernel@vivo.com 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> Precedence: bulk X-Mailing-List: linux-tegra@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 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