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 <ramesh.thomas@intel.com>
This commit is contained in:
Ramesh Thomas 2016-08-04 00:04:49 -07:00 committed by Anas Nashif
commit fa175975e9
4 changed files with 8 additions and 18 deletions

View file

@ -560,7 +560,7 @@ int _sys_clock_driver_init(struct device *device)
static uint32_t reg_timer_save; static uint32_t reg_timer_save;
static uint32_t reg_timer_cfg_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); ARG_UNUSED(dev);
@ -572,7 +572,7 @@ static int sys_clock_suspend(struct device *dev, int pm_policy)
return 0; 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); ARG_UNUSED(dev);
@ -610,8 +610,6 @@ static int sys_clock_resume(struct device *dev, int pm_policy)
} }
#endif #endif
DEFINE_DEVICE_PM_OPS(_sys_clock, sys_clock_suspend, sys_clock_resume);
/** /**
* *
* @brief Read the platform's timer hardware * @brief Read the platform's timer hardware

View file

@ -37,7 +37,9 @@
* For other timers, define device_pm_ops with default handers in case * For other timers, define device_pm_ops with default handers in case
* the app enables CONFIG_DEVICE_POWER_MANAGEMENT. * 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); DEFINE_DEVICE_PM_OPS(_sys_clock, device_pm_nop, device_pm_nop);
#endif #endif
SYS_INIT_PM("sys_clock", _sys_clock_driver_init, DEVICE_PM_OPS_GET(_sys_clock), SYS_INIT_PM("sys_clock", _sys_clock_driver_init, DEVICE_PM_OPS_GET(_sys_clock),

View file

@ -257,7 +257,7 @@ struct device_pm_ops {
* @param _resume name of the resume function * @param _resume name of the resume function
*/ */
#define DEFINE_DEVICE_PM_OPS(_name, _suspend, _resume) \ #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, \ .suspend = _suspend, \
.resume = _resume, \ .resume = _resume, \
} }
@ -274,23 +274,12 @@ struct device_pm_ops {
#define DEVICE_PM_OPS_GET(_name) \ #define DEVICE_PM_OPS_GET(_name) \
(&_name##_dev_pm_ops) (&_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 #else
#define DEFINE_DEVICE_PM_OPS(_name, _suspend, _resume) #define DEFINE_DEVICE_PM_OPS(_name, _suspend, _resume)
#define DEVICE_PM_OPS_GET(_name) NULL #define DEVICE_PM_OPS_GET(_name) NULL
#define DEVICE_PM_OPS_DECLARE(_name)
#endif #endif
/** /**

View file

@ -59,7 +59,8 @@ extern uint32_t _nano_get_earliest_deadline(void);
extern void _nano_sys_clock_tick_announce(int32_t ticks); 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 #ifdef CONFIG_MICROKERNEL
extern void (*_do_sys_clock_tick_announce)(kevent_t); extern void (*_do_sys_clock_tick_announce)(kevent_t);