mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-25 09:39:25 +01:00
frame-xchg: Use frame_watch_group_match in frame_watch_group_get
This commit is contained in:
parent
d012a7f2ac
commit
1e10d13645
@ -439,21 +439,30 @@ err:
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct watch_group_match_info {
|
||||||
|
uint64_t wdev_id;
|
||||||
|
uint32_t id;
|
||||||
|
};
|
||||||
|
|
||||||
|
static bool frame_watch_group_match(const void *a, const void *b)
|
||||||
|
{
|
||||||
|
const struct watch_group *group = a;
|
||||||
|
const struct watch_group_match_info *info = b;
|
||||||
|
|
||||||
|
return group->wdev_id == info->wdev_id && group->id == info->id;
|
||||||
|
}
|
||||||
|
|
||||||
static struct watch_group *frame_watch_group_get(uint64_t wdev_id, uint32_t id)
|
static struct watch_group *frame_watch_group_get(uint64_t wdev_id, uint32_t id)
|
||||||
{
|
{
|
||||||
const struct l_queue_entry *entry;
|
struct watch_group_match_info info = { id == 0 ? 0 : wdev_id, id };
|
||||||
struct watch_group *group;
|
struct watch_group *group = l_queue_find(watch_groups,
|
||||||
|
frame_watch_group_match, &info);
|
||||||
|
|
||||||
for (entry = l_queue_get_entries(watch_groups); entry;
|
if (!group) {
|
||||||
entry = entry->next) {
|
group = frame_watch_group_new(wdev_id, id);
|
||||||
group = entry->data;
|
l_queue_push_tail(watch_groups, group);
|
||||||
|
|
||||||
if (group->id == id && (id == 0 || group->wdev_id == wdev_id))
|
|
||||||
return group;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
group = frame_watch_group_new(wdev_id, id);
|
|
||||||
l_queue_push_tail(watch_groups, group);
|
|
||||||
return group;
|
return group;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -590,19 +599,6 @@ bool frame_watch_add(uint64_t wdev_id, uint32_t group_id, uint16_t frame_type,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct watch_group_match_info {
|
|
||||||
uint64_t wdev_id;
|
|
||||||
uint32_t id;
|
|
||||||
};
|
|
||||||
|
|
||||||
static bool frame_watch_group_match(const void *a, const void *b)
|
|
||||||
{
|
|
||||||
const struct watch_group *group = a;
|
|
||||||
const struct watch_group_match_info *info = b;
|
|
||||||
|
|
||||||
return group->wdev_id == info->wdev_id && group->id == info->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool frame_watch_group_remove(uint64_t wdev_id, uint32_t group_id)
|
bool frame_watch_group_remove(uint64_t wdev_id, uint32_t group_id)
|
||||||
{
|
{
|
||||||
struct watch_group_match_info info = { wdev_id, group_id };
|
struct watch_group_match_info info = { wdev_id, group_id };
|
||||||
|
Loading…
Reference in New Issue
Block a user