From patchwork Wed Mar 3 16:37:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 11478 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id C4AA7BD1F1 for ; Wed, 3 Mar 2021 16:37:48 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 8D8E168A92; Wed, 3 Mar 2021 17:37:48 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="LvCnK2PV"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7FBDE68A7E for ; Wed, 3 Mar 2021 17:37:47 +0100 (CET) Received: from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 13A868CA for ; Wed, 3 Mar 2021 17:37:47 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1614789467; bh=0054k6DZd6EEbq+ffJKDi2PcJkRjtjUaxwC8WaTh30U=; h=From:To:Subject:Date:From; b=LvCnK2PVcQI2z7uhUKjHV740EZfzyhNVfhXgNG8uDjvcxBXs/Rc28ZJGNKo6aXJGY MFDE5FZJUTNxT/3h5/Bfk+kC4XgRxGUGmVSXnKdFd3qlNRztFuOWnU2EkNWcVK+h2q cajxoBjZVy4Mp7kyw6jLEB/6ckQRRZHYsbOJod74= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Wed, 3 Mar 2021 18:37:14 +0200 Message-Id: <20210303163715.21730-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 1/2] libcamera: v4l2_device: Make fd() function const X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" 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 Reviewed-by: Kieran Bingham Reviewed-by: Paul Elder --- 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_; } private: void listControls();