aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSebastian Ott <sebott@linux.vnet.ibm.com>2012-10-12 04:22:25 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2012-10-18 11:50:08 -0400
commitaa92b33c6b93b5ef4ccbaa72afa9c387a96c2ee2 (patch)
tree8a78109e3bda649b028f7f0d100efdfe17aadfce /drivers
parent4e860696e050375ae7fbb06984c19e2bf6a322e0 (diff)
s390/cio: use generic bitmap functions
Use generic bitmap functions in the subchannel id bitmap to simplify and de-bloat the code. Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com> Acked-by: Peter Oberparleiter <peter.oberparleiter@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/s390/cio/idset.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/drivers/s390/cio/idset.c b/drivers/s390/cio/idset.c
index e6d5f8c49524..f0973a04ec49 100644
--- a/drivers/s390/cio/idset.c
+++ b/drivers/s390/cio/idset.c
@@ -1,9 +1,10 @@
1/* 1/*
2 * Copyright IBM Corp. 2007 2 * Copyright IBM Corp. 2007, 2012
3 * Author(s): Peter Oberparleiter <peter.oberparleiter@de.ibm.com> 3 * Author(s): Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
4 */ 4 */
5 5
6#include <linux/vmalloc.h> 6#include <linux/vmalloc.h>
7#include <linux/bitmap.h>
7#include <linux/bitops.h> 8#include <linux/bitops.h>
8#include "idset.h" 9#include "idset.h"
9#include "css.h" 10#include "css.h"
@@ -111,20 +112,13 @@ int idset_sch_get_first(struct idset *set, struct subchannel_id *schid)
111 112
112int idset_is_empty(struct idset *set) 113int idset_is_empty(struct idset *set)
113{ 114{
114 int bitnum; 115 return bitmap_empty(set->bitmap, set->num_ssid * set->num_id);
115
116 bitnum = find_first_bit(set->bitmap, set->num_ssid * set->num_id);
117 if (bitnum >= set->num_ssid * set->num_id)
118 return 1;
119 return 0;
120} 116}
121 117
122void idset_add_set(struct idset *to, struct idset *from) 118void idset_add_set(struct idset *to, struct idset *from)
123{ 119{
124 unsigned long i, len; 120 int len = min(__BITOPS_WORDS(to->num_ssid * to->num_id),
121 __BITOPS_WORDS(from->num_ssid * from->num_id));
125 122
126 len = min(__BITOPS_WORDS(to->num_ssid * to->num_id), 123 bitmap_or(to->bitmap, to->bitmap, from->bitmap, len);
127 __BITOPS_WORDS(from->num_ssid * from->num_id));
128 for (i = 0; i < len ; i++)
129 to->bitmap[i] |= from->bitmap[i];
130} 124}