From: Dongju Chae Date: Wed, 11 Sep 2019 08:18:48 +0000 (+0900) Subject: [NPU] Fix ioctl() warnings in NPU driver API X-Git-Tag: accepted/tizen/unified/20220103.130045~666 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d3b679e390b356d7463414e89966b58e2abd572b;p=platform%2Fadaptation%2Fnpu%2Ftrix-engine.git [NPU] Fix ioctl() warnings in NPU driver API This commit fixes ioctl() warnings in NPU driver API. Signed-off-by: Dongju Chae --- diff --git a/src/core/npu/NPUdrvAPI.c b/src/core/npu/NPUdrvAPI.c index 99c57d0..55d4386 100644 --- a/src/core/npu/NPUdrvAPI.c +++ b/src/core/npu/NPUdrvAPI.c @@ -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; }