The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH 0/2] staging: comedi: comedi.h: Avoid BIT macro
@ 2016-03-02 14:27 Ian Abbott
  2016-03-02 14:27 ` [PATCH 1/2] staging: comedi: comedi.h: Do not use " Ian Abbott
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Ian Abbott @ 2016-03-02 14:27 UTC (permalink / raw)
  To: devel; +Cc: Greg Kroah-Hartman, Ian Abbott, H Hartley Sweeten, linux-kernel

Patch 1 effectively reverts commit 72315cdaba9d on linux-next "Staging:
comedi: Prefer using the BIT macro"), but I replaced the use of the BIT
macro with hexadecimal constants instead of the original left bit-shift
expressions.  We shouldn't use the BIT macro in "comedi.h" as it is
intended to be included in the UAPI headers.

Patch 2 just fixes the kernel-doc comment for struct comedi_krange.

1) staging: comedi: comedi.h: Do not use BIT macro
2) staging: comedi: comedi.h: Fix comment for struct comedi_krange

 drivers/staging/comedi/comedi.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] staging: comedi: comedi.h: Do not use BIT macro
  2016-03-02 14:27 [PATCH 0/2] staging: comedi: comedi.h: Avoid BIT macro Ian Abbott
@ 2016-03-02 14:27 ` Ian Abbott
  2016-03-02 14:27 ` [PATCH 2/2] staging: comedi: comedi.h: Fix comment for struct comedi_krange Ian Abbott
  2016-03-02 16:21 ` [PATCH 0/2] staging: comedi: comedi.h: Avoid BIT macro Hartley Sweeten
  2 siblings, 0 replies; 4+ messages in thread
From: Ian Abbott @ 2016-03-02 14:27 UTC (permalink / raw)
  To: devel; +Cc: Greg Kroah-Hartman, Ian Abbott, H Hartley Sweeten, linux-kernel

The "comedi.h" file is part of the user API for COMEDI devices, and is
intended to be migrated to "include/uapi/linux".  The `BIT` macro from
"include/linux/bitops.h" should not be used there.

Replace the use of the `BIT` macro with hexadecimal constants of the
same value.  The `BIT` macro replaced expressions of the form `(1 << N)`
in this file originally, but reverting back to that form would encourage
patches changing them back to use the `BIT` macro.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
---
 drivers/staging/comedi/comedi.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/comedi/comedi.h b/drivers/staging/comedi/comedi.h
index f1415cb..9547324 100644
--- a/drivers/staging/comedi/comedi.h
+++ b/drivers/staging/comedi/comedi.h
@@ -72,12 +72,12 @@
 #define CR_AREF(a)	(((a) >> 24) & 0x03)
 
 #define CR_FLAGS_MASK	0xfc000000
-#define CR_ALT_FILTER	BIT(26)
+#define CR_ALT_FILTER	0x04000000
 #define CR_DITHER	CR_ALT_FILTER
 #define CR_DEGLITCH	CR_ALT_FILTER
-#define CR_ALT_SOURCE	BIT(27)
-#define CR_EDGE		BIT(30)
-#define CR_INVERT	BIT(31)
+#define CR_ALT_SOURCE	0x08000000
+#define CR_EDGE		0x40000000
+#define CR_INVERT	0x80000000
 
 #define AREF_GROUND	0x00	/* analog ref = analog ground */
 #define AREF_COMMON	0x01	/* analog ref = analog common */
@@ -894,7 +894,7 @@ struct comedi_bufinfo {
 #define RANGE_LENGTH(b)		((b) & 0xffff)
 
 #define RF_UNIT(flags)		((flags) & 0xff)
-#define RF_EXTERNAL		BIT(8)
+#define RF_EXTERNAL		0x100
 
 #define UNIT_volt		0
 #define UNIT_mA			1
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] staging: comedi: comedi.h: Fix comment for struct comedi_krange
  2016-03-02 14:27 [PATCH 0/2] staging: comedi: comedi.h: Avoid BIT macro Ian Abbott
  2016-03-02 14:27 ` [PATCH 1/2] staging: comedi: comedi.h: Do not use " Ian Abbott
@ 2016-03-02 14:27 ` Ian Abbott
  2016-03-02 16:21 ` [PATCH 0/2] staging: comedi: comedi.h: Avoid BIT macro Hartley Sweeten
  2 siblings, 0 replies; 4+ messages in thread
From: Ian Abbott @ 2016-03-02 14:27 UTC (permalink / raw)
  To: devel; +Cc: Greg Kroah-Hartman, Ian Abbott, H Hartley Sweeten, linux-kernel

The kernel-doc comment for `struct comedi_krange` refers to the macro
constant `RF_external`.  It should be `RF_EXTERNAL`, so fix it.  It also
documents the value of the constant as `(1 << 8)`, but the macro now
expands to the hexadecimal constant `0x100`, so use that as the
documented value.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
---
 drivers/staging/comedi/comedi.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/comedi.h b/drivers/staging/comedi/comedi.h
index 9547324..ad5297f 100644
--- a/drivers/staging/comedi/comedi.h
+++ b/drivers/staging/comedi/comedi.h
@@ -667,7 +667,7 @@ struct comedi_rangeinfo {
  * by 1e6, so a @max value of %1000000 (with %UNIT_volt) represents a maximal
  * value of 1 volt.
  *
- * The only defined flag value is %RF_external (%1 << %8), indicating that the
+ * The only defined flag value is %RF_EXTERNAL (%0x100), indicating that the
  * the range needs to be multiplied by an external reference.
  */
 struct comedi_krange {
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [PATCH 0/2] staging: comedi: comedi.h: Avoid BIT macro
  2016-03-02 14:27 [PATCH 0/2] staging: comedi: comedi.h: Avoid BIT macro Ian Abbott
  2016-03-02 14:27 ` [PATCH 1/2] staging: comedi: comedi.h: Do not use " Ian Abbott
  2016-03-02 14:27 ` [PATCH 2/2] staging: comedi: comedi.h: Fix comment for struct comedi_krange Ian Abbott
@ 2016-03-02 16:21 ` Hartley Sweeten
  2 siblings, 0 replies; 4+ messages in thread
From: Hartley Sweeten @ 2016-03-02 16:21 UTC (permalink / raw)
  To: Ian Abbott, devel@driverdev.osuosl.org
  Cc: Greg Kroah-Hartman, linux-kernel@vger.kernel.org

On Wednesday, March 02, 2016 7:28 AM, Ian Abbott wrote:
> Patch 1 effectively reverts commit 72315cdaba9d on linux-next "Staging:
> comedi: Prefer using the BIT macro"), but I replaced the use of the BIT
> macro with hexadecimal constants instead of the original left bit-shift
> expressions.  We shouldn't use the BIT macro in "comedi.h" as it is
> intended to be included in the UAPI headers.
>
> Patch 2 just fixes the kernel-doc comment for struct comedi_krange.
>
> 1) staging: comedi: comedi.h: Do not use BIT macro
> 2) staging: comedi: comedi.h: Fix comment for struct comedi_krange
>
>  drivers/staging/comedi/comedi.h | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)

Thanks for fixing this. I noticed the same issue yesterday.

Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-03-02 16:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-02 14:27 [PATCH 0/2] staging: comedi: comedi.h: Avoid BIT macro Ian Abbott
2016-03-02 14:27 ` [PATCH 1/2] staging: comedi: comedi.h: Do not use " Ian Abbott
2016-03-02 14:27 ` [PATCH 2/2] staging: comedi: comedi.h: Fix comment for struct comedi_krange Ian Abbott
2016-03-02 16:21 ` [PATCH 0/2] staging: comedi: comedi.h: Avoid BIT macro Hartley Sweeten

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