All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Yury Norov <yury.norov@gmail.com>,
	 Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Janani Sunil <janani.sunil@analog.com>,
	 Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>,
	 linux-kernel@vger.kernel.org, Mark Brown <broonie@kernel.org>
Subject: [PATCH] bitfield: Restore be16_replace_bits()
Date: Wed, 23 Sep 2026 23:09:53 +0100	[thread overview]
Message-ID: <20260923-bitfield-be16_replace_bits-v1-1-71b6388b8385@kernel.org> (raw)

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 fba86bb76999..f73b8cd65601 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)
 {

---
base-commit: 1c88ceb09d5e5506456a625043bc9b35ce86fc41
change-id: 20260923-bitfield-be16_replace_bits-1d6c48fb608b

Best regards,
--  
Mark Brown <broonie@kernel.org>


             reply	other threads:[~2026-09-23 22:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-23 22:09 Mark Brown [this message]
2026-09-23 22:20 ` [PATCH] bitfield: Restore be16_replace_bits() Yury Norov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260923-bitfield-be16_replace_bits-v1-1-71b6388b8385@kernel.org \
    --to=broonie@kernel.org \
    --cc=janani.sunil@analog.com \
    --cc=jonathan.cameron@oss.qualcomm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=yury.norov@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.