From b4415f1c9863a2fda42e1882ed4857de9d9366b1 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sat, 4 Jan 2020 06:48:10 +0200 Subject: v4l2: Use Object::invokeMethod() return value MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Now that Object::invokeMethod() supports returning a value, use it and drop the return value method argument. Signed-off-by: Laurent Pinchart Reviewed-by: Niklas Söderlund --- src/v4l2/v4l2_camera_proxy.cpp | 51 ++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 27 deletions(-) (limited to 'src/v4l2/v4l2_camera_proxy.cpp') diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp index 559caba6..2eeb1239 100644 --- a/src/v4l2/v4l2_camera_proxy.cpp +++ b/src/v4l2/v4l2_camera_proxy.cpp @@ -40,9 +40,8 @@ int V4L2CameraProxy::open(bool nonBlocking) { LOG(V4L2Compat, Debug) << "Servicing open"; - int ret; - vcam_->invokeMethod(&V4L2Camera::open, ConnectionTypeBlocking, - &ret); + int ret = vcam_->invokeMethod(&V4L2Camera::open, + ConnectionTypeBlocking); if (ret < 0) { errno = -ret; return -1; @@ -91,9 +90,8 @@ void *V4L2CameraProxy::mmap(size_t length, int prot, int flags, off_t offset) return MAP_FAILED; } - void *val; - vcam_->invokeMethod(&V4L2Camera::mmap, ConnectionTypeBlocking, - &val, index); + void *val = vcam_->invokeMethod(&V4L2Camera::mmap, + ConnectionTypeBlocking, index); buffers_[index].flags |= V4L2_BUF_FLAG_MAPPED; mmaps_[val] = index; @@ -245,9 +243,11 @@ int V4L2CameraProxy::vidioc_s_fmt(struct v4l2_format *arg) return ret; Size size(arg->fmt.pix.width, arg->fmt.pix.height); - vcam_->invokeMethod(&V4L2Camera::configure, ConnectionTypeBlocking, - &ret, &streamConfig_, size, - v4l2ToDrm(arg->fmt.pix.pixelformat), bufferCount_); + ret = vcam_->invokeMethod(&V4L2Camera::configure, + ConnectionTypeBlocking, + &streamConfig_, size, + v4l2ToDrm(arg->fmt.pix.pixelformat), + bufferCount_); if (ret < 0) return -EINVAL; @@ -297,9 +297,8 @@ int V4L2CameraProxy::freeBuffers() { LOG(V4L2Compat, Debug) << "Freeing libcamera bufs"; - int ret; - vcam_->invokeMethod(&V4L2Camera::streamOff, - ConnectionTypeBlocking, &ret); + int ret = vcam_->invokeMethod(&V4L2Camera::streamOff, + ConnectionTypeBlocking); if (ret < 0) { LOG(V4L2Compat, Error) << "Failed to stop stream"; return ret; @@ -327,10 +326,11 @@ int V4L2CameraProxy::vidioc_reqbufs(struct v4l2_requestbuffers *arg) return freeBuffers(); Size size(curV4L2Format_.fmt.pix.width, curV4L2Format_.fmt.pix.height); - vcam_->invokeMethod(&V4L2Camera::configure, ConnectionTypeBlocking, - &ret, &streamConfig_, size, - v4l2ToDrm(curV4L2Format_.fmt.pix.pixelformat), - arg->count); + ret = vcam_->invokeMethod(&V4L2Camera::configure, + ConnectionTypeBlocking, + &streamConfig_, size, + v4l2ToDrm(curV4L2Format_.fmt.pix.pixelformat), + arg->count); if (ret < 0) return -EINVAL; @@ -343,8 +343,8 @@ int V4L2CameraProxy::vidioc_reqbufs(struct v4l2_requestbuffers *arg) arg->count = streamConfig_.bufferCount; bufferCount_ = arg->count; - vcam_->invokeMethod(&V4L2Camera::allocBuffers, - ConnectionTypeBlocking, &ret, arg->count); + ret = vcam_->invokeMethod(&V4L2Camera::allocBuffers, + ConnectionTypeBlocking, arg->count); if (ret < 0) { arg->count = 0; return ret; @@ -392,9 +392,8 @@ int V4L2CameraProxy::vidioc_qbuf(struct v4l2_buffer *arg) arg->index >= bufferCount_) return -EINVAL; - int ret; - vcam_->invokeMethod(&V4L2Camera::qbuf, ConnectionTypeBlocking, - &ret, arg->index); + int ret = vcam_->invokeMethod(&V4L2Camera::qbuf, ConnectionTypeBlocking, + arg->index); if (ret < 0) return ret; @@ -437,9 +436,8 @@ int V4L2CameraProxy::vidioc_streamon(int *arg) if (!validateBufferType(*arg)) return -EINVAL; - int ret; - vcam_->invokeMethod(&V4L2Camera::streamOn, - ConnectionTypeBlocking, &ret); + int ret = vcam_->invokeMethod(&V4L2Camera::streamOn, + ConnectionTypeBlocking); return ret; } @@ -451,9 +449,8 @@ int V4L2CameraProxy::vidioc_streamoff(int *arg) if (!validateBufferType(*arg)) return -EINVAL; - int ret; - vcam_->invokeMethod(&V4L2Camera::streamOff, - ConnectionTypeBlocking, &ret); + int ret = vcam_->invokeMethod(&V4L2Camera::streamOff, + ConnectionTypeBlocking); for (struct v4l2_buffer &buf : buffers_) buf.flags &= ~(V4L2_BUF_FLAG_QUEUED | V4L2_BUF_FLAG_DONE); -- cgit v1.2.1