From 8f24fc351eadfbbb45a0e5aac247bfca8fc73ca3 Mon Sep 17 00:00:00 2001 From: ajesh Date: Fri, 26 Apr 2019 22:26:54 +0530 Subject: [PATCH] gpu: nvgpu: unit: fix the ffs test The LSB position is 1 in ffs, fix the ffs test parameters accordingly. Jira NVGPU-2149 Change-Id: Ic67199b43b36e0ff98671ada301b71be85037ac9 Signed-off-by: ajesh Reviewed-on: https://git-master.nvidia.com/r/2107277 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Alex Waterman Reviewed-by: Ankur Kishore Reviewed-by: mobile promotions Tested-by: mobile promotions --- userspace/units/posix/bitops/posix-bitops.c | 22 ++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/userspace/units/posix/bitops/posix-bitops.c b/userspace/units/posix/bitops/posix-bitops.c index aebc69039..03565aabe 100644 --- a/userspace/units/posix/bitops/posix-bitops.c +++ b/userspace/units/posix/bitops/posix-bitops.c @@ -68,16 +68,16 @@ static int test_ffs(struct unit_module *m, struct gk20a *g, void *args) unsigned long i; - CHECK_FFS_WORD(single_ulong_maps[0], BITS_PER_LONG - 1UL); - CHECK_FFS_WORD(single_ulong_maps[1], 0UL); - CHECK_FFS_WORD(single_ulong_maps[2], 8UL); - CHECK_FFS_WORD(single_ulong_maps[3], 0UL); - CHECK_FFS_WORD(single_ulong_maps[4], 0UL); - CHECK_FFS_WORD(single_ulong_maps[5], 0UL); - CHECK_FFS_WORD(single_ulong_maps[6], 16UL); - CHECK_FFS_WORD(single_ulong_maps[7], 0UL); - CHECK_FFS_WORD(single_ulong_maps[8], 31UL); - CHECK_FFS_WORD(single_ulong_maps[9], 16UL); + CHECK_FFS_WORD(single_ulong_maps[0], 0UL); + CHECK_FFS_WORD(single_ulong_maps[1], 1UL); + CHECK_FFS_WORD(single_ulong_maps[2], 9UL); + CHECK_FFS_WORD(single_ulong_maps[3], 1UL); + CHECK_FFS_WORD(single_ulong_maps[4], 1UL); + CHECK_FFS_WORD(single_ulong_maps[5], 1UL); + CHECK_FFS_WORD(single_ulong_maps[6], 17UL); + CHECK_FFS_WORD(single_ulong_maps[7], 1UL); + CHECK_FFS_WORD(single_ulong_maps[8], 32UL); + CHECK_FFS_WORD(single_ulong_maps[9], 17UL); #undef CHECK_FFS_WORD @@ -86,7 +86,7 @@ static int test_ffs(struct unit_module *m, struct gk20a *g, void *args) * possible return values of the function. */ for (i = 0; i < BITS_PER_LONG; i++) { - if (ffs(BIT(i)) != i) + if (ffs(BIT(i)) != (i + 1)) unit_return_fail(m, "ffs(1 << %lu) != %lu [%lu]!\n", i, i, ffs(BIT(i))); }