Show a patch.

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

{
    "id": 22911,
    "url": "https://patchwork.libcamera.org/api/patches/22911/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/22911/",
    "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": "<20250303154844.745574-3-barnabas.pocze@ideasonboard.com>",
    "date": "2025-03-03T15:48:43",
    "name": "[v1,2/3] treewide: Remove `libcamera::LOG(...)` occurences",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "49c0c4c0c926575214cdedab0c52c743c0d45bff",
    "submitter": {
        "id": 216,
        "url": "https://patchwork.libcamera.org/api/people/216/?format=api",
        "name": "Barnabás Pőcze",
        "email": "barnabas.pocze@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/22911/mbox/",
    "series": [
        {
            "id": 5037,
            "url": "https://patchwork.libcamera.org/api/series/5037/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5037",
            "date": "2025-03-03T15:48:41",
            "name": "libcamera: base: log: Do not instantiate disabled `LogMessage`s",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/5037/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/22911/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/22911/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 ADD74BD808\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  3 Mar 2025 15:48:55 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 07F4E68779;\n\tMon,  3 Mar 2025 16:48:52 +0100 (CET)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8AE0A68779\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  3 Mar 2025 16:48:48 +0100 (CET)",
            "from pb-laptop.local (185.221.143.4.nat.pool.zt.hu [185.221.143.4])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 19F4F1189\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  3 Mar 2025 16:47:17 +0100 (CET)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"NsKDcTKB\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1741016837;\n\tbh=jKd6XXbCYcF3fkanfHSCd7vIcIVch53IiPtdnN/oBek=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=NsKDcTKBRSWdSHZatBupdZ/fppyBPAT/7WioFhPGgssjC+hyP9oPt9Sxo0/ebkJCe\n\tm/M5TOsHPC7CAwTUSjWzxW8NvIJdybL6zb7OBOmJ1q/+jyhKO4kUfy6L1laV48oxJx\n\tHBL3D7UFCo5QaIFKa+gQc26tGQea/QWfSHUXf1/U=",
        "From": "=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Subject": "[PATCH v1 2/3] treewide: Remove `libcamera::LOG(...)` occurences",
        "Date": "Mon,  3 Mar 2025 16:48:43 +0100",
        "Message-ID": "<20250303154844.745574-3-barnabas.pocze@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.48.1",
        "In-Reply-To": "<20250303154844.745574-1-barnabas.pocze@ideasonboard.com>",
        "References": "<20250303154844.745574-1-barnabas.pocze@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "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>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "When a class inherits from `Loggable`, it will have a protected\n`_log()` method and that will be used instead of the global\n`_log()` method in the expansion of the `LOG()` macro. However,\nif such a class has static member functions, then simply writing\n`LOG()` will not work because name lookup will find the non-static\nmember function and no the global function, resulting in a compiler\nerror because the non-static member cannot be invoked without\nan object, and there is no object in a static member function.\n\nThis can be avoided by using `using libcamera::_log;`, thereby\nbringing the global declaration into the current scope.\n\nSigned-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n---\n src/libcamera/sensor/camera_sensor_raw.cpp |  8 +++++---\n src/libcamera/v4l2_device.cpp              | 10 ++++++----\n 2 files changed, 11 insertions(+), 7 deletions(-)",
    "diff": "diff --git a/src/libcamera/sensor/camera_sensor_raw.cpp b/src/libcamera/sensor/camera_sensor_raw.cpp\nindex ab75b1f82..b6f16f58a 100644\n--- a/src/libcamera/sensor/camera_sensor_raw.cpp\n+++ b/src/libcamera/sensor/camera_sensor_raw.cpp\n@@ -171,10 +171,12 @@ CameraSensorRaw::~CameraSensorRaw() = default;\n std::variant<std::unique_ptr<CameraSensor>, int>\n CameraSensorRaw::match(MediaEntity *entity)\n {\n+\tusing libcamera::_log;\n+\n \t/* Check the entity type. */\n \tif (entity->type() != MediaEntity::Type::V4L2Subdevice ||\n \t    entity->function() != MEDIA_ENT_F_CAM_SENSOR) {\n-\t\tlibcamera::LOG(CameraSensor, Debug)\n+\t\tLOG(CameraSensor, Debug)\n \t\t\t<< entity->name() << \": unsupported entity type (\"\n \t\t\t<< utils::to_underlying(entity->type())\n \t\t\t<< \") or function (\" << utils::hex(entity->function()) << \")\";\n@@ -199,7 +201,7 @@ CameraSensorRaw::match(MediaEntity *entity)\n \t\t\tbreak;\n \n \t\tdefault:\n-\t\t\tlibcamera::LOG(CameraSensor, Debug)\n+\t\t\tLOG(CameraSensor, Debug)\n \t\t\t\t<< entity->name() << \": unsupported pad \" << pad->index()\n \t\t\t\t<< \" type \" << utils::hex(pad->flags());\n \t\t\treturn { 0 };\n@@ -207,7 +209,7 @@ CameraSensorRaw::match(MediaEntity *entity)\n \t}\n \n \tif (numSinks < 1 || numSinks > 2 || numSources != 1) {\n-\t\tlibcamera::LOG(CameraSensor, Debug)\n+\t\tLOG(CameraSensor, Debug)\n \t\t\t<< entity->name() << \": unsupported number of sinks (\"\n \t\t\t<< numSinks << \") or sources (\" << numSources << \")\";\n \t\treturn { 0 };\ndiff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\nindex 2f65a43a0..8fda38949 100644\n--- a/src/libcamera/v4l2_device.cpp\n+++ b/src/libcamera/v4l2_device.cpp\n@@ -989,6 +989,8 @@ template std::optional<ColorSpace> V4L2Device::toColorSpace(const struct v4l2_mb\n template<typename T>\n int V4L2Device::fromColorSpace(const std::optional<ColorSpace> &colorSpace, T &v4l2Format)\n {\n+\tusing libcamera::_log;\n+\n \tv4l2Format.colorspace = V4L2_COLORSPACE_DEFAULT;\n \tv4l2Format.xfer_func = V4L2_XFER_FUNC_DEFAULT;\n \tv4l2Format.ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT;\n@@ -1017,7 +1019,7 @@ int V4L2Device::fromColorSpace(const std::optional<ColorSpace> &colorSpace, T &v\n \tif (itPrimaries != primariesToV4l2.end()) {\n \t\tv4l2Format.colorspace = itPrimaries->second;\n \t} else {\n-\t\tlibcamera::LOG(V4L2, Warning)\n+\t\tLOG(V4L2, Warning)\n \t\t\t<< \"Unrecognised primaries in \"\n \t\t\t<< ColorSpace::toString(colorSpace);\n \t\tret = -EINVAL;\n@@ -1027,7 +1029,7 @@ int V4L2Device::fromColorSpace(const std::optional<ColorSpace> &colorSpace, T &v\n \tif (itTransfer != transferFunctionToV4l2.end()) {\n \t\tv4l2Format.xfer_func = itTransfer->second;\n \t} else {\n-\t\tlibcamera::LOG(V4L2, Warning)\n+\t\tLOG(V4L2, Warning)\n \t\t\t<< \"Unrecognised transfer function in \"\n \t\t\t<< ColorSpace::toString(colorSpace);\n \t\tret = -EINVAL;\n@@ -1037,7 +1039,7 @@ int V4L2Device::fromColorSpace(const std::optional<ColorSpace> &colorSpace, T &v\n \tif (itYcbcrEncoding != ycbcrEncodingToV4l2.end()) {\n \t\tv4l2Format.ycbcr_enc = itYcbcrEncoding->second;\n \t} else {\n-\t\tlibcamera::LOG(V4L2, Warning)\n+\t\tLOG(V4L2, Warning)\n \t\t\t<< \"Unrecognised YCbCr encoding in \"\n \t\t\t<< ColorSpace::toString(colorSpace);\n \t\tret = -EINVAL;\n@@ -1047,7 +1049,7 @@ int V4L2Device::fromColorSpace(const std::optional<ColorSpace> &colorSpace, T &v\n \tif (itRange != rangeToV4l2.end()) {\n \t\tv4l2Format.quantization = itRange->second;\n \t} else {\n-\t\tlibcamera::LOG(V4L2, Warning)\n+\t\tLOG(V4L2, Warning)\n \t\t\t<< \"Unrecognised quantization in \"\n \t\t\t<< ColorSpace::toString(colorSpace);\n \t\tret = -EINVAL;\n",
    "prefixes": [
        "v1",
        "2/3"
    ]
}