Skip to contentSkip to conversation

[2.5] include/asm-generic/bitops.h {set,clear}_bit return void

PATCH Arnd Bergmann 4 participants 5 messages Apr 15, 2003 – Apr 27, 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

Review

Quoted 4 lines · Carl-Daniel Hailfinger
(quoted diff) +4 -0
+     mask = 1 << (nr & 0x1f);
+     cli();
+     *addr |= mask;
+     sti();

cli() and sti() are no more. Moreover, the file you are trying to fix is not even used anywhere. Better submit a patch to remove it completely.

        Arnd <><
#2 lore raw
Quoted 10 lines · Arnd Bergmann

Review

Quoted 4 lines · Carl-Daniel Hailfinger
(quoted diff) +4 -0
+     mask = 1 << (nr & 0x1f);
+     cli();
+     *addr |= mask;
+     sti();

cli() and sti() are no more. Moreover, the file you are trying to fix is

What is the preferred way to achieve atomicity in an operation now that cli() and sti() are gone?

Quoted 1 line

not even used anywhere. Better submit a patch to remove it completely.

The point of asm-generic is not to use the files, but to give porters a hint about the functionality. Quoting asm-generic/bitops.h:

/* For the benefit of those who are trying to port Linux to another
* architecture, here are some C-language equivalents. You should
* recode these in the native assembly language, if at all possible.
* To guarantee atomicity, these routines call cli() and sti() to
* disable interrupts while they operate. (You have to provide inline
* routines to cli() and sti().) */

Or is this comment wrong, too?

Regards,
Carl-Daniel

Signature · 1 line
http://www.hailfinger.org/
#3 lore raw
Quoted 2 lines · Carl-Daniel Hailfinger

What is the preferred way to achieve atomicity in an operation now that cli() and sti() are gone?

spin locks.

Quoted 11 lines

The point of asm-generic is not to use the files, but to give porters a hint about the functionality. Quoting asm-generic/bitops.h:

/* For the benefit of those who are trying to port Linux to another
* architecture, here are some C-language equivalents. You should
* recode these in the native assembly language, if at all possible.
* To guarantee atomicity, these routines call cli() and sti() to
* disable interrupts while they operate. (You have to provide inline
* routines to cli() and sti().) */

Or is this comment wrong, too?

Well, the cli() and sti() part is definitely wrong for 2.5.

It is wrong though to assume that nothing will use these; someone may copy them directly (and then they do not work) or someone may #include this file.

I like Arnd's suggestion to just remove these functions and all other instances of them -- assuming in fact they are never used.

Robert Love

#4 lore raw
Quoted 10 lines · Robert Love
Quoted 10 lines

The point of asm-generic is not to use the files, but to give porters a hint about the functionality. Quoting asm-generic/bitops.h:

/* For the benefit of those who are trying to port Linux to another
* architecture, here are some C-language equivalents. You should
* recode these in the native assembly language, if at all possible.
* To guarantee atomicity, these routines call cli() and sti() to
* disable interrupts while they operate. (You have to provide inline
* routines to cli() and sti().) */

Quoted 7 lines
Quoted 1 line

Or is this comment wrong, too?

Well, the cli() and sti() part is definitely wrong for 2.5.

It is wrong though to assume that nothing will use these; someone may copy them directly (and then they do not work) or someone may #include this file.

AFAICS, the meaning of the asm-generic directory has completely changed during the 2.4/2.5 timeframe. They are now meant to be included from other header files, with the exception of unaligned.h and bitops.h.

These two files are now worthless for the purpose they were meant for. When someone wants to start a new architecture, the maintained architectures are the place to look at. For example, the parisc and ia64 implementations of bitops.h are both generic enough to be used for a new architecture and they actually are SMP safe and complete, while the asm-generic variant has been broken since linux-2.0!

Quoted 2 lines

I like Arnd's suggestion to just remove these functions and all other instances of them -- assuming in fact they are never used.

I actually meant removing the asm-generic/bitops.h file, not the functions.

	Arnd <><
#5 lore raw
In reply to Carl-Daniel Hailfinger

Hi!

Quoted 9 lines
Quoted 9 lines

Review

Quoted 6 lines
(quoted diff) +4 -0
+     mask = 1 << (nr & 0x1f);
+     cli();
+     *addr |= mask;
+     sti();

cli() and sti() are no more. Moreover, the file you are trying to fix is

No. That file is still usefull.

Quoted 2 lines

What is the preferred way to achieve atomicity in an operation now that cli() and sti() are gone?

spin_lock_irqsave(&bitops_lock).

Quoted 13 lines
Quoted 1 line

not even used anywhere. Better submit a patch to remove it completely.

The point of asm-generic is not to use the files, but to give porters a hint about the functionality. Quoting asm-generic/bitops.h:

/* For the benefit of those who are trying to port Linux to another
* architecture, here are some C-language equivalents. You should
* recode these in the native assembly language, if at all possible.
* To guarantee atomicity, these routines call cli() and sti() to
* disable interrupts while they operate. (You have to provide inline
* routines to cli() and sti().) */

Or is this comment wrong, too?

Signature · 2 lines
				Pavel
Written on sharp zaurus, because my Velo1 broke. If you have Velo you don't need...