power_mgmt: Remove deprecated macros and structs

Remove deprecated macros and function and structs that
were deprecated 2 versions ago 1.6 for power management

jira:ZEP-973

Change-Id: I127e482c67e09afea6a2008672661862dbf00c80
Signed-off-by: Amir Kaplan <amir.kaplan@intel.com>
This commit is contained in:
Amir Kaplan 2017-03-22 14:49:34 +02:00 committed by Anas Nashif
parent de64c8394c
commit 61b6f5ab7c
3 changed files with 7 additions and 195 deletions

View file

@ -130,72 +130,23 @@ static const int _INIT_LEVEL_APPLICATION = 1;
.driver_data = data \
}
#define DEVICE_AND_API_INIT_PM(dev_name, drv_name, init_fn, device_pm_ops, \
data, cfg_info, level, prio, api) \
DEVICE_AND_API_INIT(dev_name, drv_name, init_fn, data, cfg_info, \
level, prio, api)
#define DEVICE_DEFINE(dev_name, drv_name, init_fn, pm_control_fn, \
data, cfg_info, level, prio, api) \
DEVICE_AND_API_INIT(dev_name, drv_name, init_fn, data, cfg_info, \
level, prio, api)
#else
/**
* @def DEVICE_INIT_PM
*
* @warning This macro is deprecated and will be removed in
* a future version, superseded by DEVICE_DEFINE.
*
* @brief Create device object and set it up for boot time initialization,
* with the option to device_pm_ops.
*
* @copydetails DEVICE_INIT
* @param device_pm_ops Address to the device_pm_ops structure of the driver.
*/
/**
* @def DEVICE_AND_API_INIT_PM
*
* @warning This macro is deprecated and will be removed in
* a future version, superseded by DEVICE_DEFINE.
* @def DEVICE_DEFINE
*
* @brief Create device object and set it up for boot time initialization,
* with the options to set driver_api and device_pm_ops.
* with the option to device_pm_control.
*
* @copydetails DEVICE_INIT_PM
* @param api Provides an initial pointer to the API function struct
* used by the driver. Can be NULL.
* @details The driver api is also set here, eliminating the need to do that
* during initialization.
* @copydetails DEVICE_AND_API_INIT
* @param pm_control_fn Pointer to device_pm_control function.
* Can be empty function (device_pm_control_nop) if not implemented.
*/
#define DEVICE_AND_API_INIT_PM(dev_name, drv_name, init_fn, device_pm_ops, \
data, cfg_info, level, prio, api) \
\
static struct device_config _CONCAT(__config_, dev_name) __used \
__attribute__((__section__(".devconfig.init"))) = { \
.name = drv_name, .init = (init_fn), \
.dev_pm_ops = (device_pm_ops), \
.config_info = (cfg_info) \
}; \
_DEPRECATION_CHECK(dev_name, level) \
static struct device _CONCAT(__device_, dev_name) __used \
__attribute__((__section__(".init_" #level STRINGIFY(prio)))) = { \
.config = &_CONCAT(__config_, dev_name), \
.driver_api = api, \
.driver_data = data \
}
/**
* @def DEVICE_DEFINE
*
* @brief Create device object and set it up for boot time initialization,
* with the option to device_pm_control.
*
* @copydetails DEVICE_AND_API_INIT
* @param pm_control_fn Pointer to device_pm_control function.
* Can be empty function (device_pm_control_nop) if not implemented.
*/
extern struct device_pm_ops device_pm_ops_nop;
#define DEVICE_DEFINE(dev_name, drv_name, init_fn, pm_control_fn, \
data, cfg_info, level, prio, api) \
\
@ -203,7 +154,6 @@ extern struct device_pm_ops device_pm_ops_nop;
__attribute__((__section__(".devconfig.init"))) = { \
.name = drv_name, .init = (init_fn), \
.device_pm_control = (pm_control_fn), \
.dev_pm_ops = (&device_pm_ops_nop), \
.config_info = (cfg_info) \
}; \
_DEPRECATION_CHECK(dev_name, level) \
@ -225,12 +175,6 @@ extern struct device_pm_ops device_pm_ops_nop;
prio, api)
#endif
/* deprecated */
#define DEVICE_INIT_PM(dev_name, drv_name, init_fn, device_pm_ops, \
data, cfg_info, level, prio) \
DEVICE_AND_API_INIT_PM(dev_name, drv_name, init_fn, device_pm_ops, \
data, cfg_info, level, prio, NULL)
#define DEVICE_INIT(dev_name, drv_name, init_fn, data, cfg_info, level, prio) \
DEVICE_AND_API_INIT(dev_name, drv_name, init_fn, data, cfg_info, \
level, prio, NULL)
@ -292,43 +236,6 @@ struct device;
* @ingroup power_management_api
* @{
*/
/**
* @brief Structure holding handlers for device PM operations
*
* @warning This struct is deprecated and will be removed in
* a future version.
*
* @param suspend Pointer to the handler for suspend operations
* @param resume Pointer to the handler for resume operations
*/
struct device_pm_ops {
int (*suspend)(struct device *device, int pm_policy);
int (*resume)(struct device *device, int pm_policy);
};
/**
* @brief Helper macro to define the device_pm_ops structure
*
* @param _name name of the device
* @param _suspend name of the suspend function
* @param _resume name of the resume function
*/
#define DEFINE_DEVICE_PM_OPS(_name, _suspend, _resume) \
static struct device_pm_ops _CONCAT(_name, _dev_pm_ops) = { \
.suspend = _suspend, \
.resume = _resume, \
}
/**
* @brief Macro to get a pointer to the device_ops_structure
*
* Will return the name of the structure that was created using
* DEFINE_PM_OPS macro if CONFIG_DEVICE_POWER_MANAGEMENT is defined.
* Otherwise, will return NULL.
*
* @param _name name of the device
*/
#define DEVICE_PM_OPS_GET(_name) &_CONCAT(_name, _dev_pm_ops)
/**
* @}
@ -374,17 +281,11 @@ struct device_pm_ops {
/* Constants defining support device power commands */
#define DEVICE_PM_SET_POWER_STATE 1
#define DEVICE_PM_GET_POWER_STATE 2
#else
#define DEFINE_DEVICE_PM_OPS(_name, _suspend, _resume)
#define DEVICE_PM_OPS_GET(_name) NULL
#endif
/**
* @brief Static device information (In ROM) Per driver instance
*
* @note This struct contains deprecated struct (device_pm_ops)
* that will be removed in a future version.
*
* @param name name of the device
* @param init init function for the driver
* @param config_info address of driver instance config information
@ -393,7 +294,6 @@ struct device_config {
char *name;
int (*init)(struct device *device);
#ifdef CONFIG_DEVICE_POWER_MANAGEMENT
struct device_pm_ops *dev_pm_ops; /* deprecated */
int (*device_pm_control)(struct device *device, uint32_t command,
void *context);
#endif
@ -460,66 +360,6 @@ void device_busy_clear(struct device *busy_dev);
* Device PM functions
*/
/**
* @brief No-op function to initialize unimplemented pm hooks
*
* This function should be used to initialize device pm hooks
* for which a device has no operation.
*
* @param unused_device Unused
* @param unused_policy Unused
*
* @retval 0 Always returns 0
*/
int device_pm_nop(struct device *unused_device, int unused_policy);
/**
* @fn static inline int device_suspend(struct device *device, int pm_policy)
*
* @brief Call the suspend function of a device
*
*
* @warning This function is deprecated and will be removed in
* a future version, use device_set_power_state instead.
*
* Called by the Power Manager application to let the device do
* any policy based PM suspend operations.
*
* @param device Pointer to device structure of the driver instance.
* @param pm_policy PM policy for which this call is made.
*
* @retval 0 If successful.
* @retval Errno Negative errno code if failure.
*/
static inline int __deprecated device_suspend(struct device *device,
int pm_policy)
{
return device->config->dev_pm_ops->suspend(device, pm_policy);
}
/**
* @fn static inline int device_resume(struct device *device, int pm_policy)
*
* @brief Call the resume function of a device
*
* @warning This function is deprecated and will be removed in
* a future version, use device_set_power_state instead.
*
* Called by the Power Manager application to let the device do
* any policy based PM resume operations.
*
* @param device Pointer to device structure of the driver instance.
* @param pm_policy PM policy for which this call is made.
*
* @retval 0 If successful.
* @retval Errno Negative errno code if failure.
*/
static inline int __deprecated device_resume(struct device *device,
int pm_policy)
{
return device->config->dev_pm_ops->resume(device, pm_policy);
}
/**
* @brief No-op function to initialize unimplemented hook
*

View file

@ -58,29 +58,6 @@ extern "C" {
#define SYS_INIT(init_fn, level, prio) \
DEVICE_INIT(_SYS_NAME(init_fn), "", init_fn, NULL, NULL, level, prio)
/**
* @def SYS_INIT_PM
*
* @warning This macro is deprecated and will be removed in
* a future version, superseded by SYS_DEVICE_DEFINE.
*
* @brief Run an initialization function at boot at specified priority,
* and define functions to run at suspend/resume.
*
* @copydetails SYS_INIT
* @param device_pm_ops Pointer to power management functions.
* @param drv_name Name of this system device
*/
#ifdef CONFIG_DEVICE_POWER_MANAGEMENT
#define SYS_INIT_PM(drv_name, init_fn, device_pm_ops, level, prio) \
DEVICE_INIT_PM(_SYS_NAME(init_fn), drv_name, init_fn, device_pm_ops, \
NULL, NULL, level, prio)
#else
#define SYS_INIT_PM(drv_name, init_fn, device_pm_ops, level, prio) \
DEVICE_INIT(_SYS_NAME(init_fn), "", init_fn, NULL, NULL, level, prio)
#endif
/**
* @def SYS_DEVICE_DEFINE
*

View file

@ -41,7 +41,6 @@ static struct device *config_levels[] = {
};
#ifdef CONFIG_DEVICE_POWER_MANAGEMENT
struct device_pm_ops device_pm_ops_nop = {device_pm_nop, device_pm_nop};
extern uint32_t __device_busy_start[];
extern uint32_t __device_busy_end[];
#define DEVICE_BUSY_SIZE (__device_busy_end - __device_busy_start)
@ -62,7 +61,8 @@ void _sys_device_do_config_level(int level)
{
struct device *info;
for (info = config_levels[level]; info < config_levels[level+1]; info++) {
for (info = config_levels[level]; info < config_levels[level+1];
info++) {
struct device_config *device = info->config;
device->init(info);
@ -83,11 +83,6 @@ struct device *device_get_binding(const char *name)
}
#ifdef CONFIG_DEVICE_POWER_MANAGEMENT
int device_pm_nop(struct device *unused_device, int unused_policy)
{
return 0;
}
int device_pm_control_nop(struct device *unused_device,
uint32_t unused_ctrl_command, void *unused_context)
{