sensor.h "error: invalid conversion from ..."

Paul ADAM <paul.adam@...>

when I am compiling sensor.h in a cpp file, I have following error 5 times:

/home/.../zephyr/include/sensor.h: In function ‘int sensor_trigger_set(device*, sensor_trigger*, sensor_trigger_handler_t)’:
/home/.../zephyr/include/sensor.h:339:45: error: invalid conversion from ‘const void*’ to ‘const sensor_driver_api*’ [-fpermissive]
  const struct sensor_driver_api *api = dev->driver_api;

The solution (if I do not want to let the compiler be more permissive) is to change the code like this:

    const struct sensor_driver_api *api = ( const struct sensor_driver_api * ) dev->driver_api;

What do you think about? Is there another solution?
I was told that this explicit conversion is required by MISRA-C standard. Do you confirm?
Should I do a git pull request? Or can someone modify the code in the repository?

Best regards

Join to automatically receive all group messages.