[PATCH 1/3] pm: Introduce __pm to mark power management functions and data

From: Guenter Roeck
Date: Thu May 09 2013 - 13:10:44 EST


By marking power management functions and data with __pm, #ifdef CONFIG_PM
and #ifdef CONFIG_PM_SLEEP is no longer necessary in most cases.
This ensures that the power management code still compiles even if power
management is disabled, but does not consume space in the object file.
As a side effect, drivers declaring struct dev_pm_ops unconditionally
get a bit smaller if CONFIG_PM_SLEEP is disabled.

Signed-off-by: Guenter Roeck <linux@xxxxxxxxxxxx>
---
include/linux/pm.h | 2 ++
1 file changed, 2 insertions(+)

diff --git a/include/linux/pm.h b/include/linux/pm.h
index fe70d9b..46df155 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -43,9 +43,11 @@ struct device;
#ifdef CONFIG_PM
extern const char power_group_name[]; /* = "power" */
#define pm_ops_ptr(_ptr) (_ptr)
+#define __pm
#else
#define power_group_name NULL
#define pm_ops_ptr(_ptr) NULL
+#define __pm __section(.discard)
#endif

typedef struct pm_message {
--
1.7.9.7

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/