From 72f495e542c1c458e71fd6971f412edec41830e1 Mon Sep 17 00:00:00 2001 From: Wenpeng Liang Date: Wed, 24 Nov 2021 19:03:54 +0800 Subject: libhns: hr ilog32() should be represented by a function instead of a macro The compiler will check whether the modifiers of the function are of the correct type. Signed-off-by: Wenpeng Liang --- providers/hns/hns_roce_u.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/providers/hns/hns_roce_u.h b/providers/hns/hns_roce_u.h index 92dc26c..c1ae1c9 100644 --- a/providers/hns/hns_roce_u.h +++ b/providers/hns/hns_roce_u.h @@ -101,8 +101,6 @@ #define roce_set_bit(origin, shift, val) \ roce_set_field((origin), (1ul << (shift)), (shift), (val)) -#define hr_ilog32(n) ilog32((unsigned int)(n) - 1) - enum { HNS_ROCE_QP_TABLE_BITS = 8, HNS_ROCE_QP_TABLE_SIZE = 1 << HNS_ROCE_QP_TABLE_BITS, @@ -326,6 +324,11 @@ static inline unsigned int to_hr_hem_entries_size(int count, int buf_shift) return hr_hw_page_align(count << buf_shift); } +static inline unsigned int hr_ilog32(unsigned int count) +{ + return ilog32(count - 1); +} + static inline struct hns_roce_device *to_hr_dev(struct ibv_device *ibv_dev) { return container_of(ibv_dev, struct hns_roce_device, ibv_dev.device); -- 2.27.0