summaryrefslogtreecommitdiff
path: root/src/devices/wwan/nm-device-modem.c
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2019-08-22 09:28:39 +0200
committerThomas Haller <thaller@redhat.com>2019-08-28 16:27:00 +0200
commitdc275121847fcfd02aeeb6360309e54300ebf3d4 (patch)
treeda260bde15bbe65f51733458434ff82fa0c922ef /src/devices/wwan/nm-device-modem.c
parentcca0c2b56a4c637d8fc222353126b6f46187ba53 (diff)
downloadNetworkManager-dc275121847fcfd02aeeb6360309e54300ebf3d4.tar.gz
device: don't let subclasses call NMDevice's act_stage1_prepare()
NMDevice's act_stage1_prepare() now does nothing. Calling it is not useful and has no effect. In general, when a subclass overwrites a virtual function, it must be defined whether the subclass must, may or must-not call the parents implementation. Likewise, it must be clear when the parents implementation should be chained: first, as last, does it matter? In any case, that very much depends on how the parent is implemented and this can only be solved by documentation and common conventions. It's a forgiving approach to have a parents implementation do nothing, then the subclass may call it at any time (or not call it at all). This is especially useful if classes don't know their parent class well. But in NetworkManager code the relationship between classes are known at compile time, so every of these classes knows it derives directly from NMDevice. This forgingin approach was what NMDevice's act_stage1_prepare() was doing. However, it also adds lines of code resulting in a different kind of complexity. So, it's not clear that this forgiving approach is really better. Note that it also has a (tiny) runtime and code-size overhead. Change the expectation of how NMDevice's act_stage1_prepare() should be called: it is no longer implemented, and subclasses *MUST* not chain up.
Diffstat (limited to 'src/devices/wwan/nm-device-modem.c')
-rw-r--r--src/devices/wwan/nm-device-modem.c5
1 files changed, 0 insertions, 5 deletions
diff --git a/src/devices/wwan/nm-device-modem.c b/src/devices/wwan/nm-device-modem.c
index 29c51162d0..be0993916d 100644
--- a/src/devices/wwan/nm-device-modem.c
+++ b/src/devices/wwan/nm-device-modem.c
@@ -583,13 +583,8 @@ deactivate_async (NMDevice *self,
static NMActStageReturn
act_stage1_prepare (NMDevice *device, NMDeviceStateReason *out_failure_reason)
{
- NMActStageReturn ret;
NMActRequest *req;
- ret = NM_DEVICE_CLASS (nm_device_modem_parent_class)->act_stage1_prepare (device, out_failure_reason);
- if (ret != NM_ACT_STAGE_RETURN_SUCCESS)
- return ret;
-
req = nm_device_get_act_request (device);
g_return_val_if_fail (req, NM_ACT_STAGE_RETURN_FAILURE);