From fa175975e9efbd0a8377393177107de510caccf7 Mon Sep 17 00:00:00 2001 From: Ramesh Thomas Date: Thu, 4 Aug 2016 00:04:49 -0700 Subject: [PATCH] power_mgmt: Make device_pm_ops definition static DEFINE_DEVICE_PM macro was not defining device_pm_ops as 'static'. Fixes the issue and impacted areas. Jira: ZEP-639 Change-Id: I5e1de6af97bf7b2b690af0c81034ce167e655e43 Signed-off-by: Ramesh Thomas --- drivers/timer/loapic_timer.c | 6 ++---- drivers/timer/sys_clock_init.c | 4 +++- include/device.h | 13 +------------ include/drivers/system_timer.h | 3 ++- 4 files changed, 8 insertions(+), 18 deletions(-) diff --git a/drivers/timer/loapic_timer.c b/drivers/timer/loapic_timer.c index 29f4cd551d8..69e507d1b77 100644 --- a/drivers/timer/loapic_timer.c +++ b/drivers/timer/loapic_timer.c @@ -560,7 +560,7 @@ int _sys_clock_driver_init(struct device *device) static uint32_t reg_timer_save; static uint32_t reg_timer_cfg_save; -static int sys_clock_suspend(struct device *dev, int pm_policy) +int _sys_clock_suspend(struct device *dev, int pm_policy) { ARG_UNUSED(dev); @@ -572,7 +572,7 @@ static int sys_clock_suspend(struct device *dev, int pm_policy) return 0; } -static int sys_clock_resume(struct device *dev, int pm_policy) +int _sys_clock_resume(struct device *dev, int pm_policy) { ARG_UNUSED(dev); @@ -610,8 +610,6 @@ static int sys_clock_resume(struct device *dev, int pm_policy) } #endif -DEFINE_DEVICE_PM_OPS(_sys_clock, sys_clock_suspend, sys_clock_resume); - /** * * @brief Read the platform's timer hardware diff --git a/drivers/timer/sys_clock_init.c b/drivers/timer/sys_clock_init.c index 446dbd20c62..cd18d2c81af 100644 --- a/drivers/timer/sys_clock_init.c +++ b/drivers/timer/sys_clock_init.c @@ -37,7 +37,9 @@ * For other timers, define device_pm_ops with default handers in case * the app enables CONFIG_DEVICE_POWER_MANAGEMENT. */ -#ifndef CONFIG_LOAPIC_TIMER +#ifdef CONFIG_LOAPIC_TIMER +DEFINE_DEVICE_PM_OPS(_sys_clock, _sys_clock_suspend, _sys_clock_resume); +#else DEFINE_DEVICE_PM_OPS(_sys_clock, device_pm_nop, device_pm_nop); #endif SYS_INIT_PM("sys_clock", _sys_clock_driver_init, DEVICE_PM_OPS_GET(_sys_clock), diff --git a/include/device.h b/include/device.h index c56598b00ff..42db3022d6a 100644 --- a/include/device.h +++ b/include/device.h @@ -257,7 +257,7 @@ struct device_pm_ops { * @param _resume name of the resume function */ #define DEFINE_DEVICE_PM_OPS(_name, _suspend, _resume) \ - struct device_pm_ops _name##_dev_pm_ops = { \ + static struct device_pm_ops _name##_dev_pm_ops = { \ .suspend = _suspend, \ .resume = _resume, \ } @@ -274,23 +274,12 @@ struct device_pm_ops { #define DEVICE_PM_OPS_GET(_name) \ (&_name##_dev_pm_ops) -/** - * @brief Macro to declare the device_pm_ops structure - * - * The declaration would be added if CONFIG_DEVICE_POWER_MANAGEMENT - * is defined. Otherwise this macro will not add anything. - * - * @param _name name of the device - */ -#define DEVICE_PM_OPS_DECLARE(_name) \ - extern struct device_pm_ops _name##_dev_pm_ops /** * @} */ #else #define DEFINE_DEVICE_PM_OPS(_name, _suspend, _resume) #define DEVICE_PM_OPS_GET(_name) NULL -#define DEVICE_PM_OPS_DECLARE(_name) #endif /** diff --git a/include/drivers/system_timer.h b/include/drivers/system_timer.h index 88bbb594555..fb748cb03a7 100644 --- a/include/drivers/system_timer.h +++ b/include/drivers/system_timer.h @@ -59,7 +59,8 @@ extern uint32_t _nano_get_earliest_deadline(void); extern void _nano_sys_clock_tick_announce(int32_t ticks); -DEVICE_PM_OPS_DECLARE(_sys_clock); +extern int _sys_clock_suspend(struct device *dev, int pm_policy); +extern int _sys_clock_resume(struct device *dev, int pm_policy); #ifdef CONFIG_MICROKERNEL extern void (*_do_sys_clock_tick_announce)(kevent_t);