get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2219579,
    "url": "http://patchwork.ozlabs.org/api/patches/2219579/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/20260403135205.26979-5-ansuelsmth@gmail.com/",
    "project": {
        "id": 18,
        "url": "http://patchwork.ozlabs.org/api/projects/18/?format=api",
        "name": "U-Boot",
        "link_name": "uboot",
        "list_id": "u-boot.lists.denx.de",
        "list_email": "u-boot@lists.denx.de",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null,
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20260403135205.26979-5-ansuelsmth@gmail.com>",
    "list_archive_url": null,
    "date": "2026-04-03T13:52:01",
    "name": "[v5,4/6] misc: fw_loader: implement request_firmware_size() OP",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "12bf493443e0911524a9c9a0195dce8e66e5d1aa",
    "submitter": {
        "id": 71108,
        "url": "http://patchwork.ozlabs.org/api/people/71108/?format=api",
        "name": "Christian Marangi",
        "email": "ansuelsmth@gmail.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/uboot/patch/20260403135205.26979-5-ansuelsmth@gmail.com/mbox/",
    "series": [
        {
            "id": 498633,
            "url": "http://patchwork.ozlabs.org/api/series/498633/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/uboot/list/?series=498633",
            "date": "2026-04-03T13:51:57",
            "name": "misc: fs_loader: reorg and split to FS and FW loader + FIP loader",
            "version": 5,
            "mbox": "http://patchwork.ozlabs.org/series/498633/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2219579/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2219579/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<u-boot-bounces@lists.denx.de>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": "patchwork-incoming@legolas.ozlabs.org",
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=oSROIRA5;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de\n (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de;\n envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org)",
            "phobos.denx.de;\n dmarc=pass (p=none dis=none) header.from=gmail.com",
            "phobos.denx.de;\n spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de",
            "phobos.denx.de;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.b=\"oSROIRA5\";\n\tdkim-atps=neutral",
            "phobos.denx.de;\n dmarc=pass (p=none dis=none) header.from=gmail.com",
            "phobos.denx.de;\n spf=pass smtp.mailfrom=ansuelsmth@gmail.com"
        ],
        "Received": [
            "from phobos.denx.de (phobos.denx.de\n [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fnKtH0LRFz1yCs\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 04 Apr 2026 00:52:55 +1100 (AEDT)",
            "from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id 8D04484118;\n\tFri,  3 Apr 2026 15:52:28 +0200 (CEST)",
            "by phobos.denx.de (Postfix, from userid 109)\n id DFCA784120; Fri,  3 Apr 2026 15:52:26 +0200 (CEST)",
            "from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com\n [IPv6:2a00:1450:4864:20::32d])\n (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits))\n (No client certificate requested)\n by phobos.denx.de (Postfix) with ESMTPS id D996884101\n for <u-boot@lists.denx.de>; Fri,  3 Apr 2026 15:52:24 +0200 (CEST)",
            "by mail-wm1-x32d.google.com with SMTP id\n 5b1f17b1804b1-483487335c2so19847755e9.2\n for <u-boot@lists.denx.de>; Fri, 03 Apr 2026 06:52:24 -0700 (PDT)",
            "from Ansuel-XPS24 ([217.202.87.54])\n by smtp.googlemail.com with ESMTPSA id\n 5b1f17b1804b1-4888a7162cesm196732895e9.13.2026.04.03.06.52.21\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Fri, 03 Apr 2026 06:52:23 -0700 (PDT)"
        ],
        "X-Spam-Checker-Version": "SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de",
        "X-Spam-Level": "",
        "X-Spam-Status": "No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,\n DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,\n RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham\n autolearn_force=no version=3.4.2",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20251104; t=1775224344; x=1775829144; darn=lists.denx.de;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:to:from:from:to:cc:subject:date:message-id\n :reply-to; bh=lRyMlkwMBFUTS1fPkCX5K1jq+MSWJv9ALEWgihBG4qE=;\n b=oSROIRA50GVnMeK7G2aqIEtu38b5Zgw7LjYHjRSggRZS8xNyF/2YudAQs1WvQhUVcT\n pB8w0/Dlo/CD/sNqeuc1wIW7vU1Eh1/N2jAVi2TFnyd/v58PAJP3j02P8AfDb/y1exyl\n GMZSvvFp9S+Xn+LypT957DEhgo1zNksCdFjaIusUPMZUExvOq8qpkP2MLfZGAqeHlWjq\n r4kqPZCHwm2QOhMSVo70V3efIHW2CYlVD7w+j9pwUJsChCK808VxKn1oixrhgbisfJ35\n 5iStSzLsxGLTj0iEbex7cFyrCSaI0HsoW9reexPOq1gllYhjzeoNop4fBIHoz802yN2V\n /kmQ==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1775224344; x=1775829144;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to\n :cc:subject:date:message-id:reply-to;\n bh=lRyMlkwMBFUTS1fPkCX5K1jq+MSWJv9ALEWgihBG4qE=;\n b=OQ5VJbkp0PrQWELpMeEUom6zNyayU+jP/6WXxz2rLpZ6U05cG933gdvN1nayQGZXJq\n dV/Op+AzuJDeTkPSpJgakNo88fH44PGPnusxkjTNxdDUfe58Ub9Q1z2TFGMpXYWS/avO\n +AzktOyL0gc4S7OMyDnYwiHA1O65t69fshCo+uEgnDj3+1h4myMQ/WFobjOsBqIvOUHQ\n zPY+HhX+T7V/5/Se7kycyWjfHu4NGhnzkaMipt/ALgttsgDmJ7mwOoWVBPgZugXYrCDW\n MAfdeibq8ykEpToPVq1r7PFpcJWSJ9MrUwK3Iyn2vorvEhbdCGot7zYV7ZW2X2PZg/ie\n RGkg==",
        "X-Forwarded-Encrypted": "i=1;\n AJvYcCVWxeC7w8c6vKT9o1rp00wEY5TFSGCJiMPG/+VnJ9Gq6uicm/LHKCbDLoWPeMNFTaiHBgUxheQ=@lists.denx.de",
        "X-Gm-Message-State": "AOJu0Yw2uwklp8+RLPJ0PMFDNxmEi5APLpLyk3Ev7U301hLJlJy6ZZNy\n ddrG+2FyJVH4gk4U7qI2Vs82gXtV0xRwPwrONgb5qjSZBULcpLchWAq1",
        "X-Gm-Gg": "ATEYQzwVck+mk5uUkBa+CtOsopmSDSZ1lJE9iVIrdD2f4hl+D2YAjOIk0FbndnlDp54\n JQJA+tKwP+h8CgyR4swdE7+27rZHgB5KiiSjKwurDn4PLRfYKDhrzGHmvY3w2plWodaJAd8DT+B\n 0OwpktGWcP0IpJUhhjfslLTKptrsMcblBKYPeAeM37WRMCrkfaXfpD5VZmTBe9ddKKG+TTZLSmt\n jJlp/VSPHPjC0S/ee4u4tSyxCk8lMdmWORQth0aH9ofb3fsxjELJ1htKniGUIUhqFUv0CNQ5s5O\n rb6RdfLTGCCdLWGiFbdWMF5HFKTpYboZ72c6Pvti3kdBWtzP15dlkfsNRCBwKMMOi2sid07L5Xo\n 7W1O2AE92NnyWq3oiyDhQ9PO0sWFLHhGzwAyH/0vevze0Yz+x88snznY5EhyuQ0NWCKgKypAia1\n EtIOUNsV1C7IFTMouEPgrdFvs=",
        "X-Received": "by 2002:a05:600c:1f96:b0:483:8062:b2f with SMTP id\n 5b1f17b1804b1-488996e142bmr48366555e9.6.1775224343999;\n Fri, 03 Apr 2026 06:52:23 -0700 (PDT)",
        "From": "Christian Marangi <ansuelsmth@gmail.com>",
        "To": "Tom Rini <trini@konsulko.com>, Simon Glass <sjg@chromium.org>,\n Christian Marangi <ansuelsmth@gmail.com>,\n Casey Connolly <casey.connolly@linaro.org>,\n Quentin Schulz <quentin.schulz@cherry.de>, Peng Fan <peng.fan@nxp.com>,\n Justin Klaassen <justin@tidylabs.net>,\n Neha Malcom Francis <n-francis@ti.com>,\n Heinrich Schuchardt <xypron.glpk@gmx.de>,\n Jamie Gibbons <jamie.gibbons@microchip.com>,\n Leo Yu-Chi Liang <ycliang@andestech.com>, Harsha Vardhan V M <h-vm@ti.com>,\n Weijie Gao <weijie.gao@mediatek.com>,\n Marek Vasut <marek.vasut+renesas@mailbox.org>,\n Patrice Chotard <patrice.chotard@foss.st.com>, Yao Zi <me@ziyao.cc>,\n Alif Zakuan Yuslaimi <alif.zakuan.yuslaimi@altera.com>,\n \"Lucien.Jheng\" <lucienzx159@gmail.com>, u-boot@lists.denx.de",
        "Subject": "[PATCH v5 4/6] misc: fw_loader: implement request_firmware_size() OP",
        "Date": "Fri,  3 Apr 2026 15:52:01 +0200",
        "Message-ID": "<20260403135205.26979-5-ansuelsmth@gmail.com>",
        "X-Mailer": "git-send-email 2.53.0",
        "In-Reply-To": "<20260403135205.26979-1-ansuelsmth@gmail.com>",
        "References": "<20260403135205.26979-1-ansuelsmth@gmail.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-BeenThere": "u-boot@lists.denx.de",
        "X-Mailman-Version": "2.1.39",
        "Precedence": "list",
        "List-Id": "U-Boot discussion <u-boot.lists.denx.de>",
        "List-Unsubscribe": "<https://lists.denx.de/options/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=unsubscribe>",
        "List-Archive": "<https://lists.denx.de/pipermail/u-boot/>",
        "List-Post": "<mailto:u-boot@lists.denx.de>",
        "List-Help": "<mailto:u-boot-request@lists.denx.de?subject=help>",
        "List-Subscribe": "<https://lists.denx.de/listinfo/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=subscribe>",
        "Errors-To": "u-boot-bounces@lists.denx.de",
        "Sender": "\"U-Boot\" <u-boot-bounces@lists.denx.de>",
        "X-Virus-Scanned": "clamav-milter 0.103.8 at phobos.denx.de",
        "X-Virus-Status": "Clean"
    },
    "content": "It might be useful to get the firmware size before reading it to allocate\nthe correct size. This is needed for case where the firmware size change\nacross different firmware version and is not always the same. In such case\nthe only way to handle this scenario is to allocate a big-enough buffer to\nread the firmware.\n\nTo better handle this, introduce the request_firmware_size() OP to get the\nfirmware size before reading it. This way proper buffer can be allocated\nand dynamic firmware size can be better supported.\n\nFS loader is updated to handle the new .get_size() handler.\n\nSigned-off-by: Christian Marangi <ansuelsmth@gmail.com>\n---\n drivers/misc/fw_loader/fs_loader.c | 72 +++++++++++++++++++++++++-----\n drivers/misc/fw_loader/fw_loader.c | 20 +++++++++\n drivers/misc/fw_loader/internal.h  |  1 +\n include/fw_loader.h                |  9 ++++\n 4 files changed, 91 insertions(+), 11 deletions(-)",
    "diff": "diff --git a/drivers/misc/fw_loader/fs_loader.c b/drivers/misc/fw_loader/fs_loader.c\nindex 2748d9f041e8..87e7840686f1 100644\n--- a/drivers/misc/fw_loader/fs_loader.c\n+++ b/drivers/misc/fw_loader/fs_loader.c\n@@ -89,15 +89,8 @@ static int select_fs_dev(struct device_plat *plat)\n \treturn ret;\n }\n \n-/**\n- * fw_get_filesystem_firmware - load firmware into an allocated buffer.\n- * @dev: An instance of a driver.\n- *\n- * Return: Size of total read, negative value when error.\n- */\n-static int fw_get_filesystem_firmware(struct udevice *dev)\n+static int __fw_get_filesystem_firmware_prepare(struct udevice *dev)\n {\n-\tloff_t actread = 0;\n \tchar *storage_interface, *dev_part, *ubi_mtdpart, *ubi_volume;\n \tint ret;\n \n@@ -122,6 +115,28 @@ static int fw_get_filesystem_firmware(struct udevice *dev)\n \t\tret = select_fs_dev(dev_get_plat(dev));\n \t}\n \n+\treturn ret;\n+}\n+\n+static void __fw_get_filesystem_firmware_release(struct udevice *dev)\n+{\n+#ifdef CONFIG_CMD_UBIFS\n+\tumount_ubifs();\n+#endif\n+}\n+\n+/**\n+ * fw_get_filesystem_firmware - load firmware into an allocated buffer.\n+ * @dev: An instance of a driver.\n+ *\n+ * Return: Size of total read, negative value when error.\n+ */\n+static int fw_get_filesystem_firmware(struct udevice *dev)\n+{\n+\tloff_t actread = 0;\n+\tint ret;\n+\n+\tret = __fw_get_filesystem_firmware_prepare(dev);\n \tif (ret)\n \t\tgoto out;\n \n@@ -143,9 +158,43 @@ static int fw_get_filesystem_firmware(struct udevice *dev)\n \t}\n \n out:\n-#ifdef CONFIG_CMD_UBIFS\n-\tumount_ubifs();\n-#endif\n+\t__fw_get_filesystem_firmware_release(dev);\n+\treturn ret;\n+}\n+\n+/**\n+ * fw_get_filesystem_firmware_size - get firmware size.\n+ * @dev: An instance of a driver.\n+ *\n+ * Return: Size of firmware, negative value when error.\n+ */\n+static int fw_get_filesystem_firmware_size(struct udevice *dev)\n+{\n+\tstruct firmware *firmwarep;\n+\tloff_t size = 0;\n+\tint ret;\n+\n+\tret = __fw_get_filesystem_firmware_prepare(dev);\n+\tif (ret)\n+\t\tgoto out;\n+\n+\tfirmwarep = dev_get_priv(dev);\n+\tif (!firmwarep) {\n+\t\tret = -ENOMEM;\n+\t\tgoto out;\n+\t}\n+\n+\tret = fs_size(firmwarep->name, &size);\n+\tif (ret) {\n+\t\tdebug(\"Error: %d Failed to get size for %s.\\n\",\n+\t\t      ret, firmwarep->name);\n+\t\tgoto out;\n+\t}\n+\n+\tret = size;\n+\n+out:\n+\t__fw_get_filesystem_firmware_release(dev);\n \treturn ret;\n }\n \n@@ -159,6 +208,7 @@ static int fs_loader_probe(struct udevice *dev)\n \t\treturn ret;\n \n \tplat->get_firmware = fw_get_filesystem_firmware;\n+\tplat->get_size = fw_get_filesystem_firmware_size;\n \n \treturn 0;\n };\ndiff --git a/drivers/misc/fw_loader/fw_loader.c b/drivers/misc/fw_loader/fw_loader.c\nindex c3d0de1b93e7..06bd6ab9ab12 100644\n--- a/drivers/misc/fw_loader/fw_loader.c\n+++ b/drivers/misc/fw_loader/fw_loader.c\n@@ -174,3 +174,23 @@ int request_firmware_into_buf(struct udevice *dev,\n \n \treturn plat->get_firmware(dev);\n }\n+\n+int request_firmware_size(struct udevice *dev, const char *name)\n+{\n+\tstruct device_plat *plat;\n+\tint ret;\n+\n+\tif (!dev)\n+\t\treturn -EINVAL;\n+\n+\tret = _request_firmware_prepare(dev, name, NULL, 0, 0);\n+\tif (ret < 0) /* error */\n+\t\treturn ret;\n+\n+\tplat = dev_get_plat(dev);\n+\n+\tif (!plat->get_size)\n+\t\treturn -EOPNOTSUPP;\n+\n+\treturn plat->get_size(dev);\n+}\ndiff --git a/drivers/misc/fw_loader/internal.h b/drivers/misc/fw_loader/internal.h\nindex fa006b7e6077..a94de609d0b6 100644\n--- a/drivers/misc/fw_loader/internal.h\n+++ b/drivers/misc/fw_loader/internal.h\n@@ -34,6 +34,7 @@ struct device_plat {\n \tchar *ubivol;\n \n \tint (*get_firmware)(struct udevice *dev);\n+\tint (*get_size)(struct udevice *dev);\n };\n \n /**\ndiff --git a/include/fw_loader.h b/include/fw_loader.h\nindex 7053c7bc6f05..1af3db385161 100644\n--- a/include/fw_loader.h\n+++ b/include/fw_loader.h\n@@ -39,6 +39,15 @@ int request_firmware_into_buf(struct udevice *dev,\n \t\t\t      const char *name,\n \t\t\t      void *buf, size_t size, u32 offset);\n \n+/**\n+ * request_firmware_size - Get firmware size.\n+ * @dev: An instance of a driver.\n+ * @name: Name of firmware file.\n+ *\n+ * Return: Size of firmware, negative value when error.\n+ */\n+int request_firmware_size(struct udevice *dev, const char *name);\n+\n /**\n  * request_firmware_into_buf_via_script() -\n  * Load firmware using a U-Boot script and copy to buffer\n",
    "prefixes": [
        "v5",
        "4/6"
    ]
}