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 8F8AAC433EF for ; Wed, 20 Jul 2022 17:01:32 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 56F5A840BB; Wed, 20 Jul 2022 19:00:40 +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="CsObTEQc"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A699584068; Wed, 20 Jul 2022 19:00:27 +0200 (CEST) Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) (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 4A4F3840C3 for ; Wed, 20 Jul 2022 19:00:20 +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-wr1-x42d.google.com with SMTP id b26so27009907wrc.2 for ; Wed, 20 Jul 2022 10:00:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QYisZhqW+aKJv9360y4eXTMHUygJ9mL6p155v3waaGI=; b=CsObTEQc713u4XoQ2RWHM6908SbUmDx+NNtNBmJRvJVj6YRaQCq8MmvaiNhDD6ODMB kcudnRkQWd+nRFZG6VT6nwjVPNAfMuXZDjT5tfbdJMcQjTTpf2UllbhKCE7fS3/SGSFy XsIzYui/ZhnoDF9GubZmDjwptkF89jCkdHrOk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QYisZhqW+aKJv9360y4eXTMHUygJ9mL6p155v3waaGI=; b=Od9khKp8EFPAgidFVs6dLxCBUs/bJeInekOYp5hZ0EPEh074sKmQzH370mYRTnXozN aA3v1QO3bL6eaEUoNNb1scYMcEb0W9vSIjDhWSzYDjcBRmEI0iW4Fsh7GyahZ/xT4i6b x3gl59e8tcSl42rvx4Vnp8wgAFibF4bK2jQGPQzP1+zud/kmYS8h62QWFlOfLdcaB/zR 4AMHe/uRPcHTwqEaYM/tUP+fz1BIo1cItxvel7Pe57Mowf8E7VWMbyH+NHfcPzrKLPaf cRovK6htVTYbHYEuJ4451RPD0BOLbhSX2Z1abg5chUvIBdRLGxaLKiqeSLO8iR2f6trq qgRg== X-Gm-Message-State: AJIora/uLo+RfoOvhdyKvr2PnS8ukQzZZq0e4+yQa+PLSMf9VpwiZ10H eC7r7h6jZp9sC2hKMIgix4HKz5BNQ/xVTyOT X-Google-Smtp-Source: AGRyM1v+A6tXkL7syfCUloFy7lN8d97Qxlb0AvxRkpESiJy/qdIVVoct4JJBFa6S3MqZmh1l9m9H9A== X-Received: by 2002:a05:6000:152:b0:21d:8674:8c41 with SMTP id r18-20020a056000015200b0021d86748c41mr30646910wrx.169.1658336419252; Wed, 20 Jul 2022 10:00:19 -0700 (PDT) Received: from sjg1.roam.corp.google.com ([62.48.169.138]) by smtp.gmail.com with ESMTPSA id u16-20020a05600c00d000b003a31c4f6f74sm3690906wmm.32.2022.07.20.10.00.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Jul 2022 10:00:18 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass , Marek Vasut , Pavel Herrmann Subject: [PATCH 07/19] dm: core: Swap parameters of ofnode_write_prop() Date: Wed, 20 Jul 2022 10:59:35 -0600 Message-Id: <20220720165947.12728-8-sjg@chromium.org> X-Mailer: git-send-email 2.37.0.170.g444d1eabd0-goog In-Reply-To: <20220720165947.12728-1-sjg@chromium.org> References: <20220720165947.12728-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 --- 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.0.170.g444d1eabd0-goog