Commit 59093ff2 authored by Bjarki Arge Andreasen's avatar Bjarki Arge Andreasen Committed by Henrik Brix Andersen
Browse files

tests: pm: device_runtime_api: add retval to test_driver



Add API to configure the return value of pm actions of the
test_driver used by the device_runtime_api test suite.

Signed-off-by: default avatarBjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
parent f62bf95d
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@ struct test_driver_data {
	bool ongoing;
	bool async;
	struct k_sem sync;
	int ret;
};

static int test_driver_action(const struct device *dev,
@@ -34,7 +35,7 @@ static int test_driver_action(const struct device *dev,

	data->count++;

	return 0;
	return data->ret;
}

void test_driver_pm_async(const struct device *dev)
@@ -65,6 +66,13 @@ size_t test_driver_pm_count(const struct device *dev)
	return data->count;
}

void test_driver_pm_retval(const struct device *dev, int ret)
{
	struct test_driver_data *data = dev->data;

	data->ret = ret;
}

int test_driver_init(const struct device *dev)
{
	struct test_driver_data *data = dev->data;
+9 −0
Original line number Diff line number Diff line
@@ -45,4 +45,13 @@ bool test_driver_pm_ongoing(const struct device *dev);
 */
size_t test_driver_pm_count(const struct device *dev);

/**
 * @brief Configure the return value of pm actions.
 *
 * @param dev Device instance.
 *
 * @return The number of state changes the device made.
 */
void test_driver_pm_retval(const struct device *dev, int ret);

#endif /* TESTS_SUBSYS_PM_DEVICE_RUNTIME_TEST_DRIVER_H_ */