[PATCH v2 4/6] iio: cros_ec_sensors: Convert to use PI definition

From: Andy Shevchenko

Date: Fri Nov 07 2025 - 15:10:14 EST


Convert to use PI definition instead of open coded value of it.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
---
drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c
index 82cef4a12442..e248ba1eb3f9 100644
--- a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c
+++ b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c
@@ -21,6 +21,7 @@
#include <linux/platform_data/cros_ec_commands.h>
#include <linux/platform_data/cros_ec_proto.h>
#include <linux/platform_device.h>
+#include <linux/units.h>
#include <linux/slab.h>

#define CROS_EC_SENSORS_MAX_CHANNELS 4
@@ -120,7 +121,7 @@ static int cros_ec_sensors_read(struct iio_dev *indio_dev,
* loss. Round to the nearest integer.
*/
*val = 0;
- *val2 = div_s64(val64 * 3141592653ULL,
+ *val2 = div_s64(val64 * DIV_ROUND_UP_ULL(PI_LL, GIGA),
180 << (CROS_EC_SENSOR_BITS - 1));
ret = IIO_VAL_INT_PLUS_NANO;
break;
--
2.50.1