IB/ipath: Avoid test_bit() on u64 SDMA status value
authorRoland Dreier <rolandd@cisco.com>
Mon, 26 May 2008 22:20:34 +0000 (15:20 -0700)
committerRoland Dreier <rolandd@cisco.com>
Mon, 26 May 2008 22:20:34 +0000 (15:20 -0700)
Gabriel C <nix.or.die@googlemail.com> pointed out that when the x86
bitops are updated to operate on unsigned long, the code in
sdma_abort_task() will produce warnings:

    drivers/infiniband/hw/ipath/ipath_sdma.c: In function 'sdma_abort_task':
    drivers/infiniband/hw/ipath/ipath_sdma.c:267: warning: passing argument 2 of 'constant_test_bit' from incompatible pointer type

and so on, because it uses test_bit() to operation on a u64 value
(returned by ipath_read_kref64() for a hardware register).

Fix up these warnings by converting the test_bit() operations to &ing
with appropriate symbolic defines of the bits within the hardware
register.  This has the benign side-effect of making the code more
self-documenting as well.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
drivers/infiniband/hw/ipath/ipath_kernel.h
drivers/infiniband/hw/ipath/ipath_sdma.c

index 59a8b254b97fd3b3ad110be7944259b733f358eb..0bd8bcb184a18cf38c44cc33ae980210711dd44c 100644 (file)
@@ -232,6 +232,11 @@ struct ipath_sdma_desc {
 #define IPATH_SDMA_TXREQ_S_ABORTED   2
 #define IPATH_SDMA_TXREQ_S_SHUTDOWN  3
 
+#define IPATH_SDMA_STATUS_SCORE_BOARD_DRAIN_IN_PROG    (1ull << 63)
+#define IPATH_SDMA_STATUS_ABORT_IN_PROG                        (1ull << 62)
+#define IPATH_SDMA_STATUS_INTERNAL_SDMA_ENABLE         (1ull << 61)
+#define IPATH_SDMA_STATUS_SCB_EMPTY                    (1ull << 30)
+
 /* max dwords in small buffer packet */
 #define IPATH_SMALLBUF_DWORDS (dd->ipath_piosize2k >> 2)
 
index 0a8c1b8091a2ba04d2ea265c3acc933eb2a6f0a0..eaba03273e4febd20ca45ce88e3b63fbd7e83f40 100644 (file)
@@ -263,14 +263,10 @@ static void sdma_abort_task(unsigned long opaque)
                hwstatus = ipath_read_kreg64(dd,
                                dd->ipath_kregs->kr_senddmastatus);
 
-               if (/* ScoreBoardDrainInProg */
-                   test_bit(63, &hwstatus) ||
-                   /* AbortInProg */
-                   test_bit(62, &hwstatus) ||
-                   /* InternalSDmaEnable */
-                   test_bit(61, &hwstatus) ||
-                   /* ScbEmpty */
-                   !test_bit(30, &hwstatus)) {
+               if ((hwstatus & (IPATH_SDMA_STATUS_SCORE_BOARD_DRAIN_IN_PROG |
+                                IPATH_SDMA_STATUS_ABORT_IN_PROG             |
+                                IPATH_SDMA_STATUS_INTERNAL_SDMA_ENABLE)) ||
+                   !(hwstatus & IPATH_SDMA_STATUS_SCB_EMPTY)) {
                        if (dd->ipath_sdma_reset_wait > 0) {
                                /* not done shutting down sdma */
                                --dd->ipath_sdma_reset_wait;