Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp85816lqo; Thu, 9 May 2024 13:27:05 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVehcdFsa09Jk+DSr32olnDMQd8f/eDXbIoBw8XmYalQUSwYys0p6a/EjwzCdMhoMhmSbjTZfCJPD/f+tca5KF9AlQihbS8JtdTxQY4Yg== X-Google-Smtp-Source: AGHT+IG5c7ZG6YCTMxvWyWUCMeKJdQO0PYsjFaMBJAh3OMa5L1T5NP98kFMgW2iO4pczDZHr8wme X-Received: by 2002:a17:907:20a2:b0:a59:efea:caba with SMTP id a640c23a62f3a-a5a2d65ed0bmr40276866b.51.1715286425627; Thu, 09 May 2024 13:27:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715286425; cv=pass; d=google.com; s=arc-20160816; b=c7MNE+jDATpuNW9aIQNRsVOe39VvqE4NbbLJEEQbgsnIzqJmOAtx5xQ4UCxjcz3s6r /7Ogaj1eCkEtOEGjcbULOb+rsZMtfYkA6qFibuz3PusIJeb6AMKn37O4TwLB4s3Fkzp1 263ePhLpvZKXvFvIc4F3613fLp7snhkMlsVk1iM6MEXpKi4Mgfn4emYfCE0sr+945oeh xlS2H457DUnZyRxte1tgP9Vkslbh6x17uR5FIPAFb3r8rofQJv6kWjl/BSWHNBij3Xph 71ZZjoPmbAx0Olyjttsiq4h4/7p7YhOnc/SPrKh7D0NnilJePt7ujBssNOgSlyLulZQi rqEA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=qX1DtiA+PUQHRn3nGRgzieMrVDQkAdDkg4WRPoC1ywM=; fh=DsiZjbPnF5b9qFFPIz4gizqHjjcLTuhQc+5CdOdwHGo=; b=yALUNYuAhGv6hjuv1fJh6dTkIloGyUmO9EuMcM+zGwRcNs2vB+4Z8U3lztYJh3Z98W /4LAbzE4XaCLgjAk5WLrDYl9OIwUSGty54OzGuE26XCFglpr5/pmR9G3lqqEI2B35afQ PEY5LAOvTZ6h4Rt51VFXZjUg3XFoBIuGrZbHSZLVHdrvrC/1+PFBK8IuWRQ0cJP27RLd 2Fn6HG1X4DNHx6wCH19gWOdf930Vk6OwXoe3ZHiP2Gx/s162WQ6Sz4yqfSR7N9zBOKSJ BmY8PFPsK3eXBmlqGVJnK0mWAFWWXxOrYm26D7Ngd38+sXU3tRHuLR/ahHx5dt4lmKwT d2Uw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=gy43XoG5; arc=pass (i=1 spf=pass spfdomain=wanadoo.fr dkim=pass dkdomain=wanadoo.fr dmarc=pass fromdomain=wanadoo.fr); spf=pass (google.com: domain of linux-kernel+bounces-174918-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-174918-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=wanadoo.fr Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a5a17ba3c4esi115304666b.609.2024.05.09.13.27.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 May 2024 13:27:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-174918-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=gy43XoG5; arc=pass (i=1 spf=pass spfdomain=wanadoo.fr dkim=pass dkdomain=wanadoo.fr dmarc=pass fromdomain=wanadoo.fr); spf=pass (google.com: domain of linux-kernel+bounces-174918-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-174918-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=wanadoo.fr Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id A2BBA1F21201 for ; Thu, 9 May 2024 20:27:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5042A80039; Thu, 9 May 2024 20:05:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b="gy43XoG5" Received: from smtp.smtpout.orange.fr (smtp-17.smtpout.orange.fr [80.12.242.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8ADDA8405C; Thu, 9 May 2024 20:05:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.12.242.17 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715285111; cv=none; b=jKY4Mfg0eaLrJr/WrdVgdlgAk6pRArPNGl8cBMO4unQxT+l3Jq+LBgfYbwpfZETRF0KWqt+Lr3KyxP3CXBaV3o4HvUB9YRsS7ADJKiG7XMJigiR67yLjZx73L++GIY6z0HZ022yBBRpZMAzLZuKHJTdREvpDWNriRE8zVdOyiP8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715285111; c=relaxed/simple; bh=+OQRrox4NiFSzWCAahZ6m6z1qcTCIJu3cMe6d9XV/4c=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=a1qNLMnzRrY03Dd6c/bMRAYrn8KQuBU9jLkY58PBaL4VFeM4iQJo+8Wme15Yh68uZp9oZYKH5UizblIIi89ucUkz3Hn9yMY7fE2PJ4TVUkwz/Rc6kTV47M9wgnwGp7qNn/YKR92/Di/YClmPnXP0CTxTJSXOv/1eD+Bpjm5rZTs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wanadoo.fr; spf=pass smtp.mailfrom=wanadoo.fr; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b=gy43XoG5; arc=none smtp.client-ip=80.12.242.17 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wanadoo.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wanadoo.fr Received: from [192.168.1.37] ([86.243.17.157]) by smtp.orange.fr with ESMTPA id 5A0hsrFbhk6QC5A0hsoqMR; Thu, 09 May 2024 22:05:01 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1715285101; bh=qX1DtiA+PUQHRn3nGRgzieMrVDQkAdDkg4WRPoC1ywM=; h=Message-ID:Date:MIME-Version:Subject:To:From; b=gy43XoG56J30hlSWRVxCtOVjO+dv2aixkqyHA8acv4TEvVWK2o7y8K7yQn869TRC+ uC4GAeHtsDzUCkvNxURGSSEg3oaBojbjYEsg46lQm7Iho87LQ7iNRsKt/8/Ylpu2pn 3p1auesTJw3otin1+94vVd59NLW5gaEaM5uRjCIqxQKxn9dPDpNI25F6+tFmfv7bP9 9/KzmUe7fXLSa535HO+aKf+57bPecDA6C1SSkXsvmAyAlfSHUWukgcj9EdcPdq1fuu MYjaBoi/hE3i5RVyNPoyz+U2JtPWPk0SZZDMyaON/10cV4RqQns3REKpmsiMYpne1I UiNcdFX3zuWqg== X-ME-Helo: [192.168.1.37] X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Thu, 09 May 2024 22:05:01 +0200 X-ME-IP: 86.243.17.157 Message-ID: Date: Thu, 9 May 2024 22:04:57 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4] PM / devfreq: exynos: Use Use devm_clk_get_enabled() helpers To: Anand Moon , Chanwoo Choi , MyungJoo Ham , Kyungmin Park , Krzysztof Kozlowski , Alim Akhtar Cc: linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <20240509064754.10082-1-linux.amoon@gmail.com> Content-Language: en-MW From: Christophe JAILLET In-Reply-To: <20240509064754.10082-1-linux.amoon@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Le 09/05/2024 à 08:47, Anand Moon a écrit : > 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 the calls to clk_disable_unprepare(). > > While at it, use dev_err_probe consistently, and use its return value > to return the error code. > > Signed-off-by: Anand Moon > --- > V4 - wrap up the error messagee within 80 char > v3 - No change > v2 - No change > --- > drivers/devfreq/exynos-bus.c | 22 +++++----------------- > 1 file changed, 5 insertions(+), 17 deletions(-) > > diff --git a/drivers/devfreq/exynos-bus.c b/drivers/devfreq/exynos-bus.c > index 00118580905a..7d06c476d8e9 100644 > --- a/drivers/devfreq/exynos-bus.c > +++ b/drivers/devfreq/exynos-bus.c > @@ -160,7 +160,6 @@ static void exynos_bus_exit(struct device *dev) > platform_device_unregister(bus->icc_pdev); > > dev_pm_opp_of_remove_table(dev); > - clk_disable_unprepare(bus->clk); > dev_pm_opp_put_regulators(bus->opp_token); > } > > @@ -171,7 +170,6 @@ static void exynos_bus_passive_exit(struct device *dev) > platform_device_unregister(bus->icc_pdev); > > dev_pm_opp_of_remove_table(dev); > - clk_disable_unprepare(bus->clk); > } > > static int exynos_bus_parent_parse_of(struct device_node *np, > @@ -247,23 +245,16 @@ static int exynos_bus_parse_of(struct device_node *np, > int ret; > > /* Get the clock to provide each bus with source clock */ > - bus->clk = devm_clk_get(dev, "bus"); > - if (IS_ERR(bus->clk)) { > - dev_err(dev, "failed to get bus clock\n"); > - return PTR_ERR(bus->clk); > - } > - > - ret = clk_prepare_enable(bus->clk); > - if (ret < 0) { > - dev_err(dev, "failed to get enable clock\n"); > - return ret; > - } > + bus->clk = devm_clk_get_enabled(dev, "bus"); > + if (IS_ERR(bus->clk)) > + return dev_err_probe(dev, PTR_ERR(bus->clk), > + "failed to get bus clock\n"); > > /* Get the freq and voltage from OPP table to scale the bus freq */ > ret = dev_pm_opp_of_add_table(dev); > if (ret < 0) { > dev_err(dev, "failed to get OPP table\n"); > - goto err_clk; > + return ret; > } > > rate = clk_get_rate(bus->clk); > @@ -281,8 +272,6 @@ static int exynos_bus_parse_of(struct device_node *np, > > err_opp: > dev_pm_opp_of_remove_table(dev); > -err_clk: > - clk_disable_unprepare(bus->clk); > > return ret; > } > @@ -453,7 +442,6 @@ static int exynos_bus_probe(struct platform_device *pdev) > > err: > dev_pm_opp_of_remove_table(dev); > - clk_disable_unprepare(bus->clk); > err_reg: > dev_pm_opp_put_regulators(bus->opp_token); > Hi, if the patch is correct, I think that clk in struct exynos_bus can be easily be removed as well. CJ