From: Johannes Berg <johannes@sipsolutions.net>
To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Cc: Al Viro <viro@zeniv.linux.org.uk>,
Andy Shevchenko <andy.shevchenko@gmail.com>
Subject: [PATCH v4 2/3] bitfield: add u8 helpers
Date: Mon, 18 Jun 2018 22:37:49 +0200 [thread overview]
Message-ID: <20180618203750.28658-2-johannes@sipsolutions.net> (raw)
In-Reply-To: <20180618203750.28658-1-johannes@sipsolutions.net>
There's no reason why we shouldn't pack/unpack bits into/from
u8 values/registers/etc., so add u8 helpers.
Use the ____MAKE_OP() macro directly to avoid having nonsense
le8_encode_bits() and similar functions.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
include/linux/bitfield.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/linux/bitfield.h b/include/linux/bitfield.h
index 147a7bb341dd..65a6981eef7b 100644
--- a/include/linux/bitfield.h
+++ b/include/linux/bitfield.h
@@ -143,6 +143,7 @@ static __always_inline base type##_get_bits(__##type v, base field) \
____MAKE_OP(le##size,u##size,cpu_to_le##size,le##size##_to_cpu) \
____MAKE_OP(be##size,u##size,cpu_to_be##size,be##size##_to_cpu) \
____MAKE_OP(u##size,u##size,,)
+____MAKE_OP(u8,u8,,)
__MAKE_OP(16)
__MAKE_OP(32)
__MAKE_OP(64)
--
2.14.4
next prev parent reply other threads:[~2018-06-18 20:38 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-18 20:37 [PATCH v4 1/3] bitfield: fix *_encode_bits() Johannes Berg
2018-06-18 20:37 ` Johannes Berg [this message]
2018-06-18 20:42 ` [PATCH v4 2/3] bitfield: add u8 helpers Andy Shevchenko
2018-06-18 20:37 ` [PATCH v4 3/3] bitfield: add tests Johannes Berg
2018-06-18 20:44 ` Andy Shevchenko
2018-06-18 20:47 ` Johannes Berg
2018-06-18 20:41 ` [PATCH v4 1/3] bitfield: fix *_encode_bits() Andy Shevchenko
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=20180618203750.28658-2-johannes@sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=andy.shevchenko@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).