pm: device: runtime: remove pm_device_get_async

As of today there is no clear usage of asynchronous gets, since in
general, a resume operation should be synchronous (we are about to use
the device immediately after resuming it). Removing this API simplifies
the runtime implementation in a significant way (refer to future
commits).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
Gerard Marull-Paretas 2021-10-21 18:27:43 +02:00 committed by Christopher Friedt
parent 8dd018ba85
commit 30d217aa28
6 changed files with 3 additions and 48 deletions

View file

@ -451,21 +451,6 @@ Disable Device Runtime Power Management of a Device API
Disables Runtime Power Management of the device.
Resume Device asynchronously API
--------------------------------
.. code-block:: c
int pm_device_get_async(const struct device *dev);
Marks the device as being used. This API will asynchronously
bring the device to resume state if it was suspended. If the device
was already active, it just increments the device usage count.
The API returns 0 on success.
Device drivers can monitor this operation to finish calling
:c:func:`pm_device_wait`.
Resume Device synchronously API
-------------------------------

View file

@ -908,7 +908,7 @@ Libraries / Subsystems
* Device runtime power management (PM), former IDLE runtime, was
completely overhauled.
* Multiple threads can wait an operation (:c:func:`pm_device_get_async` and
* Multiple threads can wait an operation (``pm_device_get_async`` and
:c:func:`pm_device_put_async`) to finish.
* A new API :c:func:`pm_device_wait` was added so that drivers can easily
wait for an async request to finish.

View file

@ -52,24 +52,6 @@ void pm_device_enable(const struct device *dev);
*/
void pm_device_disable(const struct device *dev);
/**
* @brief Call device resume asynchronously based on usage count
*
* Called by a device driver to mark the device as being used.
* This API will asynchronously bring the device to resume state
* if it not already in active state.
*
* @funcprops \isr_ok, \pre_kernel_ok
*
* @param dev Pointer to device structure of the specific device driver
* the caller is interested in.
* @retval 0 If successfully queued the Async request. If queued,
* the caller need to wait on the poll event linked to device
* pm signal mechanism to know the completion of resume operation.
* @retval Errno Negative errno code if failure.
*/
int pm_device_get_async(const struct device *dev);
/**
* @brief Call device resume synchronously based on usage count
*

View file

@ -24,13 +24,6 @@ static int dummy_open(const struct device *dev)
return ret;
}
ret = pm_device_get_async(dev);
if (ret < 0) {
return ret;
}
printk("Async wakeup request queued\n");
(void) pm_device_wait(dev, K_FOREVER);
(void)pm_device_state_get(dev, &state);

View file

@ -156,11 +156,6 @@ int pm_device_get(const struct device *dev)
return pm_device_request(dev, PM_DEVICE_STATE_ACTIVE, 0);
}
int pm_device_get_async(const struct device *dev)
{
return pm_device_request(dev, PM_DEVICE_STATE_ACTIVE, PM_DEVICE_ASYNC);
}
int pm_device_put(const struct device *dev)
{
return pm_device_request(dev, PM_DEVICE_STATE_SUSPENDED, 0);

View file

@ -162,12 +162,12 @@ void test_power_state_trans(void)
* @brief notification between system and device
*
* @details
* - device driver notify its power state change by pm_device_get_async and
* - device driver notify its power state change by pm_device_get and
* pm_device_put_async
* - system inform device system power state change through device interface
* pm_control
*
* @see pm_device_get_async(), pm_device_put_async(), pm_device_state_set(),
* @see pm_device_get(), pm_device_put_async(), pm_device_state_set(),
* pm_device_state_get()
*
* @ingroup power_tests