public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 1/1] bitfield: Add explicit inclusions to the example
@ 2022-02-07 11:38 Andy Shevchenko
  0 siblings, 0 replies; only message in thread
From: Andy Shevchenko @ 2022-02-07 11:38 UTC (permalink / raw)
  To: Peter Zijlstra, linux-kernel
  Cc: Andrew Morton, Andy Shevchenko, Jan Dąbroś

It's not obvious that bitfield.h doesn't guarantee the bits.h
inclusion and the example in the former is confusing. Some
developers think that it's okay to just include bitfield.h to
get it working. Change example to explicitly include necessary
headers in order to avoid confusion.

Fixes: 3e9b3112ec74 ("add basic register-field manipulation macros")
Depends-on: 8bd9cb51daac ("locking/atomics, asm-generic: Move some macros from <linux/bitops.h> to a new <linux/bits.h> file")
Reported-by: Jan Dąbroś <jsd@semihalf.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 include/linux/bitfield.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/linux/bitfield.h b/include/linux/bitfield.h
index 6093fa6db260..ee433c60ee1b 100644
--- a/include/linux/bitfield.h
+++ b/include/linux/bitfield.h
@@ -19,6 +19,9 @@
  *
  * Example:
  *
+ *  #include <bitfield.h>
+ *  #include <bits.h>
+ *
  *  #define REG_FIELD_A  GENMASK(6, 0)
  *  #define REG_FIELD_B  BIT(7)
  *  #define REG_FIELD_C  GENMASK(15, 8)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-02-07 12:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-07 11:38 [PATCH v1 1/1] bitfield: Add explicit inclusions to the example Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox