Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 37141C19F2A for ; Sat, 30 Jul 2022 21:54:24 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8FC478420D; Sat, 30 Jul 2022 23:53:27 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="gJ2geRuQ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D9CDB841C5; Sat, 30 Jul 2022 23:53:17 +0200 (CEST) Received: from mail-ot1-x32b.google.com (mail-ot1-x32b.google.com [IPv6:2607:f8b0:4864:20::32b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id E74098420D for ; Sat, 30 Jul 2022 23:53:11 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-ot1-x32b.google.com with SMTP id a14-20020a0568300b8e00b0061c4e3eb52aso5661546otv.3 for ; Sat, 30 Jul 2022 14:53:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=1I3XGI/hbHjxqTRaX4oKPjfEAluxEzfAYatMZwDu5oA=; b=gJ2geRuQjX652wXR9ozpY6ZCLbbefXudV8gzUuLpNVKAkLliB1fDT98/GV/zKckWs8 XIwxvLGaThixbmafIi5vHNyz468hBV8YTNICvZf/sOtf4fqJA2jz0TEcD+7/MxWMAWTh VkrHjLbrmSDmFxudbsYvD8ozcxQ4lEheOMyMo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=1I3XGI/hbHjxqTRaX4oKPjfEAluxEzfAYatMZwDu5oA=; b=fuw6Ps25Fw4x+lUbglVff2B+58LAzHasC+T0hs13RNFy02vDC1F3fzxW93A7dmCIoT 7gZZVah5XhyiZLuukhXs/0h3N7tvG4QyCJk8vdLFFDhob8xOktpB3sWyU9E8sty9unHK iCTXpVtEDqBumjIs4s6C+AMXwJS17+77BARKTlVJo/q1oGJlWHBMlUwqGBo/dB8qcNns DSvZ9SciIXzmeRmXeb/a3n0795UyhpApOskmpuG6CdZEu3XLAbm/vUHQPatw6Tqvzitn tqzC/3jaTaxwwOcQfZvwLD+lQ2lnipKNRKIO9hdctoMEjJXd5jIFpwlmjgIB2Au2NngU d7Pg== X-Gm-Message-State: AJIora+ZaStTz8PuW4Q88Seaq/EkbClYi04QDhqNgjdxZlyj3iA/p45N qlM/qy6NSToqrf0AU+VcD2Pixa4Qr5omxwi6 X-Google-Smtp-Source: AGRyM1vECZjSKZiR07B/Xmq6KGArzvwpT2HWwxs/yaZyofGKxdJuxBbJcEeSmzWTAiySGrsvuoRJOQ== X-Received: by 2002:a9d:6945:0:b0:61c:81f2:733b with SMTP id p5-20020a9d6945000000b0061c81f2733bmr3863954oto.241.1659217991376; Sat, 30 Jul 2022 14:53:11 -0700 (PDT) Received: from sjg1.lan (c-67-190-102-125.hsd1.co.comcast.net. [67.190.102.125]) by smtp.gmail.com with ESMTPSA id 19-20020a544193000000b0032f75714af1sm1699656oiy.18.2022.07.30.14.53.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Jul 2022 14:53:10 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Bin Meng , Simon Glass , Marek Vasut , Pavel Herrmann Subject: [PATCH v2 08/35] dm: core: Swap parameters of ofnode_write_prop() Date: Sat, 30 Jul 2022 15:52:10 -0600 Message-Id: <20220730215237.818368-7-sjg@chromium.org> X-Mailer: git-send-email 2.37.1.455.g008518b4e5-goog In-Reply-To: <20220730215237.818368-1-sjg@chromium.org> References: <20220730215237.818368-1-sjg@chromium.org> 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean It is normal for the length to come after the value in libfdt. Follow this same convention with ofnode. Signed-off-by: Simon Glass --- (no changes since v1) drivers/core/ofnode.c | 6 +++--- include/dm/ofnode.h | 6 +++--- test/dm/ofnode.c | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c index bd41ef503c2..1c9542a3567 100644 --- a/drivers/core/ofnode.c +++ b/drivers/core/ofnode.c @@ -1105,8 +1105,8 @@ ofnode ofnode_by_prop_value(ofnode from, const char *propname, } } -int ofnode_write_prop(ofnode node, const char *propname, int len, - const void *value) +int ofnode_write_prop(ofnode node, const char *propname, const void *value, + int len) { const struct device_node *np = ofnode_to_np(node); struct property *pp; @@ -1161,7 +1161,7 @@ int ofnode_write_string(ofnode node, const char *propname, const char *value) debug("%s: %s = %s", __func__, propname, value); - return ofnode_write_prop(node, propname, strlen(value) + 1, value); + return ofnode_write_prop(node, propname, value, strlen(value) + 1); } int ofnode_set_enabled(ofnode node, bool value) diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h index d7ad5dccc14..071a9d63f67 100644 --- a/include/dm/ofnode.h +++ b/include/dm/ofnode.h @@ -1114,13 +1114,13 @@ int ofnode_device_is_compatible(ofnode node, const char *compat); * * @node: The node for whose property should be set * @propname: The name of the property to set - * @len: The length of the new value of the property * @value: The new value of the property (must be valid prior to calling * the function) + * @len: The length of the new value of the property * Return: 0 if successful, -ve on error */ -int ofnode_write_prop(ofnode node, const char *propname, int len, - const void *value); +int ofnode_write_prop(ofnode node, const char *propname, const void *value, + int len); /** * ofnode_write_string() - Set a string property of a ofnode diff --git a/test/dm/ofnode.c b/test/dm/ofnode.c index b8d8e440dbc..0aeaaeb7f8c 100644 --- a/test/dm/ofnode.c +++ b/test/dm/ofnode.c @@ -576,8 +576,8 @@ static int dm_test_ofnode_livetree_writing(struct unit_test_state *uts) /* Non-existent in DTB */ ut_asserteq_64(FDT_ADDR_T_NONE, dev_read_addr(dev)); /* reg = 0x42, size = 0x100 */ - ut_assertok(ofnode_write_prop(node, "reg", 8, - "\x00\x00\x00\x42\x00\x00\x01\x00")); + ut_assertok(ofnode_write_prop(node, "reg", + "\x00\x00\x00\x42\x00\x00\x01\x00", 8)); ut_asserteq(0x42, dev_read_addr(dev)); /* Test disabling devices */ -- 2.37.1.455.g008518b4e5-goog