From patchwork Wed Jan 22 20:57:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 2717 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 28CF160871 for ; Wed, 22 Jan 2020 21:57:43 +0100 (CET) Received: from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi [81.175.216.236]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id CF2DE2F9 for ; Wed, 22 Jan 2020 21:57:42 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1579726663; bh=RYzAJ/Do9yiXZrKTgiF64fSQHcD03ntuRoEUIMr0iWU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=XO4dYHlMK0EBXDC+SKfoZ4m4uYMa2mbEz8NrtiiXepzj56K+UQ63pyqoGOtuU+slK UPxCbZuRYuvZEOW8agQEleTJD98Ks4SFnXcMizR0CpTDv5knkwtEVvUM1ojgx6Er3C 4tI5fErAjPxLmGuyYjarVR47adN+GDdsTrXWPbHg= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Wed, 22 Jan 2020 22:57:11 +0200 Message-Id: <20200122205723.8865-2-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200122205723.8865-1-laurent.pinchart@ideasonboard.com> References: <20200122205723.8865-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 01/13] libcamera: Fix documentation of buffer allocation/export functions X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Jan 2020 20:57:43 -0000 The V4L2VideoDevice::exportBuffers(), PipelineHandler::exportFrameBuffers() and FrameBufferAllocator::allocate() functions all return the number of allocated buffers on success, but are documented as returning 0 in that case. Fix their documentation. Signed-off-by: Laurent Pinchart Reviewed-by: Niklas Söderlund --- src/libcamera/framebuffer_allocator.cpp | 11 ++++------- src/libcamera/pipeline_handler.cpp | 3 ++- src/libcamera/v4l2_videodevice.cpp | 3 ++- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/libcamera/framebuffer_allocator.cpp b/src/libcamera/framebuffer_allocator.cpp index a7588c7fe4c2..c772b5165bbf 100644 --- a/src/libcamera/framebuffer_allocator.cpp +++ b/src/libcamera/framebuffer_allocator.cpp @@ -108,7 +108,8 @@ FrameBufferAllocator::~FrameBufferAllocator() * Upon successful allocation, the allocated buffers can be retrieved with the * buffers() method. * - * \return 0 on success or a negative error code otherwise + * \return The number of allocated buffers on success or a negative error code + * otherwise * \retval -EACCES The camera is not in a state where buffers can be allocated * \retval -EINVAL The \a stream does not belong to the camera or the stream is * not part of the active camera configuration @@ -140,12 +141,8 @@ int FrameBufferAllocator::allocate(Stream *stream) return -EBUSY; } - int ret = camera_->pipe_->exportFrameBuffers(camera_.get(), stream, - &buffers_[stream]); - if (ret) - return ret; - - return 0; + return camera_->pipe_->exportFrameBuffers(camera_.get(), stream, + &buffers_[stream]); } /** diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp index 669097f609ab..01b9ede34b53 100644 --- a/src/libcamera/pipeline_handler.cpp +++ b/src/libcamera/pipeline_handler.cpp @@ -316,7 +316,8 @@ const ControlInfoMap &PipelineHandler::controls(Camera *camera) * * The only intended caller is the FrameBufferAllocator helper. * - * \return 0 on success or a negative error code otherwise + * \return The number of allocated buffers on success or a negative error code + * otherwise */ /** diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp index 18220b81af21..82267730289d 100644 --- a/src/libcamera/v4l2_videodevice.cpp +++ b/src/libcamera/v4l2_videodevice.cpp @@ -973,7 +973,8 @@ int V4L2VideoDevice::requestBuffers(unsigned int count) * \brief Allocate buffers from the video device * \param[in] count Number of buffers to allocate * \param[out] buffers Vector to store allocated buffers - * \return 0 on success or a negative error code otherwise + * \return The number of allocated buffers on success or a negative error code + * otherwise */ int V4L2VideoDevice::exportBuffers(unsigned int count, std::vector> *buffers)