Message ID | 20200120113308.23623-1-laurent.pinchart@ideasonboard.com |
---|---|
State | Accepted |
Commit | ce2ea24fb46f924bda14721c7cee0d2e4ea0d74f |
Headers | show |
Series |
|
Related | show |
Hi Laurent, Thanks for your work. On 2020-01-20 13:33:08 +0200, Laurent Pinchart wrote: > 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 <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> > --- > 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 207a13bd841d..296bd3355aa8 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<std::unique_ptr<FrameBuffer>> *buffers) > -- > Regards, > > Laurent Pinchart > > _______________________________________________ > libcamera-devel mailing list > libcamera-devel@lists.libcamera.org > https://lists.libcamera.org/listinfo/libcamera-devel
diff --git a/src/libcamera/framebuffer_allocator.cpp b/src/libcamera/framebuffer_allocator.cpp index 207a13bd841d..296bd3355aa8 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<std::unique_ptr<FrameBuffer>> *buffers)
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 <laurent.pinchart@ideasonboard.com> --- 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(-)