* [PATCH 0/7] bitops: introduce for_each_clear_bit()
@ 2012-01-13 15:53 Akinobu Mita
2012-01-13 15:53 ` [PATCH 3/7] bitops: introduce list_for_each_clear_bit Akinobu Mita
2012-01-13 15:53 ` [PATCH 5/7] s390/char: use for_each_clear_bit Akinobu Mita
0 siblings, 2 replies; 5+ messages in thread
From: Akinobu Mita @ 2012-01-13 15:53 UTC (permalink / raw)
To: linux-kernel, akpm
Cc: linux-s390, linux-usb, Robert Richter, x86, Heiko Carstens,
Akinobu Mita, Ingo Molnar, linux-mtd, H. Peter Anvin,
Martin Schwidefsky, linux390, Thomas Gleixner, David Woodhouse
This patch set introduces for_each_clear_bit() which is similar to
for_each_set_bit(), but it iterates over all the cleared bits in a
memory region.
This also renames for_each_set_bit_cont() to for_each_set_bit_from()
because it is anologous to list_for_each_entry_from() in list.h
rather than list_for_each_entry_continue(), and then introduces
for_each_clear_bit_from(), too.
Akinobu Mita (7):
bitops: rename for_each_set_bit_cont in favor of anologous to list.h
function
bitops: remove for_each_set_bit_cont
bitops: introduce list_for_each_clear_bit
mtd: use for_each_clear_bit
s390/char: use for_each_clear_bit
uwb: use for_each_clear_bit
x86: use for_each_clear_bit_from
arch/x86/kernel/cpu/perf_event.c | 4 ++--
arch/x86/kernel/irqinit.c | 6 +++---
drivers/mtd/chips/cfi_cmdset_0001.c | 6 ++----
drivers/s390/char/sclp_cmd.c | 5 ++---
drivers/uwb/allocator.c | 6 ++----
include/linux/bitops.h | 13 ++++++++++++-
tools/perf/util/include/linux/bitops.h | 2 +-
7 files changed, 24 insertions(+), 18 deletions(-)
Cc: Robert Richter <robert.richter@amd.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: linux-mtd@lists.infradead.org
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: linux390@de.ibm.com
Cc: linux-s390@vger.kernel.org
Cc: linux-usb@vger.kernel.org
--
1.7.4.4
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 3/7] bitops: introduce list_for_each_clear_bit
2012-01-13 15:53 [PATCH 0/7] bitops: introduce for_each_clear_bit() Akinobu Mita
@ 2012-01-13 15:53 ` Akinobu Mita
2012-01-13 17:16 ` Sergei Shtylyov
2012-01-13 15:53 ` [PATCH 5/7] s390/char: use for_each_clear_bit Akinobu Mita
1 sibling, 1 reply; 5+ messages in thread
From: Akinobu Mita @ 2012-01-13 15:53 UTC (permalink / raw)
To: linux-kernel, akpm
Cc: linux-s390, linux-usb, Robert Richter, x86, Heiko Carstens,
Akinobu Mita, Ingo Molnar, linux-mtd, H. Peter Anvin,
Martin Schwidefsky, linux390, Thomas Gleixner, David Woodhouse
Introduce list_for_each_clear_bit() and list_for_each_clear_bit_from().
They are similar to for_each_set_bit() and list_for_each_set_bit_from(),
but they iterate over all the cleared bits in a memory region.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Robert Richter <robert.richter@amd.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: linux-mtd@lists.infradead.org
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: linux390@de.ibm.com
Cc: linux-s390@vger.kernel.org
Cc: linux-usb@vger.kernel.org
---
include/linux/bitops.h | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index 15ad702..c8a0d65 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -32,6 +32,17 @@ extern unsigned long __sw_hweight64(__u64 w);
(bit) < (size); \
(bit) = find_next_bit((addr), (size), (bit) + 1))
+#define for_each_clear_bit(bit, addr, size) \
+ for ((bit) = find_first_zero_bit((addr), (size)); \
+ (bit) < (size); \
+ (bit) = find_next_zero_bit((addr), (size), (bit) + 1))
+
+/* same as for_each_clear_bit() but use bit as value to start with */
+#define for_each_clear_bit_from(bit, addr, size) \
+ for ((bit) = find_next_zero_bit((addr), (size), (bit)); \
+ (bit) < (size); \
+ (bit) = find_next_zero_bit((addr), (size), (bit) + 1))
+
static __inline__ int get_bitmask_order(unsigned int count)
{
int order;
--
1.7.4.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 5/7] s390/char: use for_each_clear_bit
2012-01-13 15:53 [PATCH 0/7] bitops: introduce for_each_clear_bit() Akinobu Mita
2012-01-13 15:53 ` [PATCH 3/7] bitops: introduce list_for_each_clear_bit Akinobu Mita
@ 2012-01-13 15:53 ` Akinobu Mita
1 sibling, 0 replies; 5+ messages in thread
From: Akinobu Mita @ 2012-01-13 15:53 UTC (permalink / raw)
To: linux-kernel, akpm
Cc: Akinobu Mita, Martin Schwidefsky, Heiko Carstens, linux390,
linux-s390
Use for_each_clear_bit() to iterate over all the cleared bit in a
memory region.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: linux390@de.ibm.com
Cc: linux-s390@vger.kernel.org
---
drivers/s390/char/sclp_cmd.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/s390/char/sclp_cmd.c b/drivers/s390/char/sclp_cmd.c
index 0b54a91..168525a 100644
--- a/drivers/s390/char/sclp_cmd.c
+++ b/drivers/s390/char/sclp_cmd.c
@@ -441,9 +441,8 @@ static int sclp_mem_notifier(struct notifier_block *nb,
start = arg->start_pfn << PAGE_SHIFT;
size = arg->nr_pages << PAGE_SHIFT;
mutex_lock(&sclp_mem_mutex);
- for (id = 0; id <= sclp_max_storage_id; id++)
- if (!test_bit(id, sclp_storage_ids))
- sclp_attach_storage(id);
+ for_each_clear_bit(id, sclp_storage_ids, sclp_max_storage_id + 1)
+ sclp_attach_storage(id);
switch (action) {
case MEM_ONLINE:
case MEM_GOING_OFFLINE:
--
1.7.4.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 3/7] bitops: introduce list_for_each_clear_bit
2012-01-13 15:53 ` [PATCH 3/7] bitops: introduce list_for_each_clear_bit Akinobu Mita
@ 2012-01-13 17:16 ` Sergei Shtylyov
2012-01-13 23:36 ` Akinobu Mita
0 siblings, 1 reply; 5+ messages in thread
From: Sergei Shtylyov @ 2012-01-13 17:16 UTC (permalink / raw)
To: Akinobu Mita
Cc: linux-s390, linux-usb, Robert Richter, x86, Heiko Carstens,
linux-kernel, Ingo Molnar, linux-mtd, H. Peter Anvin,
Martin Schwidefsky, linux390, akpm, David Woodhouse,
Thomas Gleixner
Hello.
On 01/13/2012 06:53 PM, Akinobu Mita wrote:
> Introduce list_for_each_clear_bit() and list_for_each_clear_bit_from().
It seems you've got somewhat muddled -- you're actually introducing
for_each_clear_bit() and for_each_clear_bit_from()
> They are similar to for_each_set_bit() and list_for_each_set_bit_from(),
> but they iterate over all the cleared bits in a memory region.
> Signed-off-by: Akinobu Mita<akinobu.mita@gmail.com>
> Cc: Robert Richter<robert.richter@amd.com>
> Cc: Thomas Gleixner<tglx@linutronix.de>
> Cc: Ingo Molnar<mingo@redhat.com>
> Cc: "H. Peter Anvin"<hpa@zytor.com>
> Cc: x86@kernel.org
> Cc: David Woodhouse<dwmw2@infradead.org>
> Cc: linux-mtd@lists.infradead.org
> Cc: Martin Schwidefsky<schwidefsky@de.ibm.com>
> Cc: Heiko Carstens<heiko.carstens@de.ibm.com>
> Cc: linux390@de.ibm.com
> Cc: linux-s390@vger.kernel.org
> Cc: linux-usb@vger.kernel.org
WBR, Sergei
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 3/7] bitops: introduce list_for_each_clear_bit
2012-01-13 17:16 ` Sergei Shtylyov
@ 2012-01-13 23:36 ` Akinobu Mita
0 siblings, 0 replies; 5+ messages in thread
From: Akinobu Mita @ 2012-01-13 23:36 UTC (permalink / raw)
To: Sergei Shtylyov
Cc: linux-s390, linux-usb, Robert Richter, x86, Heiko Carstens,
linux-kernel, Ingo Molnar, linux-mtd, H. Peter Anvin,
Martin Schwidefsky, linux390, akpm, David Woodhouse,
Thomas Gleixner
2012/1/14 Sergei Shtylyov <sshtylyov@mvista.com>:
> Hello.
>
> On 01/13/2012 06:53 PM, Akinobu Mita wrote:
>
>> Introduce list_for_each_clear_bit() and list_for_each_clear_bit_from().
>
>
> It seems you've got somewhat muddled -- you're actually introducing
> for_each_clear_bit() and for_each_clear_bit_from()
Oops, thanks for a notification.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-01-13 23:36 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-13 15:53 [PATCH 0/7] bitops: introduce for_each_clear_bit() Akinobu Mita
2012-01-13 15:53 ` [PATCH 3/7] bitops: introduce list_for_each_clear_bit Akinobu Mita
2012-01-13 17:16 ` Sergei Shtylyov
2012-01-13 23:36 ` Akinobu Mita
2012-01-13 15:53 ` [PATCH 5/7] s390/char: use for_each_clear_bit Akinobu Mita
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox