mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-22 23:09:34 +01:00
station: Simplify usage of station_signal_agent_notify()
station_signal_agent_notify() has been refactored so that its usage is simpler. station_rssi_level_changed() has been replaced by an inlined call to station_signal_agent_notify().
This commit is contained in:
parent
6cea51b79f
commit
38e2d4383a
@ -1438,6 +1438,8 @@ static void station_set_drop_unicast_l2_multicast(struct station *station,
|
|||||||
"drop_unicast_in_l2_multicast", v);
|
"drop_unicast_in_l2_multicast", v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void station_signal_agent_notify(struct station *station);
|
||||||
|
|
||||||
static void station_enter_state(struct station *station,
|
static void station_enter_state(struct station *station,
|
||||||
enum station_state state)
|
enum station_state state)
|
||||||
{
|
{
|
||||||
@ -2754,9 +2756,6 @@ static void station_event_channel_switched(struct station *station,
|
|||||||
network_bss_update(network, station->connected_bss);
|
network_bss_update(network, station->connected_bss);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void station_rssi_level_changed(struct station *station,
|
|
||||||
uint8_t level_idx);
|
|
||||||
|
|
||||||
static bool station_try_next_bss(struct station *station)
|
static bool station_try_next_bss(struct station *station)
|
||||||
{
|
{
|
||||||
struct scan_bss *next;
|
struct scan_bss *next;
|
||||||
@ -3011,7 +3010,8 @@ static void station_netdev_event(struct netdev *netdev, enum netdev_event event,
|
|||||||
station_ok_rssi(station);
|
station_ok_rssi(station);
|
||||||
break;
|
break;
|
||||||
case NETDEV_EVENT_RSSI_LEVEL_NOTIFY:
|
case NETDEV_EVENT_RSSI_LEVEL_NOTIFY:
|
||||||
station_rssi_level_changed(station, l_get_u8(event_data));
|
if (station->signal_agent)
|
||||||
|
station_signal_agent_notify(station);
|
||||||
break;
|
break;
|
||||||
case NETDEV_EVENT_ROAMING:
|
case NETDEV_EVENT_ROAMING:
|
||||||
station_enter_state(station, STATION_STATE_ROAMING);
|
station_enter_state(station, STATION_STATE_ROAMING);
|
||||||
@ -3645,9 +3645,13 @@ struct signal_agent {
|
|||||||
unsigned int disconnect_watch;
|
unsigned int disconnect_watch;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void station_signal_agent_notify(struct signal_agent *agent,
|
static void station_signal_agent_notify(struct station *station)
|
||||||
const char *device_path, uint8_t level)
|
|
||||||
{
|
{
|
||||||
|
struct signal_agent *agent = station->signal_agent;
|
||||||
|
struct netdev *netdev = station->netdev;
|
||||||
|
const char *device_path = netdev_get_path(netdev);
|
||||||
|
uint8_t level = netdev_get_rssi_level_idx(netdev);
|
||||||
|
|
||||||
struct l_dbus_message *msg;
|
struct l_dbus_message *msg;
|
||||||
|
|
||||||
msg = l_dbus_message_new_method_call(dbus_get_bus(),
|
msg = l_dbus_message_new_method_call(dbus_get_bus(),
|
||||||
@ -3660,18 +3664,6 @@ static void station_signal_agent_notify(struct signal_agent *agent,
|
|||||||
l_dbus_send(dbus_get_bus(), msg);
|
l_dbus_send(dbus_get_bus(), msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void station_rssi_level_changed(struct station *station,
|
|
||||||
uint8_t level_idx)
|
|
||||||
{
|
|
||||||
struct netdev *netdev = station->netdev;
|
|
||||||
|
|
||||||
if (!station->signal_agent)
|
|
||||||
return;
|
|
||||||
|
|
||||||
station_signal_agent_notify(station->signal_agent,
|
|
||||||
netdev_get_path(netdev), level_idx);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void station_signal_agent_release(struct signal_agent *agent,
|
static void station_signal_agent_release(struct signal_agent *agent,
|
||||||
const char *device_path)
|
const char *device_path)
|
||||||
{
|
{
|
||||||
@ -3762,14 +3754,8 @@ static struct l_dbus_message *station_dbus_signal_agent_register(
|
|||||||
reply = l_dbus_message_new_method_return(message);
|
reply = l_dbus_message_new_method_return(message);
|
||||||
l_dbus_send(dbus, reply);
|
l_dbus_send(dbus, reply);
|
||||||
|
|
||||||
if (station->connected_network) {
|
if (station->connected_network)
|
||||||
struct netdev *netdev = station->netdev;
|
station_signal_agent_notify(station);
|
||||||
uint8_t level = netdev_get_rssi_level_idx(netdev);
|
|
||||||
|
|
||||||
station_signal_agent_notify(station->signal_agent,
|
|
||||||
netdev_get_path(netdev),
|
|
||||||
level);
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user