diff mbox

[3/5,RFC] cpuidle : add a pointer for cpuidle_state in the cpuidle_device

Message ID 1343213162-8064-4-git-send-email-daniel.lezcano@linaro.org (mailing list archive)
State New, archived
Headers show

Commit Message

Daniel Lezcano July 25, 2012, 10:46 a.m. UTC
This patch adds a pointer to the cpuidle_state array in the cpuidle_device
structure. When the cpuidle_device is initialized, the pointer is assigned
from the driver's cpuidle states array.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
 drivers/cpuidle/cpuidle.c |    1 +
 include/linux/cpuidle.h   |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

Comments

Santosh Shilimkar July 26, 2012, 3:35 p.m. UTC | #1
On Wed, Jul 25, 2012 at 12:46 PM, Daniel Lezcano
<daniel.lezcano@linaro.org> wrote:
>
> This patch adds a pointer to the cpuidle_state array in the cpuidle_device
> structure. When the cpuidle_device is initialized, the pointer is assigned
> from the driver's cpuidle states array.
>
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> ---
Would be good to also mention the intention behind this change
in the change-log. The next patch make it clear but for this change
too, it should be added.

Feel free to add my ack if you need one.

Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Peter De Schrijver Sept. 3, 2012, 3:16 p.m. UTC | #2
On Wed, Jul 25, 2012 at 12:46:00PM +0200, Daniel Lezcano wrote:
> This patch adds a pointer to the cpuidle_state array in the cpuidle_device
> structure. When the cpuidle_device is initialized, the pointer is assigned
> from the driver's cpuidle states array.
> 
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> ---
>  drivers/cpuidle/cpuidle.c |    1 +
>  include/linux/cpuidle.h   |    1 +
>  2 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
> index d6a533e..42b1a8a 100644
> --- a/drivers/cpuidle/cpuidle.c
> +++ b/drivers/cpuidle/cpuidle.c
> @@ -305,6 +305,7 @@ int cpuidle_enable_device(struct cpuidle_device *dev)
>  		return -EIO;
>  	if (!dev->state_count)
>  		dev->state_count = drv->state_count;
> +	dev->states = drv->states;

This should only be done when dev->state_count == 0 no?

Cheers,

Peter.
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Daniel Lezcano Sept. 6, 2012, 12:47 p.m. UTC | #3
On 09/03/2012 05:16 PM, Peter De Schrijver wrote:
> On Wed, Jul 25, 2012 at 12:46:00PM +0200, Daniel Lezcano wrote:
>> This patch adds a pointer to the cpuidle_state array in the cpuidle_device
>> structure. When the cpuidle_device is initialized, the pointer is assigned
>> from the driver's cpuidle states array.
>>
>> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
>> ---
>>  drivers/cpuidle/cpuidle.c |    1 +
>>  include/linux/cpuidle.h   |    1 +
>>  2 files changed, 2 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
>> index d6a533e..42b1a8a 100644
>> --- a/drivers/cpuidle/cpuidle.c
>> +++ b/drivers/cpuidle/cpuidle.c
>> @@ -305,6 +305,7 @@ int cpuidle_enable_device(struct cpuidle_device *dev)
>>  		return -EIO;
>>  	if (!dev->state_count)
>>  		dev->state_count = drv->state_count;
>> +	dev->states = drv->states;
> 
> This should only be done when dev->state_count == 0 no?

Right. In acpi/processor_idle.c, the state count for the device is
initialized and I overwritten this value in all the cases, but this not
right. I removed the initialization in acpi because it is pointless and
moved this line to do the 'if' block as you mentioned.

Thanks
  -- Daniel
diff mbox

Patch

diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index d6a533e..42b1a8a 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -305,6 +305,7 @@  int cpuidle_enable_device(struct cpuidle_device *dev)
 		return -EIO;
 	if (!dev->state_count)
 		dev->state_count = drv->state_count;
+	dev->states = drv->states;
 
 	if (dev->registered == 0) {
 		ret = __cpuidle_register_device(dev);
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index 89dcd30..40a04a1 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -95,6 +95,7 @@  struct cpuidle_device {
 
 	int			last_residency;
 	int			state_count;
+	struct cpuidle_state    *states;
 	struct cpuidle_state_usage	states_usage[CPUIDLE_STATE_MAX];
 	struct cpuidle_state_kobj *kobjs[CPUIDLE_STATE_MAX];