From patchwork Thu Feb 1 05:08:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Khem Raj X-Patchwork-Id: 19472 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 AF2FABE173 for ; Thu, 1 Feb 2024 05:08:17 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D411662806; Thu, 1 Feb 2024 06:08:16 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="G8eTs0rJ"; dkim-atps=neutral Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 2048F61D0D for ; Thu, 1 Feb 2024 06:08:15 +0100 (CET) Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-6dddee3ba13so336959b3a.1 for ; Wed, 31 Jan 2024 21:08:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706764093; x=1707368893; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=PPtrwJlBRgPqMDsYakCCb31Ers9Xe26suId8IblPW0Q=; b=G8eTs0rJquA7xN9VI5YXmrwPwrHSLzvQlRWJsfrd+l8CTb2s1/Rx3KE4AFRKNUyc61 SAlX4LYRo37JkoMnmQ3eP4TMfnPnfuTE9LvrcP2zP+fhCJ6AFB1Pq8U9ObQjZpxL0aHE brT2iWPW/T6hYgyZ3KNUrkRx9Yf8Zbh8PI3eJQrIDuhBaJBhvKKmVmX7I2P5b+z5FXtr fau1r1P7xJdx9j1NhmxdF01t1OOT6MQ67HOlgC3e7YFgACfhODPohnRo2IXCCXGt1xvb lWSUrXLF5RNaIXfxa6DrjNCVOEPL11vKoJAbuR3nRSsurxcgxh5mnNZGg3qij5rAqKe0 IRSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706764093; x=1707368893; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=PPtrwJlBRgPqMDsYakCCb31Ers9Xe26suId8IblPW0Q=; b=KlBKtNyDQr3bA/A+E3qpvMJlrqNPXw+VAxmjXl9xKFJu5z/j2s4zEGoq0O11e31Yx1 GfV7yRysv/2wTAKQGSxzT6xe48zP3TbNF8Y+WOFqEFyqDV8xHSFXG90U5m7J31MYej+r q05OjPWQpn3gccdn9/UnXJofDvMk2DMdNz2YnrxOqzj5IlK5F4UoqBbqRauSKyc/jLKC bFaHPy47t9gxZFhAgrcZ3CDG9D1aoqy8WhbpeDW1jmWZTrmdsK9XQ2TU2Rgrm77cXwV3 2QdKHpbRmmdap5qu9sJXXdC/MVmgITwt9clUYTeLNVZahzaAD4rPu780oRDul8mbeb2g w7Cw== X-Gm-Message-State: AOJu0Yzuk0RKas5yNN4e0rvirtnGuLWa4NVOg/VAhgz0px2a6Gx//M+E j0joQxJkZoI7tArf7nzTjy/44Y3bTk8qiIp4lICnHTJyUef2oG8ye1BISLiIOmI= X-Google-Smtp-Source: AGHT+IHvpYunTTj7nLpSIXys5QDqhPpec4hacxbpsZasL3aad1mIlDQxdeX7Yvyj+05PWyhdoUSpnQ== X-Received: by 2002:a62:aa16:0:b0:6d9:af69:b704 with SMTP id e22-20020a62aa16000000b006d9af69b704mr3523080pff.13.1706764093124; Wed, 31 Jan 2024 21:08:13 -0800 (PST) Received: from apollo.hsd1.ca.comcast.net ([2601:646:9d80:4380::8157]) by smtp.gmail.com with ESMTPSA id z1-20020aa78881000000b006ddcf451a37sm10803480pfe.75.2024.01.31.21.08.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 21:08:12 -0800 (PST) From: Khem Raj To: libcamera-devel@lists.libcamera.org Subject: [PATCH 1/2] media_device: Add bool return type to unlock() Date: Wed, 31 Jan 2024 21:08:09 -0800 Message-ID: <20240201050810.3501276-1-raj.khem@gmail.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 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: , Cc: Khem Raj Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" unlock uses lockf which is marked with __attribute__ ((warn_unused_result)) and compilers warn about it and some treat -Wunused-result as error with -Werror turned on, It would be good to check if lockf failed or succeeded, however, that piece is not changed with this, this fixes build with clang++ 18 ../git/src/libcamera/media_device.cpp:167:2: error: ignoring return value of function declared with 'warn_unused_result' attribute [-Werror,-Wunused-result] 167 | lockf(fd_.get(), F_ULOCK, 0); | ^~~~~ ~~~~~~~~~~~~~~~~~~~~~ 1 error generated. Signed-off-by: Khem Raj --- include/libcamera/internal/media_device.h | 2 +- src/libcamera/media_device.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/libcamera/internal/media_device.h b/include/libcamera/internal/media_device.h index eb8cfde4..b09dfd16 100644 --- a/include/libcamera/internal/media_device.h +++ b/include/libcamera/internal/media_device.h @@ -33,7 +33,7 @@ public: bool busy() const { return acquired_; } bool lock(); - void unlock(); + bool unlock(); int populate(); bool isValid() const { return valid_; } diff --git a/src/libcamera/media_device.cpp b/src/libcamera/media_device.cpp index 2949816b..eaa2fdb0 100644 --- a/src/libcamera/media_device.cpp +++ b/src/libcamera/media_device.cpp @@ -159,12 +159,12 @@ bool MediaDevice::lock() * * \sa lock() */ -void MediaDevice::unlock() +bool MediaDevice::unlock() { if (!fd_.isValid()) - return; + return false; - lockf(fd_.get(), F_ULOCK, 0); + return lockf(fd_.get(), F_ULOCK, 0) == 0; } /**