All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Osipenko <digetx@gmail.com>
To: Chanwoo Choi <cw00.choi@samsung.com>,
	Dan Carpenter <dan.carpenter@oracle.com>
Cc: MyungJoo Ham <myungjoo.ham@samsung.com>,
	Kyungmin Park <kyungmin.park@samsung.com>,
	Thierry Reding <thierry.reding@gmail.com>,
	Jonathan Hunter <jonathanh@nvidia.com>,
	linux-pm@vger.kernel.org, linux-tegra@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] PM / devfreq: tegra30: disable clock on error in probe
Date: Tue, 15 Sep 2020 20:01:12 +0300	[thread overview]
Message-ID: <5aac4d59-5e06-25a6-3de1-6a5a586b9e34@gmail.com> (raw)
In-Reply-To: <2573cd77-1175-d194-7bfc-24d28b276846@samsung.com>

15.09.2020 05:13, Chanwoo Choi пишет:
> On 9/15/20 11:00 AM, Chanwoo Choi wrote:
>> Hi Dmitry,
>>
>> On 9/14/20 10:56 PM, Dmitry Osipenko wrote:
>>> 14.09.2020 10:09, Chanwoo Choi пишет:
>>>> Hi,
>>>>
>>>> On 9/8/20 4:25 PM, Dan Carpenter wrote:
>>>>> This error path needs to call clk_disable_unprepare().
>>>>>
>>>>> Fixes: 7296443b900e ("PM / devfreq: tegra30: Handle possible round-rate error")
>>>>> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>>>>> ---
>>>>> ---
>>>>>  drivers/devfreq/tegra30-devfreq.c | 4 +++-
>>>>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/drivers/devfreq/tegra30-devfreq.c b/drivers/devfreq/tegra30-devfreq.c
>>>>> index e94a27804c20..dedd39de7367 100644
>>>>> --- a/drivers/devfreq/tegra30-devfreq.c
>>>>> +++ b/drivers/devfreq/tegra30-devfreq.c
>>>>> @@ -836,7 +836,8 @@ static int tegra_devfreq_probe(struct platform_device *pdev)
>>>>>  	rate = clk_round_rate(tegra->emc_clock, ULONG_MAX);
>>>>>  	if (rate < 0) {
>>>>>  		dev_err(&pdev->dev, "Failed to round clock rate: %ld\n", rate);
>>>>> -		return rate;
>>>>> +		err = rate;
>>>>> +		goto disable_clk;
>>>>>  	}
>>>>>  
>>>>>  	tegra->max_freq = rate / KHZ;
>>>>> @@ -897,6 +898,7 @@ static int tegra_devfreq_probe(struct platform_device *pdev)
>>>>>  	dev_pm_opp_remove_all_dynamic(&pdev->dev);
>>>>>  
>>>>>  	reset_control_reset(tegra->reset);
>>>>> +disable_clk:
>>>>>  	clk_disable_unprepare(tegra->clock);
>>>>
>>>> Is it doesn't need to reset with reset_contrl_reset()?
>>>
>>> Hello, Chanwoo!
>>>
>>> It's reset just before the clk_round_rate() invocation, hence there
>>> shouldn't be a need to reset it second time.
>>
>> Do you mean that reset is deasserted automatically
>> when invoke clk_round_rate() on tegra?

I only mean that the tegra30-devfreq driver deasserts the reset before
the clk_round_rate():

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/devfreq/tegra30-devfreq.c?h=v5.9-rc5#n834

>> If tree, I think that 'reset_control_reset(tegra->reset)' invocation
> 
> I'm sorry for my typo. s/tree/true.
> 
>> is not needed on 'remove_opp:' goto. Because already reset deassertion
>> is invoked by clk_round_rate(), it seems that doesn't need to invoke
>> anymore during exception case.
>>
>> Actually, it is not clear in my case.

The reset_control_reset() in the error path of the driver probe function
is placed that way to make the tear-down order match the driver removal
order. Perhaps the reset could be moved before the remove_opp, but this
change won't make any real difference, hence it already should be good
as-is.

WARNING: multiple messages have this Message-ID (diff)
From: Dmitry Osipenko <digetx@gmail.com>
To: Chanwoo Choi <cw00.choi@samsung.com>,
	Dan Carpenter <dan.carpenter@oracle.com>
Cc: MyungJoo Ham <myungjoo.ham@samsung.com>,
	Kyungmin Park <kyungmin.park@samsung.com>,
	Thierry Reding <thierry.reding@gmail.com>,
	Jonathan Hunter <jonathanh@nvidia.com>,
	linux-pm@vger.kernel.org, linux-tegra@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] PM / devfreq: tegra30: disable clock on error in probe
Date: Tue, 15 Sep 2020 17:01:12 +0000	[thread overview]
Message-ID: <5aac4d59-5e06-25a6-3de1-6a5a586b9e34@gmail.com> (raw)
In-Reply-To: <2573cd77-1175-d194-7bfc-24d28b276846@samsung.com>

15.09.2020 05:13, Chanwoo Choi пишет:
> On 9/15/20 11:00 AM, Chanwoo Choi wrote:
>> Hi Dmitry,
>>
>> On 9/14/20 10:56 PM, Dmitry Osipenko wrote:
>>> 14.09.2020 10:09, Chanwoo Choi пишет:
>>>> Hi,
>>>>
>>>> On 9/8/20 4:25 PM, Dan Carpenter wrote:
>>>>> This error path needs to call clk_disable_unprepare().
>>>>>
>>>>> Fixes: 7296443b900e ("PM / devfreq: tegra30: Handle possible round-rate error")
>>>>> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>>>>> ---
>>>>> ---
>>>>>  drivers/devfreq/tegra30-devfreq.c | 4 +++-
>>>>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/drivers/devfreq/tegra30-devfreq.c b/drivers/devfreq/tegra30-devfreq.c
>>>>> index e94a27804c20..dedd39de7367 100644
>>>>> --- a/drivers/devfreq/tegra30-devfreq.c
>>>>> +++ b/drivers/devfreq/tegra30-devfreq.c
>>>>> @@ -836,7 +836,8 @@ static int tegra_devfreq_probe(struct platform_device *pdev)
>>>>>  	rate = clk_round_rate(tegra->emc_clock, ULONG_MAX);
>>>>>  	if (rate < 0) {
>>>>>  		dev_err(&pdev->dev, "Failed to round clock rate: %ld\n", rate);
>>>>> -		return rate;
>>>>> +		err = rate;
>>>>> +		goto disable_clk;
>>>>>  	}
>>>>>  
>>>>>  	tegra->max_freq = rate / KHZ;
>>>>> @@ -897,6 +898,7 @@ static int tegra_devfreq_probe(struct platform_device *pdev)
>>>>>  	dev_pm_opp_remove_all_dynamic(&pdev->dev);
>>>>>  
>>>>>  	reset_control_reset(tegra->reset);
>>>>> +disable_clk:
>>>>>  	clk_disable_unprepare(tegra->clock);
>>>>
>>>> Is it doesn't need to reset with reset_contrl_reset()?
>>>
>>> Hello, Chanwoo!
>>>
>>> It's reset just before the clk_round_rate() invocation, hence there
>>> shouldn't be a need to reset it second time.
>>
>> Do you mean that reset is deasserted automatically
>> when invoke clk_round_rate() on tegra?

I only mean that the tegra30-devfreq driver deasserts the reset before
the clk_round_rate():

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/devfreq/tegra30-devfreq.c?h=v5.9-rc5#n834

>> If tree, I think that 'reset_control_reset(tegra->reset)' invocation
> 
> I'm sorry for my typo. s/tree/true.
> 
>> is not needed on 'remove_opp:' goto. Because already reset deassertion
>> is invoked by clk_round_rate(), it seems that doesn't need to invoke
>> anymore during exception case.
>>
>> Actually, it is not clear in my case.

The reset_control_reset() in the error path of the driver probe function
is placed that way to make the tear-down order match the driver removal
order. Perhaps the reset could be moved before the remove_opp, but this
change won't make any real difference, hence it already should be good
as-is.

  reply	other threads:[~2020-09-15 17:25 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20200908072627epcas1p41f2c8c2730d42bd8935a40b0ab8122f7@epcas1p4.samsung.com>
2020-09-08  7:25 ` [PATCH] PM / devfreq: tegra30: disable clock on error in probe Dan Carpenter
2020-09-08  7:25   ` Dan Carpenter
2020-09-08 13:02   ` Dmitry Osipenko
2020-09-08 13:02     ` Dmitry Osipenko
2020-09-14  6:57   ` Chanwoo Choi
2020-09-14  7:09     ` Chanwoo Choi
2020-09-14 13:56     ` Dmitry Osipenko
2020-09-14 13:56       ` Dmitry Osipenko
2020-09-14 14:17       ` Dan Carpenter
2020-09-14 14:17         ` Dan Carpenter
2020-09-14 14:28         ` Dmitry Osipenko
2020-09-14 14:28           ` Dmitry Osipenko
2020-09-15  1:48       ` Chanwoo Choi
2020-09-15  2:00         ` Chanwoo Choi
2020-09-15  2:13         ` Chanwoo Choi
2020-09-15  2:13           ` Chanwoo Choi
2020-09-15 17:01           ` Dmitry Osipenko [this message]
2020-09-15 17:01             ` Dmitry Osipenko
2020-09-16  2:38             ` Chanwoo Choi
2020-09-16  2:38               ` Chanwoo Choi
2020-09-16 19:07               ` Dmitry Osipenko
2020-09-16 19:07                 ` Dmitry Osipenko
2020-09-17  2:32                 ` Chanwoo Choi
2020-09-17  2:32                   ` Chanwoo Choi
2020-09-17 21:14                   ` Dmitry Osipenko
2020-09-17 21:14                     ` Dmitry Osipenko
2020-09-18  9:23                     ` Chanwoo Choi
2020-09-18  9:23                       ` Chanwoo Choi
2020-09-20 21:37                       ` Dmitry Osipenko
2020-09-20 21:37                         ` Dmitry Osipenko
2020-09-23  0:23                         ` Dmitry Osipenko
2020-09-23  0:23                           ` Dmitry Osipenko
2020-09-23  0:42                           ` Chanwoo Choi
2020-09-23  0:42                             ` Chanwoo Choi
2020-09-14 13:57     ` Dan Carpenter
2020-09-14 13:57       ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5aac4d59-5e06-25a6-3de1-6a5a586b9e34@gmail.com \
    --to=digetx@gmail.com \
    --cc=cw00.choi@samsung.com \
    --cc=dan.carpenter@oracle.com \
    --cc=jonathanh@nvidia.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=myungjoo.ham@samsung.com \
    --cc=thierry.reding@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.