@@ -499,6 +499,28 @@ void scan_freq_set_constrain(struct scan_freq_set *set,
set->channels_2ghz &= constraint->channels_2ghz;
}
+void scan_freq_set_subtract(struct scan_freq_set *set,
+ const struct scan_freq_set *subtract)
+{
+ struct l_uintset *sub;
+
+ sub = l_uintset_subtract(set->channels_6ghz, subtract->channels_6ghz);
+ if (L_WARN_ON(!sub))
+ return;
+
+ l_uintset_free(set->channels_6ghz);
+ set->channels_6ghz = sub;
+
+ sub = l_uintset_subtract(set->channels_5ghz, subtract->channels_5ghz);
+ if (L_WARN_ON(!sub))
+ return;
+
+ l_uintset_free(set->channels_5ghz);
+ set->channels_5ghz = sub;
+
+ set->channels_2ghz &= ~subtract->channels_2ghz;
+}
+
static void add_foreach(uint32_t freq, void *user_data)
{
uint32_t **list = user_data;
@@ -118,6 +118,8 @@ void scan_freq_set_merge(struct scan_freq_set *to,
const struct scan_freq_set *from);
void scan_freq_set_constrain(struct scan_freq_set *set,
const struct scan_freq_set *constraint);
+void scan_freq_set_subtract(struct scan_freq_set *set,
+ const struct scan_freq_set *subtract);
bool scan_freq_set_isempty(const struct scan_freq_set *set);
uint32_t *scan_freq_set_to_fixed_array(const struct scan_freq_set *set,
size_t *len_out);