pm: remove useless array definition in cpuidle_structure
PATCH 1/1 pm: remove useless array definition in cpuidle_structure
From: Daniel Lezcano <[email protected]>
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.
--- include/linux/cpuidle.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
include/linux/cpuidle.h +2 -2
@@ -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
Signature · 1 line
1.7.4.1
Quoted 25 lines · Robert Lee
From: Daniel Lezcano <[email protected]>
All the modules name are ro-data, it is never copied to the array.
eg.
static struct
cpuidle_driverintel_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 <[email protected]>Signed-off-by Robert Lee <[email protected]>--- include/linux/cpuidle.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)include/linux/cpuidle.h +0
-0
include/linux/cpuidle.h static inline int cpuidle_get_last_residency(struct cpuidle_device *dev) · line 124
Quoted 10 lines
include/linux/cpuidle.h +2
-2@@ -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)
Len, Arjan,
Quoted 35 lines · Deepthi Dharwar
Quoted 34 lines · Robert Lee
From: Daniel Lezcano <[email protected]>
All the modules name are ro-data, it is never copied to the array.
eg.
static struct
cpuidle_driverintel_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 <[email protected]>Signed-off-by Robert Lee <[email protected]>--- include/linux/cpuidle.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)include/linux/cpuidle.h +2
-2@@ -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; };
Quoted 7 lines
include/linux/cpuidle.h static inline int cpuidle_get_last_residency(struct cpuidle_device *dev) · line 124
Quoted 1 line
include/linux/cpuidle.h +0
-0#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 <[email protected]>Reviewed-by Deepthi Dharwar <[email protected]>
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
Quoted 43 lines · Rafael J. Wysocki
Len, Arjan,
Quoted 40 lines · Deepthi Dharwar
Quoted 25 lines · Robert Lee
From: Daniel Lezcano<[email protected]>
All the modules name are ro-data, it is never copied to the array.
eg.
static struct
cpuidle_driverintel_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<[email protected]>Signed-off-by Robert Lee<[email protected]>--- include/linux/cpuidle.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)include/linux/cpuidle.h +0
-0include/linux/cpuidle.h static inline int cpuidle_get_last_residency(struct cpuidle_device *dev) · line 124
Quoted 10 lines
include/linux/cpuidle.h +2
-2@@ -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)
Quoted 7 lines
Quoted 2 lines
Tested-by Deepthi Dharwar<[email protected]>Reviewed-by Deepthi Dharwar<[email protected]>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
Signature · 5 lines
<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