From 4d3d23dd24ec9cff370fce24703956fdb6a24afc Mon Sep 17 00:00:00 2001 From: Larry Finger Date: Tue, 3 Aug 2021 08:52:21 -0500 Subject: [PATCH] Remove wrapper around do_div Wrapper routine rtw_modular64() contains only a call to do_div() and is used once in the code. Remove the wrapper. Link: https://lore.kernel.org/r/20210803135223.12543-9-Larry.Finger@lwfinger.net --- core/rtw_wlan_util.c | 2 +- hal/hal_com.c | 2 +- hal/hal_mcc.c | 4 ++-- include/osdep_service.h | 1 - os_dep/osdep_service.c | 19 ------------------- 5 files changed, 4 insertions(+), 24 deletions(-) diff --git a/core/rtw_wlan_util.c b/core/rtw_wlan_util.c index a1b5063..97300c1 100644 --- a/core/rtw_wlan_util.c +++ b/core/rtw_wlan_util.c @@ -2428,7 +2428,7 @@ void rtw_debug_rx_bcn(_adapter *adapter, u8 *pframe, u32 packet_len) update_TSF(pmlmeext, pframe, packet_len); tsf = pmlmeext->TSFValue; - tsf_offset = rtw_modular64(pmlmeext->TSFValue, (mlmeinfo->bcn_interval * 1024)); + tsf_offset = do_div(pmlmeext->TSFValue, (mlmeinfo->bcn_interval * 1024)); /*get TIM IE*/ /*DTIM Count*/ diff --git a/hal/hal_com.c b/hal/hal_com.c index f0c7e43..ea558a0 100644 --- a/hal/hal_com.c +++ b/hal/hal_com.c @@ -11328,7 +11328,7 @@ static void hw_var_set_correct_tsf(_adapter *adapter, u8 mlme_state) struct mlme_ext_priv *mlmeext = &adapter->mlmeextpriv; struct mlme_ext_info *mlmeinfo = &(mlmeext->mlmext_info); - tsf = mlmeext->TSFValue - rtw_modular64(mlmeext->TSFValue, (mlmeinfo->bcn_interval * 1024)) - 1024; /*us*/ + tsf = mlmeext->TSFValue - do_div(mlmeext->TSFValue, (mlmeinfo->bcn_interval * 1024)) - 1024; /*us*/ if ((mlmeinfo->state & 0x03) == WIFI_FW_ADHOC_STATE || (mlmeinfo->state & 0x03) == WIFI_FW_AP_STATE) diff --git a/hal/hal_mcc.c b/hal/hal_mcc.c index 179d4d5..ac251cb 100644 --- a/hal/hal_mcc.c +++ b/hal/hal_mcc.c @@ -753,11 +753,11 @@ static u8 rtw_hal_mcc_update_timing_parameters(PADAPTER padapter, u8 force_updat /* selecet policy table according TSF diff */ tsf0 = tsf[0]; beaconperiod_0 = pmccobjpriv->iface[0]->mlmepriv.cur_network.network.Configuration.BeaconPeriod; - tsf0 = rtw_modular64(tsf0, (beaconperiod_0 * TU)); + tsf0 = do_div(tsf0, (beaconperiod_0 * TU)); tsf1 = tsf[1]; beaconperiod_1 = pmccobjpriv->iface[1]->mlmepriv.cur_network.network.Configuration.BeaconPeriod; - tsf1 = rtw_modular64(tsf1, (beaconperiod_1 * TU)); + tsf1 = do_div(tsf1, (beaconperiod_1 * TU)); if (tsf0 > tsf1) tsfdiff = tsf0- tsf1; diff --git a/include/osdep_service.h b/include/osdep_service.h index 93f68c4..d26cd9f 100644 --- a/include/osdep_service.h +++ b/include/osdep_service.h @@ -622,7 +622,6 @@ extern void rtw_free_netdev(struct net_device *netdev); #endif /* PLATFORM_FREEBSD */ -extern u64 rtw_modular64(u64 x, u64 y); extern u64 rtw_division64(u64 x, u64 y); extern u32 rtw_random32(void); diff --git a/os_dep/osdep_service.c b/os_dep/osdep_service.c index f805308..3dc89ca 100644 --- a/os_dep/osdep_service.c +++ b/os_dep/osdep_service.c @@ -2433,25 +2433,6 @@ void module_init_exit_wrapper(void *arg) } #endif /* PLATFORM_FREEBSD */ - -#ifdef CONFIG_PLATFORM_SPRD - #ifdef do_div - #undef do_div - #endif - #include -#endif - -u64 rtw_modular64(u64 x, u64 y) -{ -#ifdef PLATFORM_LINUX - return do_div(x, y); -#elif defined(PLATFORM_WINDOWS) - return x % y; -#elif defined(PLATFORM_FREEBSD) - return x % y; -#endif -} - u64 rtw_division64(u64 x, u64 y) { #ifdef PLATFORM_LINUX