Skip to content

Commit 6f7e034

Browse files
committed
Fit recent kernel versions earlier
Adopt jserv's suggestion: Place the newer kernel versions at the top to maintain consistency with the coding style.
1 parent 78bea24 commit 6f7e034

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

vwifi.c

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,8 @@ static void inform_bss(struct vwifi_vif *vif)
454454
struct cfg80211_inform_bss data = {
455455
/* the only channel */
456456
.chan = &ap->wdev.wiphy->bands[NL80211_BAND_2GHZ]->channels[0],
457-
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 7, 0)
457+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 7, 0)
458+
#else
458459
.scan_width = NL80211_BSS_CHAN_WIDTH_20,
459460
#endif
460461
.signal = DBM_TO_MBM(rand_int_smooth(-100, -30, jiffies)),
@@ -531,7 +532,8 @@ static enum hrtimer_restart vwifi_beacon(struct hrtimer *timer)
531532
.boottime_ns = ktime_get_boottime_ns(),
532533
.chan = vif->channel,
533534
};
534-
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 7, 0)
535+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 7, 0)
536+
#else
535537
switch (vif->bw) {
536538
case NL80211_CHAN_WIDTH_5:
537539
bss_meta.scan_width = NL80211_BSS_CHAN_WIDTH_5;
@@ -1582,10 +1584,10 @@ static int vwifi_stop_ap(struct wiphy *wiphy, struct net_device *ndev)
15821584

15831585
static int vwifi_change_beacon(struct wiphy *wiphy,
15841586
struct net_device *ndev,
1585-
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 7, 0)
1586-
struct cfg80211_beacon_data *info
1587-
#else
1587+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 7, 0)
15881588
struct cfg80211_ap_update *info
1589+
#else
1590+
struct cfg80211_beacon_data *info
15891591
#endif
15901592
)
15911593
{
@@ -1598,22 +1600,22 @@ static int vwifi_change_beacon(struct wiphy *wiphy,
15981600
* 2. tail: beacon IEs after TIM IE
15991601
* We combine them and store them in vif->beacon_ie.
16001602
*/
1601-
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 7, 0)
1602-
head_ie_len = info->head_len - ie_offset;
1603-
tail_ie_len = info->tail_len;
1604-
#else
1603+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 7, 0)
16051604
head_ie_len = info->beacon.head_len - ie_offset;
16061605
tail_ie_len = info->beacon.tail_len;
1606+
#else
1607+
head_ie_len = info->head_len - ie_offset;
1608+
tail_ie_len = info->tail_len;
16071609
#endif
16081610
if (likely(head_ie_len + tail_ie_len <= IE_MAX_LEN)) {
16091611
vif->beacon_ie_len = head_ie_len + tail_ie_len;
16101612
memset(vif->beacon_ie, 0, IE_MAX_LEN);
1611-
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 7, 0)
1612-
memcpy(vif->beacon_ie, &info->head[ie_offset], head_ie_len);
1613-
memcpy(vif->beacon_ie + head_ie_len, info->tail, tail_ie_len);
1614-
#else
1613+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 7, 0)
16151614
memcpy(vif->beacon_ie, &info->beacon.head[ie_offset], head_ie_len);
16161615
memcpy(vif->beacon_ie + head_ie_len, info->beacon.tail, tail_ie_len);
1616+
#else
1617+
memcpy(vif->beacon_ie, &info->head[ie_offset], head_ie_len);
1618+
memcpy(vif->beacon_ie + head_ie_len, info->tail, tail_ie_len);
16171619
#endif
16181620
pr_info(
16191621
"%s: head_ie_len (before TIM IE) = %d, tail_ie_len = "
@@ -2565,7 +2567,8 @@ static void vwifi_virtio_mgmt_rx_scan_response(
25652567
};
25662568
struct cfg80211_inform_bss data = {
25672569
.chan = &rx_channel,
2568-
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 7, 0)
2570+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 7, 0)
2571+
#else
25692572
.scan_width = NL80211_BSS_CHAN_WIDTH_20,
25702573
#endif
25712574
.signal = DBM_TO_MBM(rand_int_smooth(-100, -30, jiffies)),

0 commit comments

Comments
 (0)