wds: cast pdp_type enum to int to avoid clang considering the range check tautological
[project/uqmi.git] / dev.c
diff --git a/dev.c b/dev.c
index 68d404c..c25900b 100644 (file)
--- a/dev.c
+++ b/dev.c
@@ -1,3 +1,24 @@
+/*
+ * uqmi -- tiny QMI support implementation
+ *
+ * Copyright (C) 2014-2015 Felix Fietkau <nbd@openwrt.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA.
+ */
+
 #include <fcntl.h>
 #include <unistd.h>
 #include <stdlib.h>
@@ -266,7 +287,7 @@ static void __qmi_service_disconnect(struct qmi_dev *qmi, int idx)
 int qmi_service_release_client_id(struct qmi_dev *qmi, QmiService svc)
 {
        int idx = qmi_get_service_idx(svc);
-       qmi->service_keep_cid &= ~(1 << idx);
+       qmi->service_release_cid |= 1 << idx;
        return 0;
 }
 
@@ -275,6 +296,7 @@ static void qmi_close_all_services(struct qmi_dev *qmi)
        uint32_t connected = qmi->service_connected;
        int idx;
 
+       qmi->service_keep_cid &= ~qmi->service_release_cid;
        for (idx = 0; connected; idx++, connected >>= 1) {
                if (!(connected & 1))
                        continue;
@@ -341,6 +363,7 @@ QmiService qmi_service_get_by_name(const char *str)
                { "pds", QMI_SERVICE_PDS },
                { "wds", QMI_SERVICE_WDS },
                { "wms", QMI_SERVICE_WMS },
+               { "wda", QMI_SERVICE_WDA },
        };
        int i;