Commit aa92b33c authored by Sebastian Ott's avatar Sebastian Ott Committed by Martin Schwidefsky

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: default avatarSebastian Ott <sebott@linux.vnet.ibm.com>
Acked-by: default avatarPeter Oberparleiter <peter.oberparleiter@de.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 4e860696
/* /*
* Copyright IBM Corp. 2007 * Copyright IBM Corp. 2007, 2012
* Author(s): Peter Oberparleiter <peter.oberparleiter@de.ibm.com> * Author(s): Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
*/ */
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#include <linux/bitmap.h>
#include <linux/bitops.h> #include <linux/bitops.h>
#include "idset.h" #include "idset.h"
#include "css.h" #include "css.h"
...@@ -111,20 +112,13 @@ int idset_sch_get_first(struct idset *set, struct subchannel_id *schid) ...@@ -111,20 +112,13 @@ int idset_sch_get_first(struct idset *set, struct subchannel_id *schid)
int idset_is_empty(struct idset *set) int idset_is_empty(struct idset *set)
{ {
int bitnum; return bitmap_empty(set->bitmap, set->num_ssid * set->num_id);
bitnum = find_first_bit(set->bitmap, set->num_ssid * set->num_id);
if (bitnum >= set->num_ssid * set->num_id)
return 1;
return 0;
} }
void idset_add_set(struct idset *to, struct idset *from) 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), bitmap_or(to->bitmap, to->bitmap, from->bitmap, len);
__BITOPS_WORDS(from->num_ssid * from->num_id));
for (i = 0; i < len ; i++)
to->bitmap[i] |= from->bitmap[i];
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment