[PATCH 3/3] Make use of nm_device_get_connection()



Signed-off-by: Thomas Graf <tgraf redhat com>
---
 src/nm-device-bt.c   |    6 +-----
 src/nm-device-wifi.c |   10 ++--------
 src/nm-device.c      |   20 ++++----------------
 3 files changed, 7 insertions(+), 29 deletions(-)

diff --git a/src/nm-device-bt.c b/src/nm-device-bt.c
index 55ff951..ce3e6ed 100644
--- a/src/nm-device-bt.c
+++ b/src/nm-device-bt.c
@@ -845,15 +845,11 @@ static NMActStageReturn
 real_act_stage2_config (NMDevice *device, NMDeviceStateReason *reason)
 {
 	NMDeviceBtPrivate *priv = NM_DEVICE_BT_GET_PRIVATE (device);
-	NMActRequest *req;
 	NMDBusManager *dbus_mgr;
 	DBusGConnection *g_connection;
 	gboolean dun = FALSE;
 
-	req = nm_device_get_act_request (device);
-	g_assert (req);
-
-	priv->bt_type = get_connection_bt_type (nm_act_request_get_connection (req));
+	priv->bt_type = get_connection_bt_type (nm_device_get_connection (device));
 	if (priv->bt_type == NM_BT_CAPABILITY_NONE) {
 		// FIXME: set a reason code
 		return NM_ACT_STAGE_RETURN_FAILURE;
diff --git a/src/nm-device-wifi.c b/src/nm-device-wifi.c
index 16db1a6..b5c63c2 100644
--- a/src/nm-device-wifi.c
+++ b/src/nm-device-wifi.c
@@ -2784,15 +2784,12 @@ handle_ip_config_timeout (NMDeviceWifi *self,
 static NMActStageReturn
 real_act_stage4_ip4_config_timeout (NMDevice *dev, NMDeviceStateReason *reason)
 {
-	NMActRequest *req;
 	NMConnection *connection;
 	NMSettingIP4Config *s_ip4;
 	gboolean may_fail = FALSE, chain_up = FALSE;
 	NMActStageReturn ret;
 
-	req = nm_device_get_act_request (dev);
-	g_assert (req);
-	connection = nm_act_request_get_connection (req);
+	connection = nm_device_get_connection (dev);
 	g_assert (connection);
 
 	s_ip4 = nm_connection_get_setting_ip4_config (connection);
@@ -2809,15 +2806,12 @@ real_act_stage4_ip4_config_timeout (NMDevice *dev, NMDeviceStateReason *reason)
 static NMActStageReturn
 real_act_stage4_ip6_config_timeout (NMDevice *dev, NMDeviceStateReason *reason)
 {
-	NMActRequest *req;
 	NMConnection *connection;
 	NMSettingIP6Config *s_ip6;
 	gboolean may_fail = FALSE, chain_up = FALSE;
 	NMActStageReturn ret;
 
-	req = nm_device_get_act_request (dev);
-	g_assert (req);
-	connection = nm_act_request_get_connection (req);
+	connection = nm_device_get_connection (dev);
 	g_assert (connection);
 
 	s_ip6 = nm_connection_get_setting_ip6_config (connection);
diff --git a/src/nm-device.c b/src/nm-device.c
index 2aed664..5721f73 100644
--- a/src/nm-device.c
+++ b/src/nm-device.c
@@ -718,16 +718,13 @@ activation_source_schedule (NMDevice *self, GSourceFunc func, int family)
 gboolean
 nm_device_ip_config_should_fail (NMDevice *self, gboolean ip6)
 {
-	NMActRequest *req;
 	NMConnection *connection;
 	NMSettingIP4Config *s_ip4;
 	NMSettingIP6Config *s_ip6;
 
 	g_return_val_if_fail (self != NULL, TRUE);
 
-	req = nm_device_get_act_request (self);
-	g_assert (req);
-	connection = nm_act_request_get_connection (req);
+	connection = nm_device_get_connection (self);
 	g_assert (connection);
 
 	/* Fail the connection if the failed IP method is required to complete */
@@ -1267,7 +1264,6 @@ static void
 dhcp4_lease_change (NMDevice *device, NMIP4Config *config)
 {
 	NMConnection *connection;
-	NMActRequest *req;
 	NMDeviceStateReason reason = NM_DEVICE_STATE_REASON_NONE;
 
 	if (config == NULL) {
@@ -1277,9 +1273,7 @@ dhcp4_lease_change (NMDevice *device, NMIP4Config *config)
 		return;
 	}
 
-	req = nm_device_get_act_request (device);
-	g_assert (req);
-	connection = nm_act_request_get_connection (req);
+	connection = nm_device_get_connection (device);
 	g_assert (connection);
 
 	/* Merge with user overrides */
@@ -1425,7 +1419,6 @@ nm_device_dhcp4_renew (NMDevice *self, gboolean release)
 	NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
 	NMActStageReturn ret;
 	NMDeviceStateReason reason;
-	NMActRequest *req;
 	NMConnection *connection;
 
 	g_return_val_if_fail (priv->dhcp4_client != NULL, FALSE);
@@ -1436,9 +1429,7 @@ nm_device_dhcp4_renew (NMDevice *self, gboolean release)
 	/* Terminate old DHCP instance and release the old lease */
 	dhcp4_cleanup (self, TRUE, release);
 
-	req = nm_device_get_act_request (self);
-	g_assert (req);
-	connection = nm_act_request_get_connection (req);
+	connection = nm_device_get_connection (self);
 	g_assert (connection);
 
 	/* Start DHCP again on the interface */
@@ -2011,14 +2002,11 @@ real_act_stage3_ip6_config_start (NMDevice *self,
 	NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
 	const char *ip_iface;
 	NMActStageReturn ret = NM_ACT_STAGE_RETURN_FAILURE;
-	NMActRequest *req;
 	NMConnection *connection;
 
 	g_return_val_if_fail (reason != NULL, NM_ACT_STAGE_RETURN_FAILURE);
 
-	req = nm_device_get_act_request (self);
-	g_assert (req);
-	connection = nm_act_request_get_connection (req);
+	connection = nm_device_get_connection (self);
 	g_assert (connection);
 
 	ip_iface = nm_device_get_ip_iface (self);
-- 
1.7.7.3



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]