[libcamera-devel,v2,4/5] v4l2: v4l2_camera_proxy: Apply clang thread safety annotation
diff mbox series

Message ID 20220620165027.549085-5-umang.jain@ideasonboard.com
State Superseded
Delegated to: Umang Jain
Headers show
Series
  • Apply clang thread safety annotation libcamera-core and v4l2
Related show

Commit Message

Umang Jain June 20, 2022, 4:50 p.m. UTC
From: Hirokazu Honda <hiroh@chromium.org>

This annotates member functions of V4L2CameraProxy by clang
thread safety annotations.

Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
---
 src/v4l2/v4l2_camera_proxy.h | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

Comments

Laurent Pinchart Aug. 28, 2022, 6:33 p.m. UTC | #1
Hi Umang and Hiro,

Thank you for the patch.

On Mon, Jun 20, 2022 at 10:20:26PM +0530, Umang Jain via libcamera-devel wrote:
> From: Hirokazu Honda <hiroh@chromium.org>
> 
> This annotates member functions of V4L2CameraProxy by clang
> thread safety annotations.
> 
> Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  src/v4l2/v4l2_camera_proxy.h | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/src/v4l2/v4l2_camera_proxy.h b/src/v4l2/v4l2_camera_proxy.h
> index 76ca2d8a..8a0195e1 100644
> --- a/src/v4l2/v4l2_camera_proxy.h
> +++ b/src/v4l2/v4l2_camera_proxy.h
> @@ -27,13 +27,15 @@ class V4L2CameraProxy
>  public:
>  	V4L2CameraProxy(unsigned int index, std::shared_ptr<libcamera::Camera> camera);
>  
> -	int open(V4L2CameraFile *file);
> -	void close(V4L2CameraFile *file);
> +	int open(V4L2CameraFile *file) LIBCAMERA_TSA_EXCLUDES(proxyMutex_);
> +	void close(V4L2CameraFile *file) LIBCAMERA_TSA_EXCLUDES(proxyMutex_);
>  	void *mmap(V4L2CameraFile *file, void *addr, size_t length, int prot,
> -		   int flags, off64_t offset);
> -	int munmap(V4L2CameraFile *file, void *addr, size_t length);
> +		   int flags, off64_t offset) LIBCAMERA_TSA_EXCLUDES(proxyMutex_);
> +	int munmap(V4L2CameraFile *file, void *addr, size_t length)
> +		LIBCAMERA_TSA_EXCLUDES(proxyMutex_);
>  
> -	int ioctl(V4L2CameraFile *file, unsigned long request, void *arg);
> +	int ioctl(V4L2CameraFile *file, unsigned long request, void *arg)
> +		LIBCAMERA_TSA_EXCLUDES(proxyMutex_);
>  
>  private:
>  	bool validateBufferType(uint32_t type);

Patch
diff mbox series

diff --git a/src/v4l2/v4l2_camera_proxy.h b/src/v4l2/v4l2_camera_proxy.h
index 76ca2d8a..8a0195e1 100644
--- a/src/v4l2/v4l2_camera_proxy.h
+++ b/src/v4l2/v4l2_camera_proxy.h
@@ -27,13 +27,15 @@  class V4L2CameraProxy
 public:
 	V4L2CameraProxy(unsigned int index, std::shared_ptr<libcamera::Camera> camera);
 
-	int open(V4L2CameraFile *file);
-	void close(V4L2CameraFile *file);
+	int open(V4L2CameraFile *file) LIBCAMERA_TSA_EXCLUDES(proxyMutex_);
+	void close(V4L2CameraFile *file) LIBCAMERA_TSA_EXCLUDES(proxyMutex_);
 	void *mmap(V4L2CameraFile *file, void *addr, size_t length, int prot,
-		   int flags, off64_t offset);
-	int munmap(V4L2CameraFile *file, void *addr, size_t length);
+		   int flags, off64_t offset) LIBCAMERA_TSA_EXCLUDES(proxyMutex_);
+	int munmap(V4L2CameraFile *file, void *addr, size_t length)
+		LIBCAMERA_TSA_EXCLUDES(proxyMutex_);
 
-	int ioctl(V4L2CameraFile *file, unsigned long request, void *arg);
+	int ioctl(V4L2CameraFile *file, unsigned long request, void *arg)
+		LIBCAMERA_TSA_EXCLUDES(proxyMutex_);
 
 private:
 	bool validateBufferType(uint32_t type);