From be03b02cf6e8e1d53023b2d1f42c0210e00aeef8 Mon Sep 17 00:00:00 2001
From: Owen Huang <Owen.Huang@infineon.com>
Date: Thu, 4 Jul 2024 00:47:10 -0500
Subject: [PATCH 266/296] brcmfmac: fix LINUX_VERSION_CODE warning

WARNING: Comparisons should place the constant on the right side of the test


Signed-off-by: Owen Huang <Owen.Huang@infineon.com>
---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h    | 2 +-
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c   | 2 +-
 .../net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c   | 8 ++++----
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c   | 4 ++--
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h   | 5 +++--
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c    | 4 ++--
 6 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
index 8c4e58d6f922..597f2000dc20 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
@@ -200,7 +200,7 @@ struct brcmf_bus {
 	struct brcmf_bus_msgbuf *msgbuf;
 
 	struct list_head list;
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0))
+#if (KERNEL_VERSION(4, 16, 0) > LINUX_VERSION_CODE)
 	bool allow_skborphan;
 #endif
 #ifdef CONFIG_BRCMFMAC_BT_SHARED_SDIO
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
index d4c5aafc9c11..e353103b5102 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
@@ -617,7 +617,7 @@ void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb, bool inirq)
 	ifp->ndev->stats.rx_packets++;
 
 	brcmf_dbg(DATA, "rx proto=0x%X\n", ntohs(skb->protocol));
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0))
+#if (KERNEL_VERSION(5, 18, 0) <= LINUX_VERSION_CODE)
 	netif_rx(skb);
 #else
 	if (inirq) {
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c
index 5040f6bf99e0..b4a812543712 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c
@@ -502,7 +502,7 @@ struct brcmf_fws_info {
 	bool creditmap_received;
 	u8 mode;
 	bool avoid_queueing;
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0))
+#if (KERNEL_VERSION(4, 16, 0) > LINUX_VERSION_CODE)
 	int fifo_init_credit[BRCMF_FWS_FIFO_COUNT];
 #endif
 };
@@ -1620,7 +1620,7 @@ static int brcmf_fws_notify_credit_map(struct brcmf_if *ifp,
 		WARN_ONCE(fws->fifo_credit[i] < 0,
 			  "fifo_credit[%d] is negative(%d)\n", i,
 			  fws->fifo_credit[i]);
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0))
+#if (KERNEL_VERSION(4, 16, 0) > LINUX_VERSION_CODE)
 		fws->fifo_init_credit[i] = fws->fifo_credit[i];
 #endif
 	}
@@ -2200,7 +2200,7 @@ void brcmf_fws_del_interface(struct brcmf_if *ifp)
 	brcmf_fws_unlock(fws);
 }
 
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0))
+#if (KERNEL_VERSION(4, 16, 0) > LINUX_VERSION_CODE)
 static bool brcmf_fws_ismultistream(struct brcmf_fws_info *fws)
 {
 	bool ret = false;
@@ -2245,7 +2245,7 @@ static void brcmf_fws_dequeue_worker(struct work_struct *worker)
 	fws = container_of(worker, struct brcmf_fws_info, fws_dequeue_work);
 	drvr = fws->drvr;
 
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0))
+#if (KERNEL_VERSION(4, 16, 0) > LINUX_VERSION_CODE)
 	if (brcmf_fws_ismultistream(fws))
 		drvr->bus_if->allow_skborphan = false;
 	else
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
index d5c257bcbd5e..57f5a69db2da 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
@@ -5129,7 +5129,7 @@ brcmf_sdio_rxf_thread(void *data)
 	 */
 	memset(&param, 0, sizeof(struct sched_param));
 	param.sched_priority = 1;
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 9, 0))
+#if (KERNEL_VERSION(5, 9, 0) <= LINUX_VERSION_CODE)
 	if (param.sched_priority >= MAX_RT_PRIO / 2)
 		/* If the priority is MAX_RT_PRIO/2 or higher,
 		 * it is considered as high priority.
@@ -5144,7 +5144,7 @@ brcmf_sdio_rxf_thread(void *data)
 		sched_set_fifo_low(current);
 #else
 	sched_setscheduler(current, SCHED_FIFO, &param);
-#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5, 9, 0) */
+#endif /* KERNEL_VERSION(5, 9, 0) <= LINUX_VERSION_CODE */
 
 
 	while (1) {
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h
index b6e9cbc90b01..eac6bd0c6745 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h
@@ -10,8 +10,9 @@
 #include <linux/firmware.h>
 #include "firmware.h"
 
-#if (LINUX_VERSION_CODE <= KERNEL_VERSION(6, 6, 23))
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0))
+
+#if (KERNEL_VERSION(6, 6, 23) >= LINUX_VERSION_CODE)
+#if (KERNEL_VERSION(4, 11, 0) <= LINUX_VERSION_CODE)
 #include <uapi/linux/sched/types.h>
 #endif /* kernel 4.11.0 */
 #endif /* kernel 6.6.23 */
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
index 5f27108e8860..bb2d4d902f57 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
@@ -639,7 +639,7 @@ static int brcmf_usb_tx(struct device *dev, struct sk_buff *skb)
 		goto fail;
 	}
 
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0))
+#if (KERNEL_VERSION(4, 16, 0) > LINUX_VERSION_CODE)
 	if (devinfo->bus_pub.bus->allow_skborphan)
 		skb_orphan(skb);
 #endif
@@ -1279,7 +1279,7 @@ static int brcmf_usb_probe_cb(struct brcmf_usbdev_info *devinfo,
 	bus->proto_type = BRCMF_PROTO_BCDC;
 	bus->fwvid = fwvid;
 	bus->always_use_fws_queue = true;
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0))
+#if (KERNEL_VERSION(4, 16, 0) > LINUX_VERSION_CODE)
 	bus->allow_skborphan = true;
 #endif
 #ifdef CONFIG_PM
-- 
2.25.1

