diff options
Diffstat (limited to 'drivers/staging/media/atomisp/pci/runtime/queue/src/queue.c')
-rw-r--r-- | drivers/staging/media/atomisp/pci/runtime/queue/src/queue.c | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/drivers/staging/media/atomisp/pci/runtime/queue/src/queue.c b/drivers/staging/media/atomisp/pci/runtime/queue/src/queue.c index dd79c6f180af..aea6c66a3cee 100644 --- a/drivers/staging/media/atomisp/pci/runtime/queue/src/queue.c +++ b/drivers/staging/media/atomisp/pci/runtime/queue/src/queue.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Support for Intel Camera Imaging ISP subsystem. * Copyright (c) 2015, Intel Corporation. @@ -28,7 +29,7 @@ int ia_css_queue_local_init( if (NULL == qhandle || NULL == desc || NULL == desc->cb_elems || NULL == desc->cb_desc) { /* Invalid parameters, return error*/ - return EINVAL; + return -EINVAL; } /* Mark the queue as Local */ @@ -48,7 +49,7 @@ int ia_css_queue_remote_init( { if (NULL == qhandle || NULL == desc) { /* Invalid parameters, return error*/ - return EINVAL; + return -EINVAL; } /* Mark the queue as remote*/ @@ -72,7 +73,7 @@ int ia_css_queue_uninit( ia_css_queue_t *qhandle) { if (!qhandle) - return EINVAL; + return -EINVAL; /* Load the required queue object */ if (qhandle->type == IA_CSS_QUEUE_TYPE_LOCAL) { @@ -90,7 +91,7 @@ int ia_css_queue_enqueue( int error = 0; if (!qhandle) - return EINVAL; + return -EINVAL; /* 1. Load the required queue object */ if (qhandle->type == IA_CSS_QUEUE_TYPE_LOCAL) { @@ -99,7 +100,7 @@ int ia_css_queue_enqueue( */ if (ia_css_circbuf_is_full(&qhandle->desc.cb_local)) { /* Cannot push the element. Return*/ - return ENOBUFS; + return -ENOBUFS; } /* Push the element*/ @@ -117,7 +118,7 @@ int ia_css_queue_enqueue( /* b. Operate on the queue */ if (ia_css_circbuf_desc_is_full(&cb_desc)) - return ENOBUFS; + return -ENOBUFS; cb_elem.val = item; @@ -149,7 +150,7 @@ int ia_css_queue_dequeue( int error = 0; if (!qhandle || NULL == item) - return EINVAL; + return -EINVAL; /* 1. Load the required queue object */ if (qhandle->type == IA_CSS_QUEUE_TYPE_LOCAL) { @@ -158,7 +159,7 @@ int ia_css_queue_dequeue( */ if (ia_css_circbuf_is_empty(&qhandle->desc.cb_local)) { /* Nothing to pop. Return empty queue*/ - return ENODATA; + return -ENODATA; } *item = ia_css_circbuf_pop(&qhandle->desc.cb_local); @@ -176,7 +177,7 @@ int ia_css_queue_dequeue( /* b. Operate on the queue */ if (ia_css_circbuf_desc_is_empty(&cb_desc)) - return ENODATA; + return -ENODATA; error = ia_css_queue_item_load(qhandle, cb_desc.start, &cb_elem); if (error != 0) @@ -206,7 +207,7 @@ int ia_css_queue_is_full( int error = 0; if ((!qhandle) || (!is_full)) - return EINVAL; + return -EINVAL; /* 1. Load the required queue object */ if (qhandle->type == IA_CSS_QUEUE_TYPE_LOCAL) { @@ -230,7 +231,7 @@ int ia_css_queue_is_full( return 0; } - return EINVAL; + return -EINVAL; } int ia_css_queue_get_free_space( @@ -240,7 +241,7 @@ int ia_css_queue_get_free_space( int error = 0; if ((!qhandle) || (!size)) - return EINVAL; + return -EINVAL; /* 1. Load the required queue object */ if (qhandle->type == IA_CSS_QUEUE_TYPE_LOCAL) { @@ -264,7 +265,7 @@ int ia_css_queue_get_free_space( return 0; } - return EINVAL; + return -EINVAL; } int ia_css_queue_get_used_space( @@ -274,7 +275,7 @@ int ia_css_queue_get_used_space( int error = 0; if ((!qhandle) || (!size)) - return EINVAL; + return -EINVAL; /* 1. Load the required queue object */ if (qhandle->type == IA_CSS_QUEUE_TYPE_LOCAL) { @@ -298,7 +299,7 @@ int ia_css_queue_get_used_space( return 0; } - return EINVAL; + return -EINVAL; } int ia_css_queue_peek( @@ -310,7 +311,7 @@ int ia_css_queue_peek( int error = 0; if ((!qhandle) || (!element)) - return EINVAL; + return -EINVAL; /* 1. Load the required queue object */ if (qhandle->type == IA_CSS_QUEUE_TYPE_LOCAL) { @@ -320,7 +321,7 @@ int ia_css_queue_peek( /* Check if offset is valid */ num_elems = ia_css_circbuf_get_num_elems(&qhandle->desc.cb_local); if (offset > num_elems) - return EINVAL; + return -EINVAL; *element = ia_css_circbuf_peek_from_start(&qhandle->desc.cb_local, (int)offset); return 0; @@ -339,7 +340,7 @@ int ia_css_queue_peek( /* Check if offset is valid */ num_elems = ia_css_circbuf_desc_get_num_elems(&cb_desc); if (offset > num_elems) - return EINVAL; + return -EINVAL; offset = OP_std_modadd(cb_desc.start, offset, cb_desc.size); error = ia_css_queue_item_load(qhandle, (uint8_t)offset, &cb_elem); @@ -350,7 +351,7 @@ int ia_css_queue_peek( return 0; } - return EINVAL; + return -EINVAL; } int ia_css_queue_is_empty( @@ -360,7 +361,7 @@ int ia_css_queue_is_empty( int error = 0; if ((!qhandle) || (!is_empty)) - return EINVAL; + return -EINVAL; /* 1. Load the required queue object */ if (qhandle->type == IA_CSS_QUEUE_TYPE_LOCAL) { @@ -384,7 +385,7 @@ int ia_css_queue_is_empty( return 0; } - return EINVAL; + return -EINVAL; } int ia_css_queue_get_size( @@ -394,7 +395,7 @@ int ia_css_queue_get_size( int error = 0; if ((!qhandle) || (!size)) - return EINVAL; + return -EINVAL; /* 1. Load the required queue object */ if (qhandle->type == IA_CSS_QUEUE_TYPE_LOCAL) { |