Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / drivers / infiniband / core / packer.c
index 5f15fef..c972d72 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2004 Topspin Corporation.  All rights reserved.
+ * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -32,7 +33,9 @@
  * $Id: packer.c 1349 2004-12-16 21:09:43Z roland $
  */
 
-#include <ib_pack.h>
+#include <linux/string.h>
+
+#include <rdma/ib_pack.h>
 
 static u64 value_read(int offset, int size, void *structure)
 {
@@ -96,7 +99,7 @@ void ib_pack(const struct ib_field        *desc,
                        else
                                val = 0;
 
-                       mask = cpu_to_be64(((1ull << desc[i].size_bits) - 1) << shift);
+                       mask = cpu_to_be64((~0ull >> (64 - desc[i].size_bits)) << shift);
                        addr = (__be64 *) ((__be32 *) buf + desc[i].offset_words);
                        *addr = (*addr & ~mask) | (cpu_to_be64(val) & mask);
                } else {
@@ -176,7 +179,7 @@ void ib_unpack(const struct ib_field        *desc,
                        __be64 *addr;
 
                        shift = 64 - desc[i].offset_bits - desc[i].size_bits;
-                       mask = ((1ull << desc[i].size_bits) - 1) << shift;
+                       mask = (~0ull >> (64 - desc[i].size_bits)) << shift;
                        addr = (__be64 *) buf + desc[i].offset_words;
                        val = (be64_to_cpup(addr) & mask) >> shift;
                        value_write(desc[i].struct_offset_bytes,