Show a patch.

GET /api/patches/19472/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 19472,
    "url": "https://patchwork.libcamera.org/api/patches/19472/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/19472/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/projects/1/?format=api",
        "name": "libcamera",
        "link_name": "libcamera",
        "list_id": "libcamera_core",
        "list_email": "libcamera-devel@lists.libcamera.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": ""
    },
    "msgid": "<20240201050810.3501276-1-raj.khem@gmail.com>",
    "date": "2024-02-01T05:08:09",
    "name": "[1/2] media_device: Add bool return type to unlock()",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "45f37e768cf08e203f59c3b8d19b9c26e09889bf",
    "submitter": {
        "id": 62,
        "url": "https://patchwork.libcamera.org/api/people/62/?format=api",
        "name": "Khem Raj",
        "email": "raj.khem@gmail.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/19472/mbox/",
    "series": [
        {
            "id": 4163,
            "url": "https://patchwork.libcamera.org/api/series/4163/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4163",
            "date": "2024-02-01T05:08:09",
            "name": "[1/2] media_device: Add bool return type to unlock()",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/4163/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/19472/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/19472/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>",
        "X-Original-To": "parsemail@patchwork.libcamera.org",
        "Delivered-To": "parsemail@patchwork.libcamera.org",
        "Received": [
            "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id AF2FABE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  1 Feb 2024 05:08:17 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D411662806;\n\tThu,  1 Feb 2024 06:08:16 +0100 (CET)",
            "from mail-pf1-x436.google.com (mail-pf1-x436.google.com\n\t[IPv6:2607:f8b0:4864:20::436])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2048F61D0D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  1 Feb 2024 06:08:15 +0100 (CET)",
            "by mail-pf1-x436.google.com with SMTP id\n\td2e1a72fcca58-6dddee3ba13so336959b3a.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 31 Jan 2024 21:08:15 -0800 (PST)",
            "from apollo.hsd1.ca.comcast.net ([2601:646:9d80:4380::8157])\n\tby smtp.gmail.com with ESMTPSA id\n\tz1-20020aa78881000000b006ddcf451a37sm10803480pfe.75.2024.01.31.21.08.12\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 31 Jan 2024 21:08:12 -0800 (PST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"G8eTs0rJ\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=gmail.com; s=20230601; t=1706764093; x=1707368893;\n\tdarn=lists.libcamera.org; \n\th=content-transfer-encoding:mime-version:message-id:date:subject:cc\n\t:to:from:from:to:cc:subject:date:message-id:reply-to;\n\tbh=PPtrwJlBRgPqMDsYakCCb31Ers9Xe26suId8IblPW0Q=;\n\tb=G8eTs0rJquA7xN9VI5YXmrwPwrHSLzvQlRWJsfrd+l8CTb2s1/Rx3KE4AFRKNUyc61\n\tSAlX4LYRo37JkoMnmQ3eP4TMfnPnfuTE9LvrcP2zP+fhCJ6AFB1Pq8U9ObQjZpxL0aHE\n\tbrT2iWPW/T6hYgyZ3KNUrkRx9Yf8Zbh8PI3eJQrIDuhBaJBhvKKmVmX7I2P5b+z5FXtr\n\tfau1r1P7xJdx9j1NhmxdF01t1OOT6MQ67HOlgC3e7YFgACfhODPohnRo2IXCCXGt1xvb\n\tlWSUrXLF5RNaIXfxa6DrjNCVOEPL11vKoJAbuR3nRSsurxcgxh5mnNZGg3qij5rAqKe0\n\tIRSA==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1706764093; x=1707368893;\n\th=content-transfer-encoding:mime-version:message-id:date:subject:cc\n\t:to:from:x-gm-message-state:from:to:cc:subject:date:message-id\n\t:reply-to;\n\tbh=PPtrwJlBRgPqMDsYakCCb31Ers9Xe26suId8IblPW0Q=;\n\tb=KlBKtNyDQr3bA/A+E3qpvMJlrqNPXw+VAxmjXl9xKFJu5z/j2s4zEGoq0O11e31Yx1\n\tGfV7yRysv/2wTAKQGSxzT6xe48zP3TbNF8Y+WOFqEFyqDV8xHSFXG90U5m7J31MYej+r\n\tq05OjPWQpn3gccdn9/UnXJofDvMk2DMdNz2YnrxOqzj5IlK5F4UoqBbqRauSKyc/jLKC\n\tbFaHPy47t9gxZFhAgrcZ3CDG9D1aoqy8WhbpeDW1jmWZTrmdsK9XQ2TU2Rgrm77cXwV3\n\t2QdKHpbRmmdap5qu9sJXXdC/MVmgITwt9clUYTeLNVZahzaAD4rPu780oRDul8mbeb2g\n\tw7Cw==",
        "X-Gm-Message-State": "AOJu0Yzuk0RKas5yNN4e0rvirtnGuLWa4NVOg/VAhgz0px2a6Gx//M+E\n\tj0joQxJkZoI7tArf7nzTjy/44Y3bTk8qiIp4lICnHTJyUef2oG8ye1BISLiIOmI=",
        "X-Google-Smtp-Source": "AGHT+IHvpYunTTj7nLpSIXys5QDqhPpec4hacxbpsZasL3aad1mIlDQxdeX7Yvyj+05PWyhdoUSpnQ==",
        "X-Received": "by 2002:a62:aa16:0:b0:6d9:af69:b704 with SMTP id\n\te22-20020a62aa16000000b006d9af69b704mr3523080pff.13.1706764093124; \n\tWed, 31 Jan 2024 21:08:13 -0800 (PST)",
        "From": "Khem Raj <raj.khem@gmail.com>",
        "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",
        "Content-Transfer-Encoding": "8bit",
        "X-BeenThere": "libcamera-devel@lists.libcamera.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "<libcamera-devel.lists.libcamera.org>",
        "List-Unsubscribe": "<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>",
        "List-Archive": "<https://lists.libcamera.org/pipermail/libcamera-devel/>",
        "List-Post": "<mailto:libcamera-devel@lists.libcamera.org>",
        "List-Help": "<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>",
        "List-Subscribe": "<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>",
        "Cc": "Khem Raj <raj.khem@gmail.com>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "unlock uses lockf which is marked with __attribute__\n((warn_unused_result)) and compilers warn about it and some treat\n-Wunused-result as error with -Werror turned on, It would be good to\ncheck if lockf failed or succeeded, however, that piece is not changed\nwith this, this fixes build with clang++ 18\n\n    ../git/src/libcamera/media_device.cpp:167:2: error: ignoring return value of function declared with 'warn_unused_result' attribute [-Werror,-Wunused-result]\n      167 |         lockf(fd_.get(), F_ULOCK, 0);\n          |         ^~~~~ ~~~~~~~~~~~~~~~~~~~~~\n    1 error generated.\n\nSigned-off-by: Khem Raj <raj.khem@gmail.com>\n---\n include/libcamera/internal/media_device.h | 2 +-\n src/libcamera/media_device.cpp            | 6 +++---\n 2 files changed, 4 insertions(+), 4 deletions(-)",
    "diff": "diff --git a/include/libcamera/internal/media_device.h b/include/libcamera/internal/media_device.h\nindex eb8cfde4..b09dfd16 100644\n--- a/include/libcamera/internal/media_device.h\n+++ b/include/libcamera/internal/media_device.h\n@@ -33,7 +33,7 @@ public:\n \tbool busy() const { return acquired_; }\n \n \tbool lock();\n-\tvoid unlock();\n+\tbool unlock();\n \n \tint populate();\n \tbool isValid() const { return valid_; }\ndiff --git a/src/libcamera/media_device.cpp b/src/libcamera/media_device.cpp\nindex 2949816b..eaa2fdb0 100644\n--- a/src/libcamera/media_device.cpp\n+++ b/src/libcamera/media_device.cpp\n@@ -159,12 +159,12 @@ bool MediaDevice::lock()\n  *\n  * \\sa lock()\n  */\n-void MediaDevice::unlock()\n+bool MediaDevice::unlock()\n {\n \tif (!fd_.isValid())\n-\t\treturn;\n+\t\treturn false;\n \n-\tlockf(fd_.get(), F_ULOCK, 0);\n+\treturn lockf(fd_.get(), F_ULOCK, 0) == 0;\n }\n \n /**\n",
    "prefixes": [
        "1/2"
    ]
}