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>
diff --git a/include/device.h b/include/device.h
index 514eeb0..c2ce45d 100644
--- a/include/device.h
+++ b/include/device.h
@@ -130,72 +130,23 @@
.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 @@
__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 @@
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 @@
* @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 @@
/* 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 @@
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
@@ -461,66 +361,6 @@
*/
/**
- * @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
*
* This function should be used to initialize device hook
diff --git a/include/init.h b/include/init.h
index 2e93f94..8eb89c3 100644
--- a/include/init.h
+++ b/include/init.h
@@ -59,29 +59,6 @@
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
*
* @brief Run an initialization function at boot at specified priority,
diff --git a/kernel/device.c b/kernel/device.c
index 28210b5..b7f3611 100644
--- a/kernel/device.c
+++ b/kernel/device.c
@@ -41,7 +41,6 @@
};
#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 @@
{
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 @@
}
#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)
{