summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2011-10-27 19:11:35 +0100
committerBen Hutchings <bhutchings@solarflare.com>2011-11-01 16:50:55 +0000
commitbe76a4529148c2790f53ccc8e879b4cc6b34b6b9 (patch)
tree6553f2402b464705a6a69d15646efb75afba6d04
parent5ba70c0086c0d474c7cd1a4afcd131d42b941176 (diff)
downloadethtool-be76a4529148c2790f53ccc8e879b4cc6b34b6b9.tar.gz
Fix type of bit-number parameter to set_bit() and clear_bit()
The index must not be negative, so the parameter does not need to be signed. Division and modulus on signed operands generally cannot be optimised to right-shift and bitwise-and. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
-rw-r--r--internal.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/internal.h b/internal.h
index 693b091..2b6a54a 100644
--- a/internal.h
+++ b/internal.h
@@ -62,12 +62,12 @@ static inline u64 cpu_to_be64(u64 value)
#define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_LONG)
-static inline void set_bit(int nr, unsigned long *addr)
+static inline void set_bit(unsigned int nr, unsigned long *addr)
{
addr[nr / BITS_PER_LONG] |= 1UL << (nr % BITS_PER_LONG);
}
-static inline void clear_bit(int nr, unsigned long *addr)
+static inline void clear_bit(unsigned int nr, unsigned long *addr)
{
addr[nr / BITS_PER_LONG] &= ~(1UL << (nr % BITS_PER_LONG));
}