mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: Arnd Bergmann <arnd@arndb.de>, Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, Arun Sharma <asharma@fb.com>,
	uclinux-dist-devel@blackfin.uclinux.org
Subject: [PATCH 2/6] asm-generic/atomic.h: fix type used in atomic_clear_mask
Date: Fri, 17 Jun 2011 17:53:30 -0400	[thread overview]
Message-ID: <1308347614-402-3-git-send-email-vapier@gentoo.org> (raw)
In-Reply-To: <1308347614-402-1-git-send-email-vapier@gentoo.org>

The atomic helpers are supposed to take an atomic_t pointer, not a
random unsigned long pointer.  So convert atomic_clear_mask over.

While we're here, also add some nice documentation to the func.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 include/asm-generic/atomic.h |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/include/asm-generic/atomic.h b/include/asm-generic/atomic.h
index 5f62e28..28f5939 100644
--- a/include/asm-generic/atomic.h
+++ b/include/asm-generic/atomic.h
@@ -140,13 +140,20 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u)
 
 #define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
 
-static inline void atomic_clear_mask(unsigned long mask, unsigned long *addr)
+/**
+ * atomic_clear_mask - Atomically clear bits in atomic variable
+ * @mask: Mask of the bits to be cleared
+ * @v: pointer of type atomic_t
+ *
+ * Atomically clears the bits set in @mask from @v
+ */
+static inline void atomic_clear_mask(unsigned long mask, atomic_t *v)
 {
 	unsigned long flags;
 
 	mask = ~mask;
 	raw_local_irq_save(flags); /* Don't trace it in a irqsoff handler */
-	*addr &= mask;
+	v->counter &= mask;
 	raw_local_irq_restore(flags);
 }
 
-- 
1.7.5.3


  parent reply	other threads:[~2011-06-17 21:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-17 21:53 [PATCH 0/6] Merge Blackfin/SMP atomic.h support into asm-generic/atomic.h Mike Frysinger
2011-06-17 21:53 ` [PATCH 1/6] asm-generic/atomic.h: simplify inc/dec test helpers Mike Frysinger
2011-06-17 21:53 ` Mike Frysinger [this message]
2011-06-17 21:53 ` [PATCH 3/6] asm-generic/atomic.h: add atomic_set_mask helper Mike Frysinger
2011-06-17 21:53 ` [PATCH 4/6] asm-generic/atomic.h: allow SMP peeps to leverage this Mike Frysinger
2011-06-17 21:53 ` [PATCH 5/6] Blackfin: SMP: punt unused atomic_test_mask helper Mike Frysinger
2011-06-17 21:53 ` [PATCH 6/6] Blackfin: SMP: convert to common asm-generic/atomic.h Mike Frysinger
2011-06-21 23:05   ` Andrew Morton
2011-06-21 23:35     ` [uclinux-dist-devel] " Mike Frysinger

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=1308347614-402-3-git-send-email-vapier@gentoo.org \
    --to=vapier@gentoo.org \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=asharma@fb.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=uclinux-dist-devel@blackfin.uclinux.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®