Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1528984 > unrolled thread
| Started by | Chanwoo Choi <cw00.choi@samsung.com> |
|---|---|
| First post | 2016-11-24 06:10 +0100 |
| Last post | 2016-11-25 00:40 +0100 |
| Articles | 8 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH 0/6] PM / devfreq: Modify devfreq/devfreq-event for improvement Chanwoo Choi <cw00.choi@samsung.com> - 2016-11-24 06:10 +0100
[PATCH 6/6] PM / devfreq: event: exynos-ppmu: Add the completion log of device registration Chanwoo Choi <cw00.choi@samsung.com> - 2016-11-24 06:10 +0100
[PATCH 2/6] PM / devfreq: Modify the device name as devfreq[X] for sysfs Chanwoo Choi <cw00.choi@samsung.com> - 2016-11-24 06:10 +0100
[PATCH 1/6] PM / devfreq: Fix the checkpatch warnings Chanwoo Choi <cw00.choi@samsung.com> - 2016-11-24 06:10 +0100
Re: [PATCH 1/6] PM / devfreq: Fix the checkpatch warnings Joe Perches <joe@perches.com> - 2016-11-24 11:30 +0100
Re: [PATCH 1/6] PM / devfreq: Fix the checkpatch warnings Chanwoo Choi <cw00.choi@samsung.com> - 2016-11-24 11:50 +0100
Re: [PATCH 1/6] PM / devfreq: Fix the checkpatch warnings Joe Perches <joe@perches.com> - 2016-11-24 12:00 +0100
Re: [PATCH 1/6] PM / devfreq: Fix the checkpatch warnings Chanwoo Choi <cw00.choi@samsung.com> - 2016-11-25 00:40 +0100
| From | Chanwoo Choi <cw00.choi@samsung.com> |
|---|---|
| Date | 2016-11-24 06:10 +0100 |
| Subject | [PATCH 0/6] PM / devfreq: Modify devfreq/devfreq-event for improvement |
| Message-ID | <sGUsh-6pb-3@gated-at.bofh.it> |
This patches modify the devfreq and devfreq-event framework for improving them. But, these patches don't make an impact to operation of devfreq/devfreq-event. Chanwoo Choi (6): PM / devfreq: Fix the checkpatch warnings PM / devfreq: Modify the device name as devfreq[X] for sysfs PM / devfreq: event: Simplify the sysfs name of devfreq-event device PM / devfreq: Remove the duplicate sysfs entry for current frequency PM / devfreq: event: exynos-ppmu: Use the regmap interface to handle the registers PM / devfreq: event: exynos-ppmu: Add the completion log of device registration drivers/devfreq/devfreq-event.c | 2 +- drivers/devfreq/devfreq.c | 25 ++- drivers/devfreq/event/exynos-ppmu.c | 329 ++++++++++++++++++++++++++---------- 3 files changed, 251 insertions(+), 105 deletions(-) -- 1.9.1
[toc] | [next] | [standalone]
| From | Chanwoo Choi <cw00.choi@samsung.com> |
|---|---|
| Date | 2016-11-24 06:10 +0100 |
| Subject | [PATCH 6/6] PM / devfreq: event: exynos-ppmu: Add the completion log of device registration |
| Message-ID | <sGUsi-6pb-25@gated-at.bofh.it> |
| In reply to | #1528984 |
This patch just adds the simple log to show the PPMU device's registration
during the kernel booting.
For example on exynos4412-odroidu3 board as following:
[ 1.845929] exynos-ppmu: new PPMU device registered 106a0000.ppmu_dmc0
[ 1.848997] exynos-ppmu: new PPMU device registered 106b0000.ppmu_dmc1
[ 1.853512] exynos-ppmu: new PPMU device registered 112a0000.ppmu_rightbus
[ 1.860524] exynos-ppmu: new PPMU device registered 116a0000.ppmu_leftbus0
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
---
drivers/devfreq/event/exynos-ppmu.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/devfreq/event/exynos-ppmu.c b/drivers/devfreq/event/exynos-ppmu.c
index fb3706faf5bd..b2696181c929 100644
--- a/drivers/devfreq/event/exynos-ppmu.c
+++ b/drivers/devfreq/event/exynos-ppmu.c
@@ -647,6 +647,9 @@ static int exynos_ppmu_probe(struct platform_device *pdev)
clk_prepare_enable(info->ppmu.clk);
+ pr_info("exynos-ppmu: new PPMU device registered %s\n",
+ dev_name(&pdev->dev));
+
return 0;
}
--
1.9.1
[toc] | [prev] | [next] | [standalone]
| From | Chanwoo Choi <cw00.choi@samsung.com> |
|---|---|
| Date | 2016-11-24 06:10 +0100 |
| Subject | [PATCH 2/6] PM / devfreq: Modify the device name as devfreq[X] for sysfs |
| Message-ID | <sGUsh-6pb-13@gated-at.bofh.it> |
| In reply to | #1528984 |
This patch modifies the device name as devfreq[X] for sysfs by using the 'devfreq'
prefix word instead of separate device name. On user-space aspect, user would
find the some devfreq drvier with 'devfreq[X]' pattern. So, this patch modify the
device name as following:
- /sys/class/devfreq/[non-standard device name] -> /sys/class/devfreq/devfreq[X]
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
---
drivers/devfreq/devfreq.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
index dfef5ea57e4c..4d2b7e5b8d3c 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -527,6 +527,7 @@ struct devfreq *devfreq_add_device(struct device *dev,
{
struct devfreq *devfreq;
struct devfreq_governor *governor;
+ static atomic_t devfreq_no = ATOMIC_INIT(-1);
int err = 0;
if (!dev || !profile || !governor_name) {
@@ -568,7 +569,8 @@ struct devfreq *devfreq_add_device(struct device *dev,
mutex_lock(&devfreq->lock);
}
- dev_set_name(&devfreq->dev, "%s", dev_name(dev));
+ dev_set_name(&devfreq->dev, "devfreq%lu",
+ (unsigned long)atomic_inc_return(&devfreq_no));
err = device_register(&devfreq->dev);
if (err) {
mutex_unlock(&devfreq->lock);
--
1.9.1
[toc] | [prev] | [next] | [standalone]
| From | Chanwoo Choi <cw00.choi@samsung.com> |
|---|---|
| Date | 2016-11-24 06:10 +0100 |
| Subject | [PATCH 1/6] PM / devfreq: Fix the checkpatch warnings |
| Message-ID | <sGUsi-6pb-27@gated-at.bofh.it> |
| In reply to | #1528984 |
This patch just fixes the checkpatch warnings.
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
---
drivers/devfreq/devfreq.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
index a324801d6a66..dfef5ea57e4c 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -538,15 +538,14 @@ struct devfreq *devfreq_add_device(struct device *dev,
devfreq = find_device_devfreq(dev);
mutex_unlock(&devfreq_list_lock);
if (!IS_ERR(devfreq)) {
- dev_err(dev, "%s: Unable to create devfreq for the device. It already has one.\n", __func__);
+ dev_err(dev, "%s: Unable to create devfreq for the device.\n",
+ __func__);
err = -EINVAL;
goto err_out;
}
devfreq = kzalloc(sizeof(struct devfreq), GFP_KERNEL);
if (!devfreq) {
- dev_err(dev, "%s: Unable to create devfreq for the device\n",
- __func__);
err = -ENOMEM;
goto err_out;
}
@@ -576,11 +575,13 @@ struct devfreq *devfreq_add_device(struct device *dev,
goto err_out;
}
- devfreq->trans_table = devm_kzalloc(&devfreq->dev, sizeof(unsigned int) *
+ devfreq->trans_table = devm_kzalloc(&devfreq->dev,
+ sizeof(unsigned int) *
devfreq->profile->max_state *
devfreq->profile->max_state,
GFP_KERNEL);
- devfreq->time_in_state = devm_kzalloc(&devfreq->dev, sizeof(unsigned long) *
+ devfreq->time_in_state = devm_kzalloc(&devfreq->dev,
+ sizeof(unsigned long) *
devfreq->profile->max_state,
GFP_KERNEL);
devfreq->last_stat_updated = jiffies;
@@ -990,7 +991,7 @@ static ssize_t cur_freq_show(struct device *dev, struct device_attribute *attr,
if (devfreq->profile->get_cur_freq &&
!devfreq->profile->get_cur_freq(devfreq->dev.parent, &freq))
- return sprintf(buf, "%lu\n", freq);
+ return sprintf(buf, "%lu\n", freq);
return sprintf(buf, "%lu\n", devfreq->previous_freq);
}
--
1.9.1
[toc] | [prev] | [next] | [standalone]
| From | Joe Perches <joe@perches.com> |
|---|---|
| Date | 2016-11-24 11:30 +0100 |
| Subject | Re: [PATCH 1/6] PM / devfreq: Fix the checkpatch warnings |
| Message-ID | <sGZrY-1oP-47@gated-at.bofh.it> |
| In reply to | #1528991 |
On Thu, 2016-11-24 at 14:01 +0900, Chanwoo Choi wrote:
> This patch just fixes the checkpatch warnings.
unrelated trivia:
> diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
[]
> @@ -538,15 +538,14 @@ struct devfreq *devfreq_add_device(struct device *dev,
> devfreq = find_device_devfreq(dev);
> mutex_unlock(&devfreq_list_lock);
> if (!IS_ERR(devfreq)) {
> - dev_err(dev, "%s: Unable to create devfreq for the device. It already has one.\n", __func__);
> + dev_err(dev, "%s: Unable to create devfreq for the device.\n",
> + __func__);
> err = -EINVAL;
> goto err_out;
> }
It seems to be simpler if find_device_devfreq just returned NULL
in the error cases as the only test is IS_ERR and not a
specific error return type. Then these IS_ERR calls could be
a NULL pointer test instead.
> @@ -576,11 +575,13 @@ struct devfreq *devfreq_add_device(struct device *dev,
> goto err_out;
> }
>
> - devfreq->trans_table = devm_kzalloc(&devfreq->dev, sizeof(unsigned int) *
> + devfreq->trans_table = devm_kzalloc(&devfreq->dev,
> + sizeof(unsigned int) *
> devfreq->profile->max_state *
> devfreq->profile->max_state,
> GFP_KERNEL);
> - devfreq->time_in_state = devm_kzalloc(&devfreq->dev, sizeof(unsigned long) *
> + devfreq->time_in_state = devm_kzalloc(&devfreq->dev,
> + sizeof(unsigned long) *
> devfreq->profile->max_state,
> GFP_KERNEL);
Maybe these should be devm_kcalloc calls
> devfreq->last_stat_updated = jiffies;
> @@ -990,7 +991,7 @@ static ssize_t cur_freq_show(struct device *dev, struct device_attribute *attr,
>
> if (devfreq->profile->get_cur_freq &&
> !devfreq->profile->get_cur_freq(devfreq->dev.parent, &freq))
> - return sprintf(buf, "%lu\n", freq);
> + return sprintf(buf, "%lu\n", freq);
Be nicer to align the second line in the if test here too
if (devfreq->profile->get_cur_freq &&
!devfreq->profile->get_cur_freq(devfreq->dev.parent, &freq))
return sprintf(buf, "%lu\n", freq);
> return sprintf(buf, "%lu\n", devfreq->previous_freq);
> }
[toc] | [prev] | [next] | [standalone]
| From | Chanwoo Choi <cw00.choi@samsung.com> |
|---|---|
| Date | 2016-11-24 11:50 +0100 |
| Subject | Re: [PATCH 1/6] PM / devfreq: Fix the checkpatch warnings |
| Message-ID | <sGZLk-1wb-9@gated-at.bofh.it> |
| In reply to | #1529143 |
On 2016년 11월 24일 19:20, Joe Perches wrote:
> On Thu, 2016-11-24 at 14:01 +0900, Chanwoo Choi wrote:
>> This patch just fixes the checkpatch warnings.
>
> unrelated trivia:
>
>> diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
> []
>> @@ -538,15 +538,14 @@ struct devfreq *devfreq_add_device(struct device *dev,
>> devfreq = find_device_devfreq(dev);
>> mutex_unlock(&devfreq_list_lock);
>> if (!IS_ERR(devfreq)) {
>> - dev_err(dev, "%s: Unable to create devfreq for the device. It already has one.\n", __func__);
>> + dev_err(dev, "%s: Unable to create devfreq for the device.\n",
>> + __func__);
>> err = -EINVAL;
>> goto err_out;
>> }
>
> It seems to be simpler if find_device_devfreq just returned NULL
> in the error cases as the only test is IS_ERR and not a
> specific error return type. Then these IS_ERR calls could be
> a NULL pointer test instead.
>
>> @@ -576,11 +575,13 @@ struct devfreq *devfreq_add_device(struct device *dev,
>> goto err_out;
>> }
>>
>> - devfreq->trans_table = devm_kzalloc(&devfreq->dev, sizeof(unsigned int) *
>> + devfreq->trans_table = devm_kzalloc(&devfreq->dev,
>> + sizeof(unsigned int) *
>> devfreq->profile->max_state *
>> devfreq->profile->max_state,
>> GFP_KERNEL);
>> - devfreq->time_in_state = devm_kzalloc(&devfreq->dev, sizeof(unsigned long) *
>> + devfreq->time_in_state = devm_kzalloc(&devfreq->dev,
>> + sizeof(unsigned long) *
>> devfreq->profile->max_state,
>> GFP_KERNEL);
>
> Maybe these should be devm_kcalloc calls
Why should devfreq use the devm_kcalloc?
>
>> devfreq->last_stat_updated = jiffies;
>> @@ -990,7 +991,7 @@ static ssize_t cur_freq_show(struct device *dev, struct device_attribute *attr,
>>
>> if (devfreq->profile->get_cur_freq &&
>> !devfreq->profile->get_cur_freq(devfreq->dev.parent, &freq))
>> - return sprintf(buf, "%lu\n", freq);
>> + return sprintf(buf, "%lu\n", freq);
>
> Be nicer to align the second line in the if test here too
>
> if (devfreq->profile->get_cur_freq &&
> !devfreq->profile->get_cur_freq(devfreq->dev.parent, &freq))
> return sprintf(buf, "%lu\n", freq);
>
>> return sprintf(buf, "%lu\n", devfreq->previous_freq);
>> }
>
>
>
--
Best Regards,
Chanwoo Choi
[toc] | [prev] | [next] | [standalone]
| From | Joe Perches <joe@perches.com> |
|---|---|
| Date | 2016-11-24 12:00 +0100 |
| Subject | Re: [PATCH 1/6] PM / devfreq: Fix the checkpatch warnings |
| Message-ID | <sGZUZ-1zn-5@gated-at.bofh.it> |
| In reply to | #1529154 |
On Thu, 2016-11-24 at 19:46 +0900, Chanwoo Choi wrote: > On 2016년 11월 24일 19:20, Joe Perches wrote: > > On Thu, 2016-11-24 at 14:01 +0900, Chanwoo Choi wrote: > > > This patch just fixes the checkpatch warnings. > > > > unrelated trivia: > > > > > diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c [] > > > @@ -576,11 +575,13 @@ struct devfreq *devfreq_add_device(struct device *dev, > > > goto err_out; > > > } > > > > > > - devfreq->trans_table = devm_kzalloc(&devfreq->dev, sizeof(unsigned int) * > > > + devfreq->trans_table = devm_kzalloc(&devfreq->dev, > > > + sizeof(unsigned int) * > > > devfreq->profile->max_state * > > > devfreq->profile->max_state, > > > GFP_KERNEL); > > > - devfreq->time_in_state = devm_kzalloc(&devfreq->dev, sizeof(unsigned long) * > > > + devfreq->time_in_state = devm_kzalloc(&devfreq->dev, > > > + sizeof(unsigned long) * > > > devfreq->profile->max_state, > > > GFP_KERNEL); > > > > Maybe these should be devm_kcalloc calls > > Why should devfreq use the devm_kcalloc? Because these are allocating zeroed arrays of a specific size.
[toc] | [prev] | [next] | [standalone]
| From | Chanwoo Choi <cw00.choi@samsung.com> |
|---|---|
| Date | 2016-11-25 00:40 +0100 |
| Subject | Re: [PATCH 1/6] PM / devfreq: Fix the checkpatch warnings |
| Message-ID | <sHbMt-1dA-5@gated-at.bofh.it> |
| In reply to | #1529157 |
On 2016년 11월 24일 19:52, Joe Perches wrote: > On Thu, 2016-11-24 at 19:46 +0900, Chanwoo Choi wrote: >> On 2016년 11월 24일 19:20, Joe Perches wrote: >>> On Thu, 2016-11-24 at 14:01 +0900, Chanwoo Choi wrote: >>>> This patch just fixes the checkpatch warnings. >>> >>> unrelated trivia: >>> >>>> diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c > [] >>>> @@ -576,11 +575,13 @@ struct devfreq *devfreq_add_device(struct device *dev, >>>> goto err_out; >>>> } >>>> >>>> - devfreq->trans_table = devm_kzalloc(&devfreq->dev, sizeof(unsigned int) * >>>> + devfreq->trans_table = devm_kzalloc(&devfreq->dev, >>>> + sizeof(unsigned int) * >>>> devfreq->profile->max_state * >>>> devfreq->profile->max_state, >>>> GFP_KERNEL); >>>> - devfreq->time_in_state = devm_kzalloc(&devfreq->dev, sizeof(unsigned long) * >>>> + devfreq->time_in_state = devm_kzalloc(&devfreq->dev, >>>> + sizeof(unsigned long) * >>>> devfreq->profile->max_state, >>>> GFP_KERNEL); >>> >>> Maybe these should be devm_kcalloc calls >> >> Why should devfreq use the devm_kcalloc? > > Because these are allocating zeroed arrays of a specific size. kzalloc is already set to zero. [1]https://www.kernel.org/doc/htmldocs/kernel-api/API-kzalloc.html
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web