Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

include: clock_control: Fix int return value #32386

Conversation

alexanderwachter
Copy link
Member

@alexanderwachter alexanderwachter commented Feb 17, 2021

The return value of clock_control_get_status is a clock_control_status
enum, but in case the device is not ready, an int is returned.
This leads to compiler errors. Introduced a new enum value
CLOCK_CONTROL_STATUS_UNAVAILABLE and return it instead of -ENODEV.

Fixes #32385

The return value of clock_control_get_status is a clock_control_status
enum, but in case the device is not ready, an int is returned.
This leads to compiler errors. Introduced a new enum value
CLOCK_CONTROL_STATUS_UNAVAILABLE and return it instead of -ENODEV.

Signed-off-by: Alexander Wachter <[email protected]>
@alexanderwachter
Copy link
Member Author

Alternative:

enum clock_control_status {
	CLOCK_CONTROL_STATUS_STARTING = 0,
	CLOCK_CONTROL_STATUS_OFF = 1,
	CLOCK_CONTROL_STATUS_ON = 2,
	CLOCK_CONTROL_STATUS_UNKNOWN	= 3,
	CLOCK_CONTROL_STATUS_UNAVAILABLE = -ENODEV,
};

@carlescufi carlescufi merged commit 9a5525c into zephyrproject-rtos:master Feb 17, 2021
@alexanderwachter alexanderwachter deleted the CLOCK_CONTROL/enum_ret_val branch February 17, 2021 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: API Changes to public APIs area: Clock Control bug The issue is a bug, or the PR is fixing a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

clock_control: int is returned on enum return value
4 participants