3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-23 06:02:37 +01:00

wiphy: make wiphy_band_is_disabled return more descriptive

The function wiphy_band_is_disabled() return was a bit misleading
because if the band was not supported it would return true which
could be misunderstood as the band is supported, but disabled.
There was only one call site and because of this behavior
wiphy_band_is_disabled needed to be paired with checking if the
band was supported.

To be more descriptive to the caller, wiphy_band_is_disabled() now
returns an int and if the band isn't supported -ENOTSUP will be
returned, otherwise 1 is returned if the band is disabled and 0
otherwise.
This commit is contained in:
James Prestwood 2023-09-29 09:19:57 -07:00 committed by Denis Kenzior
parent 0bb99bcc33
commit 970d23a858
3 changed files with 6 additions and 8 deletions

View File

@ -1450,9 +1450,7 @@ static int station_quick_scan_trigger(struct station *station)
* this since its so limited, so return an error which will fall back to * this since its so limited, so return an error which will fall back to
* full autoconnect. * full autoconnect.
*/ */
if (wiphy_get_supported_bands(station->wiphy) & BAND_FREQ_6_GHZ && if (wiphy_band_is_disabled(station->wiphy, BAND_FREQ_6_GHZ) == 1 &&
wiphy_band_is_disabled(station->wiphy,
BAND_FREQ_6_GHZ) &&
wiphy_country_is_unknown(station->wiphy) && wiphy_country_is_unknown(station->wiphy) &&
known_6ghz) known_6ghz)
return -ENOTSUP; return -ENOTSUP;

View File

@ -570,7 +570,7 @@ const struct band_freq_attrs *wiphy_get_frequency_info_list(
return bandp->freq_attrs; return bandp->freq_attrs;
} }
bool wiphy_band_is_disabled(const struct wiphy *wiphy, enum band_freq band) int wiphy_band_is_disabled(const struct wiphy *wiphy, enum band_freq band)
{ {
struct band_freq_attrs attr; struct band_freq_attrs attr;
unsigned int i; unsigned int i;
@ -578,7 +578,7 @@ bool wiphy_band_is_disabled(const struct wiphy *wiphy, enum band_freq band)
bandp = wiphy_get_band(wiphy, band); bandp = wiphy_get_band(wiphy, band);
if (!bandp) if (!bandp)
return true; return -ENOTSUP;
for (i = 0; i < bandp->freqs_len; i++) { for (i = 0; i < bandp->freqs_len; i++) {
attr = bandp->freq_attrs[i]; attr = bandp->freq_attrs[i];
@ -587,10 +587,10 @@ bool wiphy_band_is_disabled(const struct wiphy *wiphy, enum band_freq band)
continue; continue;
if (!attr.disabled) if (!attr.disabled)
return false; return 0;
} }
return true; return 1;
} }
bool wiphy_supports_probe_resp_offload(struct wiphy *wiphy) bool wiphy_supports_probe_resp_offload(struct wiphy *wiphy)

View File

@ -111,7 +111,7 @@ const struct band_freq_attrs *wiphy_get_frequency_info_list(
enum band_freq band, enum band_freq band,
size_t *size); size_t *size);
bool wiphy_band_is_disabled(const struct wiphy *wiphy, enum band_freq band); int wiphy_band_is_disabled(const struct wiphy *wiphy, enum band_freq band);
bool wiphy_supports_probe_resp_offload(struct wiphy *wiphy); bool wiphy_supports_probe_resp_offload(struct wiphy *wiphy);
bool wiphy_can_transition_disable(struct wiphy *wiphy); bool wiphy_can_transition_disable(struct wiphy *wiphy);