All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Carlos O'Donell Jr." <carlos@megatonmonkey.net>
To: parisc-linux@lists.parisc-linux.org
Cc: Albert Strasheim <fullung@ilink.nis.za>
Subject: [parisc-linux] Non-atomic __set_bit
Date: Mon, 24 Sep 2001 02:10:54 -0400	[thread overview]
Message-ID: <20010924021054.I3025@megatonmonkey.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 455 bytes --]

parisc,

Walking the source for devfs and thinking about Alberts problem.

Would the non-working devfs be fixed by adding:

Non-atomic versions of set_bit e.g. __set_bit 
and test_and_set_bit e.g. __test_and_set_bit
to linux/include/asm-parisc/bitops.h?

I have the latest CVS linux module.
I've patched against that. It compiles now ;)
(god bless make -j8)

I'm currently sleepy, but I'll post the patch, and test
it tommorow on a 712/60 and 715/50.

c.

[-- Attachment #2: bitops-devfs.diff --]
[-- Type: text/plain, Size: 1281 bytes --]

--- ./linux/include/asm-parisc/bitops.h.orig	Mon Sep 24 01:27:31 2001
+++ ./linux/include/asm-parisc/bitops.h.mod	Mon Sep 24 01:41:38 2001
@@ -50,6 +50,26 @@
 	SPIN_UNLOCK_IRQRESTORE(ATOMIC_HASH(addr), flags);
 }
 
+/*
+ * Non-Atomic __set_bit
+ *
+ * If called by multiple processes, only one will succeed.
+ * The others would have been reordered before the succeeding
+ * call.
+ *
+ */
+
+static __inline__ void __set_bit(int nr, void * address)
+{
+        unsigned long mask;
+        unsigned long *addr = (unsigned long *) address;
+
+        addr += (nr >> SHIFT_PER_LONG);
+        mask = 1L << CHOP_SHIFTCOUNT(nr);
+        *addr |= mask;
+}
+
+
 static __inline__ int test_and_clear_bit(int nr, void * address)
 {
 	unsigned long mask;
@@ -66,6 +86,25 @@
 
 	return oldbit;
 }
+
+/*
+ * Non-Atomic __test_and_clear_bit
+ *
+ */
+
+static __inline__ int __test_and_clear_bit(int nr, void * address)
+{
+        unsigned long mask;
+        unsigned long *addr = (unsigned long *) address;
+        int oldbit;
+        addr += (nr >> SHIFT_PER_LONG);
+        mask = 1L << CHOP_SHIFTCOUNT(nr);
+        oldbit = (*addr & mask) ? 1 : 0;
+        *addr &= ~mask;
+											            return oldbit;
+}
+
+
 
 static __inline__ void clear_bit(int nr, void * address)
 {

             reply	other threads:[~2001-09-24  6:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-09-24  6:10 Carlos O'Donell Jr. [this message]
2001-09-29  0:09 ` [parisc-linux] Non-atomic __set_bit Albert Strasheim
2001-09-29 17:27   ` Carlos O'Donell Jr.
2001-09-29 21:43     ` Albert Strasheim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010924021054.I3025@megatonmonkey.net \
    --to=carlos@megatonmonkey.net \
    --cc=fullung@ilink.nis.za \
    --cc=parisc-linux@lists.parisc-linux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.