mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] fixup! of: add function to read a file as unflattened device tree
@ 2023-05-19  7:19 Ahmad Fatoum
  2023-05-22 11:29 ` Sascha Hauer
  0 siblings, 1 reply; 4+ messages in thread
From: Ahmad Fatoum @ 2023-05-19  7:19 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

of: tidy up of_read_file a bit

 - change a single instance of space indentation to tabs
 - use %m instead of unwieldy strerror(errno)
 - add documentation

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/of/base.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index 918d5e0c5348..5da188115547 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -2893,6 +2893,12 @@ int of_device_disable_by_alias(const char *alias)
 	return of_device_disable(node);
 }
 
+/**
+ * of_read_file - unflatten oftree file
+ * @filename - path to file to unflatten its contents
+ *
+ * Returns the root node of the tree or an error pointer on error.
+ */
 struct device_node *of_read_file(const char *filename)
 {
 	void *fdt;
@@ -2901,8 +2907,7 @@ struct device_node *of_read_file(const char *filename)
 
 	fdt = read_file(filename, &size);
 	if (!fdt) {
-		pr_err("unable to read %s: %s\n", filename,
-			strerror(errno));
+		pr_err("unable to read %s: %m\n", filename);
 		return ERR_PTR(-errno);
 	}
 
@@ -2916,7 +2921,7 @@ struct device_node *of_read_file(const char *filename)
 out:
 	free(fdt);
 
-       return root;
+	return root;
 }
 
 /**
-- 
2.39.2




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] fixup! of: add function to read a file as unflattened device tree
  2023-05-19  7:19 [PATCH] fixup! of: add function to read a file as unflattened device tree Ahmad Fatoum
@ 2023-05-22 11:29 ` Sascha Hauer
  0 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2023-05-22 11:29 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On Fri, May 19, 2023 at 09:19:39AM +0200, Ahmad Fatoum wrote:
> of: tidy up of_read_file a bit
> 
>  - change a single instance of space indentation to tabs
>  - use %m instead of unwieldy strerror(errno)
>  - add documentation
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>  drivers/of/base.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)

Applied, thanks

Sascha

> 
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index 918d5e0c5348..5da188115547 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -2893,6 +2893,12 @@ int of_device_disable_by_alias(const char *alias)
>  	return of_device_disable(node);
>  }
>  
> +/**
> + * of_read_file - unflatten oftree file
> + * @filename - path to file to unflatten its contents
> + *
> + * Returns the root node of the tree or an error pointer on error.
> + */
>  struct device_node *of_read_file(const char *filename)
>  {
>  	void *fdt;
> @@ -2901,8 +2907,7 @@ struct device_node *of_read_file(const char *filename)
>  
>  	fdt = read_file(filename, &size);
>  	if (!fdt) {
> -		pr_err("unable to read %s: %s\n", filename,
> -			strerror(errno));
> +		pr_err("unable to read %s: %m\n", filename);
>  		return ERR_PTR(-errno);
>  	}
>  
> @@ -2916,7 +2921,7 @@ struct device_node *of_read_file(const char *filename)
>  out:
>  	free(fdt);
>  
> -       return root;
> +	return root;
>  }
>  
>  /**
> -- 
> 2.39.2
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] fixup! of: add function to read a file as unflattened device tree
  2023-05-08  9:03 Ahmad Fatoum
@ 2023-05-08 13:19 ` Sascha Hauer
  0 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2023-05-08 13:19 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On Mon, May 08, 2023 at 11:03:22AM +0200, Ahmad Fatoum wrote:
> of: fix warning about now unused variable
> 
> This was an argument to read_file, which has been replaced in a previous
> commit. Now GCC warns about it.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>  common/blspec.c | 1 -
>  1 file changed, 1 deletion(-)

Applied, thanks

Sascha

> 
> diff --git a/common/blspec.c b/common/blspec.c
> index 197ccb2b07e6..4b4e04b03997 100644
> --- a/common/blspec.c
> +++ b/common/blspec.c
> @@ -426,7 +426,6 @@ static bool entry_is_of_compatible(struct blspec_entry *entry)
>  {
>  	const char *devicetree;
>  	const char *abspath;
> -	size_t size;
>  	int ret;
>  	struct device_node *root = NULL, *barebox_root;
>  	const char *compat;
> -- 
> 2.39.2
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] fixup! of: add function to read a file as unflattened device tree
@ 2023-05-08  9:03 Ahmad Fatoum
  2023-05-08 13:19 ` Sascha Hauer
  0 siblings, 1 reply; 4+ messages in thread
From: Ahmad Fatoum @ 2023-05-08  9:03 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

of: fix warning about now unused variable

This was an argument to read_file, which has been replaced in a previous
commit. Now GCC warns about it.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 common/blspec.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/common/blspec.c b/common/blspec.c
index 197ccb2b07e6..4b4e04b03997 100644
--- a/common/blspec.c
+++ b/common/blspec.c
@@ -426,7 +426,6 @@ static bool entry_is_of_compatible(struct blspec_entry *entry)
 {
 	const char *devicetree;
 	const char *abspath;
-	size_t size;
 	int ret;
 	struct device_node *root = NULL, *barebox_root;
 	const char *compat;
-- 
2.39.2




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-05-22 11:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-19  7:19 [PATCH] fixup! of: add function to read a file as unflattened device tree Ahmad Fatoum
2023-05-22 11:29 ` Sascha Hauer
  -- strict thread matches above, loose matches on Subject: below --
2023-05-08  9:03 Ahmad Fatoum
2023-05-08 13:19 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox