[libcamera-devel] [PATCH 1/2] libcamera: v4l2_device: Make fd() function const
Kieran Bingham
kieran.bingham at ideasonboard.com
Wed Mar 3 17:38:52 CET 2021
On 03/03/2021 16:37, Laurent Pinchart wrote:
> There are use cases for getting the file descriptor of a const
> V4L2Device instance, for instance to print it in a log. Make the
> function const. There's little risk of abuse here (as in code then
> performing operations on the file descriptors that conceptually modify
> the V4L2 device), as the fd() function is protected.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> ---
> include/libcamera/internal/v4l2_device.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/libcamera/internal/v4l2_device.h b/include/libcamera/internal/v4l2_device.h
> index c56a950ee4f9..d006bf684335 100644
> --- a/include/libcamera/internal/v4l2_device.h
> +++ b/include/libcamera/internal/v4l2_device.h
> @@ -50,7 +50,7 @@ protected:
>
> int ioctl(unsigned long request, void *argp);
>
> - int fd() { return fd_; }
> + int fd() const { return fd_; }
Well that's easy.
Reviewed-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
>
> private:
> void listControls();
>
--
Regards
--
Kieran
More information about the libcamera-devel
mailing list