From e25a585c9fd8c3f58ec01723843fe3c08c30c1ad Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Tue, 1 Jun 2021 09:36:53 +0200 Subject: [PATCH] broadband-modem-mbim: skip switch() when selecting MBIM services Having a switch() for the MBIM services when processing indications forces us to update it on every new MBIM service added to libmbim, because we build with -Wswitch-enum by default. This warning type is extremely useful, and we should not stop using it, so let's simplify a bit the indication handling code and skip using a switch(). There are right now only 4 different service indications expected, so it shouldn't be a big deal. --- src/mm-broadband-modem-mbim.c | 30 ++++-------------------------- 1 file changed, 4 insertions(+), 26 deletions(-) diff --git a/src/mm-broadband-modem-mbim.c b/src/mm-broadband-modem-mbim.c index 85e6501c..c87c3ca0 100644 --- a/src/mm-broadband-modem-mbim.c +++ b/src/mm-broadband-modem-mbim.c @@ -3741,36 +3741,14 @@ device_notification_cb (MbimDevice *device, mbim_cid_get_printable (service, mbim_message_indicate_status_get_cid (notification))); - switch (service) { - case MBIM_SERVICE_BASIC_CONNECT: + if (service == MBIM_SERVICE_BASIC_CONNECT) basic_connect_notification (self, notification); - break; - case MBIM_SERVICE_MS_BASIC_CONNECT_EXTENSIONS: + else if (service == MBIM_SERVICE_MS_BASIC_CONNECT_EXTENSIONS) ms_basic_connect_extensions_notification (self, notification); - break; - case MBIM_SERVICE_SMS: + else if (service == MBIM_SERVICE_SMS) sms_notification (self, notification); - break; - case MBIM_SERVICE_USSD: + else if (service == MBIM_SERVICE_USSD) ussd_notification (self, notification); - break; - case MBIM_SERVICE_INVALID: - case MBIM_SERVICE_PHONEBOOK: - case MBIM_SERVICE_STK: - case MBIM_SERVICE_AUTH: - case MBIM_SERVICE_DSS: - case MBIM_SERVICE_MS_FIRMWARE_ID: - case MBIM_SERVICE_MS_HOST_SHUTDOWN: - case MBIM_SERVICE_PROXY_CONTROL: - case MBIM_SERVICE_QMI: - case MBIM_SERVICE_ATDS: - case MBIM_SERVICE_INTEL_FIRMWARE_UPDATE: - case MBIM_SERVICE_MS_SAR: - case MBIM_SERVICE_QDU: - default: - /* Ignore */ - break; - } } static void