Skip to contentSkip to conversation

bitmaps/bitops

DISCUSSION Pete Zaitcev 3 participants 3 messages Mar 16, 2003 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 5 lines

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 *

It should be unsigned long pointer. I have no idea why volatile is still alive. Perhaps Linus can remember why he left it in on is386. Other arch maintainers midnlessly ape him in this area. I think I even kept his e-mail where he explains why volatile has to go.

-- Pete

#2 lore raw
Quoted 11 lines · Pete Zaitcev
Quoted 5 lines

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 *

It should be unsigned long pointer. I have no idea why volatile is still alive. Perhaps Linus can remember why he left it in on is386. Other arch maintainers midnlessly ape him in this area. I think I even kept his e-mail where he explains why volatile has to go.

The volatile is there (at least in ppc) because without it you get compile warnings. I don't see why the bitops particularly should be the anti-volatile police. I agree that using volatile is usually a bad idea (unless you are accessing a memory-mapped I/O device).

Paul.

#3 lore raw
In reply to Pete Zaitcev
Quoted 11 lines · Pete Zaitcev
Quoted 5 lines

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 *

It should be unsigned long pointer. I have no idea why volatile is still alive. Perhaps Linus can remember why he left it in on is386. Other arch maintainers midnlessly ape him in this area. I think I even kept his e-mail where he explains why volatile has to go.

Several 2.4 drivers assume the test_and_set point is a memory barrier for locking. Lots of

	if(test_and_set_bit(0, &foo))
	{
		x=foodev->blah

Since its inline code and not a memory barrier otherwise there is little stop the compile doing

	x=foodev->blah

first