diff options
| author | Ming Lei <[email protected]> | 2021-01-22 10:33:09 +0800 |
|---|---|---|
| committer | Martin K. Petersen <[email protected]> | 2021-03-04 17:36:59 -0500 |
| commit | cbb9950b41dd9dfb7c2be3429ba09f83b8b1ff98 (patch) | |
| tree | 46d08ab612aa0177990a792f8d82fbfba319b7fb /include/linux | |
| parent | c548e62bcf6adc7066ff201e9ecc88e536dd8890 (diff) | |
scsi: sbitmap: Export sbitmap_weight
SCSI's .device_busy will be converted to sbitmap and sbitmap_weight is
needed. Export the helper.
The only existing user of sbitmap_weight() uses it to find out how many
bits are set and not cleared. Align sbitmap_weight() meaning with this
usage model.
Link: https://lore.kernel.org/r/[email protected]
Cc: Omar Sandoval <[email protected]>
Cc: Kashyap Desai <[email protected]>
Cc: Sumanesh Samanta <[email protected]>
Cc: Ewan D. Milne <[email protected]>
Tested-by: Sumanesh Samanta <[email protected]>
Reviewed-by: Hannes Reinecke <[email protected]>
Signed-off-by: Ming Lei <[email protected]>
Signed-off-by: Martin K. Petersen <[email protected]>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/sbitmap.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/linux/sbitmap.h b/include/linux/sbitmap.h index 247776fcc02c..c65ba887dcc3 100644 --- a/include/linux/sbitmap.h +++ b/include/linux/sbitmap.h @@ -341,6 +341,16 @@ static inline int sbitmap_test_bit(struct sbitmap *sb, unsigned int bitnr) */ void sbitmap_show(struct sbitmap *sb, struct seq_file *m); + +/** + * sbitmap_weight() - Return how many set and not cleared bits in a &struct + * sbitmap. + * @sb: Bitmap to check. + * + * Return: How many set and not cleared bits set + */ +unsigned int sbitmap_weight(const struct sbitmap *sb); + /** * sbitmap_bitmap_show() - Write a hex dump of a &struct sbitmap to a &struct * seq_file. |