/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause * Copyright(c) 2019-2020 Realtek Corporation */ #ifndef __RTW89_UTIL_H__ #define __RTW89_UTIL_H__ #include "core.h" #define RTW89_LINEAR_FRAC_BITS … #define rtw89_iterate_vifs_bh(rtwdev, iterator, data) … /* call this function with rtwdev->mutex is held */ #define rtw89_for_each_rtwvif(rtwdev, rtwvif) … /* Before adding rtwvif to list, we need to check if it already exist, beacase * in some case such as SER L2 happen during WoWLAN flow, calling reconfig * twice cause the list to be added twice. */ static inline bool rtw89_rtwvif_in_list(struct rtw89_dev *rtwdev, struct rtw89_vif *new) { … } /* The result of negative dividend and positive divisor is undefined, but it * should be one case of round-down or round-up. So, make it round-down if the * result is round-up. * Note: the maximum value of divisor is 0x7FFF_FFFF, because we cast it to * signed value to make compiler to use signed divide instruction. */ static inline s32 s32_div_u32_round_down(s32 dividend, u32 divisor, s32 *remainder) { … } static inline s32 s32_div_u32_round_closest(s32 dividend, u32 divisor) { … } static inline void ether_addr_copy_mask(u8 *dst, const u8 *src, u8 mask) { … } u32 rtw89_linear_2_db(u64 linear); u64 rtw89_db_2_linear(u32 db); #endif