[NPU] Fix ioctl() warnings in NPU driver API
authorDongju Chae <dongju.chae@samsung.com>
Wed, 11 Sep 2019 08:18:48 +0000 (17:18 +0900)
committer함명주/On-Device Lab(SR)/Principal Engineer/삼성전자 <myungjoo.ham@samsung.com>
Mon, 16 Sep 2019 07:30:45 +0000 (16:30 +0900)
This commit fixes ioctl() warnings in NPU driver API.

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
src/core/npu/NPUdrvAPI.c

index 99c57d0..55d4386 100644 (file)
@@ -325,9 +325,10 @@ int npu_setup_device (int fd)
   }
 
   /** send configuration to device, and wait for its output*/
-  ret = ioctl(npu_dev_priv_t->internal_fd, SRNPU_IOCTL_SET_VARIABLES,
-      &npu_setup_t);
-  if (conf->test_mode == 1) {
+  if (conf->test_mode == 0) { 
+    ret = ioctl(npu_dev_priv_t->internal_fd, SRNPU_IOCTL_SET_VARIABLES,
+        &npu_setup_t);
+  } else {
     ret = 0;
   }
 
@@ -355,9 +356,10 @@ struct srnpu_status_arg * npu_get_status (int fd)
     return NULL;
   }
 
-  ret = ioctl(npu_dev_priv_t->internal_fd, SRNPU_IOCTL_GET_STATUS,
-      npu_status_t);
-  if (conf->test_mode == 1) {
+  if (conf->test_mode == 0) {
+    ret = ioctl(npu_dev_priv_t->internal_fd, SRNPU_IOCTL_GET_STATUS,
+        npu_status_t);
+  } else {
     memset(npu_status_t, 0, sizeof(struct srnpu_status_arg));
     ret = 0;
   }
@@ -482,9 +484,10 @@ int npu_set_buffer (int fd, int dmabuf_fd, uint64_t offset0, uint64_t offset1)
   npu_buffer_t.offset0 = npu_dev_priv_t->offset0;
   npu_buffer_t.offset1 = npu_dev_priv_t->offset1;
 
-  ret = ioctl(npu_dev_priv_t->internal_fd, SRNPU_IOCTL_SET_BUFFER,
-      &npu_buffer_t);
-  if (conf->test_mode == 1) {
+  if (conf->test_mode == 0) {
+    ret = ioctl(npu_dev_priv_t->internal_fd, SRNPU_IOCTL_SET_BUFFER, 
+        &npu_buffer_t);
+  } else {
     ret = 0;
   }
 
@@ -507,8 +510,9 @@ int npu_check_compute_ready (int fd)
   if (npu_dev_priv_t == NULL)
     return -ENXIO;
 
-  ret = ioctl(npu_dev_priv_t->internal_fd, SRNPU_IOCTL_GET_READY, &ready);
-  if (conf->test_mode == 1) {
+  if (conf->test_mode == 0) {
+    ret = ioctl(npu_dev_priv_t->internal_fd, SRNPU_IOCTL_GET_READY, &ready);
+  } else {
     ret = 0;
   }
 
@@ -540,8 +544,9 @@ int npu_wait_compute_ready (int fd)
   if (npu_dev_priv_t == NULL)
     return -ENXIO;
 
-  ret = ioctl(npu_dev_priv_t->internal_fd, SRNPU_IOCTL_WAIT_READY, &ready);
-  if (conf->test_mode == 1) {
+  if (conf->test_mode == 0) {
+    ret = ioctl(npu_dev_priv_t->internal_fd, SRNPU_IOCTL_WAIT_READY, &ready);
+  } else {
     ret = 0;
   }