Hi all,
After merging the iio tree, today's linux-next build (x86_64
allmodconfig) failed like this:
/tmp/next/build/drivers/iio/adc/ad7768.c:470:12: error: call to undeclared function 'be16_replace_bits'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
470 | st->d16 = be16_replace_bits(cpu_to_be16(AD7768_SPI_READ_CMD), reg,
| ^
due to commit
508bdb4938928 ("iio: adc: Add AD7768 and AD7768-4 core support")
interacting with
1c88ceb09d5e5 ("bitfield: get rid of __MAKE_OP machinery")
from the bitmap tree, that removed a bunch of function including
be16_replace_bits() which had no in kernel users but the new driver adds
a user. I have applied the fixup below (which I'll send a a proper
patch shortly) and can carry as required.
From 8eac82a4d67b29972540fdbf603768f222f870ea Mon Sep 17 00:00:00 2001
From: Mark Brown <broonie@kernel.org>
Date: Wed, 23 Sep 2026 22:49:22 +0100
Subject: [PATCH] bitfield: Restore be16_replace_bits()
Commit 1c88ceb09d5e5 ("bitfield: get rid of __MAKE_OP machinery")
removed a bunch of unused bitfield operations including
be16_replace_bits() but commit 508bdb4938928 ("iio: adc: Add AD7768 and
AD7768-4 core support") introduces a new user. Restore the function so
the build still works once both branches are merged.
Signed-off-by: Mark Brown <broonie@kernel.org>
---
include/linux/bitfield-fix-width.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/include/linux/bitfield-fix-width.h b/include/linux/bitfield-fix-width.h
index fba86bb76999f..f73b8cd656010 100644
--- a/include/linux/bitfield-fix-width.h
+++ b/include/linux/bitfield-fix-width.h
@@ -93,6 +93,12 @@ u16 be16_get_bits(__be16 v, u16 field)
return (be16_to_cpu(v) & field) / field_multiplier(field);
}
+static __always_inline __must_check
+__be16 be16_replace_bits(__be16 old, u16 val, u16 field)
+{
+ return (old & ~cpu_to_be16(field)) | be16_encode_bits(val, field);
+}
+
static __always_inline __must_check
__u16 u16_encode_bits(u16 v, u16 field)
{
--
2.47.3