aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/sierra/mm-plugin-sierra.c10
-rw-r--r--plugins/zte/mm-plugin-zte.c10
-rw-r--r--src/mm-port-probe.c13
-rw-r--r--src/mm-port-probe.h1
4 files changed, 16 insertions, 18 deletions
diff --git a/plugins/sierra/mm-plugin-sierra.c b/plugins/sierra/mm-plugin-sierra.c
index dc8fce54..a480a3e7 100644
--- a/plugins/sierra/mm-plugin-sierra.c
+++ b/plugins/sierra/mm-plugin-sierra.c
@@ -163,15 +163,7 @@ create_modem (MMPlugin *self,
GList *probes,
GError **error)
{
- GList *l;
- gboolean is_icera;
-
- for (l = probes, is_icera = FALSE; l && !is_icera; l = g_list_next (l)) {
- if (mm_port_probe_is_icera (MM_PORT_PROBE (l->data)))
- is_icera = TRUE;
- }
-
- if (is_icera)
+ if (mm_port_probe_list_is_icera (probes))
return MM_BASE_MODEM (mm_broadband_modem_sierra_icera_new (sysfs_path,
drivers,
mm_plugin_get_name (self),
diff --git a/plugins/zte/mm-plugin-zte.c b/plugins/zte/mm-plugin-zte.c
index cf48f236..739393c6 100644
--- a/plugins/zte/mm-plugin-zte.c
+++ b/plugins/zte/mm-plugin-zte.c
@@ -59,15 +59,7 @@ create_modem (MMPlugin *self,
GList *probes,
GError **error)
{
- GList *l;
- gboolean is_icera;
-
- for (l = probes, is_icera = FALSE; l && !is_icera; l = g_list_next (l)) {
- if (mm_port_probe_is_icera (MM_PORT_PROBE (l->data)))
- is_icera = TRUE;
- }
-
- if (is_icera)
+ if (mm_port_probe_list_is_icera (probes))
return MM_BASE_MODEM (mm_broadband_modem_zte_icera_new (sysfs_path,
drivers,
mm_plugin_get_name (self),
diff --git a/src/mm-port-probe.c b/src/mm-port-probe.c
index 04a1bf8b..e0f3788a 100644
--- a/src/mm-port-probe.c
+++ b/src/mm-port-probe.c
@@ -1309,6 +1309,19 @@ mm_port_probe_is_icera (MMPortProbe *self)
FALSE);
}
+gboolean
+mm_port_probe_list_is_icera (GList *probes)
+{
+ GList *l;
+
+ for (l = probes; l; l = g_list_next (l)) {
+ if (mm_port_probe_is_icera (MM_PORT_PROBE (l->data)))
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
const gchar *
mm_port_probe_get_port_name (MMPortProbe *self)
{
diff --git a/src/mm-port-probe.h b/src/mm-port-probe.h
index adff2786..bbafab64 100644
--- a/src/mm-port-probe.h
+++ b/src/mm-port-probe.h
@@ -126,5 +126,6 @@ gboolean mm_port_probe_is_icera (MMPortProbe *self);
/* Additional helpers */
gboolean mm_port_probe_list_has_at_port (GList *list);
gboolean mm_port_probe_list_has_qmi_port (GList *list);
+gboolean mm_port_probe_list_is_icera (GList *list);
#endif /* MM_PORT_PROBE_H */