mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-22 13:02:44 +01:00
util: add scan_freq_set_remove
Removes one frequency from a scan_freq_set object.
This commit is contained in:
parent
ea93e74a06
commit
59a0947c76
22
src/util.c
22
src/util.c
@ -360,6 +360,28 @@ bool scan_freq_set_add(struct scan_freq_set *freqs, uint32_t freq)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool scan_freq_set_remove(struct scan_freq_set *freqs, uint32_t freq)
|
||||
{
|
||||
enum band_freq band;
|
||||
uint8_t channel;
|
||||
|
||||
channel = band_freq_to_channel(freq, &band);
|
||||
if (!channel)
|
||||
return false;
|
||||
|
||||
switch (band) {
|
||||
case BAND_FREQ_2_4_GHZ:
|
||||
freqs->channels_2ghz &= ~(1 << (channel - 1));
|
||||
return true;
|
||||
case BAND_FREQ_5_GHZ:
|
||||
return l_uintset_take(freqs->channels_5ghz, channel);
|
||||
case BAND_FREQ_6_GHZ:
|
||||
return l_uintset_take(freqs->channels_6ghz, channel);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool scan_freq_set_contains(const struct scan_freq_set *freqs, uint32_t freq)
|
||||
{
|
||||
enum band_freq band;
|
||||
|
@ -111,6 +111,7 @@ typedef void (*scan_freq_set_func_t)(uint32_t freq, void *userdata);
|
||||
struct scan_freq_set *scan_freq_set_new(void);
|
||||
void scan_freq_set_free(struct scan_freq_set *freqs);
|
||||
bool scan_freq_set_add(struct scan_freq_set *freqs, uint32_t freq);
|
||||
bool scan_freq_set_remove(struct scan_freq_set *freqs, uint32_t freq);
|
||||
bool scan_freq_set_contains(const struct scan_freq_set *freqs, uint32_t freq);
|
||||
uint32_t scan_freq_set_get_bands(const struct scan_freq_set *freqs);
|
||||
void scan_freq_set_foreach(const struct scan_freq_set *freqs,
|
||||
|
Loading…
Reference in New Issue
Block a user