From: Chanwoo Choi <cw00.choi@samsung.com>
To: Lukasz Luba <l.luba@partner.samsung.com>,
linux-arm-kernel@lists.infradead.org,
linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-pm@vger.kernel.org, devicetree@vger.kernel.org
Cc: tjakobi@math.uni-bielefeld.de, myungjoo.ham@samsung.com,
kyungmin.park@samsung.com, rjw@rjwysocki.net,
len.brown@intel.com, pavel@ucw.cz, gregkh@linuxfoundation.org,
keescook@chromium.org, anton@enomsg.org, ccross@android.com,
tony.luck@intel.com, robh+dt@kernel.org, mark.rutland@arm.com,
kgene@kernel.org, krzk@kernel.org, m.szyprowski@samsung.com,
b.zolnierkie@samsung.com
Subject: Re: [PATCH v2 1/5] devfreq: refactor set_target frequency function
Date: Tue, 04 Dec 2018 14:43:10 +0900 [thread overview]
Message-ID: <5C0613EE.9000208@samsung.com> (raw)
In-Reply-To: <5C060511.8020802@samsung.com>
Hi,
On 2018년 12월 04일 13:39, Chanwoo Choi wrote:
> Hi Lukasz,
>
> On 2018년 12월 03일 23:31, Lukasz Luba wrote:
>> The refactoring is needed for the new client in devfreq: suspend.
>> To avoid code duplication, move it to the new local function
>> devfreq_set_target.
>>
>> The patch is based on earlier work by Tobias Jakobi.
>
> As I already commented, Please remove it. You already mentioned it on cover-letter.
> If you want to contain the contribution history of Tobias, you might better
> to add 'Signed-off-by' or others.
If you will fix it, feel free to add my tag:
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
>
>>
>> Suggested-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
>> Suggested-by: Chanwoo Choi <cw00.choi@samsung.com>
>> Signed-off-by: Lukasz Luba <l.luba@partner.samsung.com>
>> ---
>> drivers/devfreq/devfreq.c | 62 +++++++++++++++++++++++++++--------------------
>> 1 file changed, 36 insertions(+), 26 deletions(-)
>>
>> diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
>> index 1414130..a9fd61b 100644
>> --- a/drivers/devfreq/devfreq.c
>> +++ b/drivers/devfreq/devfreq.c
>> @@ -285,6 +285,40 @@ static int devfreq_notify_transition(struct devfreq *devfreq,
>> return 0;
>> }
>>
>> +static int devfreq_set_target(struct devfreq *devfreq, unsigned long new_freq,
>> + u32 flags)
>> +{
>> + struct devfreq_freqs freqs;
>> + unsigned long cur_freq;
>> + int err = 0;
>> +
>> + if (devfreq->profile->get_cur_freq)
>> + devfreq->profile->get_cur_freq(devfreq->dev.parent, &cur_freq);
>> + else
>> + cur_freq = devfreq->previous_freq;
>> +
>> + freqs.old = cur_freq;
>> + freqs.new = new_freq;
>> + devfreq_notify_transition(devfreq, &freqs, DEVFREQ_PRECHANGE);
>> +
>> + err = devfreq->profile->target(devfreq->dev.parent, &new_freq, flags);
>> + if (err) {
>> + freqs.new = cur_freq;
>> + devfreq_notify_transition(devfreq, &freqs, DEVFREQ_POSTCHANGE);
>> + return err;
>> + }
>> +
>> + freqs.new = new_freq;
>> + devfreq_notify_transition(devfreq, &freqs, DEVFREQ_POSTCHANGE);
>> +
>> + if (devfreq_update_status(devfreq, new_freq))
>> + dev_err(&devfreq->dev,
>> + "Couldn't update frequency transition information.\n");
>> +
>> + devfreq->previous_freq = new_freq;
>> + return err;
>> +}
>> +
>> /* Load monitoring helper functions for governors use */
>>
>> /**
>> @@ -296,8 +330,7 @@ static int devfreq_notify_transition(struct devfreq *devfreq,
>> */
>> int update_devfreq(struct devfreq *devfreq)
>> {
>> - struct devfreq_freqs freqs;
>> - unsigned long freq, cur_freq, min_freq, max_freq;
>> + unsigned long freq, min_freq, max_freq;
>> int err = 0;
>> u32 flags = 0;
>>
>> @@ -333,31 +366,8 @@ int update_devfreq(struct devfreq *devfreq)
>> flags |= DEVFREQ_FLAG_LEAST_UPPER_BOUND; /* Use LUB */
>> }
>>
>> - if (devfreq->profile->get_cur_freq)
>> - devfreq->profile->get_cur_freq(devfreq->dev.parent, &cur_freq);
>> - else
>> - cur_freq = devfreq->previous_freq;
>> -
>> - freqs.old = cur_freq;
>> - freqs.new = freq;
>> - devfreq_notify_transition(devfreq, &freqs, DEVFREQ_PRECHANGE);
>> + return devfreq_set_target(devfreq, freq, flags);
>>
>> - err = devfreq->profile->target(devfreq->dev.parent, &freq, flags);
>> - if (err) {
>> - freqs.new = cur_freq;
>> - devfreq_notify_transition(devfreq, &freqs, DEVFREQ_POSTCHANGE);
>> - return err;
>> - }
>> -
>> - freqs.new = freq;
>> - devfreq_notify_transition(devfreq, &freqs, DEVFREQ_POSTCHANGE);
>> -
>> - if (devfreq_update_status(devfreq, freq))
>> - dev_err(&devfreq->dev,
>> - "Couldn't update frequency transition information.\n");
>> -
>> - devfreq->previous_freq = freq;
>> - return err;
>> }
>> EXPORT_SYMBOL(update_devfreq);
>>
>>
>
>
--
Best Regards,
Chanwoo Choi
Samsung Electronics
next prev parent reply other threads:[~2018-12-04 5:43 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20181203143127eucas1p2604fc066139a32fdffe996212b42b40e@eucas1p2.samsung.com>
2018-12-03 14:31 ` [PATCH v2 0/5] devfreq: handle suspend/resume Lukasz Luba
[not found] ` <CGME20181203143129eucas1p2955b6becc60ee57110cbc52f6e4f60c5@eucas1p2.samsung.com>
2018-12-03 14:31 ` [PATCH v2 1/5] devfreq: refactor set_target frequency function Lukasz Luba
2018-12-04 4:39 ` Chanwoo Choi
2018-12-04 5:43 ` Chanwoo Choi [this message]
2018-12-04 9:36 ` Lukasz Luba
[not found] ` <CGME20181203143131eucas1p217f22ac6d19682a54a57658a06980914@eucas1p2.samsung.com>
2018-12-03 14:31 ` [PATCH v2 2/5] devfreq: add support for suspend/resume of a devfreq device Lukasz Luba
2018-12-04 5:36 ` Chanwoo Choi
2018-12-04 5:43 ` Chanwoo Choi
2018-12-04 6:10 ` Chanwoo Choi
2018-12-04 9:53 ` Lukasz Luba
2018-12-05 0:09 ` Chanwoo Choi
2018-12-05 11:07 ` Lukasz Luba
2018-12-04 9:39 ` Lukasz Luba
2018-12-09 9:00 ` Pavel Machek
[not found] ` <CGME20181203143132eucas1p128c029a7c7461e1127924a08e4a71811@eucas1p1.samsung.com>
2018-12-03 14:31 ` [PATCH v2 3/5] devfreq: add devfreq_suspend/resume() functions Lukasz Luba
2018-12-04 6:19 ` Chanwoo Choi
2018-12-04 9:44 ` Lukasz Luba
[not found] ` <CGME20181203143134eucas1p1edd70b0f4dca115f6f154555d8829427@eucas1p1.samsung.com>
2018-12-03 14:31 ` [PATCH v2 4/5] drivers: power: suspend: call devfreq suspend/resume Lukasz Luba
[not found] ` <CGME20181203143135eucas1p165fe6183ae90de7906f9683cb41ff4c1@eucas1p1.samsung.com>
2018-12-03 14:31 ` [PATCH v2 5/5] arm: dts: exynos4: opp-suspend in DMC and leftbus Lukasz Luba
2018-12-03 17:22 ` Krzysztof Kozlowski
2018-12-03 17:48 ` Lukasz Luba
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=5C0613EE.9000208@samsung.com \
--to=cw00.choi@samsung.com \
--cc=anton@enomsg.org \
--cc=b.zolnierkie@samsung.com \
--cc=ccross@android.com \
--cc=devicetree@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=keescook@chromium.org \
--cc=kgene@kernel.org \
--cc=krzk@kernel.org \
--cc=kyungmin.park@samsung.com \
--cc=l.luba@partner.samsung.com \
--cc=len.brown@intel.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=mark.rutland@arm.com \
--cc=myungjoo.ham@samsung.com \
--cc=pavel@ucw.cz \
--cc=rjw@rjwysocki.net \
--cc=robh+dt@kernel.org \
--cc=tjakobi@math.uni-bielefeld.de \
--cc=tony.luck@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).