All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] station: Simplify usage of station_signal_agent_notify()
@ 2022-05-23  6:20 Jesse Lentz
  0 siblings, 0 replies; 2+ messages in thread
From: Jesse Lentz @ 2022-05-23  6:20 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 3148 bytes --]

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().
---
 src/station.c | 38 ++++++++++++--------------------------
 1 file changed, 12 insertions(+), 26 deletions(-)

diff --git a/src/station.c b/src/station.c
index a356339e..6aad40cb 100644
--- a/src/station.c
+++ b/src/station.c
@@ -1438,6 +1438,8 @@ static void station_set_drop_unicast_l2_multicast(struct station *station,
 				"drop_unicast_in_l2_multicast", v);
 }
 
+static void station_signal_agent_notify(struct station *station);
+
 static void station_enter_state(struct station *station,
 						enum station_state state)
 {
@@ -2754,9 +2756,6 @@ static void station_event_channel_switched(struct station *station,
 	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)
 {
 	struct scan_bss *next;
@@ -3011,7 +3010,8 @@ static void station_netdev_event(struct netdev *netdev, enum netdev_event event,
 		station_ok_rssi(station);
 		break;
 	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;
 	case NETDEV_EVENT_ROAMING:
 		station_enter_state(station, STATION_STATE_ROAMING);
@@ -3645,9 +3645,13 @@ struct signal_agent {
 	unsigned int disconnect_watch;
 };
 
-static void station_signal_agent_notify(struct signal_agent *agent,
-					const char *device_path, uint8_t level)
+static void station_signal_agent_notify(struct station *station)
 {
+	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;
 
 	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);
 }
 
-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,
 						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);
 	l_dbus_send(dbus, reply);
 
-	if (station->connected_network) {
-		struct netdev *netdev = station->netdev;
-		uint8_t level = netdev_get_rssi_level_idx(netdev);
-
-		station_signal_agent_notify(station->signal_agent,
-						netdev_get_path(netdev),
-						level);
-	}
+	if (station->connected_network)
+		station_signal_agent_notify(station);
 
 	return NULL;
 }
-- 
2.36.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/2] station: Simplify usage of station_signal_agent_notify()
@ 2022-05-23 17:57 Denis Kenzior
  0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2022-05-23 17:57 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 414 bytes --]

Hi Jesse,

On 5/23/22 01:20, Jesse Lentz wrote:
> 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().
> ---
>   src/station.c | 38 ++++++++++++--------------------------
>   1 file changed, 12 insertions(+), 26 deletions(-)
> 

Both applied, thanks.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-05-23 17:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-23  6:20 [PATCH 1/2] station: Simplify usage of station_signal_agent_notify() Jesse Lentz
2022-05-23 17:57 Denis Kenzior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.