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

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

Post by Carl-Daniel Hailfinge » Fri, 11 Apr 2003 09:30:11



Linus,

{set,clear}_bit for all arches no longer return int, but void.
This patch adjusts the generic implementation accordingly.

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

[ linux_bitops.diff < 1K ]
===== include/asm-generic/bitops.h 1.2 vs edited =====
--- 1.2/include/asm-generic/bitops.h    Fri May  3 02:08:35 2002

  * C language equivalents written by Theodore Ts'o, 9/26/92
  */

-extern __inline__ int set_bit(int nr,long * addr)
+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 test_and_set_bit(int nr,long * addr)
 {
        int     mask, retval;

        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;

 
 
 

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

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

  * 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;

        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

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

2. SCSI bootup problems under RH 6.2?

3. #include <asm/bitops.h> -> #include <linux/bitops.h>

4. AMD Athlon & Linux

5. Add linux/include/asm-generic to TAGS build

6. comp.unix.programmer's FAQ

7. [trivial] include <asm-generic/topology.h>

8. Engineers needed for Distributed Computing Company

9. 2.4.19-pre8 include/asm-i386/bitops.h ffs() bug

10. [v850] Use <asm-generic/statsfs.h> on v850

11. planned change to <asm-generic/dma-mapping.h> will cause arch breakage

12. [2.5.41] create asm-generic/fcntl.h

13. how is the asm-generic to be used?