{"id":800471,"url":"http://patchwork.ozlabs.org/api/1.2/patches/800471/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/patch/1502441568-22896-2-git-send-email-pantelis.antoniou@konsulko.com/","project":{"id":18,"url":"http://patchwork.ozlabs.org/api/1.2/projects/18/?format=json","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":"<1502441568-22896-2-git-send-email-pantelis.antoniou@konsulko.com>","list_archive_url":null,"date":"2017-08-11T08:52:39","name":"[U-Boot,v2,01/10] Introduce fdt_setprop_placeholder() method","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"0790ffa17aec2c0465e8a17fbac08362dfc3be5b","submitter":{"id":64098,"url":"http://patchwork.ozlabs.org/api/1.2/people/64098/?format=json","name":"Pantelis Antoniou","email":"pantelis.antoniou@konsulko.com"},"delegate":{"id":3184,"url":"http://patchwork.ozlabs.org/api/1.2/users/3184/?format=json","username":"sjg","first_name":"Simon","last_name":"Glass","email":"sjg@chromium.org"},"mbox":"http://patchwork.ozlabs.org/project/uboot/patch/1502441568-22896-2-git-send-email-pantelis.antoniou@konsulko.com/mbox/","series":[],"comments":"http://patchwork.ozlabs.org/api/patches/800471/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/800471/checks/","tags":{},"related":[],"headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=konsulko.com header.i=@konsulko.com\n\theader.b=\"EnN1ckta\"; dkim-atps=neutral"],"Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xTJm61Wt9z9t2W\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 11 Aug 2017 18:57:10 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid CDB23C21C4F; Fri, 11 Aug 2017 08:56:28 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 0F1AAC21DD0;\n\tFri, 11 Aug 2017 08:55:53 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid CE827C21DA1; Fri, 11 Aug 2017 08:55:43 +0000 (UTC)","from mail-wr0-f175.google.com (mail-wr0-f175.google.com\n\t[209.85.128.175])\n\tby lists.denx.de (Postfix) with ESMTPS id A0CBEC21C97\n\tfor <u-boot@lists.denx.de>; Fri, 11 Aug 2017 08:55:37 +0000 (UTC)","by mail-wr0-f175.google.com with SMTP id 33so11109766wrz.4\n\tfor <u-boot@lists.denx.de>; Fri, 11 Aug 2017 01:55:37 -0700 (PDT)","from localhost.localdomain ([195.97.110.117])\n\tby smtp.gmail.com with ESMTPSA id\n\to71sm759811wmg.15.2017.08.11.01.55.35\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tFri, 11 Aug 2017 01:55:36 -0700 (PDT)"],"X-Spam-Checker-Version":"SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE,\n\tRCVD_IN_MSPIKE_H2,\n\tT_DKIM_INVALID autolearn=unavailable autolearn_force=no\n\tversion=3.4.0","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com;\n\ts=google; \n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=zkVmHlvGrK4jP3lqjdj93xMas1MSP0Ebeyk1NLM8jOc=;\n\tb=EnN1ckta74p39oxSEGimob5ktDOTZOqizCo4tyi99kWG6LerA3FRNBAf+odWq9GTOa\n\tpeTMcX5YMCWj6UGr8tM2bNo7pkLTUBhcVTPy3eJ0xa2Qp3MdYv5jvzUGBeuKHosC64Tt\n\tRRVsIwzRAFQC6Gh2qoGJc5jE/uR5LrZUmH6Hc=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=zkVmHlvGrK4jP3lqjdj93xMas1MSP0Ebeyk1NLM8jOc=;\n\tb=Tfl2K0Ih3UPVfCi82D/91XVObdHfwpbOMh4v7Bcq7iE+1Qa748l8tzCme7oMpBbzol\n\trWXifHhBNPDeRgv+PlVusn/zjBywwouGF5NU98686PscObMSZqL3+PdUcDoUcroo4AkM\n\tv/IaHjLC2Yl6Lmrg2e2fm8YVWrB/YJsNFrK5AjveuA9nXbJla/qNkLoYTQnl+uSgP/NJ\n\t0IiGW/HIBeSpgjWGmKrzqv8WFL6CB1NWzx9gZkibRshSvy0PIiCkFBqJhzLF67SiUtYJ\n\tnkm06LYCwFae4A2uNbBLjh/ypujteeKc8+rVcOxLtu628W3Zqa11n0ZX7xJokIztKg3S\n\tGgUg==","X-Gm-Message-State":"AHYfb5hAJn5w3h8fhdErH+rM3FtmaqBB/ebgaS0yxRpJuR+/Z4aNxl9W\n\temYGDMIAFS0MZQdt","X-Received":"by 10.223.161.133 with SMTP id u5mr11654747wru.191.1502441737329;\n\tFri, 11 Aug 2017 01:55:37 -0700 (PDT)","From":"Pantelis Antoniou <pantelis.antoniou@konsulko.com>","To":"Tom Rini <trini@konsulko.com>","Date":"Fri, 11 Aug 2017 11:52:39 +0300","Message-Id":"<1502441568-22896-2-git-send-email-pantelis.antoniou@konsulko.com>","X-Mailer":"git-send-email 2.1.4","In-Reply-To":"<1502441568-22896-1-git-send-email-pantelis.antoniou@konsulko.com>","References":"<1502441568-22896-1-git-send-email-pantelis.antoniou@konsulko.com>","Cc":"Marek Vasut <marex@denx.de>,\n\tPantelis Antoniou <pantelis.antoniou@konsulko.com>,\n\tTero Kristo <t-kristo@ti.com>, u-boot@lists.denx.de,\n\tMaxime Ripard <maxime.ripard@free-electrons.com>,\n\tStefan Roese <sr@denx.de>, Alan Ott <alan@signal11.us>,\n\tDavid Gibson <david@gibson.dropbear.id.au>","Subject":"[U-Boot] [PATCH v2 01/10] Introduce fdt_setprop_placeholder() method","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.18","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<http://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\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>"},"content":"In some cases you need to add a property but the contents of it\nare not known at creation time, merely the extend of it.\n\nThis method allows you to create a property of a given size (filled\nwith garbage) while a pointer to the property data will be provided.\n\nSigned-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>\n[dwg: Corrected commit message]\nSigned-off-by: David Gibson <david@gibson.dropbear.id.au>\n---\n lib/libfdt/fdt_rw.c | 20 +++++++++++++++++---\n lib/libfdt/libfdt.h | 31 +++++++++++++++++++++++++++++++\n 2 files changed, 48 insertions(+), 3 deletions(-)","diff":"diff --git a/lib/libfdt/fdt_rw.c b/lib/libfdt/fdt_rw.c\nindex 80a3212..3dc7752 100644\n--- a/lib/libfdt/fdt_rw.c\n+++ b/lib/libfdt/fdt_rw.c\n@@ -228,8 +228,8 @@ int fdt_set_name(void *fdt, int nodeoffset, const char *name)\n \treturn 0;\n }\n \n-int fdt_setprop(void *fdt, int nodeoffset, const char *name,\n-\t\tconst void *val, int len)\n+int fdt_setprop_placeholder(void *fdt, int nodeoffset, const char *name,\n+\t\t\t    int len, void **prop_data)\n {\n \tstruct fdt_property *prop;\n \tint err;\n@@ -242,8 +242,22 @@ int fdt_setprop(void *fdt, int nodeoffset, const char *name,\n \tif (err)\n \t\treturn err;\n \n+\t*prop_data = prop->data;\n+\treturn 0;\n+}\n+\n+int fdt_setprop(void *fdt, int nodeoffset, const char *name,\n+\t\tconst void *val, int len)\n+{\n+\tvoid *prop_data;\n+\tint err;\n+\n+\terr = fdt_setprop_placeholder(fdt, nodeoffset, name, len, &prop_data);\n+\tif (err)\n+\t\treturn err;\n+\n \tif (len)\n-\t\tmemcpy(prop->data, val, len);\n+\t\tmemcpy(prop_data, val, len);\n \treturn 0;\n }\n \ndiff --git a/lib/libfdt/libfdt.h b/lib/libfdt/libfdt.h\nindex f3f9cad..6af94cb 100644\n--- a/lib/libfdt/libfdt.h\n+++ b/lib/libfdt/libfdt.h\n@@ -1405,6 +1405,37 @@ int fdt_setprop(void *fdt, int nodeoffset, const char *name,\n \t\tconst void *val, int len);\n \n /**\n+ * fdt_setprop _placeholder - allocate space for a property\n+ * @fdt: pointer to the device tree blob\n+ * @nodeoffset: offset of the node whose property to change\n+ * @name: name of the property to change\n+ * @len: length of the property value\n+ * @prop_data: return pointer to property data\n+ *\n+ * fdt_setprop_placeholer() allocates the named property in the given node.\n+ * If the property exists it is resized. In either case a pointer to the\n+ * property data is returned.\n+ *\n+ * This function may insert or delete data from the blob, and will\n+ * therefore change the offsets of some existing nodes.\n+ *\n+ * returns:\n+ *\t0, on success\n+ *\t-FDT_ERR_NOSPACE, there is insufficient free space in the blob to\n+ *\t\tcontain the new property value\n+ *\t-FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag\n+ *\t-FDT_ERR_BADLAYOUT,\n+ *\t-FDT_ERR_BADMAGIC,\n+ *\t-FDT_ERR_BADVERSION,\n+ *\t-FDT_ERR_BADSTATE,\n+ *\t-FDT_ERR_BADSTRUCTURE,\n+ *\t-FDT_ERR_BADLAYOUT,\n+ *\t-FDT_ERR_TRUNCATED, standard meanings\n+ */\n+int fdt_setprop_placeholder(void *fdt, int nodeoffset, const char *name,\n+\t\t\t    int len, void **prop_data);\n+\n+/**\n  * fdt_setprop_u32 - set a property to a 32-bit integer\n  * @fdt: pointer to the device tree blob\n  * @nodeoffset: offset of the node whose property to change\n","prefixes":["U-Boot","v2","01/10"]}