Search Linux Wireless

Re: [PATCH 2/3] d80211: Split antenna selection into TX and RX antenna

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

 



On Wednesday 21 February 2007 18:24, Ivo van Doorn wrote:
> > No, there is no need to inline. Simple static in main.c above
> > the config callback, please. :)
> > And simply return BCM43xx_ANTENNA_DEFAULT for the default:
> > case, so it doesn't break immediately, if someone decides
> > to add something to d80211.
> >
> > ...But we've almost got it :D
> > After that you'll get my sign-off.
> 
> bcm43xx_antenna_from_ieee80211 is no longer inlined,
> and it returns BCM43xx_ANTENNA_DEFAULT by default.
> 
> Hopefully I got it this time. :)

Yeah, *clap clap clap* :D

> Signed-off-by: Ivo van Doorn <IvDoorn@xxxxxxxxx>

Signed-off-by: Michael Buesch <mb@xxxxxxxxx>

> ---
> 
> diff --git a/drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c b/drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c
> index cdce227..798427f 100644
> --- a/drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c
> +++ b/drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c
> @@ -2598,6 +2598,20 @@ static int bcm43xx_switch_phymode(struct bcm43xx_wl *wl,
>  	return 0;
>  }
>  
> +static int bcm43xx_antenna_from_ieee80211(u8 antenna)
> +{
> +	switch (antenna) {
> +	case 0: /* default/diversity */
> +		return BCM43xx_ANTENNA_DEFAULT;
> +	case 1: /* Antenna 0 */
> +		return BCM43xx_ANTENNA0;
> +	case 2: /* Antenna 1 */
> +		return BCM43xx_ANTENNA1;
> +	default:
> +		return BCM43xx_ANTENNA_DEFAULT;
> +	}
> +}
> +
>  static int bcm43xx_dev_config(struct ieee80211_hw *hw,
>  			      struct ieee80211_conf *conf)
>  {
> @@ -2606,22 +2620,12 @@ static int bcm43xx_dev_config(struct ieee80211_hw *hw,
>  	struct bcm43xx_phy *phy;
>  	unsigned long flags;
>  	unsigned int new_phymode = 0xFFFF;
> -	int antenna = -1;
> +	int antenna_tx;
> +	int antenna_rx;
>  	int err = 0;
>  
> -	switch (conf->antenna_sel) {
> -	case 0: /* default/diversity */
> -		antenna = BCM43xx_ANTENNA_DEFAULT;
> -		break;
> -	case 1: /* Antenna 0 */
> -		antenna = BCM43xx_ANTENNA0;
> -		break;
> -	case 2: /* Antenna 1 */
> -		antenna = BCM43xx_ANTENNA1;
> -		break;
> -	default:
> -		assert(0);
> -	}
> +	antenna_tx = bcm43xx_antenna_from_ieee80211(conf->antenna_sel_tx);
> +	antenna_rx = bcm43xx_antenna_from_ieee80211(conf->antenna_sel_rx);
>  
>  	mutex_lock(&wl->mutex);
>  
> @@ -2682,8 +2686,8 @@ static int bcm43xx_dev_config(struct ieee80211_hw *hw,
>  	}
>  
>  	/* Antennas for RX and management frame TX. */
> -	bcm43xx_mgmtframe_txantenna(dev, antenna);
> -	bcm43xx_set_rx_antenna(dev, antenna);
> +	bcm43xx_mgmtframe_txantenna(dev, antenna_tx);
> +	bcm43xx_set_rx_antenna(dev, antenna_rx);
>  
>  	/* Update templates for AP mode. */
>  	if (bcm43xx_is_mode(wl, IEEE80211_IF_TYPE_AP))
> diff --git a/drivers/net/wireless/d80211/bcm43xx/bcm43xx_xmit.c b/drivers/net/wireless/d80211/bcm43xx/bcm43xx_xmit.c
> index 71cba92..cfc84cd 100644
> --- a/drivers/net/wireless/d80211/bcm43xx/bcm43xx_xmit.c
> +++ b/drivers/net/wireless/d80211/bcm43xx/bcm43xx_xmit.c
> @@ -281,7 +281,7 @@ static void generate_txhdr_fw4(struct bcm43xx_wldev *dev,
>  		phy_ctl |= BCM43xx_TX4_PHY_OFDM;
>  	if (dev->short_preamble)
>  		phy_ctl |= BCM43xx_TX4_PHY_SHORTPRMBL;
> -	switch (txctl->antenna_sel) {
> +	switch (txctl->antenna_sel_tx) {
>  	case 0:
>  		phy_ctl |= BCM43xx_TX4_PHY_ANTLAST;
>  		break;
> 
> 

-- 
Greetings Michael.
-
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux