Re: [PATCH] staging: brcm80211: removed static ASSERTs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/05/2011 09:11 PM, Roland Vossen wrote:
> Code cleanup. ASSERTs that check static (compile time) conditions
> have been removed.

I'm missing why? Is it obvious that it can never happen or is it an
optimization?

If the latter you should switch to BUILD_BUG_ON.

> Signed-off-by: Roland Vossen <rvossen@xxxxxxxxxxxx>
> ---
>  drivers/staging/brcm80211/brcmsmac/wlc_ampdu.c |    4 ---
>  drivers/staging/brcm80211/brcmsmac/wlc_bmac.c  |   11 -------
>  drivers/staging/brcm80211/brcmsmac/wlc_main.c  |   35 ------------------------
>  3 files changed, 0 insertions(+), 50 deletions(-)
> 
> diff --git a/drivers/staging/brcm80211/brcmsmac/wlc_ampdu.c b/drivers/staging/brcm80211/brcmsmac/wlc_ampdu.c
> index e362cad..d60ffd0 100644
> --- a/drivers/staging/brcm80211/brcmsmac/wlc_ampdu.c
> +++ b/drivers/staging/brcm80211/brcmsmac/wlc_ampdu.c
> @@ -164,10 +164,6 @@ struct ampdu_info *wlc_ampdu_attach(struct wlc_info *wlc)
>  	struct ampdu_info *ampdu;
>  	int i;
>  
> -	/* some code depends on packed structures */
> -	ASSERT(DOT11_MAXNUMFRAGS == NBITS(u16));
> -	ASSERT(ISPOWEROF2(AMPDU_TX_BA_MAX_WSIZE));
> -	ASSERT(ISPOWEROF2(AMPDU_RX_BA_MAX_WSIZE));
>  	ASSERT(wlc->pub->tunables->ampdunummpdu <= AMPDU_MAX_MPDU);
>  	ASSERT(wlc->pub->tunables->ampdunummpdu > 0);
>  
> diff --git a/drivers/staging/brcm80211/brcmsmac/wlc_bmac.c b/drivers/staging/brcm80211/brcmsmac/wlc_bmac.c
> index f7dab54..86edc63 100644
> --- a/drivers/staging/brcm80211/brcmsmac/wlc_bmac.c
> +++ b/drivers/staging/brcm80211/brcmsmac/wlc_bmac.c
> @@ -547,8 +547,6 @@ static bool wlc_bmac_attach_dmapio(struct wlc_info *wlc, uint j, bool wme)
>  		 * TX: TX_AC_BK_FIFO (TX AC Background data packets)
>  		 * RX: RX_FIFO (RX data packets)
>  		 */
> -		ASSERT(TX_AC_BK_FIFO == 0);
> -		ASSERT(RX_FIFO == 0);
>  		wlc_hw->di[0] = dma_attach(name, wlc_hw->sih,
>  					   (wme ? DMAREG(wlc_hw, DMA_TX, 0) :
>  					    NULL), DMAREG(wlc_hw, DMA_RX, 0),
> @@ -563,8 +561,6 @@ static bool wlc_bmac_attach_dmapio(struct wlc_info *wlc, uint j, bool wme)
>  		 *   (legacy) TX_DATA_FIFO (TX data packets)
>  		 * RX: UNUSED
>  		 */
> -		ASSERT(TX_AC_BE_FIFO == 1);
> -		ASSERT(TX_DATA_FIFO == 1);
>  		wlc_hw->di[1] = dma_attach(name, wlc_hw->sih,
>  					   DMAREG(wlc_hw, DMA_TX, 1), NULL,
>  					   tune->ntxd, 0, 0, -1, 0, 0,
> @@ -576,7 +572,6 @@ static bool wlc_bmac_attach_dmapio(struct wlc_info *wlc, uint j, bool wme)
>  		 * TX: TX_AC_VI_FIFO (TX AC Video data packets)
>  		 * RX: UNUSED
>  		 */
> -		ASSERT(TX_AC_VI_FIFO == 2);
>  		wlc_hw->di[2] = dma_attach(name, wlc_hw->sih,
>  					   DMAREG(wlc_hw, DMA_TX, 2), NULL,
>  					   tune->ntxd, 0, 0, -1, 0, 0,
> @@ -587,8 +582,6 @@ static bool wlc_bmac_attach_dmapio(struct wlc_info *wlc, uint j, bool wme)
>  		 * TX: TX_AC_VO_FIFO (TX AC Voice data packets)
>  		 *   (legacy) TX_CTL_FIFO (TX control & mgmt packets)
>  		 */
> -		ASSERT(TX_AC_VO_FIFO == 3);
> -		ASSERT(TX_CTL_FIFO == 3);
>  		wlc_hw->di[3] = dma_attach(name, wlc_hw->sih,
>  					   DMAREG(wlc_hw, DMA_TX, 3),
>  					   NULL, tune->ntxd, 0, 0, -1,
> @@ -648,7 +641,6 @@ int wlc_bmac_attach(struct wlc_info *wlc, u16 vendor, u16 device, uint unit,
>  	WL_TRACE("wl%d: wlc_bmac_attach: vendor 0x%x device 0x%x\n",
>  		 unit, vendor, device);
>  
> -	ASSERT(sizeof(wlc_d11rxhdr_t) <= WL_HWRXOFF);
>  
>  	wme = true;
>  
> @@ -1384,7 +1376,6 @@ wlc_bmac_mhf(struct wlc_hw_info *wlc_hw, u8 idx, u16 mask, u16 val,
>  
>  	ASSERT((val & ~mask) == 0);
>  	ASSERT(idx < MHFMAX);
> -	ASSERT(ARRAY_SIZE(addr) == MHFMAX);
>  
>  	switch (bands) {
>  		/* Current band only or all bands,
> @@ -1460,8 +1451,6 @@ static void wlc_write_mhf(struct wlc_hw_info *wlc_hw, u16 *mhfs)
>  		M_HOST_FLAGS5
>  	};
>  
> -	ASSERT(ARRAY_SIZE(addr) == MHFMAX);
> -
>  	for (idx = 0; idx < MHFMAX; idx++) {
>  		wlc_bmac_write_shm(wlc_hw, addr[idx], mhfs[idx]);
>  	}
> diff --git a/drivers/staging/brcm80211/brcmsmac/wlc_main.c b/drivers/staging/brcm80211/brcmsmac/wlc_main.c
> index ccad6b8..330bd95 100644
> --- a/drivers/staging/brcm80211/brcmsmac/wlc_main.c
> +++ b/drivers/staging/brcm80211/brcmsmac/wlc_main.c
> @@ -1356,8 +1356,6 @@ void wlc_wme_initparams_sta(struct wlc_info *wlc, wme_param_ie_t *pe)
>  		  cpu_to_le16(EDCF_AC_VO_TXOP_STA)}
>  		 }
>  	};
> -
> -	ASSERT(sizeof(*pe) == WME_PARAM_IE_LEN);
>  	memcpy(pe, &stadef, sizeof(*pe));
>  }
>  
> @@ -1734,39 +1732,6 @@ void *wlc_attach(void *wl, u16 vendor, u16 device, uint unit, bool piomode,
>  	WL_NONE("wl%d: %s: vendor 0x%x device 0x%x\n",
>  		unit, __func__, vendor, device);
>  
> -	ASSERT(WSEC_MAX_RCMTA_KEYS <= WSEC_MAX_KEYS);
> -	ASSERT(WSEC_MAX_DEFAULT_KEYS == WLC_DEFAULT_KEYS);
> -
> -	/* some code depends on packed structures */
> -	ASSERT(sizeof(struct ethhdr) == ETH_HLEN);
> -	ASSERT(sizeof(d11regs_t) == SI_CORE_SIZE);
> -	ASSERT(sizeof(ofdm_phy_hdr_t) == D11_PHY_HDR_LEN);
> -	ASSERT(sizeof(cck_phy_hdr_t) == D11_PHY_HDR_LEN);
> -	ASSERT(sizeof(d11txh_t) == D11_TXH_LEN);
> -	ASSERT(sizeof(d11rxhdr_t) == RXHDR_LEN);
> -	ASSERT(sizeof(struct ieee80211_hdr) == DOT11_A4_HDR_LEN);
> -	ASSERT(sizeof(struct ieee80211_rts) == DOT11_RTS_LEN);
> -	ASSERT(sizeof(tx_status_t) == TXSTATUS_LEN);
> -	ASSERT(sizeof(struct ieee80211_ht_cap) == HT_CAP_IE_LEN);
> -#ifdef BRCM_FULLMAC
> -	ASSERT(offsetof(wl_scan_params_t, channel_list) ==
> -	       WL_SCAN_PARAMS_FIXED_SIZE);
> -#endif
> -	ASSERT(IS_ALIGNED(offsetof(wsec_key_t, data), sizeof(u32)));
> -	ASSERT(ISPOWEROF2(MA_WINDOW_SZ));
> -
> -	ASSERT(sizeof(wlc_d11rxhdr_t) <= WL_HWRXOFF);
> -
> -	/*
> -	 * Number of replay counters value used in WPA IE must match # rxivs
> -	 * supported in wsec_key_t struct. See 802.11i/D3.0 sect. 7.3.2.17
> -	 * 'RSN Information Element' figure 8 for this mapping.
> -	 */
> -	ASSERT((WPA_CAP_16_REPLAY_CNTRS == WLC_REPLAY_CNTRS_VALUE
> -		&& 16 == WLC_NUMRXIVS)
> -	       || (WPA_CAP_4_REPLAY_CNTRS == WLC_REPLAY_CNTRS_VALUE
> -		   && 4 == WLC_NUMRXIVS));
> -
>  	/* allocate struct wlc_info state and its substructures */
>  	wlc = (struct wlc_info *) wlc_attach_malloc(unit, &err, device);
>  	if (wlc == NULL)


-- 
js
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux