[libcamera-devel,v5,06/12] libcamera: Correct include headers for Mutex classes
diff mbox series

Message ID 20211201075348.3121186-7-hiroh@chromium.org
State Accepted
Headers show
Series
  • Introduce clang thread safety annotations
Related show

Commit Message

Hirokazu Honda Dec. 1, 2021, 7:53 a.m. UTC
Mutex classes are defined in mutex.h. This replaces thread.h
include for the Mutex classes with mutex.h.

Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 include/libcamera/base/semaphore.h | 3 ++-
 include/libcamera/base/thread.h    | 1 -
 src/android/camera_device.cpp      | 1 -
 src/android/camera_device.h        | 2 +-
 src/android/camera_hal_manager.h   | 2 +-
 src/android/camera_request.h       | 2 +-
 src/android/camera_stream.h        | 1 +
 src/libcamera/base/semaphore.cpp   | 1 -
 src/libcamera/base/signal.cpp      | 2 +-
 src/libcamera/base/thread.cpp      | 1 +
 src/libcamera/camera_manager.cpp   | 1 +
 src/v4l2/v4l2_camera.h             | 2 +-
 12 files changed, 10 insertions(+), 9 deletions(-)

Comments

Umang Jain Dec. 1, 2021, 10:30 a.m. UTC | #1
Hi Hiro

On 12/1/21 1:23 PM, Hirokazu Honda wrote:
> Mutex classes are defined in mutex.h. This replaces thread.h
> include for the Mutex classes with mutex.h.
>
> Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>


Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>

> ---
>   include/libcamera/base/semaphore.h | 3 ++-
>   include/libcamera/base/thread.h    | 1 -
>   src/android/camera_device.cpp      | 1 -
>   src/android/camera_device.h        | 2 +-
>   src/android/camera_hal_manager.h   | 2 +-
>   src/android/camera_request.h       | 2 +-
>   src/android/camera_stream.h        | 1 +
>   src/libcamera/base/semaphore.cpp   | 1 -
>   src/libcamera/base/signal.cpp      | 2 +-
>   src/libcamera/base/thread.cpp      | 1 +
>   src/libcamera/camera_manager.cpp   | 1 +
>   src/v4l2/v4l2_camera.h             | 2 +-
>   12 files changed, 10 insertions(+), 9 deletions(-)
>
> diff --git a/include/libcamera/base/semaphore.h b/include/libcamera/base/semaphore.h
> index ec05fad3..c11e8dd1 100644
> --- a/include/libcamera/base/semaphore.h
> +++ b/include/libcamera/base/semaphore.h
> @@ -8,7 +8,8 @@
>   #pragma once
>   
>   #include <libcamera/base/private.h>
> -#include <libcamera/base/thread.h>
> +
> +#include <libcamera/base/mutex.h>
>   
>   namespace libcamera {
>   
> diff --git a/include/libcamera/base/thread.h b/include/libcamera/base/thread.h
> index 44678c34..9d00f102 100644
> --- a/include/libcamera/base/thread.h
> +++ b/include/libcamera/base/thread.h
> @@ -14,7 +14,6 @@
>   #include <libcamera/base/private.h>
>   
>   #include <libcamera/base/message.h>
> -#include <libcamera/base/mutex.h>
>   #include <libcamera/base/signal.h>
>   #include <libcamera/base/utils.h>
>   
> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
> index f2e0bdbd..d74307a2 100644
> --- a/src/android/camera_device.cpp
> +++ b/src/android/camera_device.cpp
> @@ -14,7 +14,6 @@
>   #include <vector>
>   
>   #include <libcamera/base/log.h>
> -#include <libcamera/base/thread.h>
>   #include <libcamera/base/utils.h>
>   
>   #include <libcamera/control_ids.h>
> diff --git a/src/android/camera_device.h b/src/android/camera_device.h
> index bda0b376..a945f5de 100644
> --- a/src/android/camera_device.h
> +++ b/src/android/camera_device.h
> @@ -17,7 +17,7 @@
>   #include <libcamera/base/class.h>
>   #include <libcamera/base/log.h>
>   #include <libcamera/base/message.h>
> -#include <libcamera/base/thread.h>
> +#include <libcamera/base/mutex.h>
>   
>   #include <libcamera/camera.h>
>   #include <libcamera/framebuffer.h>
> diff --git a/src/android/camera_hal_manager.h b/src/android/camera_hal_manager.h
> index cc310f90..765701b2 100644
> --- a/src/android/camera_hal_manager.h
> +++ b/src/android/camera_hal_manager.h
> @@ -17,7 +17,7 @@
>   #include <system/camera_metadata.h>
>   
>   #include <libcamera/base/class.h>
> -#include <libcamera/base/thread.h>
> +#include <libcamera/base/mutex.h>
>   
>   #include <libcamera/camera_manager.h>
>   
> diff --git a/src/android/camera_request.h b/src/android/camera_request.h
> index 88d501a8..887dbe86 100644
> --- a/src/android/camera_request.h
> +++ b/src/android/camera_request.h
> @@ -12,7 +12,7 @@
>   #include <vector>
>   
>   #include <libcamera/base/class.h>
> -#include <libcamera/base/thread.h>
> +#include <libcamera/base/mutex.h>
>   
>   #include <libcamera/camera.h>
>   #include <libcamera/framebuffer.h>
> diff --git a/src/android/camera_stream.h b/src/android/camera_stream.h
> index adb5a37d..e4eb953a 100644
> --- a/src/android/camera_stream.h
> +++ b/src/android/camera_stream.h
> @@ -13,6 +13,7 @@
>   
>   #include <hardware/camera3.h>
>   
> +#include <libcamera/base/mutex.h>
>   #include <libcamera/base/thread.h>
>   
>   #include <libcamera/camera.h>
> diff --git a/src/libcamera/base/semaphore.cpp b/src/libcamera/base/semaphore.cpp
> index bf730c87..4fe30293 100644
> --- a/src/libcamera/base/semaphore.cpp
> +++ b/src/libcamera/base/semaphore.cpp
> @@ -6,7 +6,6 @@
>    */
>   
>   #include <libcamera/base/semaphore.h>
> -#include <libcamera/base/thread.h>
>   
>   /**
>    * \file base/semaphore.h
> diff --git a/src/libcamera/base/signal.cpp b/src/libcamera/base/signal.cpp
> index 9c2319c5..9df45d07 100644
> --- a/src/libcamera/base/signal.cpp
> +++ b/src/libcamera/base/signal.cpp
> @@ -7,7 +7,7 @@
>   
>   #include <libcamera/base/signal.h>
>   
> -#include <libcamera/base/thread.h>
> +#include <libcamera/base/mutex.h>
>   
>   /**
>    * \file base/signal.h
> diff --git a/src/libcamera/base/thread.cpp b/src/libcamera/base/thread.cpp
> index b2043b7e..6bda9d14 100644
> --- a/src/libcamera/base/thread.cpp
> +++ b/src/libcamera/base/thread.cpp
> @@ -17,6 +17,7 @@
>   #include <libcamera/base/event_dispatcher_poll.h>
>   #include <libcamera/base/log.h>
>   #include <libcamera/base/message.h>
> +#include <libcamera/base/mutex.h>
>   
>   /**
>    * \page thread Thread Support
> diff --git a/src/libcamera/camera_manager.cpp b/src/libcamera/camera_manager.cpp
> index 77ff3bd1..70d73822 100644
> --- a/src/libcamera/camera_manager.cpp
> +++ b/src/libcamera/camera_manager.cpp
> @@ -12,6 +12,7 @@
>   #include <libcamera/camera.h>
>   
>   #include <libcamera/base/log.h>
> +#include <libcamera/base/mutex.h>
>   #include <libcamera/base/thread.h>
>   #include <libcamera/base/utils.h>
>   
> diff --git a/src/v4l2/v4l2_camera.h b/src/v4l2/v4l2_camera.h
> index bf1b6de4..9307d61d 100644
> --- a/src/v4l2/v4l2_camera.h
> +++ b/src/v4l2/v4l2_camera.h
> @@ -10,8 +10,8 @@
>   #include <deque>
>   #include <utility>
>   
> +#include <libcamera/base/mutex.h>
>   #include <libcamera/base/semaphore.h>
> -#include <libcamera/base/thread.h>
>   
>   #include <libcamera/camera.h>
>   #include <libcamera/file_descriptor.h>
Laurent Pinchart Dec. 1, 2021, 10:54 a.m. UTC | #2
Hi Hiro,

On Wed, Dec 01, 2021 at 04:53:42PM +0900, Hirokazu Honda wrote:
> Mutex classes are defined in mutex.h. This replaces thread.h
> include for the Mutex classes with mutex.h.
> 
> Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>  include/libcamera/base/semaphore.h | 3 ++-
>  include/libcamera/base/thread.h    | 1 -
>  src/android/camera_device.cpp      | 1 -
>  src/android/camera_device.h        | 2 +-
>  src/android/camera_hal_manager.h   | 2 +-
>  src/android/camera_request.h       | 2 +-
>  src/android/camera_stream.h        | 1 +
>  src/libcamera/base/semaphore.cpp   | 1 -
>  src/libcamera/base/signal.cpp      | 2 +-
>  src/libcamera/base/thread.cpp      | 1 +
>  src/libcamera/camera_manager.cpp   | 1 +
>  src/v4l2/v4l2_camera.h             | 2 +-
>  12 files changed, 10 insertions(+), 9 deletions(-)
> 
> diff --git a/include/libcamera/base/semaphore.h b/include/libcamera/base/semaphore.h
> index ec05fad3..c11e8dd1 100644
> --- a/include/libcamera/base/semaphore.h
> +++ b/include/libcamera/base/semaphore.h
> @@ -8,7 +8,8 @@
>  #pragma once
>  
>  #include <libcamera/base/private.h>
> -#include <libcamera/base/thread.h>
> +
> +#include <libcamera/base/mutex.h>
>  
>  namespace libcamera {
>  
> diff --git a/include/libcamera/base/thread.h b/include/libcamera/base/thread.h
> index 44678c34..9d00f102 100644
> --- a/include/libcamera/base/thread.h
> +++ b/include/libcamera/base/thread.h
> @@ -14,7 +14,6 @@
>  #include <libcamera/base/private.h>
>  
>  #include <libcamera/base/message.h>
> -#include <libcamera/base/mutex.h>
>  #include <libcamera/base/signal.h>
>  #include <libcamera/base/utils.h>
>  
> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
> index f2e0bdbd..d74307a2 100644
> --- a/src/android/camera_device.cpp
> +++ b/src/android/camera_device.cpp
> @@ -14,7 +14,6 @@
>  #include <vector>
>  
>  #include <libcamera/base/log.h>
> -#include <libcamera/base/thread.h>
>  #include <libcamera/base/utils.h>
>  
>  #include <libcamera/control_ids.h>
> diff --git a/src/android/camera_device.h b/src/android/camera_device.h
> index bda0b376..a945f5de 100644
> --- a/src/android/camera_device.h
> +++ b/src/android/camera_device.h
> @@ -17,7 +17,7 @@
>  #include <libcamera/base/class.h>
>  #include <libcamera/base/log.h>
>  #include <libcamera/base/message.h>
> -#include <libcamera/base/thread.h>
> +#include <libcamera/base/mutex.h>
>  
>  #include <libcamera/camera.h>
>  #include <libcamera/framebuffer.h>
> diff --git a/src/android/camera_hal_manager.h b/src/android/camera_hal_manager.h
> index cc310f90..765701b2 100644
> --- a/src/android/camera_hal_manager.h
> +++ b/src/android/camera_hal_manager.h
> @@ -17,7 +17,7 @@
>  #include <system/camera_metadata.h>
>  
>  #include <libcamera/base/class.h>
> -#include <libcamera/base/thread.h>
> +#include <libcamera/base/mutex.h>
>  
>  #include <libcamera/camera_manager.h>
>  
> diff --git a/src/android/camera_request.h b/src/android/camera_request.h
> index 88d501a8..887dbe86 100644
> --- a/src/android/camera_request.h
> +++ b/src/android/camera_request.h
> @@ -12,7 +12,7 @@
>  #include <vector>
>  
>  #include <libcamera/base/class.h>
> -#include <libcamera/base/thread.h>
> +#include <libcamera/base/mutex.h>
>  
>  #include <libcamera/camera.h>
>  #include <libcamera/framebuffer.h>
> diff --git a/src/android/camera_stream.h b/src/android/camera_stream.h
> index adb5a37d..e4eb953a 100644
> --- a/src/android/camera_stream.h
> +++ b/src/android/camera_stream.h
> @@ -13,6 +13,7 @@
>  
>  #include <hardware/camera3.h>
>  
> +#include <libcamera/base/mutex.h>
>  #include <libcamera/base/thread.h>
>  
>  #include <libcamera/camera.h>
> diff --git a/src/libcamera/base/semaphore.cpp b/src/libcamera/base/semaphore.cpp
> index bf730c87..4fe30293 100644
> --- a/src/libcamera/base/semaphore.cpp
> +++ b/src/libcamera/base/semaphore.cpp
> @@ -6,7 +6,6 @@
>   */
>  
>  #include <libcamera/base/semaphore.h>
> -#include <libcamera/base/thread.h>
>  
>  /**
>   * \file base/semaphore.h
> diff --git a/src/libcamera/base/signal.cpp b/src/libcamera/base/signal.cpp
> index 9c2319c5..9df45d07 100644
> --- a/src/libcamera/base/signal.cpp
> +++ b/src/libcamera/base/signal.cpp
> @@ -7,7 +7,7 @@
>  
>  #include <libcamera/base/signal.h>
>  
> -#include <libcamera/base/thread.h>
> +#include <libcamera/base/mutex.h>
>  
>  /**
>   * \file base/signal.h
> diff --git a/src/libcamera/base/thread.cpp b/src/libcamera/base/thread.cpp
> index b2043b7e..6bda9d14 100644
> --- a/src/libcamera/base/thread.cpp
> +++ b/src/libcamera/base/thread.cpp
> @@ -17,6 +17,7 @@
>  #include <libcamera/base/event_dispatcher_poll.h>
>  #include <libcamera/base/log.h>
>  #include <libcamera/base/message.h>
> +#include <libcamera/base/mutex.h>
>  
>  /**
>   * \page thread Thread Support
> diff --git a/src/libcamera/camera_manager.cpp b/src/libcamera/camera_manager.cpp
> index 77ff3bd1..70d73822 100644
> --- a/src/libcamera/camera_manager.cpp
> +++ b/src/libcamera/camera_manager.cpp
> @@ -12,6 +12,7 @@
>  #include <libcamera/camera.h>
>  
>  #include <libcamera/base/log.h>
> +#include <libcamera/base/mutex.h>
>  #include <libcamera/base/thread.h>
>  #include <libcamera/base/utils.h>
>  
> diff --git a/src/v4l2/v4l2_camera.h b/src/v4l2/v4l2_camera.h
> index bf1b6de4..9307d61d 100644
> --- a/src/v4l2/v4l2_camera.h
> +++ b/src/v4l2/v4l2_camera.h
> @@ -10,8 +10,8 @@
>  #include <deque>
>  #include <utility>
>  
> +#include <libcamera/base/mutex.h>
>  #include <libcamera/base/semaphore.h>
> -#include <libcamera/base/thread.h>

This causes a collateral dammage:

[32/142] Compiling C++ object src/v4l2/v4l2-compat.so.p/v4l2_compat.cpp.o
FAILED: src/v4l2/v4l2-compat.so.p/v4l2_compat.cpp.o 
arm-buildroot-linux-uclibcgnueabihf-g++ -Isrc/v4l2/v4l2-compat.so.p -Isrc/v4l2 -I../../src/v4l2 -Iinclude -I../../include -Iinclude/libcamera/ipa -Iinclude/libcamera -fdiagnostics-color=always -Wall -Winvalid-pch -Wnon-virtual-dtor -Wextra -Werror -std=c++17 -g -Wno-psabi -Wshadow -include config.h -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -fPIC -DLIBCAMERA_BASE_PRIVATE -U_FILE_OFFSET_BITS -D_FILE_OFFSET_BITS=32 -D_LARGEFILE64_SOURCE -fvisibility=hidden -MD -MQ src/v4l2/v4l2-compat.so.p/v4l2_compat.cpp.o -MF src/v4l2/v4l2-compat.so.p/v4l2_compat.cpp.o.d -o src/v4l2/v4l2-compat.so.p/v4l2_compat.cpp.o -c ../../src/v4l2/v4l2_compat.cpp
../../src/v4l2/v4l2_compat.cpp: In function ‘int open(const char*, int, ...)’:
../../src/v4l2/v4l2_compat.cpp:34:33: error: ‘O_TMPFILE’ was not declared in this scope
   34 |  if (oflag & O_CREAT || oflag & O_TMPFILE)
      |                                 ^~~~~~~~~
../../src/v4l2/v4l2_compat.cpp: In function ‘int open64(const char*, int, ...)’:
../../src/v4l2/v4l2_compat.cpp:51:33: error: ‘O_TMPFILE’ was not declared in this scope
   51 |  if (oflag & O_CREAT || oflag & O_TMPFILE)
      |                                 ^~~~~~~~~
../../src/v4l2/v4l2_compat.cpp: In function ‘int openat(int, const char*, int, ...)’:
../../src/v4l2/v4l2_compat.cpp:67:33: error: ‘O_TMPFILE’ was not declared in this scope
   67 |  if (oflag & O_CREAT || oflag & O_TMPFILE)
      |                                 ^~~~~~~~~
../../src/v4l2/v4l2_compat.cpp: In function ‘int openat64(int, const char*, int, ...)’:
../../src/v4l2/v4l2_compat.cpp:82:33: error: ‘O_TMPFILE’ was not declared in this scope
   82 |  if (oflag & O_CREAT || oflag & O_TMPFILE)
      |

I'll add

#include <libcamera/base/util.h>

to v4l2_compat.cpp as part of this patch.

>  
>  #include <libcamera/camera.h>
>  #include <libcamera/file_descriptor.h>

Patch
diff mbox series

diff --git a/include/libcamera/base/semaphore.h b/include/libcamera/base/semaphore.h
index ec05fad3..c11e8dd1 100644
--- a/include/libcamera/base/semaphore.h
+++ b/include/libcamera/base/semaphore.h
@@ -8,7 +8,8 @@ 
 #pragma once
 
 #include <libcamera/base/private.h>
-#include <libcamera/base/thread.h>
+
+#include <libcamera/base/mutex.h>
 
 namespace libcamera {
 
diff --git a/include/libcamera/base/thread.h b/include/libcamera/base/thread.h
index 44678c34..9d00f102 100644
--- a/include/libcamera/base/thread.h
+++ b/include/libcamera/base/thread.h
@@ -14,7 +14,6 @@ 
 #include <libcamera/base/private.h>
 
 #include <libcamera/base/message.h>
-#include <libcamera/base/mutex.h>
 #include <libcamera/base/signal.h>
 #include <libcamera/base/utils.h>
 
diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
index f2e0bdbd..d74307a2 100644
--- a/src/android/camera_device.cpp
+++ b/src/android/camera_device.cpp
@@ -14,7 +14,6 @@ 
 #include <vector>
 
 #include <libcamera/base/log.h>
-#include <libcamera/base/thread.h>
 #include <libcamera/base/utils.h>
 
 #include <libcamera/control_ids.h>
diff --git a/src/android/camera_device.h b/src/android/camera_device.h
index bda0b376..a945f5de 100644
--- a/src/android/camera_device.h
+++ b/src/android/camera_device.h
@@ -17,7 +17,7 @@ 
 #include <libcamera/base/class.h>
 #include <libcamera/base/log.h>
 #include <libcamera/base/message.h>
-#include <libcamera/base/thread.h>
+#include <libcamera/base/mutex.h>
 
 #include <libcamera/camera.h>
 #include <libcamera/framebuffer.h>
diff --git a/src/android/camera_hal_manager.h b/src/android/camera_hal_manager.h
index cc310f90..765701b2 100644
--- a/src/android/camera_hal_manager.h
+++ b/src/android/camera_hal_manager.h
@@ -17,7 +17,7 @@ 
 #include <system/camera_metadata.h>
 
 #include <libcamera/base/class.h>
-#include <libcamera/base/thread.h>
+#include <libcamera/base/mutex.h>
 
 #include <libcamera/camera_manager.h>
 
diff --git a/src/android/camera_request.h b/src/android/camera_request.h
index 88d501a8..887dbe86 100644
--- a/src/android/camera_request.h
+++ b/src/android/camera_request.h
@@ -12,7 +12,7 @@ 
 #include <vector>
 
 #include <libcamera/base/class.h>
-#include <libcamera/base/thread.h>
+#include <libcamera/base/mutex.h>
 
 #include <libcamera/camera.h>
 #include <libcamera/framebuffer.h>
diff --git a/src/android/camera_stream.h b/src/android/camera_stream.h
index adb5a37d..e4eb953a 100644
--- a/src/android/camera_stream.h
+++ b/src/android/camera_stream.h
@@ -13,6 +13,7 @@ 
 
 #include <hardware/camera3.h>
 
+#include <libcamera/base/mutex.h>
 #include <libcamera/base/thread.h>
 
 #include <libcamera/camera.h>
diff --git a/src/libcamera/base/semaphore.cpp b/src/libcamera/base/semaphore.cpp
index bf730c87..4fe30293 100644
--- a/src/libcamera/base/semaphore.cpp
+++ b/src/libcamera/base/semaphore.cpp
@@ -6,7 +6,6 @@ 
  */
 
 #include <libcamera/base/semaphore.h>
-#include <libcamera/base/thread.h>
 
 /**
  * \file base/semaphore.h
diff --git a/src/libcamera/base/signal.cpp b/src/libcamera/base/signal.cpp
index 9c2319c5..9df45d07 100644
--- a/src/libcamera/base/signal.cpp
+++ b/src/libcamera/base/signal.cpp
@@ -7,7 +7,7 @@ 
 
 #include <libcamera/base/signal.h>
 
-#include <libcamera/base/thread.h>
+#include <libcamera/base/mutex.h>
 
 /**
  * \file base/signal.h
diff --git a/src/libcamera/base/thread.cpp b/src/libcamera/base/thread.cpp
index b2043b7e..6bda9d14 100644
--- a/src/libcamera/base/thread.cpp
+++ b/src/libcamera/base/thread.cpp
@@ -17,6 +17,7 @@ 
 #include <libcamera/base/event_dispatcher_poll.h>
 #include <libcamera/base/log.h>
 #include <libcamera/base/message.h>
+#include <libcamera/base/mutex.h>
 
 /**
  * \page thread Thread Support
diff --git a/src/libcamera/camera_manager.cpp b/src/libcamera/camera_manager.cpp
index 77ff3bd1..70d73822 100644
--- a/src/libcamera/camera_manager.cpp
+++ b/src/libcamera/camera_manager.cpp
@@ -12,6 +12,7 @@ 
 #include <libcamera/camera.h>
 
 #include <libcamera/base/log.h>
+#include <libcamera/base/mutex.h>
 #include <libcamera/base/thread.h>
 #include <libcamera/base/utils.h>
 
diff --git a/src/v4l2/v4l2_camera.h b/src/v4l2/v4l2_camera.h
index bf1b6de4..9307d61d 100644
--- a/src/v4l2/v4l2_camera.h
+++ b/src/v4l2/v4l2_camera.h
@@ -10,8 +10,8 @@ 
 #include <deque>
 #include <utility>
 
+#include <libcamera/base/mutex.h>
 #include <libcamera/base/semaphore.h>
-#include <libcamera/base/thread.h>
 
 #include <libcamera/camera.h>
 #include <libcamera/file_descriptor.h>