bitmaps/bitops

Randy.Dunlap (rddunlap@osdl.org)
Sat, 15 Mar 2003 13:09:33 -0800 (PST)


Hi,

Not picking on this code, but as an example:

drivers/ieee1394/ieee1394_transactions.c, line 152 (in 2.5.64),
uses: test_and_set_bit(bit_number, tp->pool),

where tp->pool is declared by using a DECLARE_BITMAP(), like so:
struct hpsb_tlabel_pool {
DECLARE_BITMAP(pool, 64);

That makes sense (at least to me), but gcc complains about the
type of <pool> when used in test_and_set_bit():
drivers/ieee1394/ieee1394_transactions.c:152: warning: passing arg 2 of
`test_and_set_bit' from incompatible pointer type

Is this an error, a bug, a nuisance, or just another "ignore gcc 2.96"
problem?

For reference, DECLARE_BITMAP() generates an array of unsigned longs:
#define DECLARE_BITMAP(name,bits) \
unsigned long name[BITS_TO_LONGS(bits)]
but the prototype for test_and_set_bit() depends on $(ARCH), and it's
not consistent, with the second arg (bitmap address) being one of:
volatile void *
void *
volatile unsigned long *

If there's (kernel) surgery required here, unless it's trivial, I think
that I'd leave it for early 2.7.

~Randy

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/