uqmi: Change returned value to QMI_CMD_REQUEST for 'sync' command.
[project/uqmi.git] / qmi-message.c
index 450f39c..21515f9 100644 (file)
@@ -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 <stdio.h>
 #include <string.h>
 #include <stdlib.h>
@@ -5,9 +26,9 @@
 #include "qmi-message.h"
 
 static uint8_t buf[QMI_BUFFER_LEN];
-static int buf_ofs;
+static unsigned int buf_ofs;
 
-uint8_t *__qmi_get_buf(int *ofs)
+uint8_t *__qmi_get_buf(unsigned int *ofs)
 {
        *ofs = buf_ofs;
        return buf;
@@ -18,7 +39,7 @@ void __qmi_alloc_reset(void)
        buf_ofs = 0;
 }
 
-void *__qmi_alloc_static(int len)
+void *__qmi_alloc_static(unsigned int len)
 {
        void *ret;
 
@@ -33,7 +54,7 @@ void *__qmi_alloc_static(int len)
        return ret;
 }
 
-char *__qmi_copy_string(void *data, int len)
+char *__qmi_copy_string(void *data, unsigned int len)
 {
        char *res;
 
@@ -44,7 +65,7 @@ char *__qmi_copy_string(void *data, int len)
        return res;
 }
 
-struct tlv *tlv_get_next(void **buf, int *buflen)
+struct tlv *tlv_get_next(void **buf, unsigned int *buflen)
 {
        struct tlv *tlv = NULL;
        unsigned int tlv_len;
@@ -108,7 +129,7 @@ int qmi_complete_request_message(struct qmi_msg *qm)
        return tlv_end - msg_start + 1;
 }
 
-int qmi_check_message_status(void *tlv_buf, int len)
+int qmi_check_message_status(void *tlv_buf, unsigned int len)
 {
        struct tlv *tlv;
        struct {