Skip to content

Commit b642925

Browse files
bjarki-andreasenkartben
authored andcommitted
pm: policy: fix mocks of CONFIG_PM_POLICY_DEVICE_CONSTRAINTS
The APIs pm_policy_device_power_lock_get and pm_policy_device_power_lock_put are not mocked properly as they should be excluded based on CONFIG_PM_POLICY_DEVICE_CONSTRAINTS, not CONFIG_PM. Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
1 parent 706b7e9 commit b642925

File tree

1 file changed

+37
-33
lines changed

1 file changed

+37
-33
lines changed

include/zephyr/pm/policy.h

Lines changed: 37 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -204,32 +204,6 @@ void pm_policy_event_update(struct pm_policy_event *evt, int64_t uptime_ticks);
204204
*/
205205
void pm_policy_event_unregister(struct pm_policy_event *evt);
206206

207-
/**
208-
* @brief Increase power state locks.
209-
*
210-
* Set power state locks in all power states that disable power in the given
211-
* device.
212-
*
213-
* @param dev Device reference.
214-
*
215-
* @see pm_policy_device_power_lock_put()
216-
* @see pm_policy_state_lock_get()
217-
*/
218-
void pm_policy_device_power_lock_get(const struct device *dev);
219-
220-
/**
221-
* @brief Decrease power state locks.
222-
*
223-
* Remove power state locks in all power states that disable power in the given
224-
* device.
225-
*
226-
* @param dev Device reference.
227-
*
228-
* @see pm_policy_device_power_lock_get()
229-
* @see pm_policy_state_lock_put()
230-
*/
231-
void pm_policy_device_power_lock_put(const struct device *dev);
232-
233207
/**
234208
* @brief Check if a state will disable a device
235209
*
@@ -295,22 +269,52 @@ static inline void pm_policy_event_unregister(struct pm_policy_event *evt)
295269
ARG_UNUSED(evt);
296270
}
297271

298-
static inline void pm_policy_device_power_lock_get(const struct device *dev)
272+
static inline int64_t pm_policy_next_event_ticks(void)
299273
{
300-
ARG_UNUSED(dev);
274+
return -1;
301275
}
302276

303-
static inline void pm_policy_device_power_lock_put(const struct device *dev)
277+
#endif /* CONFIG_PM */
278+
279+
#if defined(CONFIG_PM_POLICY_DEVICE_CONSTRAINTS) || defined(__DOXYGEN__)
280+
/**
281+
* @brief Increase power state locks.
282+
*
283+
* Set power state locks in all power states that disable power in the given
284+
* device.
285+
*
286+
* @param dev Device reference.
287+
*
288+
* @see pm_policy_device_power_lock_put()
289+
* @see pm_policy_state_lock_get()
290+
*/
291+
void pm_policy_device_power_lock_get(const struct device *dev);
292+
293+
/**
294+
* @brief Decrease power state locks.
295+
*
296+
* Remove power state locks in all power states that disable power in the given
297+
* device.
298+
*
299+
* @param dev Device reference.
300+
*
301+
* @see pm_policy_device_power_lock_get()
302+
* @see pm_policy_state_lock_put()
303+
*/
304+
void pm_policy_device_power_lock_put(const struct device *dev);
305+
306+
#else
307+
308+
static inline void pm_policy_device_power_lock_get(const struct device *dev)
304309
{
305310
ARG_UNUSED(dev);
306311
}
307312

308-
static inline int64_t pm_policy_next_event_ticks(void)
313+
static inline void pm_policy_device_power_lock_put(const struct device *dev)
309314
{
310-
return -1;
315+
ARG_UNUSED(dev);
311316
}
312-
313-
#endif /* CONFIG_PM */
317+
#endif /* CONFIG_PM_POLICY_DEVICE_CONSTRAINTS */
314318

315319
#if defined(CONFIG_PM) || defined(CONFIG_PM_POLICY_LATENCY_STANDALONE) || defined(__DOXYGEN__)
316320
/**

0 commit comments

Comments
 (0)