Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

s390/facility: decompose test_facility()

The patch decomposes the function test_facility() into its API
test_facility() and its implementation __test_facility(). This
allows to reuse the implementation with a different API.

Patch is used to prepare checkin of SIE satellite code.

Signed-off-by: Michael Mueller <mimu@linux.vnet.ibm.com>
Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>

authored by

Michael Mueller and committed by
Martin Schwidefsky
32089246 749d3f9c

+11 -6
+11 -6
arch/s390/include/asm/facility.h
··· 13 13 14 14 #define MAX_FACILITY_BIT (256*8) /* stfle_fac_list has 256 bytes */ 15 15 16 + static inline int __test_facility(unsigned long nr, void *facilities) 17 + { 18 + unsigned char *ptr; 19 + 20 + if (nr >= MAX_FACILITY_BIT) 21 + return 0; 22 + ptr = (unsigned char *) facilities + (nr >> 3); 23 + return (*ptr & (0x80 >> (nr & 7))) != 0; 24 + } 25 + 16 26 /* 17 27 * The test_facility function uses the bit odering where the MSB is bit 0. 18 28 * That makes it easier to query facility bits with the bit number as ··· 30 20 */ 31 21 static inline int test_facility(unsigned long nr) 32 22 { 33 - unsigned char *ptr; 34 - 35 - if (nr >= MAX_FACILITY_BIT) 36 - return 0; 37 - ptr = (unsigned char *) &S390_lowcore.stfle_fac_list + (nr >> 3); 38 - return (*ptr & (0x80 >> (nr & 7))) != 0; 23 + return __test_facility(nr, &S390_lowcore.stfle_fac_list); 39 24 } 40 25 41 26 /**