Backport new field_prep()/get() particularly useful to handle case where a bitmask is not const and FIELD_PREP can't be used. This permit to replace manual shift with these macro. (also needed to permit backport of some patch without modification) Backport reworked patch that drop the local field_prep()/get() macro in favor of the global one. Link: https://github.com/openwrt/openwrt/pull/22479 Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
38 lines
1.4 KiB
Diff
38 lines
1.4 KiB
Diff
From 1fe1c28a108e4953f083c0106575ee0eccc296ae Mon Sep 17 00:00:00 2001
|
|
From: Geert Uytterhoeven <geert+renesas@glider.be>
|
|
Date: Thu, 6 Nov 2025 14:34:07 +0100
|
|
Subject: [PATCH] iio: mlx90614: Convert to common field_{get,prep}() helpers
|
|
|
|
Drop the driver-specific field_get() and field_prep() macros, in favor
|
|
of the globally available variants from <linux/bitfield.h>.
|
|
|
|
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
|
|
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
Acked-by: Crt Mori <cmo@melexis.com>
|
|
Signed-off-by: Yury Norov (NVIDIA) <yury.norov@gmail.com>
|
|
---
|
|
drivers/iio/temperature/mlx90614.c | 7 +------
|
|
1 file changed, 1 insertion(+), 6 deletions(-)
|
|
|
|
--- a/drivers/iio/temperature/mlx90614.c
|
|
+++ b/drivers/iio/temperature/mlx90614.c
|
|
@@ -22,6 +22,7 @@
|
|
* the "wakeup" GPIO is not given, power management will be disabled.
|
|
*/
|
|
|
|
+#include <linux/bitfield.h>
|
|
#include <linux/delay.h>
|
|
#include <linux/err.h>
|
|
#include <linux/gpio/consumer.h>
|
|
@@ -68,10 +69,6 @@
|
|
#define MLX90614_CONST_SCALE 20 /* Scale in milliKelvin (0.02 * 1000) */
|
|
#define MLX90614_CONST_FIR 0x7 /* Fixed value for FIR part of low pass filter */
|
|
|
|
-/* Non-constant mask variant of FIELD_GET() and FIELD_PREP() */
|
|
-#define field_get(_mask, _reg) (((_reg) & (_mask)) >> (ffs(_mask) - 1))
|
|
-#define field_prep(_mask, _val) (((_val) << (ffs(_mask) - 1)) & (_mask))
|
|
-
|
|
struct mlx_chip_info {
|
|
/* EEPROM offsets with 16-bit data, MSB first */
|
|
/* emissivity correction coefficient */
|