diff mbox

[2/2] PM / devfreq: exynos-nocp: Remove redundant code to reset load_count/total_count

Message ID 1474361863-2319-2-git-send-email-axel.lin@ingics.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Axel Lin Sept. 20, 2016, 8:57 a.m. UTC
This is done by devfreq_event_get_event() so remove the redundant code in
exynos_nocp_get_event().

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/devfreq/event/exynos-nocp.c | 3 ---
 1 file changed, 3 deletions(-)

Comments

Chanwoo Choi Sept. 20, 2016, 9:34 a.m. UTC | #1
Hi,

On 2016년 09월 20일 17:57, Axel Lin wrote:
> This is done by devfreq_event_get_event() so remove the redundant code in
> exynos_nocp_get_event().
> 
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> ---
>  drivers/devfreq/event/exynos-nocp.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/drivers/devfreq/event/exynos-nocp.c b/drivers/devfreq/event/exynos-nocp.c
> index a584140..49e712a 100644
> --- a/drivers/devfreq/event/exynos-nocp.c
> +++ b/drivers/devfreq/event/exynos-nocp.c
> @@ -176,9 +176,6 @@ static int exynos_nocp_get_event(struct devfreq_event_dev *edev,
>  	return 0;
>  
>  out:
> -	edata->load_count = 0;
> -	edata->total_count = 0;
> -
>  	dev_err(nocp->dev, "Failed to read the counter of NoC probe device\n");
>  
>  	return ret;
> 

As you said, devfreq_event_get_event() initializes both load_count and total_count
before calling edev->desc->ops->get_event(). Looks good to me.

Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Axel Lin Sept. 20, 2016, 9:38 a.m. UTC | #2
2016-09-20 17:34 GMT+08:00 Chanwoo Choi <cw00.choi@samsung.com>:
> Hi,
>
> On 2016년 09월 20일 17:57, Axel Lin wrote:
>> This is done by devfreq_event_get_event() so remove the redundant code in
>> exynos_nocp_get_event().
>>
>> Signed-off-by: Axel Lin <axel.lin@ingics.com>
>> ---
>>  drivers/devfreq/event/exynos-nocp.c | 3 ---
>>  1 file changed, 3 deletions(-)
>>
>> diff --git a/drivers/devfreq/event/exynos-nocp.c b/drivers/devfreq/event/exynos-nocp.c
>> index a584140..49e712a 100644
>> --- a/drivers/devfreq/event/exynos-nocp.c
>> +++ b/drivers/devfreq/event/exynos-nocp.c
>> @@ -176,9 +176,6 @@ static int exynos_nocp_get_event(struct devfreq_event_dev *edev,
>>       return 0;
>>
>>  out:
>> -     edata->load_count = 0;
>> -     edata->total_count = 0;
>> -
>>       dev_err(nocp->dev, "Failed to read the counter of NoC probe device\n");
>>
>>       return ret;
>>
>
> As you said, devfreq_event_get_event() initializes both load_count and total_count
> before calling edev->desc->ops->get_event(). Looks good to me.

Actually, the point is if edev->desc->ops->get_event() fails,
the code in devfreq_event_get_event() will reset
edata->total_count and edata->load_count to 0.

Axel
--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Chanwoo Choi Sept. 20, 2016, 9:43 a.m. UTC | #3
On 2016년 09월 20일 18:38, Axel Lin wrote:
> 2016-09-20 17:34 GMT+08:00 Chanwoo Choi <cw00.choi@samsung.com>:
>> Hi,
>>
>> On 2016년 09월 20일 17:57, Axel Lin wrote:
>>> This is done by devfreq_event_get_event() so remove the redundant code in
>>> exynos_nocp_get_event().
>>>
>>> Signed-off-by: Axel Lin <axel.lin@ingics.com>
>>> ---
>>>  drivers/devfreq/event/exynos-nocp.c | 3 ---
>>>  1 file changed, 3 deletions(-)
>>>
>>> diff --git a/drivers/devfreq/event/exynos-nocp.c b/drivers/devfreq/event/exynos-nocp.c
>>> index a584140..49e712a 100644
>>> --- a/drivers/devfreq/event/exynos-nocp.c
>>> +++ b/drivers/devfreq/event/exynos-nocp.c
>>> @@ -176,9 +176,6 @@ static int exynos_nocp_get_event(struct devfreq_event_dev *edev,
>>>       return 0;
>>>
>>>  out:
>>> -     edata->load_count = 0;
>>> -     edata->total_count = 0;
>>> -
>>>       dev_err(nocp->dev, "Failed to read the counter of NoC probe device\n");
>>>
>>>       return ret;
>>>
>>
>> As you said, devfreq_event_get_event() initializes both load_count and total_count
>> before calling edev->desc->ops->get_event(). Looks good to me.
> 
> Actually, the point is if edev->desc->ops->get_event() fails,
> the code in devfreq_event_get_event() will reset
> edata->total_count and edata->load_count to 0.

You're right. devfreq_event_get_event() initializes the data
when before calling edev->desc->ops->get_event() or fail happen.
diff mbox

Patch

diff --git a/drivers/devfreq/event/exynos-nocp.c b/drivers/devfreq/event/exynos-nocp.c
index a584140..49e712a 100644
--- a/drivers/devfreq/event/exynos-nocp.c
+++ b/drivers/devfreq/event/exynos-nocp.c
@@ -176,9 +176,6 @@  static int exynos_nocp_get_event(struct devfreq_event_dev *edev,
 	return 0;
 
 out:
-	edata->load_count = 0;
-	edata->total_count = 0;
-
 	dev_err(nocp->dev, "Failed to read the counter of NoC probe device\n");
 
 	return ret;