base-modem: separate method to lookup exact port by name

There's no point in returning a list of all ports with a given name,
just provide a lookup method that returns the single port with the
given name.
This commit is contained in:
Aleksander Morgado
2021-02-25 14:13:03 +01:00
parent b8e076f9c4
commit 381e2f382b
6 changed files with 53 additions and 31 deletions
+2 -4
View File
@@ -177,8 +177,7 @@ mm_broadband_modem_huawei_get_at_port_list (MMBroadbandModemHuawei *self)
/* Additional cdc-wdm ports used for dialing */
cdc_wdm_at_ports = mm_base_modem_find_ports (MM_BASE_MODEM (self),
MM_PORT_SUBSYS_USBMISC,
MM_PORT_TYPE_AT,
NULL);
MM_PORT_TYPE_AT);
return g_list_concat (out, cdc_wdm_at_ports);
}
@@ -2201,8 +2200,7 @@ peek_port_at_for_data (MMBroadbandModemHuawei *self,
/* Find the CDC-WDM port on the same USB interface as the given net port */
cdc_wdm_at_ports = mm_base_modem_find_ports (MM_BASE_MODEM (self),
MM_PORT_SUBSYS_USBMISC,
MM_PORT_TYPE_AT,
NULL);
MM_PORT_TYPE_AT);
for (l = cdc_wdm_at_ports; l && !found; l = g_list_next (l)) {
const gchar *wdm_port_parent_path;
@@ -81,8 +81,7 @@ peek_port_qmi_for_data (MMBroadbandModemQmi *self,
/* Find one QMI port, we don't care which one */
rpmsg_qmi_ports = mm_base_modem_find_ports (MM_BASE_MODEM (self),
MM_PORT_SUBSYS_RPMSG,
MM_PORT_TYPE_QMI,
NULL);
MM_PORT_TYPE_QMI);
if (!rpmsg_qmi_ports) {
g_set_error (error,
MM_CORE_ERROR,