From 72ddfc7550aaff59a12f52aa0b4a72783cf4870d Mon Sep 17 00:00:00 2001 From: Sherry Sun Date: Thu, 27 Oct 2022 12:32:47 +0800 Subject: [PATCH] mxm_wifiex: use get_random_u32() when possible The prandom_u32() function has been a deprecated inline wrapper around get_random_u32() for several releases now, and compiles down to the exact same code. Replace the deprecated wrapper with a direct call to the real function. Signed-off-by: Sherry Sun --- mxm_wifiex/wlan_src/mlinux/moal_cfg80211.c | 4 ++++ mxm_wifiex/wlan_src/mlinux/moal_sta_cfg80211.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/mxm_wifiex/wlan_src/mlinux/moal_cfg80211.c b/mxm_wifiex/wlan_src/mlinux/moal_cfg80211.c index 420f8c4..943ea75 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_cfg80211.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_cfg80211.c @@ -2907,7 +2907,11 @@ int woal_cfg80211_mgmt_tx(struct wiphy *wiphy, #if KERNEL_VERSION(3, 8, 0) > LINUX_VERSION_CODE *cookie = random32() | 1; #else +#if KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE *cookie = prandom_u32() | 1; +#else + *cookie = get_random_u32() | 1; +#endif #endif pmbuf->data_offset = MLAN_MIN_DATA_HEADER_LEN; pkt_type = MRVL_PKT_TYPE_MGMT_FRAME; diff --git a/mxm_wifiex/wlan_src/mlinux/moal_sta_cfg80211.c b/mxm_wifiex/wlan_src/mlinux/moal_sta_cfg80211.c index 6048071..80263ac 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_sta_cfg80211.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_sta_cfg80211.c @@ -6223,7 +6223,11 @@ woal_cfg80211_remain_on_channel(struct wiphy *wiphy, struct net_device *dev, #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0) *cookie = (u64)random32() | 1; #else +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0) *cookie = (u64)prandom_u32() | 1; +#else + *cookie = (u64)get_random_u32() | 1; +#endif #endif priv->phandle->remain_on_channel = MTRUE; priv->phandle->remain_bss_index = priv->bss_index;