3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-25 17:59:25 +01:00

network: Use station_foreach

Instead of __iwd_device_foreach api, use the newly introduced
station_foreach API
This commit is contained in:
Denis Kenzior 2018-09-04 16:07:03 -05:00
parent d576c28d9f
commit dcfdd0ccde
6 changed files with 26 additions and 25 deletions

View File

@ -78,18 +78,6 @@ static uint32_t netdev_watch;
static void device_netdev_event(struct netdev *netdev, enum netdev_event event,
void *user_data);
void __iwd_device_foreach(iwd_device_foreach_func func, void *user_data)
{
const struct l_queue_entry *device_entry;
for (device_entry = l_queue_get_entries(device_list); device_entry;
device_entry = device_entry->next) {
struct device *device = device_entry->data;
func(device, user_data);
}
}
void device_set_scan_results(struct device *device, struct l_queue *bss_list,
bool add_to_autoconnect)
{

View File

@ -23,12 +23,6 @@
#define uninitialized_var(x) x = x
struct l_genl_family;
struct device;
struct station;
typedef void (*iwd_device_foreach_func)(struct device *, void *data);
void __iwd_device_foreach(iwd_device_foreach_func func, void *user_data);
const struct l_settings *iwd_get_config(void);

View File

@ -1291,12 +1291,12 @@ void network_rank_update(struct network *network, bool connected)
network->rank = rank;
}
static void emit_known_network_changed(struct device *device, void *user_data)
static void emit_known_network_changed(struct station *station, void *user_data)
{
struct network_info *info = user_data;
struct network *network;
network = device_network_find(device, info->ssid, info->type);
network = station_network_find(station, info->ssid, info->type);
if (!network)
return;
@ -1319,7 +1319,7 @@ struct network_info *network_info_add_known(const char *ssid,
if (network) {
/* Promote network to is_known */
network->is_known = true;
__iwd_device_foreach(emit_known_network_changed, network);
station_foreach(emit_known_network_changed, network);
return network;
}
@ -1331,12 +1331,13 @@ struct network_info *network_info_add_known(const char *ssid,
return network;
}
static void disconnect_no_longer_known(struct device *device, void *user_data)
static void disconnect_no_longer_known(struct station *station, void *user_data)
{
struct network_info *info = user_data;
struct device *device = netdev_get_device(station_get_netdev(station));
struct network *network;
network = device_get_connected_network(device);
network = station_get_connected_network(station);
if (network && network->info == info)
device_disconnect(device);
@ -1346,8 +1347,8 @@ void network_info_forget_known(struct network_info *network)
{
network->is_known = false;
__iwd_device_foreach(emit_known_network_changed, network);
__iwd_device_foreach(disconnect_no_longer_known, network);
station_foreach(emit_known_network_changed, network);
station_foreach(disconnect_no_longer_known, network);
/*
* Network is no longer a Known Network, see if we still need to

View File

@ -25,6 +25,7 @@
enum security;
struct device;
struct station;
struct network;
struct scan_bss;

View File

@ -1126,6 +1126,18 @@ void station_ok_rssi(struct station *station)
station->signal_low = false;
}
void station_foreach(station_foreach_func_t func, void *user_data)
{
const struct l_queue_entry *entry;
for (entry = l_queue_get_entries(station_list); entry;
entry = entry->next) {
struct station *station = entry->data;
func(station, user_data);
}
}
struct station *station_find(uint32_t ifindex)
{
const struct l_queue_entry *entry;

View File

@ -24,6 +24,7 @@
struct wiphy;
struct netdev;
struct station;
enum security;
struct scan_bss;
struct network;
@ -37,6 +38,7 @@ enum station_state {
STATION_STATE_ROAMING
};
typedef void (*station_foreach_func_t)(struct station *, void *data);
typedef void (*station_state_watch_func_t)(enum station_state, void *userdata);
typedef void (*station_destroy_func_t)(void *userdata);
@ -108,5 +110,8 @@ void station_low_rssi(struct station *station);
void station_ok_rssi(struct station *station);
struct station *station_find(uint32_t ifindex);
void station_foreach(station_foreach_func_t func, void *user_data);
struct station *station_create(struct wiphy *wiphy, struct netdev *netdev);
void station_free(struct station *station);