Search Linux Wireless

Re: [PATCH] iwlwifi: do not register bands with no supported channels

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

 



On Tue, Mar 25, 2008 at 9:58 PM, John W. Linville
<linville@xxxxxxxxxxxxx> wrote:
> Signed-off-by: John W. Linville <linville@xxxxxxxxxxxxx>
>  ---
>  Otherwise, b/g-only devices fail in wiphy_register.  Tested in Fedora
>  kernels for the last week or so...
>
>   drivers/net/wireless/iwlwifi/iwl3945-base.c |    8 ++++++--
>   drivers/net/wireless/iwlwifi/iwl4965-base.c |    8 ++++++--
>   2 files changed, 12 insertions(+), 4 deletions(-)
>
>  diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
>  index 093b863..4ba9591 100644
>  --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
>  +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
>  @@ -5136,8 +5136,12 @@ static int iwl3945_init_geos(struct iwl3945_priv *priv)
>                priv->bands[IEEE80211_BAND_2GHZ].n_channels,
>                priv->bands[IEEE80211_BAND_5GHZ].n_channels);
>
>  -       priv->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &priv->bands[IEEE80211_BAND_2GHZ];
>  -       priv->hw->wiphy->bands[IEEE80211_BAND_5GHZ] = &priv->bands[IEEE80211_BAND_5GHZ];
>  +       if (priv->bands[IEEE80211_BAND_2GHZ].n_channels)
>  +               priv->hw->wiphy->bands[IEEE80211_BAND_2GHZ] =
>  +                       &priv->bands[IEEE80211_BAND_2GHZ];
>  +       if (priv->bands[IEEE80211_BAND_5GHZ].n_channels)
>  +               priv->hw->wiphy->bands[IEEE80211_BAND_5GHZ] =
>  +                       &priv->bands[IEEE80211_BAND_5GHZ];
>
>         set_bit(STATUS_GEO_CONFIGURED, &priv->status);
>
>  diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
>  index 44cfd02..9ae3d29 100644
>  --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
>  +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
>  @@ -5001,8 +5001,12 @@ int iwl4965_init_geos(struct iwl_priv *priv)
>                priv->bands[IEEE80211_BAND_2GHZ].n_channels,
>                priv->bands[IEEE80211_BAND_5GHZ].n_channels);
>
>  -       priv->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &priv->bands[IEEE80211_BAND_2GHZ];
>  -       priv->hw->wiphy->bands[IEEE80211_BAND_5GHZ] = &priv->bands[IEEE80211_BAND_5GHZ];
>  +       if (priv->bands[IEEE80211_BAND_2GHZ].n_channels)
>  +               priv->hw->wiphy->bands[IEEE80211_BAND_2GHZ] =
>  +                       &priv->bands[IEEE80211_BAND_2GHZ];
>  +       if (priv->bands[IEEE80211_BAND_5GHZ].n_channels)
>  +               priv->hw->wiphy->bands[IEEE80211_BAND_5GHZ] =
>  +                       &priv->bands[IEEE80211_BAND_5GHZ];
>
>         set_bit(STATUS_GEO_CONFIGURED, &priv->status);
>

As there already exists condition testing this I would prefer
something like this

printk(KERN_INFO DRV_NAME
	       ": Tunable channels: %d 802.11bg, %d 802.11a channels\n",
	       priv->bands[IEEE80211_BAND_2GHZ].n_channels,
	       priv->bands[IEEE80211_BAND_5GHZ].n_channels);

priv->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &priv->bands[IEEE80211_BAND_2GHZ];



if ((priv->bands[IEEE80211_BAND_5GHZ].n_channels == 0) &&
	     priv->cfg->sku & IWL_SKU_A) {
		printk(KERN_INFO DRV_NAME
		       ": Incorrectly detected BG card as ABG.  Please send "
		       "your PCI ID 0x%04X:0x%04X to maintainer.\n",
		       priv->pci_dev->device, priv->pci_dev->subsystem_device);
		priv->cfg->sku &= ~IWL_SKU_A;
                priv->hw->wiphy->bands[IEEE80211_BAND_5GHZ] = NULL;
}
else
   priv->hw->wiphy->bands[IEEE80211_BAND_5GHZ] =
&priv->bands[IEEE80211_BAND_5GHZ];
>  1.5.3.3
>
>  --
>  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
>
--
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