pm: rename pm_control(_fn) to (pm_)action_cb
- Rename to "action" to make its purpose more clear - Use the _cb suffix to align with naming used for callbacks in other areas. Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
parent
3ca6d9503c
commit
82d7d3c5c9
7 changed files with 78 additions and 78 deletions
|
|
@ -87,12 +87,12 @@ typedef int16_t device_handle_t;
|
||||||
* and define device PM control function.
|
* and define device PM control function.
|
||||||
*
|
*
|
||||||
* @details Invokes DEVICE_DEFINE() with no power management support
|
* @details Invokes DEVICE_DEFINE() with no power management support
|
||||||
* (@p pm_control_fn), no API (@p api_ptr), and a device name derived from
|
* (@p pm_action_cb), no API (@p api_ptr), and a device name derived from
|
||||||
* the @p init_fn name (@p dev_name).
|
* the @p init_fn name (@p dev_name).
|
||||||
*/
|
*/
|
||||||
#define SYS_DEVICE_DEFINE(drv_name, init_fn, pm_control_fn, level, prio) \
|
#define SYS_DEVICE_DEFINE(drv_name, init_fn, pm_action_cb, level, prio) \
|
||||||
DEVICE_DEFINE(Z_SYS_NAME(init_fn), drv_name, init_fn, \
|
DEVICE_DEFINE(Z_SYS_NAME(init_fn), drv_name, init_fn, \
|
||||||
pm_control_fn, \
|
pm_action_cb, \
|
||||||
NULL, NULL, level, prio, NULL)
|
NULL, NULL, level, prio, NULL)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -117,7 +117,7 @@ typedef int16_t device_handle_t;
|
||||||
*
|
*
|
||||||
* @param init_fn Address to the init function of the driver.
|
* @param init_fn Address to the init function of the driver.
|
||||||
*
|
*
|
||||||
* @param pm_control_fn Pointer to pm_control function.
|
* @param pm_action_cb Pointer to PM action callback.
|
||||||
* Can be NULL if not implemented.
|
* Can be NULL if not implemented.
|
||||||
*
|
*
|
||||||
* @param data_ptr Pointer to the device's private data.
|
* @param data_ptr Pointer to the device's private data.
|
||||||
|
|
@ -134,10 +134,10 @@ typedef int16_t device_handle_t;
|
||||||
* @param api_ptr Provides an initial pointer to the API function struct
|
* @param api_ptr Provides an initial pointer to the API function struct
|
||||||
* used by the driver. Can be NULL.
|
* used by the driver. Can be NULL.
|
||||||
*/
|
*/
|
||||||
#define DEVICE_DEFINE(dev_name, drv_name, init_fn, pm_control_fn, \
|
#define DEVICE_DEFINE(dev_name, drv_name, init_fn, pm_action_cb, \
|
||||||
data_ptr, cfg_ptr, level, prio, api_ptr) \
|
data_ptr, cfg_ptr, level, prio, api_ptr) \
|
||||||
Z_DEVICE_DEFINE(DT_INVALID_NODE, dev_name, drv_name, init_fn, \
|
Z_DEVICE_DEFINE(DT_INVALID_NODE, dev_name, drv_name, init_fn, \
|
||||||
pm_control_fn, \
|
pm_action_cb, \
|
||||||
data_ptr, cfg_ptr, level, prio, api_ptr)
|
data_ptr, cfg_ptr, level, prio, api_ptr)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -175,7 +175,7 @@ typedef int16_t device_handle_t;
|
||||||
*
|
*
|
||||||
* @param init_fn Address to the init function of the driver.
|
* @param init_fn Address to the init function of the driver.
|
||||||
*
|
*
|
||||||
* @param pm_control_fn Pointer to pm_control function.
|
* @param pm_action_cb Pointer to PM action callback.
|
||||||
* Can be NULL if not implemented.
|
* Can be NULL if not implemented.
|
||||||
*
|
*
|
||||||
* @param data_ptr Pointer to the device's private data.
|
* @param data_ptr Pointer to the device's private data.
|
||||||
|
|
@ -192,12 +192,12 @@ typedef int16_t device_handle_t;
|
||||||
* @param api_ptr Provides an initial pointer to the API function struct
|
* @param api_ptr Provides an initial pointer to the API function struct
|
||||||
* used by the driver. Can be NULL.
|
* used by the driver. Can be NULL.
|
||||||
*/
|
*/
|
||||||
#define DEVICE_DT_DEFINE(node_id, init_fn, pm_control_fn, \
|
#define DEVICE_DT_DEFINE(node_id, init_fn, pm_action_cb, \
|
||||||
data_ptr, cfg_ptr, level, prio, \
|
data_ptr, cfg_ptr, level, prio, \
|
||||||
api_ptr, ...) \
|
api_ptr, ...) \
|
||||||
Z_DEVICE_DEFINE(node_id, Z_DEVICE_DT_DEV_NAME(node_id), \
|
Z_DEVICE_DEFINE(node_id, Z_DEVICE_DT_DEV_NAME(node_id), \
|
||||||
DEVICE_DT_NAME(node_id), init_fn, \
|
DEVICE_DT_NAME(node_id), init_fn, \
|
||||||
pm_control_fn, \
|
pm_action_cb, \
|
||||||
data_ptr, cfg_ptr, level, prio, \
|
data_ptr, cfg_ptr, level, prio, \
|
||||||
api_ptr, __VA_ARGS__)
|
api_ptr, __VA_ARGS__)
|
||||||
|
|
||||||
|
|
@ -656,11 +656,11 @@ static inline bool device_is_ready(const struct device *dev)
|
||||||
FOR_EACH_NONEMPTY_TERM(IDENTITY, (,), __VA_ARGS__)
|
FOR_EACH_NONEMPTY_TERM(IDENTITY, (,), __VA_ARGS__)
|
||||||
|
|
||||||
#ifdef CONFIG_PM_DEVICE
|
#ifdef CONFIG_PM_DEVICE
|
||||||
#define Z_DEVICE_STATE_PM_INIT(node_id, dev_name, pm_control_fn) \
|
#define Z_DEVICE_STATE_PM_INIT(node_id, dev_name, pm_action_cb) \
|
||||||
.pm = Z_PM_DEVICE_INIT(Z_DEVICE_STATE_NAME(dev_name).pm, \
|
.pm = Z_PM_DEVICE_INIT(Z_DEVICE_STATE_NAME(dev_name).pm, \
|
||||||
node_id, pm_control_fn),
|
node_id, pm_action_cb),
|
||||||
#else
|
#else
|
||||||
#define Z_DEVICE_STATE_PM_INIT(node_id, dev_name, pm_control_fn)
|
#define Z_DEVICE_STATE_PM_INIT(node_id, dev_name, pm_action_cb)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -668,12 +668,12 @@ static inline bool device_is_ready(const struct device *dev)
|
||||||
|
|
||||||
* @param node_id Devicetree node id of the device.
|
* @param node_id Devicetree node id of the device.
|
||||||
* @param dev_name Device name.
|
* @param dev_name Device name.
|
||||||
* @param pm_control_fn Device PM control callback function.
|
* @param pm_action_cb Device PM action callback.
|
||||||
*/
|
*/
|
||||||
#define Z_DEVICE_STATE_DEFINE(node_id, dev_name, pm_control_fn) \
|
#define Z_DEVICE_STATE_DEFINE(node_id, dev_name, pm_action_cb) \
|
||||||
static struct device_state Z_DEVICE_STATE_NAME(dev_name) \
|
static struct device_state Z_DEVICE_STATE_NAME(dev_name) \
|
||||||
__attribute__((__section__(".z_devstate"))) = { \
|
__attribute__((__section__(".z_devstate"))) = { \
|
||||||
Z_DEVICE_STATE_PM_INIT(node_id, dev_name, pm_control_fn)\
|
Z_DEVICE_STATE_PM_INIT(node_id, dev_name, pm_action_cb) \
|
||||||
};
|
};
|
||||||
|
|
||||||
/* If device power management is enabled, this macro defines a pointer to a
|
/* If device power management is enabled, this macro defines a pointer to a
|
||||||
|
|
@ -694,9 +694,9 @@ static inline bool device_is_ready(const struct device *dev)
|
||||||
/* Construct objects that are referenced from struct device. These
|
/* Construct objects that are referenced from struct device. These
|
||||||
* include power management and dependency handles.
|
* include power management and dependency handles.
|
||||||
*/
|
*/
|
||||||
#define Z_DEVICE_DEFINE_PRE(node_id, dev_name, pm_control_fn, ...) \
|
#define Z_DEVICE_DEFINE_PRE(node_id, dev_name, pm_action_cb, ...) \
|
||||||
Z_DEVICE_DEFINE_HANDLES(node_id, dev_name, __VA_ARGS__) \
|
Z_DEVICE_DEFINE_HANDLES(node_id, dev_name, __VA_ARGS__) \
|
||||||
Z_DEVICE_STATE_DEFINE(node_id, dev_name, pm_control_fn) \
|
Z_DEVICE_STATE_DEFINE(node_id, dev_name, pm_action_cb) \
|
||||||
Z_DEVICE_DEFINE_PM_SLOT(dev_name)
|
Z_DEVICE_DEFINE_PM_SLOT(dev_name)
|
||||||
|
|
||||||
/* Helper macros needed for CONFIG_DEVICE_HANDLE_PADDING. These should
|
/* Helper macros needed for CONFIG_DEVICE_HANDLE_PADDING. These should
|
||||||
|
|
@ -796,9 +796,9 @@ BUILD_ASSERT(sizeof(device_handle_t) == 2, "fix the linker scripts");
|
||||||
/* Like DEVICE_DEFINE but takes a node_id AND a dev_name, and trailing
|
/* Like DEVICE_DEFINE but takes a node_id AND a dev_name, and trailing
|
||||||
* dependency handles that come from outside devicetree.
|
* dependency handles that come from outside devicetree.
|
||||||
*/
|
*/
|
||||||
#define Z_DEVICE_DEFINE(node_id, dev_name, drv_name, init_fn, pm_control_fn, \
|
#define Z_DEVICE_DEFINE(node_id, dev_name, drv_name, init_fn, pm_action_cb, \
|
||||||
data_ptr, cfg_ptr, level, prio, api_ptr, ...) \
|
data_ptr, cfg_ptr, level, prio, api_ptr, ...) \
|
||||||
Z_DEVICE_DEFINE_PRE(node_id, dev_name, pm_control_fn, __VA_ARGS__) \
|
Z_DEVICE_DEFINE_PRE(node_id, dev_name, pm_action_cb, __VA_ARGS__) \
|
||||||
COND_CODE_1(DT_NODE_EXISTS(node_id), (), (static)) \
|
COND_CODE_1(DT_NODE_EXISTS(node_id), (), (static)) \
|
||||||
const Z_DECL_ALIGN(struct device) \
|
const Z_DECL_ALIGN(struct device) \
|
||||||
DEVICE_NAME_GET(dev_name) __used \
|
DEVICE_NAME_GET(dev_name) __used \
|
||||||
|
|
|
||||||
|
|
@ -827,9 +827,9 @@ static inline bool net_eth_get_vlan_status(struct net_if *iface)
|
||||||
|
|
||||||
#if defined(CONFIG_NET_VLAN)
|
#if defined(CONFIG_NET_VLAN)
|
||||||
#define Z_ETH_NET_DEVICE_INIT(node_id, dev_name, drv_name, init_fn, \
|
#define Z_ETH_NET_DEVICE_INIT(node_id, dev_name, drv_name, init_fn, \
|
||||||
pm_control_fn, data, cfg, prio, api, mtu) \
|
pm_control_cb, data, cfg, prio, api, mtu) \
|
||||||
Z_DEVICE_DEFINE(node_id, dev_name, drv_name, init_fn, \
|
Z_DEVICE_DEFINE(node_id, dev_name, drv_name, init_fn, \
|
||||||
pm_control_fn, data, cfg, POST_KERNEL, \
|
pm_control_cb, data, cfg, POST_KERNEL, \
|
||||||
prio, api); \
|
prio, api); \
|
||||||
NET_L2_DATA_INIT(dev_name, 0, NET_L2_GET_CTX_TYPE(ETHERNET_L2));\
|
NET_L2_DATA_INIT(dev_name, 0, NET_L2_GET_CTX_TYPE(ETHERNET_L2));\
|
||||||
NET_IF_INIT(dev_name, 0, ETHERNET_L2, mtu, NET_VLAN_MAX_COUNT)
|
NET_IF_INIT(dev_name, 0, ETHERNET_L2, mtu, NET_VLAN_MAX_COUNT)
|
||||||
|
|
@ -837,9 +837,9 @@ static inline bool net_eth_get_vlan_status(struct net_if *iface)
|
||||||
#else /* CONFIG_NET_VLAN */
|
#else /* CONFIG_NET_VLAN */
|
||||||
|
|
||||||
#define Z_ETH_NET_DEVICE_INIT(node_id, dev_name, drv_name, init_fn, \
|
#define Z_ETH_NET_DEVICE_INIT(node_id, dev_name, drv_name, init_fn, \
|
||||||
pm_control_fn, data, cfg, prio, api, mtu) \
|
pm_control_cb, data, cfg, prio, api, mtu) \
|
||||||
Z_NET_DEVICE_INIT(node_id, dev_name, drv_name, init_fn, \
|
Z_NET_DEVICE_INIT(node_id, dev_name, drv_name, init_fn, \
|
||||||
pm_control_fn, data, cfg, prio, api, \
|
pm_control_cb, data, cfg, prio, api, \
|
||||||
ETHERNET_L2, NET_L2_GET_CTX_TYPE(ETHERNET_L2),\
|
ETHERNET_L2, NET_L2_GET_CTX_TYPE(ETHERNET_L2),\
|
||||||
mtu)
|
mtu)
|
||||||
#endif /* CONFIG_NET_VLAN */
|
#endif /* CONFIG_NET_VLAN */
|
||||||
|
|
@ -853,7 +853,7 @@ static inline bool net_eth_get_vlan_status(struct net_if *iface)
|
||||||
* @param drv_name The name this instance of the driver exposes to
|
* @param drv_name The name this instance of the driver exposes to
|
||||||
* the system.
|
* the system.
|
||||||
* @param init_fn Address to the init function of the driver.
|
* @param init_fn Address to the init function of the driver.
|
||||||
* @param pm_control_fn Pointer to pm_control function.
|
* @param pm_control_cb Pointer to pm_control function.
|
||||||
* Can be NULL if not implemented.
|
* Can be NULL if not implemented.
|
||||||
* @param data Pointer to the device's private data.
|
* @param data Pointer to the device's private data.
|
||||||
* @param cfg The address to the structure containing the
|
* @param cfg The address to the structure containing the
|
||||||
|
|
@ -863,10 +863,10 @@ static inline bool net_eth_get_vlan_status(struct net_if *iface)
|
||||||
* used by the driver. Can be NULL.
|
* used by the driver. Can be NULL.
|
||||||
* @param mtu Maximum transfer unit in bytes for this network interface.
|
* @param mtu Maximum transfer unit in bytes for this network interface.
|
||||||
*/
|
*/
|
||||||
#define ETH_NET_DEVICE_INIT(dev_name, drv_name, init_fn, pm_control_fn, \
|
#define ETH_NET_DEVICE_INIT(dev_name, drv_name, init_fn, pm_control_cb, \
|
||||||
data, cfg, prio, api, mtu) \
|
data, cfg, prio, api, mtu) \
|
||||||
Z_ETH_NET_DEVICE_INIT(DT_INVALID_NODE, dev_name, drv_name, \
|
Z_ETH_NET_DEVICE_INIT(DT_INVALID_NODE, dev_name, drv_name, \
|
||||||
init_fn, pm_control_fn, data, cfg, prio, \
|
init_fn, pm_control_cb, data, cfg, prio, \
|
||||||
api, mtu)
|
api, mtu)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -877,7 +877,7 @@ static inline bool net_eth_get_vlan_status(struct net_if *iface)
|
||||||
*
|
*
|
||||||
* @param node_id The devicetree node identifier.
|
* @param node_id The devicetree node identifier.
|
||||||
* @param init_fn Address to the init function of the driver.
|
* @param init_fn Address to the init function of the driver.
|
||||||
* @param pm_control_fn Pointer to pm_control function.
|
* @param pm_control_cb Pointer to pm_control function.
|
||||||
* Can be NULL if not implemented.
|
* Can be NULL if not implemented.
|
||||||
* @param data Pointer to the device's private data.
|
* @param data Pointer to the device's private data.
|
||||||
* @param cfg The address to the structure containing the
|
* @param cfg The address to the structure containing the
|
||||||
|
|
@ -887,11 +887,11 @@ static inline bool net_eth_get_vlan_status(struct net_if *iface)
|
||||||
* used by the driver. Can be NULL.
|
* used by the driver. Can be NULL.
|
||||||
* @param mtu Maximum transfer unit in bytes for this network interface.
|
* @param mtu Maximum transfer unit in bytes for this network interface.
|
||||||
*/
|
*/
|
||||||
#define ETH_NET_DEVICE_DT_DEFINE(node_id, init_fn, pm_control_fn, data, \
|
#define ETH_NET_DEVICE_DT_DEFINE(node_id, init_fn, pm_control_cb, data, \
|
||||||
cfg, prio, api, mtu) \
|
cfg, prio, api, mtu) \
|
||||||
Z_ETH_NET_DEVICE_INIT(node_id, Z_DEVICE_DT_DEV_NAME(node_id), \
|
Z_ETH_NET_DEVICE_INIT(node_id, Z_DEVICE_DT_DEV_NAME(node_id), \
|
||||||
DT_PROP_OR(node_id, label, ""), \
|
DT_PROP_OR(node_id, label, ""), \
|
||||||
init_fn, pm_control_fn, data, cfg, prio, \
|
init_fn, pm_control_cb, data, cfg, prio, \
|
||||||
api, mtu)
|
api, mtu)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -2248,10 +2248,10 @@ struct net_if_api {
|
||||||
/* Network device initialization macros */
|
/* Network device initialization macros */
|
||||||
|
|
||||||
#define Z_NET_DEVICE_INIT(node_id, dev_name, drv_name, init_fn, \
|
#define Z_NET_DEVICE_INIT(node_id, dev_name, drv_name, init_fn, \
|
||||||
pm_control_fn, data, cfg, prio, api, l2, \
|
pm_control_cb, data, cfg, prio, api, l2, \
|
||||||
l2_ctx_type, mtu) \
|
l2_ctx_type, mtu) \
|
||||||
Z_DEVICE_DEFINE(node_id, dev_name, drv_name, init_fn, \
|
Z_DEVICE_DEFINE(node_id, dev_name, drv_name, init_fn, \
|
||||||
pm_control_fn, data, \
|
pm_control_cb, data, \
|
||||||
cfg, POST_KERNEL, prio, api); \
|
cfg, POST_KERNEL, prio, api); \
|
||||||
NET_L2_DATA_INIT(dev_name, 0, l2_ctx_type); \
|
NET_L2_DATA_INIT(dev_name, 0, l2_ctx_type); \
|
||||||
NET_IF_INIT(dev_name, 0, l2, mtu, NET_IF_MAX_CONFIGS)
|
NET_IF_INIT(dev_name, 0, l2, mtu, NET_IF_MAX_CONFIGS)
|
||||||
|
|
@ -2265,7 +2265,7 @@ struct net_if_api {
|
||||||
* @param drv_name The name this instance of the driver exposes to
|
* @param drv_name The name this instance of the driver exposes to
|
||||||
* the system.
|
* the system.
|
||||||
* @param init_fn Address to the init function of the driver.
|
* @param init_fn Address to the init function of the driver.
|
||||||
* @param pm_control_fn Pointer to pm_control function.
|
* @param pm_control_cb Pointer to pm_control function.
|
||||||
* Can be NULL if not implemented.
|
* Can be NULL if not implemented.
|
||||||
* @param data Pointer to the device's private data.
|
* @param data Pointer to the device's private data.
|
||||||
* @param cfg The address to the structure containing the
|
* @param cfg The address to the structure containing the
|
||||||
|
|
@ -2277,11 +2277,11 @@ struct net_if_api {
|
||||||
* @param l2_ctx_type Type of L2 context data.
|
* @param l2_ctx_type Type of L2 context data.
|
||||||
* @param mtu Maximum transfer unit in bytes for this network interface.
|
* @param mtu Maximum transfer unit in bytes for this network interface.
|
||||||
*/
|
*/
|
||||||
#define NET_DEVICE_INIT(dev_name, drv_name, init_fn, pm_control_fn, \
|
#define NET_DEVICE_INIT(dev_name, drv_name, init_fn, pm_control_cb, \
|
||||||
data, cfg, prio, api, l2, \
|
data, cfg, prio, api, l2, \
|
||||||
l2_ctx_type, mtu) \
|
l2_ctx_type, mtu) \
|
||||||
Z_NET_DEVICE_INIT(DT_INVALID_NODE, dev_name, drv_name, init_fn, \
|
Z_NET_DEVICE_INIT(DT_INVALID_NODE, dev_name, drv_name, init_fn, \
|
||||||
pm_control_fn, data, cfg, prio, api, l2, \
|
pm_control_cb, data, cfg, prio, api, l2, \
|
||||||
l2_ctx_type, mtu)
|
l2_ctx_type, mtu)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -2292,7 +2292,7 @@ struct net_if_api {
|
||||||
*
|
*
|
||||||
* @param node_id The devicetree node identifier.
|
* @param node_id The devicetree node identifier.
|
||||||
* @param init_fn Address to the init function of the driver.
|
* @param init_fn Address to the init function of the driver.
|
||||||
* @param pm_control_fn Pointer to pm_control function.
|
* @param pm_control_cb Pointer to pm_control function.
|
||||||
* Can be NULL if not implemented.
|
* Can be NULL if not implemented.
|
||||||
* @param data Pointer to the device's private data.
|
* @param data Pointer to the device's private data.
|
||||||
* @param cfg The address to the structure containing the
|
* @param cfg The address to the structure containing the
|
||||||
|
|
@ -2304,11 +2304,11 @@ struct net_if_api {
|
||||||
* @param l2_ctx_type Type of L2 context data.
|
* @param l2_ctx_type Type of L2 context data.
|
||||||
* @param mtu Maximum transfer unit in bytes for this network interface.
|
* @param mtu Maximum transfer unit in bytes for this network interface.
|
||||||
*/
|
*/
|
||||||
#define NET_DEVICE_DT_DEFINE(node_id, init_fn, pm_control_fn, data, cfg, \
|
#define NET_DEVICE_DT_DEFINE(node_id, init_fn, pm_control_cb, data, cfg, \
|
||||||
prio, api, l2, l2_ctx_type, mtu) \
|
prio, api, l2, l2_ctx_type, mtu) \
|
||||||
Z_NET_DEVICE_INIT(node_id, Z_DEVICE_DT_DEV_NAME(node_id), \
|
Z_NET_DEVICE_INIT(node_id, Z_DEVICE_DT_DEV_NAME(node_id), \
|
||||||
DT_PROP_OR(node_id, label, ""), init_fn, \
|
DT_PROP_OR(node_id, label, ""), init_fn, \
|
||||||
pm_control_fn, data, cfg, prio, api, l2, \
|
pm_control_cb, data, cfg, prio, api, l2, \
|
||||||
l2_ctx_type, mtu)
|
l2_ctx_type, mtu)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -2325,11 +2325,11 @@ struct net_if_api {
|
||||||
NET_DEVICE_DT_DEFINE(DT_DRV_INST(inst), __VA_ARGS__)
|
NET_DEVICE_DT_DEFINE(DT_DRV_INST(inst), __VA_ARGS__)
|
||||||
|
|
||||||
#define Z_NET_DEVICE_INIT_INSTANCE(node_id, dev_name, drv_name, \
|
#define Z_NET_DEVICE_INIT_INSTANCE(node_id, dev_name, drv_name, \
|
||||||
instance, init_fn, pm_control_fn, \
|
instance, init_fn, pm_control_cb, \
|
||||||
data, cfg, prio, api, l2, \
|
data, cfg, prio, api, l2, \
|
||||||
l2_ctx_type, mtu) \
|
l2_ctx_type, mtu) \
|
||||||
Z_DEVICE_DEFINE(node_id, dev_name, drv_name, init_fn, \
|
Z_DEVICE_DEFINE(node_id, dev_name, drv_name, init_fn, \
|
||||||
pm_control_fn, data, cfg, POST_KERNEL, \
|
pm_control_cb, data, cfg, POST_KERNEL, \
|
||||||
prio, api); \
|
prio, api); \
|
||||||
NET_L2_DATA_INIT(dev_name, instance, l2_ctx_type); \
|
NET_L2_DATA_INIT(dev_name, instance, l2_ctx_type); \
|
||||||
NET_IF_INIT(dev_name, instance, l2, mtu, NET_IF_MAX_CONFIGS)
|
NET_IF_INIT(dev_name, instance, l2, mtu, NET_IF_MAX_CONFIGS)
|
||||||
|
|
@ -2347,7 +2347,7 @@ struct net_if_api {
|
||||||
* the system.
|
* the system.
|
||||||
* @param instance Instance identifier.
|
* @param instance Instance identifier.
|
||||||
* @param init_fn Address to the init function of the driver.
|
* @param init_fn Address to the init function of the driver.
|
||||||
* @param pm_control_fn Pointer to pm_control function.
|
* @param pm_control_cb Pointer to pm_control function.
|
||||||
* Can be NULL if not implemented.
|
* Can be NULL if not implemented.
|
||||||
* @param data Pointer to the device's private data.
|
* @param data Pointer to the device's private data.
|
||||||
* @param cfg The address to the structure containing the
|
* @param cfg The address to the structure containing the
|
||||||
|
|
@ -2360,10 +2360,10 @@ struct net_if_api {
|
||||||
* @param mtu Maximum transfer unit in bytes for this network interface.
|
* @param mtu Maximum transfer unit in bytes for this network interface.
|
||||||
*/
|
*/
|
||||||
#define NET_DEVICE_INIT_INSTANCE(dev_name, drv_name, instance, init_fn, \
|
#define NET_DEVICE_INIT_INSTANCE(dev_name, drv_name, instance, init_fn, \
|
||||||
pm_control_fn, data, cfg, prio, \
|
pm_control_cb, data, cfg, prio, \
|
||||||
api, l2, l2_ctx_type, mtu) \
|
api, l2, l2_ctx_type, mtu) \
|
||||||
Z_NET_DEVICE_INIT_INSTANCE(DT_INVALID_NODE, dev_name, drv_name, \
|
Z_NET_DEVICE_INIT_INSTANCE(DT_INVALID_NODE, dev_name, drv_name, \
|
||||||
instance, init_fn, pm_control_fn, \
|
instance, init_fn, pm_control_cb, \
|
||||||
data, cfg, prio, api, l2, \
|
data, cfg, prio, api, l2, \
|
||||||
l2_ctx_type, mtu)
|
l2_ctx_type, mtu)
|
||||||
|
|
||||||
|
|
@ -2379,7 +2379,7 @@ struct net_if_api {
|
||||||
* @param node_id The devicetree node identifier.
|
* @param node_id The devicetree node identifier.
|
||||||
* @param instance Instance identifier.
|
* @param instance Instance identifier.
|
||||||
* @param init_fn Address to the init function of the driver.
|
* @param init_fn Address to the init function of the driver.
|
||||||
* @param pm_control_fn Pointer to pm_control function.
|
* @param pm_control_cb Pointer to pm_control function.
|
||||||
* Can be NULL if not implemented.
|
* Can be NULL if not implemented.
|
||||||
* @param data Pointer to the device's private data.
|
* @param data Pointer to the device's private data.
|
||||||
* @param cfg The address to the structure containing the
|
* @param cfg The address to the structure containing the
|
||||||
|
|
@ -2392,12 +2392,12 @@ struct net_if_api {
|
||||||
* @param mtu Maximum transfer unit in bytes for this network interface.
|
* @param mtu Maximum transfer unit in bytes for this network interface.
|
||||||
*/
|
*/
|
||||||
#define NET_DEVICE_DT_DEFINE_INSTANCE(node_id, instance, init_fn, \
|
#define NET_DEVICE_DT_DEFINE_INSTANCE(node_id, instance, init_fn, \
|
||||||
pm_control_fn, data, cfg, prio, \
|
pm_control_cb, data, cfg, prio, \
|
||||||
api, l2, l2_ctx_type, mtu) \
|
api, l2, l2_ctx_type, mtu) \
|
||||||
Z_NET_DEVICE_INIT_INSTANCE(node_id, \
|
Z_NET_DEVICE_INIT_INSTANCE(node_id, \
|
||||||
Z_DEVICE_DT_DEV_NAME(node_id), \
|
Z_DEVICE_DT_DEV_NAME(node_id), \
|
||||||
DT_LABEL(node_id), instance, \
|
DT_LABEL(node_id), instance, \
|
||||||
pm_control_fn, data, cfg, prio, api, \
|
pm_control_cb, data, cfg, prio, api, \
|
||||||
l2, l2_ctx_type, mtu)
|
l2, l2_ctx_type, mtu)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -2415,10 +2415,10 @@ struct net_if_api {
|
||||||
NET_DEVICE_DT_DEFINE_INSTANCE(DT_DRV_INST(inst), __VA_ARGS__)
|
NET_DEVICE_DT_DEFINE_INSTANCE(DT_DRV_INST(inst), __VA_ARGS__)
|
||||||
|
|
||||||
#define Z_NET_DEVICE_OFFLOAD_INIT(node_id, dev_name, drv_name, init_fn, \
|
#define Z_NET_DEVICE_OFFLOAD_INIT(node_id, dev_name, drv_name, init_fn, \
|
||||||
pm_control_fn, data, cfg, prio, \
|
pm_control_cb, data, cfg, prio, \
|
||||||
api, mtu) \
|
api, mtu) \
|
||||||
Z_DEVICE_DEFINE(node_id, dev_name, drv_name, init_fn, \
|
Z_DEVICE_DEFINE(node_id, dev_name, drv_name, init_fn, \
|
||||||
pm_control_fn, data, cfg, POST_KERNEL, prio, api);\
|
pm_control_cb, data, cfg, POST_KERNEL, prio, api);\
|
||||||
NET_IF_OFFLOAD_INIT(dev_name, 0, mtu)
|
NET_IF_OFFLOAD_INIT(dev_name, 0, mtu)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -2432,7 +2432,7 @@ struct net_if_api {
|
||||||
* @param drv_name The name this instance of the driver exposes to
|
* @param drv_name The name this instance of the driver exposes to
|
||||||
* the system.
|
* the system.
|
||||||
* @param init_fn Address to the init function of the driver.
|
* @param init_fn Address to the init function of the driver.
|
||||||
* @param pm_control_fn Pointer to pm_control function.
|
* @param pm_control_cb Pointer to pm_control function.
|
||||||
* Can be NULL if not implemented.
|
* Can be NULL if not implemented.
|
||||||
* @param data Pointer to the device's private data.
|
* @param data Pointer to the device's private data.
|
||||||
* @param cfg The address to the structure containing the
|
* @param cfg The address to the structure containing the
|
||||||
|
|
@ -2443,9 +2443,9 @@ struct net_if_api {
|
||||||
* @param mtu Maximum transfer unit in bytes for this network interface.
|
* @param mtu Maximum transfer unit in bytes for this network interface.
|
||||||
*/
|
*/
|
||||||
#define NET_DEVICE_OFFLOAD_INIT(dev_name, drv_name, init_fn, \
|
#define NET_DEVICE_OFFLOAD_INIT(dev_name, drv_name, init_fn, \
|
||||||
pm_control_fn, data, cfg, prio, api, mtu)\
|
pm_control_cb, data, cfg, prio, api, mtu)\
|
||||||
Z_NET_DEVICE_OFFLOAD_INIT(DT_INVALID_NODE, dev_name, drv_name, \
|
Z_NET_DEVICE_OFFLOAD_INIT(DT_INVALID_NODE, dev_name, drv_name, \
|
||||||
init_fn, pm_control_fn, data, cfg, prio,\
|
init_fn, pm_control_cb, data, cfg, prio,\
|
||||||
api, mtu)
|
api, mtu)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -2458,7 +2458,7 @@ struct net_if_api {
|
||||||
*
|
*
|
||||||
* @param node_id The devicetree node identifier.
|
* @param node_id The devicetree node identifier.
|
||||||
* @param init_fn Address to the init function of the driver.
|
* @param init_fn Address to the init function of the driver.
|
||||||
* @param pm_control_fn Pointer to pm_control function.
|
* @param pm_control_cb Pointer to pm_control function.
|
||||||
* Can be NULL if not implemented.
|
* Can be NULL if not implemented.
|
||||||
* @param data Pointer to the device's private data.
|
* @param data Pointer to the device's private data.
|
||||||
* @param cfg The address to the structure containing the
|
* @param cfg The address to the structure containing the
|
||||||
|
|
@ -2468,11 +2468,11 @@ struct net_if_api {
|
||||||
* used by the driver. Can be NULL.
|
* used by the driver. Can be NULL.
|
||||||
* @param mtu Maximum transfer unit in bytes for this network interface.
|
* @param mtu Maximum transfer unit in bytes for this network interface.
|
||||||
*/
|
*/
|
||||||
#define NET_DEVICE_DT_OFFLOAD_DEFINE(node_id, init_fn, pm_control_fn, \
|
#define NET_DEVICE_DT_OFFLOAD_DEFINE(node_id, init_fn, pm_control_cb, \
|
||||||
data, cfg, prio, api, mtu) \
|
data, cfg, prio, api, mtu) \
|
||||||
Z_NET_DEVICE_OFFLOAD_INIT(node_id, Z_DEVICE_DT_DEV_NAME(node_id), \
|
Z_NET_DEVICE_OFFLOAD_INIT(node_id, Z_DEVICE_DT_DEV_NAME(node_id), \
|
||||||
DT_PROP_OR(node_id, label, NULL), \
|
DT_PROP_OR(node_id, label, NULL), \
|
||||||
init_fn, pm_control_fn, data, cfg, \
|
init_fn, pm_control_cb, data, cfg, \
|
||||||
prio, api, mtu)
|
prio, api, mtu)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -274,10 +274,10 @@ net_virtual_get_iface_capabilities(struct net_if *iface)
|
||||||
}
|
}
|
||||||
|
|
||||||
#define Z_NET_VIRTUAL_INTERFACE_INIT(node_id, dev_name, drv_name, \
|
#define Z_NET_VIRTUAL_INTERFACE_INIT(node_id, dev_name, drv_name, \
|
||||||
init_fn, pm_control_fn, data, cfg, \
|
init_fn, pm_control_cb, data, cfg, \
|
||||||
prio, api, mtu) \
|
prio, api, mtu) \
|
||||||
Z_NET_DEVICE_INIT(node_id, dev_name, drv_name, init_fn, \
|
Z_NET_DEVICE_INIT(node_id, dev_name, drv_name, init_fn, \
|
||||||
pm_control_fn, data, cfg, prio, api, \
|
pm_control_cb, data, cfg, prio, api, \
|
||||||
VIRTUAL_L2, NET_L2_GET_CTX_TYPE(VIRTUAL_L2), \
|
VIRTUAL_L2, NET_L2_GET_CTX_TYPE(VIRTUAL_L2), \
|
||||||
mtu)
|
mtu)
|
||||||
/** @endcond */
|
/** @endcond */
|
||||||
|
|
@ -294,7 +294,7 @@ net_virtual_get_iface_capabilities(struct net_if *iface)
|
||||||
* @param drv_name The name this instance of the driver exposes to
|
* @param drv_name The name this instance of the driver exposes to
|
||||||
* the system.
|
* the system.
|
||||||
* @param init_fn Address to the init function of the driver.
|
* @param init_fn Address to the init function of the driver.
|
||||||
* @param pm_control_fn Pointer to pm_control function.
|
* @param pm_control_cb Pointer to pm_control function.
|
||||||
* Can be NULL if not implemented.
|
* Can be NULL if not implemented.
|
||||||
* @param data Pointer to the device's private data.
|
* @param data Pointer to the device's private data.
|
||||||
* @param cfg The address to the structure containing the
|
* @param cfg The address to the structure containing the
|
||||||
|
|
@ -306,10 +306,10 @@ net_virtual_get_iface_capabilities(struct net_if *iface)
|
||||||
* This is the default value and its value can be tweaked at runtime.
|
* This is the default value and its value can be tweaked at runtime.
|
||||||
*/
|
*/
|
||||||
#define NET_VIRTUAL_INTERFACE_INIT(dev_name, drv_name, init_fn, \
|
#define NET_VIRTUAL_INTERFACE_INIT(dev_name, drv_name, init_fn, \
|
||||||
pm_control_fn, \
|
pm_control_cb, \
|
||||||
data, cfg, prio, api, mtu) \
|
data, cfg, prio, api, mtu) \
|
||||||
Z_NET_VIRTUAL_INTERFACE_INIT(DT_INVALID_NODE, dev_name, \
|
Z_NET_VIRTUAL_INTERFACE_INIT(DT_INVALID_NODE, dev_name, \
|
||||||
drv_name, init_fn, pm_control_fn, \
|
drv_name, init_fn, pm_control_cb, \
|
||||||
data, cfg, prio, api, mtu)
|
data, cfg, prio, api, mtu)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ enum pm_device_action {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Device power management control function callback.
|
* @brief Device PM action callback.
|
||||||
*
|
*
|
||||||
* @param dev Device instance.
|
* @param dev Device instance.
|
||||||
* @param action Requested action.
|
* @param action Requested action.
|
||||||
|
|
@ -92,7 +92,7 @@ enum pm_device_action {
|
||||||
* @retval -ENOTSUP If the requested action is not supported.
|
* @retval -ENOTSUP If the requested action is not supported.
|
||||||
* @retval Errno Other negative errno on failure.
|
* @retval Errno Other negative errno on failure.
|
||||||
*/
|
*/
|
||||||
typedef int (*pm_device_control_callback_t)(const struct device *dev,
|
typedef int (*pm_device_action_cb_t)(const struct device *dev,
|
||||||
enum pm_device_action action);
|
enum pm_device_action action);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -118,8 +118,8 @@ struct pm_device {
|
||||||
atomic_t flags;
|
atomic_t flags;
|
||||||
/** Device power state */
|
/** Device power state */
|
||||||
enum pm_device_state state;
|
enum pm_device_state state;
|
||||||
/** Device PM control callback */
|
/** Device PM action callback */
|
||||||
pm_device_control_callback_t pm_control;
|
pm_device_action_cb_t action_cb;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef CONFIG_PM_DEVICE_RUNTIME
|
#ifdef CONFIG_PM_DEVICE_RUNTIME
|
||||||
|
|
@ -139,12 +139,12 @@ struct pm_device {
|
||||||
*
|
*
|
||||||
* @param obj Name of the #pm_device structure being initialized.
|
* @param obj Name of the #pm_device structure being initialized.
|
||||||
* @param node_id Devicetree node for the initialized device (can be invalid).
|
* @param node_id Devicetree node for the initialized device (can be invalid).
|
||||||
* @param pm_control_fn Device PM control callback function.
|
* @param pm_action_cb Device PM control callback function.
|
||||||
*/
|
*/
|
||||||
#define Z_PM_DEVICE_INIT(obj, node_id, pm_control_fn) \
|
#define Z_PM_DEVICE_INIT(obj, node_id, pm_action_cb) \
|
||||||
{ \
|
{ \
|
||||||
INIT_PM_DEVICE_RUNTIME(obj) \
|
INIT_PM_DEVICE_RUNTIME(obj) \
|
||||||
.pm_control = pm_control_fn, \
|
.action_cb = pm_action_cb, \
|
||||||
.state = PM_DEVICE_STATE_ACTIVE, \
|
.state = PM_DEVICE_STATE_ACTIVE, \
|
||||||
.flags = ATOMIC_INIT(COND_CODE_1( \
|
.flags = ATOMIC_INIT(COND_CODE_1( \
|
||||||
DT_NODE_EXISTS(node_id), \
|
DT_NODE_EXISTS(node_id), \
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ int pm_device_state_set(const struct device *dev,
|
||||||
enum pm_device_action action;
|
enum pm_device_action action;
|
||||||
struct pm_device *pm = dev->pm;
|
struct pm_device *pm = dev->pm;
|
||||||
|
|
||||||
if (pm->pm_control == NULL) {
|
if (pm->action_cb == NULL) {
|
||||||
return -ENOSYS;
|
return -ENOSYS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -140,7 +140,7 @@ int pm_device_state_set(const struct device *dev,
|
||||||
return -ENOTSUP;
|
return -ENOTSUP;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = pm->pm_control(dev, action);
|
ret = pm->action_cb(dev, action);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
@ -155,7 +155,7 @@ int pm_device_state_get(const struct device *dev,
|
||||||
{
|
{
|
||||||
struct pm_device *pm = dev->pm;
|
struct pm_device *pm = dev->pm;
|
||||||
|
|
||||||
if (pm->pm_control == NULL) {
|
if (pm->action_cb == NULL) {
|
||||||
return -ENOSYS;
|
return -ENOSYS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -174,7 +174,7 @@ bool pm_device_is_any_busy(void)
|
||||||
for (const struct device *dev = devs; dev < (devs + devc); dev++) {
|
for (const struct device *dev = devs; dev < (devs + devc); dev++) {
|
||||||
struct pm_device *pm = dev->pm;
|
struct pm_device *pm = dev->pm;
|
||||||
|
|
||||||
if (pm->pm_control == NULL) {
|
if (pm->action_cb == NULL) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -190,7 +190,7 @@ bool pm_device_is_busy(const struct device *dev)
|
||||||
{
|
{
|
||||||
struct pm_device *pm = dev->pm;
|
struct pm_device *pm = dev->pm;
|
||||||
|
|
||||||
if (pm->pm_control == NULL) {
|
if (pm->action_cb == NULL) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -201,7 +201,7 @@ void pm_device_busy_set(const struct device *dev)
|
||||||
{
|
{
|
||||||
struct pm_device *pm = dev->pm;
|
struct pm_device *pm = dev->pm;
|
||||||
|
|
||||||
if (pm->pm_control == NULL) {
|
if (pm->action_cb == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -212,7 +212,7 @@ void pm_device_busy_clear(const struct device *dev)
|
||||||
{
|
{
|
||||||
struct pm_device *pm = dev->pm;
|
struct pm_device *pm = dev->pm;
|
||||||
|
|
||||||
if (pm->pm_control == NULL) {
|
if (pm->action_cb == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -224,7 +224,7 @@ bool pm_device_wakeup_enable(struct device *dev, bool enable)
|
||||||
atomic_val_t flags, new_flags;
|
atomic_val_t flags, new_flags;
|
||||||
struct pm_device *pm = dev->pm;
|
struct pm_device *pm = dev->pm;
|
||||||
|
|
||||||
if (pm->pm_control == NULL) {
|
if (pm->action_cb == NULL) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -248,7 +248,7 @@ bool pm_device_wakeup_is_enabled(const struct device *dev)
|
||||||
{
|
{
|
||||||
struct pm_device *pm = dev->pm;
|
struct pm_device *pm = dev->pm;
|
||||||
|
|
||||||
if (pm->pm_control == NULL) {
|
if (pm->action_cb == NULL) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -260,7 +260,7 @@ bool pm_device_wakeup_is_capable(const struct device *dev)
|
||||||
{
|
{
|
||||||
struct pm_device *pm = dev->pm;
|
struct pm_device *pm = dev->pm;
|
||||||
|
|
||||||
if (pm->pm_control == NULL) {
|
if (pm->action_cb == NULL) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -179,7 +179,7 @@ void pm_device_enable(const struct device *dev)
|
||||||
SYS_PORT_TRACING_FUNC_ENTER(pm, device_enable, dev);
|
SYS_PORT_TRACING_FUNC_ENTER(pm, device_enable, dev);
|
||||||
if (k_is_pre_kernel()) {
|
if (k_is_pre_kernel()) {
|
||||||
pm->dev = dev;
|
pm->dev = dev;
|
||||||
if (pm->pm_control != NULL) {
|
if (pm->action_cb != NULL) {
|
||||||
pm->enable = true;
|
pm->enable = true;
|
||||||
pm->state = PM_DEVICE_STATE_SUSPENDED;
|
pm->state = PM_DEVICE_STATE_SUSPENDED;
|
||||||
k_work_init_delayable(&pm->work, pm_work_handler);
|
k_work_init_delayable(&pm->work, pm_work_handler);
|
||||||
|
|
@ -188,7 +188,7 @@ void pm_device_enable(const struct device *dev)
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)k_mutex_lock(&pm->lock, K_FOREVER);
|
(void)k_mutex_lock(&pm->lock, K_FOREVER);
|
||||||
if (pm->pm_control == NULL) {
|
if (pm->action_cb == NULL) {
|
||||||
pm->enable = false;
|
pm->enable = false;
|
||||||
goto out_unlock;
|
goto out_unlock;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue