All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pm: remove useless array definition in cpuidle_structure
@ 2011-11-03 21:44 Robert Lee
  2011-11-04 12:21 ` Deepthi Dharwar
  0 siblings, 1 reply; 4+ messages in thread
From: Robert Lee @ 2011-11-03 21:44 UTC (permalink / raw)
  To: rjw
  Cc: len.brown, hpa, daniel.lezcano, amit.kucheria, linux-pm,
	linux-kernel, patches

From: Daniel Lezcano <daniel.lezcano@linaro.org>

All the modules name are ro-data, it is never copied to the array.

eg.

static struct cpuidle_driver intel_idle_driver = {
        .name = "intel_idle",
        .owner = THIS_MODULE,
};

It safe to assign the pointer of this ro-data to a const char *.
By this way we save 12 bytes.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Robert Lee <rob.lee@linaro.org>
---
 include/linux/cpuidle.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index b51629e..16f9dce 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -117,8 +117,8 @@ static inline int cpuidle_get_last_residency(struct cpuidle_device *dev)
  ****************************/
 
 struct cpuidle_driver {
-	char			name[CPUIDLE_NAME_LEN];
-	struct module 		*owner;
+	const char    *name;
+	struct module *owner;
 };
 
 #ifdef CONFIG_CPU_IDLE
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] pm: remove useless array definition in cpuidle_structure
  2011-11-03 21:44 [PATCH] pm: remove useless array definition in cpuidle_structure Robert Lee
@ 2011-11-04 12:21 ` Deepthi Dharwar
  2011-11-04 22:28   ` Rafael J. Wysocki
  0 siblings, 1 reply; 4+ messages in thread
From: Deepthi Dharwar @ 2011-11-04 12:21 UTC (permalink / raw)
  To: Robert Lee
  Cc: rjw, len.brown, hpa, daniel.lezcano, amit.kucheria, linux-pm,
	linux-kernel, patches

On Friday 04 November 2011 03:14 AM, Robert Lee wrote:
> From: Daniel Lezcano <daniel.lezcano@linaro.org>
> 
> All the modules name are ro-data, it is never copied to the array.
> 
> eg.
> 
> static struct cpuidle_driver intel_idle_driver = {
>         .name = "intel_idle",
>         .owner = THIS_MODULE,
> };
> 
> It safe to assign the pointer of this ro-data to a const char *.
> By this way we save 12 bytes.
> 
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> Signed-off-by: Robert Lee <rob.lee@linaro.org>
> ---
>  include/linux/cpuidle.h |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
> index b51629e..16f9dce 100644
> --- a/include/linux/cpuidle.h
> +++ b/include/linux/cpuidle.h
> @@ -117,8 +117,8 @@ static inline int cpuidle_get_last_residency(struct cpuidle_device *dev)
>   ****************************/
> 
>  struct cpuidle_driver {
> -	char			name[CPUIDLE_NAME_LEN];
> -	struct module 		*owner;
> +	const char    *name;
> +	struct module *owner;
>  };
> 
>  #ifdef CONFIG_CPU_IDLE

This looks good, and makes it fool-proof by  not allowing one to tamper the name of the driver.
Tested OK on x86 (both Intel idle and ACPI)

Tested-by: Deepthi Dharwar <deepthi@linux.vnet.ibm.com>
Reviewed-by: Deepthi Dharwar <deepthi@linux.vnet.ibm.com>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] pm: remove useless array definition in cpuidle_structure
  2011-11-04 12:21 ` Deepthi Dharwar
@ 2011-11-04 22:28   ` Rafael J. Wysocki
  2011-11-07 18:59     ` Daniel Lezcano
  0 siblings, 1 reply; 4+ messages in thread
From: Rafael J. Wysocki @ 2011-11-04 22:28 UTC (permalink / raw)
  To: len.brown, Arjan van de Ven
  Cc: Deepthi Dharwar, Robert Lee, hpa, daniel.lezcano, amit.kucheria,
	linux-pm, linux-kernel, patches

Len, Arjan,

On Friday, November 04, 2011, Deepthi Dharwar wrote:
> On Friday 04 November 2011 03:14 AM, Robert Lee wrote:
> > From: Daniel Lezcano <daniel.lezcano@linaro.org>
> > 
> > All the modules name are ro-data, it is never copied to the array.
> > 
> > eg.
> > 
> > static struct cpuidle_driver intel_idle_driver = {
> >         .name = "intel_idle",
> >         .owner = THIS_MODULE,
> > };
> > 
> > It safe to assign the pointer of this ro-data to a const char *.
> > By this way we save 12 bytes.
> > 
> > Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> > Signed-off-by: Robert Lee <rob.lee@linaro.org>
> > ---
> >  include/linux/cpuidle.h |    4 ++--
> >  1 files changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
> > index b51629e..16f9dce 100644
> > --- a/include/linux/cpuidle.h
> > +++ b/include/linux/cpuidle.h
> > @@ -117,8 +117,8 @@ static inline int cpuidle_get_last_residency(struct cpuidle_device *dev)
> >   ****************************/
> > 
> >  struct cpuidle_driver {
> > -	char			name[CPUIDLE_NAME_LEN];
> > -	struct module 		*owner;
> > +	const char    *name;
> > +	struct module *owner;
> >  };
> > 
> >  #ifdef CONFIG_CPU_IDLE
> 
> This looks good, and makes it fool-proof by  not allowing one to tamper the name of the driver.
> Tested OK on x86 (both Intel idle and ACPI)
> 
> Tested-by: Deepthi Dharwar <deepthi@linux.vnet.ibm.com>
> Reviewed-by: Deepthi Dharwar <deepthi@linux.vnet.ibm.com>

This is simple enough for me to push it for 3.2, but I woulnd't like to
step on anyone's toes.  Please let me know what you think.

Rafael

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] pm: remove useless array definition in cpuidle_structure
  2011-11-04 22:28   ` Rafael J. Wysocki
@ 2011-11-07 18:59     ` Daniel Lezcano
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Lezcano @ 2011-11-07 18:59 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: len.brown, Arjan van de Ven, Deepthi Dharwar, Robert Lee, hpa,
	amit.kucheria, linux-pm, linux-kernel, patches

On 11/04/2011 11:28 PM, Rafael J. Wysocki wrote:
> Len, Arjan,
>
> On Friday, November 04, 2011, Deepthi Dharwar wrote:
>> On Friday 04 November 2011 03:14 AM, Robert Lee wrote:
>>> From: Daniel Lezcano<daniel.lezcano@linaro.org>
>>>
>>> All the modules name are ro-data, it is never copied to the array.
>>>
>>> eg.
>>>
>>> static struct cpuidle_driver intel_idle_driver = {
>>>          .name = "intel_idle",
>>>          .owner = THIS_MODULE,
>>> };
>>>
>>> It safe to assign the pointer of this ro-data to a const char *.
>>> By this way we save 12 bytes.
>>>
>>> Signed-off-by: Daniel Lezcano<daniel.lezcano@linaro.org>
>>> Signed-off-by: Robert Lee<rob.lee@linaro.org>
>>> ---
>>>   include/linux/cpuidle.h |    4 ++--
>>>   1 files changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
>>> index b51629e..16f9dce 100644
>>> --- a/include/linux/cpuidle.h
>>> +++ b/include/linux/cpuidle.h
>>> @@ -117,8 +117,8 @@ static inline int cpuidle_get_last_residency(struct cpuidle_device *dev)
>>>    ****************************/
>>>
>>>   struct cpuidle_driver {
>>> -	char			name[CPUIDLE_NAME_LEN];
>>> -	struct module 		*owner;
>>> +	const char    *name;
>>> +	struct module *owner;
>>>   };
>>>
>>>   #ifdef CONFIG_CPU_IDLE
>>
>> This looks good, and makes it fool-proof by  not allowing one to tamper the name of the driver.
>> Tested OK on x86 (both Intel idle and ACPI)
>>
>> Tested-by: Deepthi Dharwar<deepthi@linux.vnet.ibm.com>
>> Reviewed-by: Deepthi Dharwar<deepthi@linux.vnet.ibm.com>
>
> This is simple enough for me to push it for 3.2, but I woulnd't like to
> step on anyone's toes.  Please let me know what you think.
>
> Rafael


Hi Len,

are you willing to take this patch for 3.2 ?

Thanks

   -- Daniel

-- 
  <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-11-07 18:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-03 21:44 [PATCH] pm: remove useless array definition in cpuidle_structure Robert Lee
2011-11-04 12:21 ` Deepthi Dharwar
2011-11-04 22:28   ` Rafael J. Wysocki
2011-11-07 18:59     ` Daniel Lezcano

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.