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

Carl-Daniel Hailfinger (c-d.hailfinger.kernel.2003@gmx.net)
Tue, 15 Apr 2003 19:36:48 +0200


Linus,

{set,clear}_bit for all arches no longer return int, but void.
This patch renames the old generic implementations to
test_and_{set,clear}_bit and adds new-style {set,clear}_bit.

Regards,
Carl-Daniel

===== include/asm-generic/bitops.h 1.2 vs edited =====
--- 1.2/include/asm-generic/bitops.h Fri May 3 02:08:35 2002
+++ edited/include/asm-generic/bitops.h Thu Apr 10 09:12:41 2003
@@ -16,7 +16,31 @@
* C language equivalents written by Theodore Ts'o, 9/26/92
*/

+extern __inline__ void set_bit(int nr,long * addr)
+{
+ int mask;
+
+ addr += nr >> 5;
+ mask = 1 << (nr & 0x1f);
+ cli();
+ *addr |= mask;
+ sti();
+ return;
+}
+
+extern __inline__ void clear_bit(int nr, long * addr)
+{
+ int mask;
+
+ addr += nr >> 5;
+ mask = 1 << (nr & 0x1f);
+ cli();
+ *addr &= ~mask;
+ sti();
+ return;
+}
+
-extern __inline__ int set_bit(int nr,long * addr)
+extern __inline__ int test_and_set_bit(int nr,long * addr)
{
int mask, retval;

@@ -29,7 +53,7 @@
return retval;
}

-extern __inline__ int clear_bit(int nr, long * addr)
+extern __inline__ int test_and_clear_bit(int nr, long * addr)
{
int mask, retval;

-- 
Linux scales to much more than 64 CPUs!
See include/linux/smp.h:64
#define MSG_ALL_BUT_SELF 0x8000 /* Assume <32768 CPU's */

- 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/