Commit 7068c2f1 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files

Staging: brcm80211: remove broken MIN() implementation



Use the kernel-provided version, this one is broken.

Note, there are more compiler warnings now, that's due to different
types being compared, which shows how the original macro was wrong in at
least one way.  They need to be fixed up.

Cc: Brett Rudley <brudley@broadcom.com>
Cc: Henry Ptasinski <henryp@broadcom.com>
Cc: Nohee Ko <noheek@broadcom.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent c03b63c1
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -61,7 +61,7 @@ uint pktcopy(osl_t *osh, void *p, uint offset, int len, unsigned char * buf)

	/* copy the data */
	for (; p && len; p = PKTNEXT(p)) {
		n = MIN((uint) PKTLEN(p) - offset, (uint) len);
		n = min((uint) PKTLEN(p) - offset, (uint) len);
		bcopy(PKTDATA(p) + offset, buf, n);
		buf += n;
		len -= n;
@@ -89,7 +89,7 @@ uint pktfrombuf(osl_t *osh, void *p, uint offset, int len, unsigned char *buf)

	/* copy the data */
	for (; p && len; p = PKTNEXT(p)) {
		n = MIN((uint) PKTLEN(p) - offset, (uint) len);
		n = min((uint) PKTLEN(p) - offset, (uint) len);
		bcopy(buf, PKTDATA(p) + offset, n);
		buf += n;
		len -= n;
+1 −1
Original line number Diff line number Diff line
@@ -1682,7 +1682,7 @@ static int dhd_ioctl_entry(struct net_device *net, struct ifreq *ifr, int cmd)

	/* Copy out any buffer passed */
	if (ioc.buf) {
		buflen = MIN(ioc.len, DHD_IOCTL_MAXLEN);
		buflen = min(ioc.len, DHD_IOCTL_MAXLEN);
		/* optimization for direct ioctl calls from kernel */
		/*
		   if (segment_eq(get_fs(), KERNEL_DS)) {
+13 −13
Original line number Diff line number Diff line
@@ -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(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(len, 16));
#endif

		do {
@@ -1390,7 +1390,7 @@ int dhd_bus_rxctl(struct dhd_bus *bus, unsigned char *msg, uint msglen)

	dhd_os_sdlock(bus->dhd);
	rxlen = bus->rxlen;
	bcopy(bus->rxctl, msg, MIN(msglen, rxlen));
	bcopy(bus->rxctl, msg, min(msglen, rxlen));
	bus->rxlen = 0;
	dhd_os_sdunlock(bus->dhd);

@@ -1681,7 +1681,7 @@ static int dhdsdio_pktgen_set(dhd_bus_t *bus, u8 *arg)

	bus->pktgen_tick = bus->pktgen_ptick = 0;
	bus->pktgen_len = MAX(bus->pktgen_len, bus->pktgen_minlen);
	bus->pktgen_len = MIN(bus->pktgen_len, bus->pktgen_maxlen);
	bus->pktgen_len = min(bus->pktgen_len, bus->pktgen_maxlen);

	/* Clear counts for a new pktgen (mode change, or was stopped) */
	if (bus->pktgen_count && (!oldcnt || oldmode != bus->pktgen_mode))
@@ -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(SBSDIO_SB_OFT_ADDR_LIMIT, size);
		}
	}

@@ -1954,7 +1954,7 @@ static int dhdsdio_mem_dump(dhd_bus_t *bus)
	printf("Dump dongle memory");
	databuf = buf;
	while (size) {
		read_size = MIN(MEMBLOCK, size);
		read_size = min(MEMBLOCK, size);
		ret = dhdsdio_membytes(bus, FALSE, start, databuf, read_size);
		if (ret) {
			printf("%s: Error membytes %d\n", __func__, ret);
@@ -2781,7 +2781,7 @@ dhd_bus_iovar_op(dhd_pub_t *dhdp, const char *name,
					  bus->blocksize));
			}
		}
		bus->roundup = MIN(max_roundup, bus->blocksize);
		bus->roundup = min(max_roundup, bus->blocksize);

		if ((bus->idletime == DHD_IDLE_IMMEDIATE) && !bus->dpc_sched) {
			bus->activity = FALSE;
@@ -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(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(PKTLEN(pfirst), 32));
			}
#endif				/* DHD_DEBUG */
		}
@@ -4432,7 +4432,7 @@ bool dhdsdio_dpc(dhd_bus_t *bus)
		framecnt = dhdsdio_readframes(bus, rxlimit, &rxdone);
		if (rxdone || bus->rxskip)
			intstatus &= ~I_HMB_FRAME_IND;
		rxlimit -= MIN(framecnt, rxlimit);
		rxlimit -= min(framecnt, rxlimit);
	}

	/* Keep still-pending events for next scheduling */
@@ -4503,7 +4503,7 @@ bool dhdsdio_dpc(dhd_bus_t *bus)
	else if ((bus->clkstate == CLK_AVAIL) && !bus->fcstate &&
		 pktq_mlen(&bus->txq, ~bus->flowcontrol) && txlimit
		 && DATAOK(bus)) {
		framecnt = rxdone ? txlimit : MIN(txlimit, dhd_txminmax);
		framecnt = rxdone ? txlimit : min(txlimit, dhd_txminmax);
		framecnt = dhdsdio_sendfromq(bus, framecnt);
		txlimit -= framecnt;
	}
@@ -4605,7 +4605,7 @@ static void dhdsdio_pktgen_init(dhd_bus_t *bus)
{
	/* Default to specified length, or full range */
	if (dhd_pktgen_len) {
		bus->pktgen_maxlen = MIN(dhd_pktgen_len, MAX_PKTGEN_LEN);
		bus->pktgen_maxlen = min(dhd_pktgen_len, MAX_PKTGEN_LEN);
		bus->pktgen_minlen = bus->pktgen_maxlen;
	} else {
		bus->pktgen_maxlen = MAX_PKTGEN_LEN;
@@ -5498,7 +5498,7 @@ static bool dhdsdio_probe_init(dhd_bus_t *bus, osl_t *osh, void *sdh)
		DHD_INFO(("%s: Initial value for %s is %d\n",
			  __func__, "sd_blocksize", bus->blocksize));
	}
	bus->roundup = MIN(max_roundup, bus->blocksize);
	bus->roundup = min(max_roundup, bus->blocksize);

	/* Query if bus module supports packet chaining,
		 default to use if supported */
+3 −3
Original line number Diff line number Diff line
@@ -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(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);
@@ -1361,7 +1361,7 @@ wl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
	 **  If SSID is zero join based on BSSID only
	 */
	memset(&ssid, 0, sizeof(ssid));
	ssid.SSID_len = MIN(sizeof(ssid.SSID), sme->ssid_len);
	ssid.SSID_len = min(sizeof(ssid.SSID), sme->ssid_len);
	memcpy(ssid.SSID, sme->ssid, ssid.SSID_len);
	ssid.SSID_len = htod32(ssid.SSID_len);
	wl_update_prof(wl, NULL, &ssid, WL_PROF_SSID);
@@ -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(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));
+6 −6
Original line number Diff line number Diff line
@@ -701,7 +701,7 @@ wl_iw_set_spy(struct net_device *dev,
	if (!extra)
		return -EINVAL;

	iw->spy_num = MIN(ARRAYSIZE(iw->spy_addr), dwrq->length);
	iw->spy_num = min(ARRAYSIZE(iw->spy_addr), dwrq->length);
	for (i = 0; i < iw->spy_num; i++)
		memcpy(&iw->spy_addr[i], addr[i].sa_data, ETHER_ADDR_LEN);
	memset(iw->spy_qual, 0, sizeof(iw->spy_qual));
@@ -1291,7 +1291,7 @@ wl_iw_set_scan(struct net_device *dev,
				return -EBUSY;
			} else {
				g_specific_ssid.SSID_len =
				    MIN(sizeof(g_specific_ssid.SSID),
				    min(sizeof(g_specific_ssid.SSID),
					req->essid_len);
				memcpy(g_specific_ssid.SSID, req->essid,
				       g_specific_ssid.SSID_len);
@@ -1389,7 +1389,7 @@ wl_iw_iscan_set_scan(struct net_device *dev,
	if (wrqu->data.length == sizeof(struct iw_scan_req)) {
		if (wrqu->data.flags & IW_SCAN_THIS_ESSID) {
			struct iw_scan_req *req = (struct iw_scan_req *)extra;
			ssid.SSID_len = MIN(sizeof(ssid.SSID), req->essid_len);
			ssid.SSID_len = min(sizeof(ssid.SSID), req->essid_len);
			memcpy(ssid.SSID, req->essid, ssid.SSID_len);
			ssid.SSID_len = htod32(ssid.SSID_len);
		} else {
@@ -1918,9 +1918,9 @@ wl_iw_set_essid(struct net_device *dev,

	if (dwrq->length && extra) {
#if WIRELESS_EXT > 20
		g_ssid.SSID_len = MIN(sizeof(g_ssid.SSID), dwrq->length);
		g_ssid.SSID_len = min(sizeof(g_ssid.SSID), dwrq->length);
#else
		g_ssid.SSID_len = MIN(sizeof(g_ssid.SSID), dwrq->length - 1);
		g_ssid.SSID_len = min(sizeof(g_ssid.SSID), dwrq->length - 1);
#endif
		memcpy(g_ssid.SSID, extra, g_ssid.SSID_len);
	} else {
@@ -2453,7 +2453,7 @@ wl_iw_get_encode(struct net_device *dev,

	wsec = dtoh32(wsec);
	auth = dtoh32(auth);
	dwrq->length = MIN(DOT11_MAX_KEY_SIZE, key.len);
	dwrq->length = min(DOT11_MAX_KEY_SIZE, key.len);

	dwrq->flags = key.index + 1;
	if (!(wsec & (WEP_ENABLED | TKIP_ENABLED | AES_ENABLED)))
Loading