Skip to content

Commit

Permalink
drivers: stepper: Fix missing _driver_api suffix
Browse files Browse the repository at this point in the history
The gen_kobject_list.py script expects the __subystem declaration to end
with _driver_api. Adjust the stepper api and existing driver implementation
accordingly.

Signed-off-by: Fabian Blatz <[email protected]>
  • Loading branch information
faxe1008 authored and carlescufi committed Aug 29, 2024
1 parent 59685b5 commit 6ae753f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion drivers/stepper/gpio_stepper_controller.c
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ static int gpio_stepper_motor_controller_init(const struct device *dev)
.control_pins = gpio_stepper_motor_control_pins_##child};

#define GPIO_STEPPER_API_DEFINE(child) \
static const struct stepper_api gpio_stepper_api_##child = { \
static const struct stepper_driver_api gpio_stepper_api_##child = { \
.enable = gpio_stepper_enable, \
.move = gpio_stepper_move, \
.is_moving = gpio_stepper_is_moving, \
Expand Down
22 changes: 11 additions & 11 deletions include/zephyr/drivers/stepper.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ typedef int (*stepper_enable_constant_velocity_mode_t)(const struct device *dev,
/**
* @brief Stepper Motor Controller API
*/
__subsystem struct stepper_api {
__subsystem struct stepper_driver_api {
stepper_enable_t enable;
stepper_move_t move;
stepper_set_max_velocity_t set_max_velocity;
Expand Down Expand Up @@ -198,7 +198,7 @@ __syscall int stepper_enable(const struct device *dev, const bool enable);

static inline int z_impl_stepper_enable(const struct device *dev, const bool enable)
{
const struct stepper_api *api = (const struct stepper_api *)dev->api;
const struct stepper_driver_api *api = (const struct stepper_driver_api *)dev->api;

return api->enable(dev, enable);
}
Expand All @@ -222,7 +222,7 @@ __syscall int stepper_move(const struct device *dev, int32_t micro_steps,
static inline int z_impl_stepper_move(const struct device *dev, const int32_t micro_steps,
struct k_poll_signal *async)
{
const struct stepper_api *api = (const struct stepper_api *)dev->api;
const struct stepper_driver_api *api = (const struct stepper_driver_api *)dev->api;

return api->move(dev, micro_steps, async);
}
Expand All @@ -248,7 +248,7 @@ __syscall int stepper_set_max_velocity(const struct device *dev, uint32_t micro_
static inline int z_impl_stepper_set_max_velocity(const struct device *dev,
const uint32_t micro_steps_per_second)
{
const struct stepper_api *api = (const struct stepper_api *)dev->api;
const struct stepper_driver_api *api = (const struct stepper_driver_api *)dev->api;

return api->set_max_velocity(dev, micro_steps_per_second);
}
Expand All @@ -270,7 +270,7 @@ __syscall int stepper_set_micro_step_res(const struct device *dev,
static inline int z_impl_stepper_set_micro_step_res(const struct device *dev,
enum micro_step_resolution resolution)
{
const struct stepper_api *api = (const struct stepper_api *)dev->api;
const struct stepper_driver_api *api = (const struct stepper_driver_api *)dev->api;

if (api->set_micro_step_res == NULL) {
return -ENOSYS;
Expand All @@ -294,7 +294,7 @@ __syscall int stepper_get_micro_step_res(const struct device *dev,
static inline int z_impl_stepper_get_micro_step_res(const struct device *dev,
enum micro_step_resolution *resolution)
{
const struct stepper_api *api = (const struct stepper_api *)dev->api;
const struct stepper_driver_api *api = (const struct stepper_driver_api *)dev->api;

if (api->get_micro_step_res == NULL) {
return -ENOSYS;
Expand All @@ -316,7 +316,7 @@ __syscall int stepper_set_actual_position(const struct device *dev, int32_t valu

static inline int z_impl_stepper_set_actual_position(const struct device *dev, const int32_t value)
{
const struct stepper_api *api = (const struct stepper_api *)dev->api;
const struct stepper_driver_api *api = (const struct stepper_driver_api *)dev->api;

if (api->set_actual_position == NULL) {
return -ENOSYS;
Expand All @@ -338,7 +338,7 @@ __syscall int stepper_get_actual_position(const struct device *dev, int32_t *val

static inline int z_impl_stepper_get_actual_position(const struct device *dev, int32_t *value)
{
const struct stepper_api *api = (const struct stepper_api *)dev->api;
const struct stepper_driver_api *api = (const struct stepper_driver_api *)dev->api;

if (api->get_actual_position == NULL) {
return -ENOSYS;
Expand Down Expand Up @@ -366,7 +366,7 @@ __syscall int stepper_set_target_position(const struct device *dev, int32_t valu
static inline int z_impl_stepper_set_target_position(const struct device *dev, const int32_t value,
struct k_poll_signal *async)
{
const struct stepper_api *api = (const struct stepper_api *)dev->api;
const struct stepper_driver_api *api = (const struct stepper_driver_api *)dev->api;

if (api->set_target_position == NULL) {
return -ENOSYS;
Expand All @@ -388,7 +388,7 @@ __syscall int stepper_is_moving(const struct device *dev, bool *is_moving);

static inline int z_impl_stepper_is_moving(const struct device *dev, bool *is_moving)
{
const struct stepper_api *api = (const struct stepper_api *)dev->api;
const struct stepper_driver_api *api = (const struct stepper_driver_api *)dev->api;

if (api->is_moving == NULL) {
return -ENOSYS;
Expand Down Expand Up @@ -421,7 +421,7 @@ __syscall int stepper_enable_constant_velocity_mode(const struct device *dev,
static inline int z_impl_stepper_enable_constant_velocity_mode(
const struct device *dev, const enum stepper_direction direction, const uint32_t value)
{
const struct stepper_api *api = (const struct stepper_api *)dev->api;
const struct stepper_driver_api *api = (const struct stepper_driver_api *)dev->api;

if (api->enable_constant_velocity_mode == NULL) {
return -ENOSYS;
Expand Down

0 comments on commit 6ae753f

Please sign in to comment.