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

RFC: API change: clock_control: Change parameters of clock_control_async_on #27423

Closed
nordic-krch opened this issue Aug 7, 2020 · 1 comment · Fixed by #29114
Closed

RFC: API change: clock_control: Change parameters of clock_control_async_on #27423

nordic-krch opened this issue Aug 7, 2020 · 1 comment · Fixed by #29114
Assignees
Labels
area: Clock Control Breaking API Change Breaking changes to stable, public APIs RFC Request For Comments: want input from the community

Comments

@nordic-krch
Copy link
Contributor

Problem Description

clock_control_async_on initiates asynchronous start of the clock. It was initially introduced mainly to cover Nordic case were there are multiple users of one clock willing to start a clock asynchronously. Function takes struct clock_control_async_data as the parameter which consists of callback, user_data and list node. Structure can be linked by the driver to support multiple requests. Because of that, API requires that structure is valid until clock is started and callback is executed.

Asynchronous clock start was added to cover Nordic case and currently isn't used by any other implementation. On the other hand, API does not mention reference counting which was implicitly implemented in the Nordic clock control driver which lead to the confusion (see #20806).

Meanwhile onoff_manager was added to handle multiple users of the single resource in a generic way and Nordic clock control driver was adapted to use it (#24334). Once it was merged, Nordic clock control driver does use reference counting thus does not require enqueueing asynchronous requests since there is only one clock user (onoff manager). Since no other driver is using it and there is a model in place for multiple users (accessing clock through onoff API) having struct clock_control_async_data became redundant and confusing.

Proposed change

Remove linked structure and any notion of support for multiple users of the single clock source.

Detailed RFC

Convert

struct clock_control_async_data {
       sys_snode_t node;
       clock_control_cb_t cb;
       void *user_data;
};

clock_control_async_on(struct device *dev, clock_control_subsys_t sys, struct clock_control_async_data *data)

to

clock_control_async_on(struct device *dev, clock_control_subsys_t sys, clock_control_cb_t cb, void *user_data)

Dependencies

Only Nordic driver was implementing that API.

@nordic-krch nordic-krch added RFC Request For Comments: want input from the community area: Clock Control Breaking API Change Breaking changes to stable, public APIs labels Aug 7, 2020
@nordic-krch nordic-krch self-assigned this Aug 7, 2020
@carlescufi
Copy link
Member

API Meeting 13th October:

  • No objections to the change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Clock Control Breaking API Change Breaking changes to stable, public APIs RFC Request For Comments: want input from the community
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants