Show a patch.

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

{
    "id": 9402,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/9402/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/9402/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/1.1/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": "<1PjHuckjnFWu-P_WVFjNhBem43Z22IbEVss8hepg7PwpuDCy1ZuXDSQ9Ju3lrMLaOWrjWpnFcGziK2_JaaoOP_H09ER37luwAqnPQqv4VMU=@protonmail.com>",
    "date": "2020-08-26T16:05:50",
    "name": "[libcamera-devel,V2] libcamera: MediaDevice: Make MediaDevice::setupLink account for existing link flags",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "95e03ade96305e6a453e1b54e24cfe45d63399bd",
    "submitter": {
        "id": 66,
        "url": "https://patchwork.libcamera.org/api/1.1/people/66/?format=api",
        "name": "Dan Scally",
        "email": "djrscally@protonmail.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/9402/mbox/",
    "series": [
        {
            "id": 1244,
            "url": "https://patchwork.libcamera.org/api/1.1/series/1244/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1244",
            "date": "2020-08-26T16:05:50",
            "name": "[libcamera-devel,V2] libcamera: MediaDevice: Make MediaDevice::setupLink account for existing link flags",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/1244/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/9402/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/9402/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 45400BE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 26 Aug 2020 16:05:56 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A638D628E2;\n\tWed, 26 Aug 2020 18:05:55 +0200 (CEST)",
            "from mail-40135.protonmail.ch (mail-40135.protonmail.ch\n\t[185.70.40.135])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5C41B6037F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 26 Aug 2020 18:05:54 +0200 (CEST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=protonmail.com header.i=@protonmail.com\n\theader.b=\"rcb+m6Ji\"; dkim-atps=neutral",
        "Date": "Wed, 26 Aug 2020 16:05:50 +0000",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com;\n\ts=protonmail; t=1598457953;\n\tbh=SdcK5cLsoc4f8jj7FnJRoYBMLBxqiZFjN3PuFHb8ssM=;\n\th=Date:To:From:Reply-To:Subject:From;\n\tb=rcb+m6Ji/TO+5v6Fk5qgMhEhQ6DnO9szLnRPJ+ARRKxIMqVMPr4f6RlsA9FP7ZvMr\n\tkmtUAWhTQ/DpREamdwxA4I6PcQr87rSUB1CEVgoFpnV1E0/p4rS4IUah+uqtiW2TyY\n\tWLqDkinzQpTWp5KePD3CnbrJpK6B047pRKktD5lw=",
        "To": "\"libcamera-devel@lists.libcamera.org\"\n\t<libcamera-devel@lists.libcamera.org>",
        "From": "Dan Scally <djrscally@protonmail.com>",
        "Message-ID": "<1PjHuckjnFWu-P_WVFjNhBem43Z22IbEVss8hepg7PwpuDCy1ZuXDSQ9Ju3lrMLaOWrjWpnFcGziK2_JaaoOP_H09ER37luwAqnPQqv4VMU=@protonmail.com>",
        "MIME-Version": "1.0",
        "X-Spam-Status": "No, score=-1.2 required=10.0 tests=ALL_TRUSTED,DKIM_SIGNED,\n\tDKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF,\n\tFREEMAIL_FROM shortcircuit=no autolearn=disabled version=3.4.4",
        "X-Spam-Checker-Version": "SpamAssassin 3.4.4 (2020-01-24) on\n\tmailout.protonmail.ch",
        "Subject": "[libcamera-devel] [PATCH V2] libcamera: MediaDevice: Make\n\tMediaDevice::setupLink account for existing link flags",
        "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>",
        "Reply-To": "Dan Scally <djrscally@protonmail.com>",
        "Content-Type": "multipart/mixed;\n\tboundary=\"===============0597472671734103235==\"",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "The setupLink function fails (ioctl returns EINVAL) when it passes the MEDIA_LNK_FL_ENABLE flag\nto a link that is already flagged with MEDIA_LNK_FL_ENABLE and MEDIA_LNK_FL_IMMUTABLE. Contrast\nto media-ctl's equivalent media_setup_link() which ORs the new flags with the existing values.\nThis patch modifies the behaviour of setupLink() to behave the same as media_setup_link() in\nmedia-ctl.\n\nref https://git.linuxtv.org/v4l-utils.git/tree/utils/media-ctl/libmediactl.c#n210\n\nChangelog:\n\n    v2 - Simplified by removing the call to link() to fetch a link that's already passed as a parameter to the function.\n\n---\n src/libcamera/media_device.cpp | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\n \tint ret = ioctl(fd_, MEDIA_IOC_SETUP_LINK, &linkDesc);\n \tif (ret) {",
    "diff": "diff --git a/src/libcamera/media_device.cpp b/src/libcamera/media_device.cpp\nindex de18d57..007a45b 100644\n--- a/src/libcamera/media_device.cpp\n+++ b/src/libcamera/media_device.cpp\n@@ -794,7 +794,7 @@ int MediaDevice::setupLink(const MediaLink *link, unsigned int flags)\n \tlinkDesc.sink.index = sink->index();\n \tlinkDesc.sink.flags = MEDIA_PAD_FL_SINK;\n \n\n-\tlinkDesc.flags = flags;\n+\tlinkDesc.flags = flags | (link->flags() & MEDIA_LNK_FL_IMMUTABLE);\n \n\n",
    "prefixes": [
        "libcamera-devel",
        "V2"
    ]
}