drivers: sensor: add const qualifier to conversion

sensor_value_to_double should never alter the given value of val.
Therefore adding a const qualifier makes sense.

Signed-off-by: Jonathan Hahn <Jonathan.Hahn@t-online.de>
This commit is contained in:
Jonathan Hahn 2021-07-19 13:54:44 +02:00 committed by Anas Nashif
parent 25ebb42bd9
commit 7346ba0106

View file

@ -643,7 +643,7 @@ static inline void sensor_degrees_to_rad(int32_t d, struct sensor_value *rad)
* @param val A pointer to a sensor_value struct.
* @return The converted value.
*/
static inline double sensor_value_to_double(struct sensor_value *val)
static inline double sensor_value_to_double(const struct sensor_value *val)
{
return (double)val->val1 + (double)val->val2 / 1000000;
}