mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 02/14] treewide: Use of_property_write_string() where appropriate
Date: Fri, 31 Mar 2017 07:33:11 +0200	[thread overview]
Message-ID: <20170331053323.17821-3-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20170331053323.17821-1-s.hauer@pengutronix.de>

Replace users which use of_set_property() to set a property to a string
with of_property_write_string().

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/boards/highbank/init.c |  6 ++----
 arch/arm/cpu/psci.c             |  6 ++----
 arch/sandbox/board/hostfile.c   |  6 ++----
 common/memory.c                 |  2 +-
 common/oftree.c                 |  2 +-
 common/state/state.c            |  5 ++---
 drivers/of/base.c               |  2 +-
 drivers/video/simplefb.c        | 12 ++++--------
 8 files changed, 15 insertions(+), 26 deletions(-)

diff --git a/arch/arm/boards/highbank/init.c b/arch/arm/boards/highbank/init.c
index 577ccc0b74..32e217321a 100644
--- a/arch/arm/boards/highbank/init.c
+++ b/arch/arm/boards/highbank/init.c
@@ -37,14 +37,12 @@ static int hb_fixup(struct device_node *root, void *unused)
 
 	if (!(reg & HB_PWRDOM_STAT_SATA)) {
 		for_each_compatible_node_from(node, root, NULL, "calxeda,hb-ahci")
-			of_set_property(node, "status", "disabled",
-					sizeof("disabled"), 1);
+			of_property_write_string(node, "status", "disabled");
 	}
 
 	if (!(reg & HB_PWRDOM_STAT_EMMC)) {
 		for_each_compatible_node_from(node, root, NULL, "calxeda,hb-sdhci")
-			of_set_property(node, "status", "disabled",
-					sizeof("disabled"), 1);
+			of_property_write_string(node, "status", "disabled");
 	}
 
 	if ((opp_table[0] >> 16) != HB_OPP_VERSION)
diff --git a/arch/arm/cpu/psci.c b/arch/arm/cpu/psci.c
index d650c23ea2..eafb361a0a 100644
--- a/arch/arm/cpu/psci.c
+++ b/arch/arm/cpu/psci.c
@@ -204,13 +204,11 @@ static int of_psci_fixup(struct device_node *root, void *unused)
 	if (!psci)
 		return -EINVAL;
 
-	ret = of_set_property(psci, "compatible", "arm,psci-1.0",
-			strlen("arm,psci-1.0") + 1, 1);
+	ret = of_property_write_string(psci, "compatible", "arm,psci-1.0");
 	if (ret)
 		return ret;
 
-	ret = of_set_property(psci, "method", "smc",
-			strlen("smc") + 1, 1);
+	ret = of_property_write_string(psci, "method", "smc");
 	if (ret)
 		return ret;
 
diff --git a/arch/sandbox/board/hostfile.c b/arch/sandbox/board/hostfile.c
index c1a2643bc7..e7d92ea031 100644
--- a/arch/sandbox/board/hostfile.c
+++ b/arch/sandbox/board/hostfile.c
@@ -133,8 +133,7 @@ static int of_hostfile_fixup(struct device_node *root, void *ctx)
 
 	node = of_new_node(root, hf->devname);
 
-	ret = of_set_property(node, "compatible", hostfile_dt_ids->compatible,
-			      strlen(hostfile_dt_ids->compatible) + 1, 1);
+	ret = of_property_write_string(node, "compatible", hostfile_dt_ids->compatible);
 	if (ret)
 		return ret;
 
@@ -146,8 +145,7 @@ static int of_hostfile_fixup(struct device_node *root, void *ctx)
 	if (ret)
 		return ret;
 
-	ret = of_set_property(node, "barebox,filename", hf->filename,
-			      strlen(hf->filename) + 1, 1);
+	ret = of_property_write_string(node, "barebox,filename", hf->filename);
 
 	return ret;
 }
diff --git a/common/memory.c b/common/memory.c
index ad38b00ecb..ff5bdc14e2 100644
--- a/common/memory.c
+++ b/common/memory.c
@@ -185,7 +185,7 @@ static int of_memory_fixup(struct device_node *node, void *unused)
 	if (!memnode)
 		return -ENOMEM;
 
-	err = of_set_property(memnode, "device_type", "memory", sizeof("memory"), 1);
+	err = of_property_write_string(memnode, "device_type", "memory");
 	if (err)
 		return err;
 
diff --git a/common/oftree.c b/common/oftree.c
index e98b908738..09a4455a9e 100644
--- a/common/oftree.c
+++ b/common/oftree.c
@@ -128,7 +128,7 @@ static int of_fixup_bootargs(struct device_node *root, void *unused)
 		return -ENOMEM;
 
 
-	err = of_set_property(node, "bootargs", str, strlen(str) + 1, 1);
+	err = of_property_write_string(node, "bootargs", str);
 
 	return err;
 }
diff --git a/common/state/state.c b/common/state/state.c
index 4020d5e1ea..02bb1bb24a 100644
--- a/common/state/state.c
+++ b/common/state/state.c
@@ -167,9 +167,8 @@ static int state_convert_node_variable(struct state *state,
 
 		if ((conv == STATE_CONVERT_TO_NODE)
 		    || (conv == STATE_CONVERT_FIXUP)) {
-			ret = of_set_property(new_node, "type",
-					      vtype->type_name,
-					      strlen(vtype->type_name) + 1, 1);
+			ret = of_property_write_string(new_node, "type",
+					      vtype->type_name);
 			if (ret)
 				goto out;
 
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 01ab38907d..6632f4d9dd 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -2115,7 +2115,7 @@ int of_device_enable_path(const char *path)
  */
 int of_device_disable(struct device_node *node)
 {
-	return of_set_property(node, "status", "disabled", sizeof("disabled"), 1);
+	return of_property_write_string(node, "status", "disabled");
 }
 
 /**
diff --git a/drivers/video/simplefb.c b/drivers/video/simplefb.c
index 357262988e..a2c59de364 100644
--- a/drivers/video/simplefb.c
+++ b/drivers/video/simplefb.c
@@ -89,9 +89,6 @@ static const struct simplefb_mode *simplefb_find_mode(const struct fb_info *fbi)
 static int simplefb_create_node(struct device_node *root,
 				const struct fb_info *fbi, const char *format)
 {
-	const char *compat = "simple-framebuffer";
-	const char *disabled = "disabled";
-	const char *okay = "okay";
 	struct device_node *node;
 	u32 cells[2];
 	int ret;
@@ -100,12 +97,11 @@ static int simplefb_create_node(struct device_node *root,
 	if (!node)
 		return -ENOMEM;
 
-	ret = of_set_property(node, "status", disabled,
-				strlen(disabled) + 1, 1);
+	ret = of_property_write_string(node, "status", "disabled");
 	if (ret < 0)
 		return ret;
 
-	ret = of_set_property(node, "compatible", compat, strlen(compat) + 1, 1);
+	ret = of_property_write_string(node, "compatible", "simple-framebuffer");
 	if (ret)
 		return ret;
 
@@ -130,14 +126,14 @@ static int simplefb_create_node(struct device_node *root,
 	if (ret < 0)
 		return ret;
 
-	ret = of_set_property(node, "format", format, strlen(format) + 1, 1);
+	ret = of_property_write_string(node, "format", format);
 	if (ret < 0)
 		return ret;
 
 	of_add_reserve_entry((u32)fbi->screen_base,
 			(u32)fbi->screen_base + fbi->screen_size);
 
-	return of_set_property(node, "status", okay, strlen(okay) + 1, 1);
+	return of_property_write_string(node, "status", "okay");
 }
 
 static int simplefb_of_fixup(struct device_node *root, void *ctx)
-- 
2.11.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2017-03-31  5:34 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-31  5:33 OF partitions rework Sascha Hauer
2017-03-31  5:33 ` [PATCH 01/14] of: Add of_property_write_string() Sascha Hauer
2017-03-31  5:33 ` Sascha Hauer [this message]
2017-03-31  5:33 ` [PATCH 03/14] of: partition: Move of_mtd_fixup to drivers/of/ Sascha Hauer
2017-03-31  5:33 ` [PATCH 04/14] mtd: of: Make used partition binding configurable Sascha Hauer
2017-03-31  5:33 ` [PATCH 05/14] of: partition: support 64bit partition sizes Sascha Hauer
2017-03-31  5:33 ` [PATCH 06/14] mtd: partition: set cdev->offset to the actual offset Sascha Hauer
2017-03-31  8:46   ` Sascha Hauer
2017-03-31  5:33 ` [PATCH 07/14] cdev: Collect partitions on list Sascha Hauer
2017-03-31  5:33 ` [PATCH 08/14] of: partition: Make partition fixup independent from mtd devices Sascha Hauer
2017-03-31  5:33 ` [PATCH 09/14] fs: devfs-core: remove unused code Sascha Hauer
2017-03-31  5:33 ` [PATCH 10/14] fs: devfs-core: replace DEVFS_PARTITION_FIXED flag with pointer to the master cdev Sascha Hauer
2017-03-31  5:33 ` [PATCH 11/14] of: partition: only create partition node when partitions exist Sascha Hauer
2017-03-31  5:33 ` [PATCH 12/14] of: partitions: flag partitions from a partition table Sascha Hauer
2017-03-31  5:33 ` [PATCH 13/14] of: partition: Register the of partition fixup for of partition users Sascha Hauer
2017-03-31  5:33 ` [PATCH 14/14] of: of_path: add of_find_node_by_devpath() Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170331053323.17821-3-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox