Browse Source

Staging: brcm80211: brcmfmac: fix some comparison warnings

Use min_t() instead of min() in some places to make the
comparison explicit and resolve some compiler warnings.

Cc: Brett Rudley <brudley@broadcom.com>
Cc: Henry Ptasinski <henryp@broadcom.com>
Cc: Nohee Ko <noheek@broadcom.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Greg Kroah-Hartman 15 years ago
parent
commit
b61640d1ac

+ 5 - 5
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c

@@ -979,7 +979,7 @@ static int dhdsdio_txpkt(dhd_bus_t *bus, void *pkt, uint chan, bool free_pkt)
 	      (DHD_DATA_ON() && (chan != SDPCM_CONTROL_CHANNEL))))) {
 		prhex("Tx Frame", frame, len);
 	} else if (DHD_HDRS_ON()) {
-		prhex("TxHdr", frame, min(len, 16));
+		prhex("TxHdr", frame, min_t(u16, len, 16));
 	}
 #endif
 
@@ -1312,7 +1312,7 @@ int dhd_bus_txctl(struct dhd_bus *bus, unsigned char *msg, uint msglen)
 		if (DHD_BYTES_ON() && DHD_CTL_ON())
 			prhex("Tx Frame", frame, len);
 		else if (DHD_HDRS_ON())
-			prhex("TxHdr", frame, min(len, 16));
+			prhex("TxHdr", frame, min_t(u16, len, 16));
 #endif
 
 		do {
@@ -1737,7 +1737,7 @@ dhdsdio_membytes(dhd_bus_t *bus, bool write, u32 address, u8 *data,
 				break;
 			}
 			sdaddr = 0;
-			dsize = min(SBSDIO_SB_OFT_ADDR_LIMIT, size);
+			dsize = min_t(uint, SBSDIO_SB_OFT_ADDR_LIMIT, size);
 		}
 	}
 
@@ -3355,7 +3355,7 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq)
 #ifdef DHD_DEBUG
 		if (DHD_GLOM_ON()) {
 			prhex("SUPERFRAME", PKTDATA(pfirst),
-			      min(PKTLEN(pfirst), 48));
+			      min_t(int, PKTLEN(pfirst), 48));
 		}
 #endif
 
@@ -3559,7 +3559,7 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq)
 				PKTLEN(pfirst), PKTNEXT(pfirst),
 				PKTLINK(pfirst)));
 				prhex("", (u8 *) PKTDATA(pfirst),
-				      min(PKTLEN(pfirst), 32));
+				      min_t(int, PKTLEN(pfirst), 32));
 			}
 #endif				/* DHD_DEBUG */
 		}

+ 2 - 2
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c

@@ -804,7 +804,7 @@ __wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
 			ssids->ssid, ssids->ssid_len));
 		memset(&sr->ssid, 0, sizeof(sr->ssid));
 		sr->ssid.SSID_len =
-			    min(sizeof(sr->ssid.SSID), ssids->ssid_len);
+			    min_t(u8, sizeof(sr->ssid.SSID), ssids->ssid_len);
 		if (sr->ssid.SSID_len) {
 			memcpy(sr->ssid.SSID, ssids->ssid, sr->ssid.SSID_len);
 			sr->ssid.SSID_len = htod32(sr->ssid.SSID_len);
@@ -1754,7 +1754,7 @@ wl_cfg80211_get_key(struct wiphy *wiphy, struct net_device *dev,
 	key.index = key_idx;
 	swap_key_to_BE(&key);
 	memset(&params, 0, sizeof(params));
-	params.key_len = (u8) min(DOT11_MAX_KEY_SIZE, key.len);
+	params.key_len = (u8) min_t(u8, DOT11_MAX_KEY_SIZE, key.len);
 	memcpy(params.key, key.data, params.key_len);
 
 	err = wl_dev_ioctl(dev, WLC_GET_WSEC, &wsec, sizeof(wsec));