diff options
author | Sebastian Ott <sebott@linux.vnet.ibm.com> | 2015-09-21 18:40:33 +0200 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2015-10-14 14:32:04 +0200 |
commit | 9d49f86daba3ed22cadf01beff1b130ad25fe0bf (patch) | |
tree | 54d07327930ab0976c5aa1ee36281f07cd32c661 /arch/s390/include/asm/cio.h | |
parent | s390/cio: reactivate cmf after hibernate (diff) | |
download | linux-9d49f86daba3ed22cadf01beff1b130ad25fe0bf.tar.xz linux-9d49f86daba3ed22cadf01beff1b130ad25fe0bf.zip |
s390/cio: introduce pathmask_to_pos
We often need to correlate an 8 bit path mask with the position
in a channel path array. Introduce and use pathmask_to_pos for
that task.
Reviewed-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/include/asm/cio.h')
-rw-r--r-- | arch/s390/include/asm/cio.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/arch/s390/include/asm/cio.h b/arch/s390/include/asm/cio.h index 096339207764..0c5d8ee657f0 100644 --- a/arch/s390/include/asm/cio.h +++ b/arch/s390/include/asm/cio.h @@ -5,6 +5,7 @@ #define _ASM_S390_CIO_H_ #include <linux/spinlock.h> +#include <linux/bitops.h> #include <asm/types.h> #define LPM_ANYPATH 0xff @@ -296,6 +297,15 @@ static inline int ccw_dev_id_is_equal(struct ccw_dev_id *dev_id1, return 0; } +/** + * pathmask_to_pos() - find the position of the left-most bit in a pathmask + * @mask: pathmask with at least one bit set + */ +static inline u8 pathmask_to_pos(u8 mask) +{ + return 8 - ffs(mask); +} + void channel_subsystem_reinit(void); extern void css_schedule_reprobe(void); |