diff options
author | Edmundo Carmona Antoranz <eantoranz@gmail.com> | 2021-03-14 08:59:43 -0600 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-03-14 17:01:46 +0100 |
commit | ebf4824798184d4a86214d570c04cf390c5edfa8 (patch) | |
tree | d36c0662b859939bc96669a4a5bda7670f7435e7 /drivers/staging/vt6655 | |
parent | c170f1687bcff6ea809725098035a104f13dd6e4 (diff) |
staging: vt6655: remove duplicate code
In the definition of vnt_init_bands(), there are two sections of
code that are very similar. Unifying them through a new
function that takes care of initialization of a single band.
Signed-off-by: Edmundo Carmona Antoranz <eantoranz@gmail.com>
Link: https://lore.kernel.org/r/20210314145943.1933245-3-eantoranz@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/vt6655')
-rw-r--r-- | drivers/staging/vt6655/channel.c | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/drivers/staging/vt6655/channel.c b/drivers/staging/vt6655/channel.c index ba92b7259ec6..cf46ee63681a 100644 --- a/drivers/staging/vt6655/channel.c +++ b/drivers/staging/vt6655/channel.c @@ -114,40 +114,38 @@ static struct ieee80211_supported_band vnt_supported_5ghz_band = { .n_bitrates = ARRAY_SIZE(vnt_rates_a), }; -void vnt_init_bands(struct vnt_private *priv) +static void vnt_init_band(struct vnt_private *priv, + struct ieee80211_supported_band *supported_band, + enum nl80211_band band) { - struct ieee80211_channel *ch; int i; + for (i = 0; i < supported_band->n_channels; i++) { + supported_band->channels[i].max_power = 0x3f; + supported_band->channels[i].flags = + IEEE80211_CHAN_NO_HT40; + } + + priv->hw->wiphy->bands[band] = supported_band; +} + +void vnt_init_bands(struct vnt_private *priv) +{ switch (priv->byRFType) { case RF_AIROHA7230: case RF_UW2452: case RF_NOTHING: default: - ch = vnt_channels_5ghz; - - for (i = 0; i < ARRAY_SIZE(vnt_channels_5ghz); i++) { - ch[i].max_power = 0x3f; - ch[i].flags = IEEE80211_CHAN_NO_HT40; - } - - priv->hw->wiphy->bands[NL80211_BAND_5GHZ] = - &vnt_supported_5ghz_band; + vnt_init_band(priv, &vnt_supported_5ghz_band, + NL80211_BAND_5GHZ); fallthrough; case RF_RFMD2959: case RF_AIROHA: case RF_AL2230S: case RF_UW2451: case RF_VT3226: - ch = vnt_channels_2ghz; - - for (i = 0; i < ARRAY_SIZE(vnt_channels_2ghz); i++) { - ch[i].max_power = 0x3f; - ch[i].flags = IEEE80211_CHAN_NO_HT40; - } - - priv->hw->wiphy->bands[NL80211_BAND_2GHZ] = - &vnt_supported_2ghz_band; + vnt_init_band(priv, &vnt_supported_2ghz_band, + NL80211_BAND_2GHZ); break; } } |