All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chanwoo Choi <cw00.choi@samsung.com>
To: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: myungjoo.ham@samsung.com, kyungmin.park@samsung.com,
	kgene.kim@samsung.com, rafael.j.wysocki@intel.com,
	a.kesavan@samsung.com, tomasz.figa@gmail.com,
	b.zolnierkie@samsung.com, linux-pm@vger.kernel.org,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-samsung-soc@vger.kernel.org
Subject: Re: [RFC PATCHv3 2/7] devfreq: event: Add the list of supported devfreq-event type
Date: Tue, 16 Dec 2014 10:15:16 +0900	[thread overview]
Message-ID: <548F87A4.5060000@samsung.com> (raw)
In-Reply-To: <1418655206.20866.6.camel@AMDC1943>

Hi Krzysztof,

On 12/15/2014 11:53 PM, Krzysztof Kozlowski wrote:
> On pią, 2014-12-12 at 17:27 +0900, Chanwoo Choi wrote:
>> This patch adds the list of supported devfreq-event type as following.
>> Each devfreq-event device driver would support the various devfreq-event type
>> for devfreq governor at the same time.
>> - DEVFREQ_EVENT_TYPE_RAW_DATA
>> - DEVFREQ_EVENT_TYPE_UTILIZATION
>> - DEVFREQ_EVENT_TYPE_BANDWIDTH
>> - DEVFREQ_EVENT_TYPE_LATENCY
>>
>> Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
>> Cc: Kyungmin Park <kyungmin.park@samsung.com>
>> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
>> ---
>>  drivers/devfreq/devfreq-event.c | 44 +++++++++++++++++++++++++++++++++++++----
>>  include/linux/devfreq.h         | 29 ++++++++++++++++++++++-----
>>  2 files changed, 64 insertions(+), 9 deletions(-)
>>
>> diff --git a/drivers/devfreq/devfreq-event.c b/drivers/devfreq/devfreq-event.c
>> index eaf59c1..9444f93 100644
>> --- a/drivers/devfreq/devfreq-event.c
>> +++ b/drivers/devfreq/devfreq-event.c
>> @@ -29,6 +29,9 @@
>>  #include <linux/of.h>
>>  #include "governor.h"
>>  
>> +#define EVENT_TYPE_RAW_DATA_MAX		U64_MAX
>> +#define EVENT_TYPE_UTILIZATION_MAX	100
>> +
>>  static struct class *devfreq_event_class;
>>  
>>  /* The list of all devfreq event list */
>> @@ -144,7 +147,8 @@ EXPORT_SYMBOL_GPL(devfreq_event_is_enabled);
>>   * Note that this function set the event to the devfreq-event device to start
>>   * for getting the event data which could be various event type.
>>   */
>> -int devfreq_event_set_event(struct devfreq_event_dev *edev)
>> +int devfreq_event_set_event(struct devfreq_event_dev *edev,
>> +				enum devfreq_event_type type)
>>  {
>>  	int ret;
>>  
>> @@ -158,7 +162,15 @@ int devfreq_event_set_event(struct devfreq_event_dev *edev)
>>  		return -EPERM;
>>  
>>  	mutex_lock(&edev->lock);
>> -	ret = edev->desc->ops->set_event(edev);
>> +
>> +	if ((edev->desc->type & type) == 0) {
>> +		dev_err(&edev->dev, "unsupported of devfreq-event type\n");
>> +		mutex_unlock(&edev->lock);
>> +		return -EINVAL;
>> +	}
>> +
>> +	ret = edev->desc->ops->set_event(edev, type);
>> +
>>  	mutex_unlock(&edev->lock);
>>  
>>  	return ret;
>> @@ -174,7 +186,9 @@ EXPORT_SYMBOL_GPL(devfreq_event_set_event);
>>   * current event data and total_event should be stored in second parameter
>>   * (total_event).
>>   */
>> -u64 devfreq_event_get_event(struct devfreq_event_dev *edev, u64 *total_event)
>> +u64 devfreq_event_get_event(struct devfreq_event_dev *edev,
>> +				enum devfreq_event_type type,
>> +				u64 *total_event)
>>  {
>>  	u64 event;
>>  
>> @@ -190,7 +204,27 @@ u64 devfreq_event_get_event(struct devfreq_event_dev *edev, u64 *total_event)
>>  		return 0;
>>  
>>  	mutex_lock(&edev->lock);
>> -	event = edev->desc->ops->get_event(edev, total_event);
>> +
>> +	if ((edev->desc->type & type) == 0) {
>> +		dev_err(&edev->dev, "unsupported of devfreq-event type\n");
>> +		return -EINVAL;
>> +	}
>> +
>> +	event = edev->desc->ops->get_event(edev, type, total_event);
>> +
>> +	switch (type) {
>> +	case DEVFREQ_EVENT_TYPE_RAW_DATA:
>> +	case DEVFREQ_EVENT_TYPE_BANDWIDTH:
>> +	case DEVFREQ_EVENT_TYPE_LATENCY:
>> +		if ((event > *total_event)
>> +			|| ((event > EVENT_TYPE_RAW_DATA_MAX) ||
>> +				*total_event > EVENT_TYPE_RAW_DATA_MAX))
>> +			event = 0;
> 
> missing break here.

My mistake. I'll add it and 'default' case statement.

Best Regards,
Chanwoo Choi

WARNING: multiple messages have this Message-ID (diff)
From: cw00.choi@samsung.com (Chanwoo Choi)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCHv3 2/7] devfreq: event: Add the list of supported devfreq-event type
Date: Tue, 16 Dec 2014 10:15:16 +0900	[thread overview]
Message-ID: <548F87A4.5060000@samsung.com> (raw)
In-Reply-To: <1418655206.20866.6.camel@AMDC1943>

Hi Krzysztof,

On 12/15/2014 11:53 PM, Krzysztof Kozlowski wrote:
> On pi?, 2014-12-12 at 17:27 +0900, Chanwoo Choi wrote:
>> This patch adds the list of supported devfreq-event type as following.
>> Each devfreq-event device driver would support the various devfreq-event type
>> for devfreq governor at the same time.
>> - DEVFREQ_EVENT_TYPE_RAW_DATA
>> - DEVFREQ_EVENT_TYPE_UTILIZATION
>> - DEVFREQ_EVENT_TYPE_BANDWIDTH
>> - DEVFREQ_EVENT_TYPE_LATENCY
>>
>> Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
>> Cc: Kyungmin Park <kyungmin.park@samsung.com>
>> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
>> ---
>>  drivers/devfreq/devfreq-event.c | 44 +++++++++++++++++++++++++++++++++++++----
>>  include/linux/devfreq.h         | 29 ++++++++++++++++++++++-----
>>  2 files changed, 64 insertions(+), 9 deletions(-)
>>
>> diff --git a/drivers/devfreq/devfreq-event.c b/drivers/devfreq/devfreq-event.c
>> index eaf59c1..9444f93 100644
>> --- a/drivers/devfreq/devfreq-event.c
>> +++ b/drivers/devfreq/devfreq-event.c
>> @@ -29,6 +29,9 @@
>>  #include <linux/of.h>
>>  #include "governor.h"
>>  
>> +#define EVENT_TYPE_RAW_DATA_MAX		U64_MAX
>> +#define EVENT_TYPE_UTILIZATION_MAX	100
>> +
>>  static struct class *devfreq_event_class;
>>  
>>  /* The list of all devfreq event list */
>> @@ -144,7 +147,8 @@ EXPORT_SYMBOL_GPL(devfreq_event_is_enabled);
>>   * Note that this function set the event to the devfreq-event device to start
>>   * for getting the event data which could be various event type.
>>   */
>> -int devfreq_event_set_event(struct devfreq_event_dev *edev)
>> +int devfreq_event_set_event(struct devfreq_event_dev *edev,
>> +				enum devfreq_event_type type)
>>  {
>>  	int ret;
>>  
>> @@ -158,7 +162,15 @@ int devfreq_event_set_event(struct devfreq_event_dev *edev)
>>  		return -EPERM;
>>  
>>  	mutex_lock(&edev->lock);
>> -	ret = edev->desc->ops->set_event(edev);
>> +
>> +	if ((edev->desc->type & type) == 0) {
>> +		dev_err(&edev->dev, "unsupported of devfreq-event type\n");
>> +		mutex_unlock(&edev->lock);
>> +		return -EINVAL;
>> +	}
>> +
>> +	ret = edev->desc->ops->set_event(edev, type);
>> +
>>  	mutex_unlock(&edev->lock);
>>  
>>  	return ret;
>> @@ -174,7 +186,9 @@ EXPORT_SYMBOL_GPL(devfreq_event_set_event);
>>   * current event data and total_event should be stored in second parameter
>>   * (total_event).
>>   */
>> -u64 devfreq_event_get_event(struct devfreq_event_dev *edev, u64 *total_event)
>> +u64 devfreq_event_get_event(struct devfreq_event_dev *edev,
>> +				enum devfreq_event_type type,
>> +				u64 *total_event)
>>  {
>>  	u64 event;
>>  
>> @@ -190,7 +204,27 @@ u64 devfreq_event_get_event(struct devfreq_event_dev *edev, u64 *total_event)
>>  		return 0;
>>  
>>  	mutex_lock(&edev->lock);
>> -	event = edev->desc->ops->get_event(edev, total_event);
>> +
>> +	if ((edev->desc->type & type) == 0) {
>> +		dev_err(&edev->dev, "unsupported of devfreq-event type\n");
>> +		return -EINVAL;
>> +	}
>> +
>> +	event = edev->desc->ops->get_event(edev, type, total_event);
>> +
>> +	switch (type) {
>> +	case DEVFREQ_EVENT_TYPE_RAW_DATA:
>> +	case DEVFREQ_EVENT_TYPE_BANDWIDTH:
>> +	case DEVFREQ_EVENT_TYPE_LATENCY:
>> +		if ((event > *total_event)
>> +			|| ((event > EVENT_TYPE_RAW_DATA_MAX) ||
>> +				*total_event > EVENT_TYPE_RAW_DATA_MAX))
>> +			event = 0;
> 
> missing break here.

My mistake. I'll add it and 'default' case statement.

Best Regards,
Chanwoo Choi

  reply	other threads:[~2014-12-16  1:15 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-12  8:27 [RFC PATCHv3 0/7] devfreq: Add devfreq-event class to provide raw data for devfreq device Chanwoo Choi
2014-12-12  8:27 ` Chanwoo Choi
2014-12-12  8:27 ` [RFC PATCHv3 1/7] devfreq: event: Add new devfreq_event class to provide basic data for devfreq governor Chanwoo Choi
2014-12-12  8:27   ` Chanwoo Choi
2014-12-12  8:27   ` Chanwoo Choi
     [not found]   ` <1418372852-12454-2-git-send-email-cw00.choi-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-12-15 14:53     ` Krzysztof Kozlowski
2014-12-15 14:53       ` Krzysztof Kozlowski
2014-12-15 14:53       ` Krzysztof Kozlowski
2014-12-16  1:23       ` Chanwoo Choi
2014-12-16  1:23         ` Chanwoo Choi
2014-12-16  1:23         ` Chanwoo Choi
2014-12-12  8:27 ` [RFC PATCHv3 2/7] devfreq: event: Add the list of supported devfreq-event type Chanwoo Choi
2014-12-12  8:27   ` Chanwoo Choi
2014-12-15 14:53   ` Krzysztof Kozlowski
2014-12-15 14:53     ` Krzysztof Kozlowski
2014-12-16  1:15     ` Chanwoo Choi [this message]
2014-12-16  1:15       ` Chanwoo Choi
2014-12-12  8:27 ` [RFC PATCHv3 3/7] devfreq: event: Add exynos-ppmu devfreq event driver Chanwoo Choi
2014-12-12  8:27   ` Chanwoo Choi
2014-12-12  8:27   ` Chanwoo Choi
2014-12-12  8:27 ` [RFC PATCHv3 4/7] devfreq: event: Add documentation for exynos-ppmu devfreq-event driver Chanwoo Choi
2014-12-12  8:27   ` Chanwoo Choi
2014-12-12  8:27   ` Chanwoo Choi
2014-12-12  8:27 ` [RFC PATCHv3 5/7] ARM: dts: Add PPMU dt node for Exynos3250 Chanwoo Choi
2014-12-12  8:27   ` Chanwoo Choi
2014-12-12  8:27 ` [RFC PATCHv3 6/7] ARM: dts: Add PPMU dt node for Exynos4 SoC Chanwoo Choi
2014-12-12  8:27   ` Chanwoo Choi
2014-12-12  8:27   ` Chanwoo Choi
2014-12-12  8:27 ` [RFC PATCHv3 7/7] ARM: dts: exynos: Add PPMU dt node to Exynos3250-based Rinato board Chanwoo Choi
2014-12-12  8:27   ` Chanwoo Choi
2014-12-12  8:27   ` Chanwoo Choi

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=548F87A4.5060000@samsung.com \
    --to=cw00.choi@samsung.com \
    --cc=a.kesavan@samsung.com \
    --cc=b.zolnierkie@samsung.com \
    --cc=devicetree@vger.kernel.org \
    --cc=k.kozlowski@samsung.com \
    --cc=kgene.kim@samsung.com \
    --cc=kyungmin.park@samsung.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=myungjoo.ham@samsung.com \
    --cc=rafael.j.wysocki@intel.com \
    --cc=tomasz.figa@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.