Skip to content

Commit

Permalink
s390/cio: use generic bitmap functions
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Sebastian Ott authored and Martin Schwidefsky committed Oct 18, 2012
1 parent 4e86069 commit aa92b33
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions drivers/s390/cio/idset.c
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -111,20 +112,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);
}

0 comments on commit aa92b33

Please sign in to comment.