[PATCH 2/5] atmodem: add explicit handling for netreg status in creg_notify()
Sean Nyekjaer <[email protected]> Thu, 21 Aug 2025 13:24:10 +0200
| Newsgroups | dev.linux.lists.ofono |
|---|---|
| Message-ID | <[email protected]> |
Modify creg_notify() to use a switch statement with the
network_registration_status enum.
Previously these statuses were checked using a conditional
statement, which was less clear.
---
drivers/atmodem/network-registration.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/atmodem/network-registration.c b/drivers/atmodem/network-registration.c
index 18e56f2bf9e2dbd6c96947ac57f66ddf0125391e..e13ea5b2405769825e8535648b1b0c283236f08e 100644
--- a/drivers/atmodem/network-registration.c
+++ b/drivers/atmodem/network-registration.c
@@ -1572,8 +1572,14 @@ static void creg_notify(GAtResult *result, gpointer user_data)
&lac, &ci, &tech, nd->vendor) == FALSE)
return;
- if (status != 1 && status != 5)
- goto notify;
+ switch (status) {
+ case NETWORK_REGISTRATION_STATUS_REGISTERED:
+ case NETWORK_REGISTRATION_STATUS_ROAMING:
+ break;
+ default:
+ goto notify;
+ break;
+ }
tq = g_try_new0(struct tech_query, 1);
if (tq == NULL)
--
2.50.1