summaryrefslogtreecommitdiffstats
path: root/drivers/s390/cio/idset.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-10-24 04:05:56 +0300
committerLinus Torvalds <torvalds@linux-foundation.org>2012-10-24 04:05:56 +0300
commit4e3ab74c22425e73a0c11dcc065c94c5c75ed2ad (patch)
tree8ae6e81fc69fe38db812573a66dc4b3a4d19b5fe /drivers/s390/cio/idset.c
parent4a09cbcee49a6f94fa5f56e90b087dfbeb005b77 (diff)
parentfd2c32a95b10f49d3099188d4d825d9a91e9fe05 (diff)
downloadlinux-4e3ab74c22425e73a0c11dcc065c94c5c75ed2ad.tar.gz
linux-4e3ab74c22425e73a0c11dcc065c94c5c75ed2ad.tar.bz2
linux-4e3ab74c22425e73a0c11dcc065c94c5c75ed2ad.zip
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux
Pull s390 fixes from Martin Schwidefsky: "Among the usual minor bug fixes the more interesting patches are the perf counters for the latest machine, the missing select to enable transparent huge pages and a build fix for the UAPI rework." * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux: s390,uapi: do not use uapi/asm-generic/kvm_para.h s390/cache: fix data/instruction cache output s390: fix linker script for 31 bit builds s390/thp: select HAVE_ARCH_TRANSPARENT_HUGEPAGE s390/kdump: Use 64 bit mode for 0x10000 entry point perf_cpum_cf: Add support for counters available with IBM zEC12 s390/css: stop stsch loop after cc 3 s390/cio: use generic bitmap functions s390/chpid: make headers usable (again)
Diffstat (limited to 'drivers/s390/cio/idset.c')
-rw-r--r--drivers/s390/cio/idset.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/drivers/s390/cio/idset.c b/drivers/s390/cio/idset.c
index e6d5f8c49524..199bc6791177 100644
--- a/drivers/s390/cio/idset.c
+++ b/drivers/s390/cio/idset.c
@@ -1,9 +1,10 @@
/*
- * Copyright IBM Corp. 2007
+ * Copyright IBM Corp. 2007, 2012
* Author(s): Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
*/
#include <linux/vmalloc.h>
+#include <linux/bitmap.h>
#include <linux/bitops.h>
#include "idset.h"
#include "css.h"
@@ -89,6 +90,14 @@ void idset_sch_del(struct idset *set, struct subchannel_id schid)
idset_del(set, schid.ssid, schid.sch_no);
}
+/* Clear ids starting from @schid up to end of subchannel set. */
+void idset_sch_del_subseq(struct idset *set, struct subchannel_id schid)
+{
+ int pos = schid.ssid * set->num_id + schid.sch_no;
+
+ bitmap_clear(set->bitmap, pos, set->num_id - schid.sch_no);
+}
+
int idset_sch_contains(struct idset *set, struct subchannel_id schid)
{
return idset_contains(set, schid.ssid, schid.sch_no);
@@ -111,20 +120,13 @@ int idset_sch_get_first(struct idset *set, struct subchannel_id *schid)
int idset_is_empty(struct idset *set)
{
- int bitnum;
-
- bitnum = find_first_bit(set->bitmap, set->num_ssid * set->num_id);
- if (bitnum >= set->num_ssid * set->num_id)
- return 1;
- return 0;
+ return bitmap_empty(set->bitmap, set->num_ssid * set->num_id);
}
void idset_add_set(struct idset *to, struct idset *from)
{
- unsigned long i, len;
+ int len = min(__BITOPS_WORDS(to->num_ssid * to->num_id),
+ __BITOPS_WORDS(from->num_ssid * from->num_id));
- len = min(__BITOPS_WORDS(to->num_ssid * to->num_id),
- __BITOPS_WORDS(from->num_ssid * from->num_id));
- for (i = 0; i < len ; i++)
- to->bitmap[i] |= from->bitmap[i];
+ bitmap_or(to->bitmap, to->bitmap, from->bitmap, len);
}