Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751216AbdHXD65 (ORCPT ); Wed, 23 Aug 2017 23:58:57 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:58100 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751019AbdHXD6z (ORCPT ); Wed, 23 Aug 2017 23:58:55 -0400 X-AuditID: b6c32a38-f799e6d000004f48-55-599e4efcc4aa MIME-version: 1.0 Content-transfer-encoding: 8BIT Content-type: text/plain; charset="utf-8" Message-id: <599E4EFF.6070808@samsung.com> Date: Thu, 24 Aug 2017 12:58:55 +0900 From: Chanwoo Choi Organization: Samsung Electronics User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 To: myungjoo.ham@samsung.com, kyungmin.park@samsung.com Cc: rafael.j.wysocki@intel.com, chanwoo@kernel.org, inki.dae@samsung.com, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Subject: Re: [PATCH 12/12] PM / devfreq: Add opp_notifier_cb() function pointer to support OPP notifier In-reply-to: <1503538979-22693-13-git-send-email-cw00.choi@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrPKsWRmVeSWpSXmKPExsWy7bCmge4fv3mRBo+/mltMvHGFxWLS/Qks Fmeb3rBbXN41h83ic+8RRovbjSvYLB6veMvuwO6xeM9LJo9NqzrZPPq2rGL0+LxJLoAlKtUm IzUxJbVIITUvOT8lMy/dVsk7ON453tTMwFDX0NLCXEkhLzE31VbJxSdA1y0zB+gCJYWyxJxS oFBAYnGxkr6dTVF+aUmqQkZ+cYmtUrShoZGeoYG5npGRkZ6JcayVkSlQSUJqxuamnIJfghWX 20waGC/wdTFyckgImEj8Oj2VCcIWk7hwbz1bFyMXh5DADkaJi4s/s0A43xklTjxoAspwgHXc fmkA0iAksIFR4vtrHRCbV0BQ4sfkeywgJcwC8hJHLmWDhJkFNCVefJkENeYeo8TLnt+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kK4dAEj8ypGydSC4tz03GKjAsO8 1HK94sTc4tK8dL3k/NxNjMCg3nZYq28H4/0l8YcYBTgYlXh4LyycGynEmlhWXJl7iFGCg1lJ hHeVx7xIId6UxMqq1KL8+KLSnNTiQ4zSHCxK4ryZfTMihQTSE0tSs1NTC1KLYLJMHJxSDYyT 76Z/ZbNpOsh+PFJ0z/rGe89l5y/K7TPw0C56//fNMc2Nh7N+XPzkV/d029uL0vJRT6bFTn/4 W7r1gN9eieTl1+vse/Zfrmjc/U3torlFiKD8+maxO2w/o5hFTep4lweeL8ifzJ4gMGHTq1l2 En3T1j9s63mZnP/OqObO8X1q82I0H4f92MajxFKckWioxVxUnAgAj0khimYCAAA= X-CMS-MailID: 20170824035852epcas1p40f1bd5579bc72bcbb70b0adddfce07b0 X-Msg-Generator: CA X-Sender-IP: 182.195.42.142 X-Local-Sender: =?UTF-8?B?7LWc7LCs7JqwG1RpemVuIFBsYXRmb3JtIExhYihTL1fshLw=?= =?UTF-8?B?7YSwKRvsgrzshLHsoITsnpAbU2VuaW9yIEVuZ2luZWVy?= X-Global-Sender: =?UTF-8?B?Q2hhbndvbyBDaG9pG1RpemVuIFBsYXRmb3JtIExhYi4bU2Ft?= =?UTF-8?B?c3VuZyBFbGVjdHJvbmljcxtTZW5pb3IgRW5naW5lZXI=?= X-Sender-Code: =?UTF-8?B?QzEwG1RFTEUbQzEwVjgxMTE=?= CMS-TYPE: 101P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20170824014300epcas1p3bf35f95d83b2a2ed36126f918638b8fc X-RootMTR: 20170824014300epcas1p3bf35f95d83b2a2ed36126f918638b8fc References: <1503538979-22693-1-git-send-email-cw00.choi@samsung.com> <1503538979-22693-13-git-send-email-cw00.choi@samsung.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2234 Lines: 64 Dear all, On 2017년 08월 24일 10:42, Chanwoo Choi wrote: > The devfreq uses the OPP interface as a mandatory method > and so the devfreq has to support the OPP notifier in order to > catch the OPP events. So, this patch adds the new opp_notifier_cb() > function pointer in the struct devfreq_dev_profile. The user can > add the their own callback function to receive the OPP events. > > Also, the devfreq provides the default OPP notifeir callback > in order to remake the frequency table when OPP events happen. > - default_opp_notifier_cb() > > After merged the commit 0ec09ac2cebe ("PM / devfreq: Set the > freq_table of devfreq device"), if the freq_table is NULL, > the devfreq_add_device() makes the freq_table by using OPP interface. > In this case, the devfreq should handle the freq_table > when OPP events happen such as OPP_EVENT_REMOVE, OPP_EVENT_ADD. > > When the dev_pm_opp_add/remove() are called, the devfreq core > has to remake the frequency table with the changed OPP information > in the default_opp_notifier_cb(). > > Signed-off-by: Chanwoo Choi > --- > drivers/devfreq/devfreq.c | 46 +++++++++++++++++++++++++++++++++++++++++++++- > include/linux/devfreq.h | 12 ++++++++++++ > 2 files changed, 57 insertions(+), 1 deletion(-) > > diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c > index 7efa867e4aea..d313bed95871 100644 > --- a/drivers/devfreq/devfreq.c > +++ b/drivers/devfreq/devfreq.c > @@ -163,6 +163,39 @@ static int set_freq_table(struct devfreq *devfreq) > return 0; > } > > +static int default_opp_notifier_cb(struct notifier_block *nb, > + unsigned long opp_event, void *opp) > +{ > + struct devfreq *devfreq = container_of(nb, struct devfreq, nb); > + struct devfreq_dev_profile *profile = devfreq->profile; > + struct device *dev = devfreq->dev.parent; > + int ret = 0; > + > + mutex_lock(&devfreq->lock); > + > + switch (opp_event) { > + case OPP_EVENT_ADD: > + case OPP_EVENT_REMOVE: > + /* Free the frequency table */ > + profile->max_state = 0; > + kfree(dev, profile->freq_table); It is my mistake when changing from devm_kfree to kfree. I'll fix on next patchset. [ditto] -- Best Regards, Chanwoo Choi Samsung Electronics