mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] console: Obey "linux, stdout-path" parameter regardless of CONSOLE_ACTIVATE_XX
@ 2013-10-25 15:23 Alexander Shiyan
  2013-10-25 23:57 ` Sascha Hauer
  0 siblings, 1 reply; 3+ messages in thread
From: Alexander Shiyan @ 2013-10-25 15:23 UTC (permalink / raw)
  To: barebox

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 common/console.c  |  4 ++--
 drivers/of/base.c | 13 ++++---------
 include/of.h      |  2 +-
 3 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/common/console.c b/common/console.c
index 56bc864..2d31d71 100644
--- a/common/console.c
+++ b/common/console.c
@@ -168,8 +168,8 @@ int console_register(struct console_device *newcdev)
 		activate = 1;
 	}
 
-	if (newcdev->dev && of_device_is_stdout_path(newcdev->dev))
-		activate = 1;
+	if (newcdev->dev)
+		 check_of_device_is_stdout_path(newcdev->dev, &activate);
 
 	list_add_tail(&newcdev->list, &console_list);
 
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 116dd0c..6303b53 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -1819,23 +1819,18 @@ void of_delete_node(struct device_node *node)
 		of_set_root_node(NULL);
 }
 
-int of_device_is_stdout_path(struct device_d *dev)
+void check_of_device_is_stdout_path(struct device_d *dev, int *activate)
 {
 	struct device_node *dn;
 	const char *name;
 
 	name = of_get_property(of_chosen, "linux,stdout-path", NULL);
 	if (name == NULL)
-		return 0;
+		return;
 
 	dn = of_find_node_by_path(name);
-	if (!dn)
-		return 0;
-
-	if (dn == dev->device_node)
-		return 1;
-
-	return 0;
+	if (dn)
+		*activate = dn == dev->device_node;
 }
 
 /**
diff --git a/include/of.h b/include/of.h
index e5cd750..0f739d9 100644
--- a/include/of.h
+++ b/include/of.h
@@ -225,7 +225,7 @@ extern struct device_d *of_find_device_by_node(struct device_node *np);
 
 struct cdev *of_parse_partition(struct cdev *cdev, struct device_node *node);
 int of_parse_partitions(struct cdev *cdev, struct device_node *node);
-int of_device_is_stdout_path(struct device_d *dev);
+void check_of_device_is_stdout_path(struct device_d *dev, int *activate);
 const char *of_get_model(void);
 void *of_flatten_dtb(struct device_node *node);
 int of_add_memory(struct device_node *node, bool dump);
-- 
1.8.1.5


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

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

* Re: [PATCH] console: Obey "linux, stdout-path" parameter regardless of CONSOLE_ACTIVATE_XX
  2013-10-25 15:23 [PATCH] console: Obey "linux, stdout-path" parameter regardless of CONSOLE_ACTIVATE_XX Alexander Shiyan
@ 2013-10-25 23:57 ` Sascha Hauer
  2013-10-26  3:38   ` Alexander Shiyan
  0 siblings, 1 reply; 3+ messages in thread
From: Sascha Hauer @ 2013-10-25 23:57 UTC (permalink / raw)
  To: Alexander Shiyan; +Cc: barebox

On Fri, Oct 25, 2013 at 07:23:48PM +0400, Alexander Shiyan wrote:
> Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
> ---
>  common/console.c  |  4 ++--
>  drivers/of/base.c | 13 ++++---------
>  include/of.h      |  2 +-
>  3 files changed, 7 insertions(+), 12 deletions(-)
> 
> diff --git a/common/console.c b/common/console.c
> index 56bc864..2d31d71 100644
> --- a/common/console.c
> +++ b/common/console.c
> @@ -168,8 +168,8 @@ int console_register(struct console_device *newcdev)
>  		activate = 1;
>  	}
>  
> -	if (newcdev->dev && of_device_is_stdout_path(newcdev->dev))
> -		activate = 1;
> +	if (newcdev->dev)
> +		 check_of_device_is_stdout_path(newcdev->dev, &activate);
>  
>  	list_add_tail(&newcdev->list, &console_list);
>  
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index 116dd0c..6303b53 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -1819,23 +1819,18 @@ void of_delete_node(struct device_node *node)
>  		of_set_root_node(NULL);
>  }
>  
> -int of_device_is_stdout_path(struct device_d *dev)
> +void check_of_device_is_stdout_path(struct device_d *dev, int *activate)
>  {
>  	struct device_node *dn;
>  	const char *name;
>  
>  	name = of_get_property(of_chosen, "linux,stdout-path", NULL);
>  	if (name == NULL)
> -		return 0;
> +		return;
>  
>  	dn = of_find_node_by_path(name);
> -	if (!dn)
> -		return 0;
> -
> -	if (dn == dev->device_node)
> -		return 1;
> -
> -	return 0;
> +	if (dn)
> +		*activate = dn == dev->device_node;
>  }

Can you elaborate why you need this patch? Normally on devicetree based
boards I set CONSOLE_ACTIVATE_NONE. In this case I think your patch
changes nothing. If you set CONSOLE_ACTIVATE_ALL or
CONSOLE_ACTIVATE_FIRST your patch seems to overwrite the Kconfig setting
with the devicetree setting. Why don't you set CONSOLE_ACTIVATE_NONE in
the first place?

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

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

* Re: [PATCH] console: Obey "linux, stdout-path" parameter regardless of CONSOLE_ACTIVATE_XX
  2013-10-25 23:57 ` Sascha Hauer
@ 2013-10-26  3:38   ` Alexander Shiyan
  0 siblings, 0 replies; 3+ messages in thread
From: Alexander Shiyan @ 2013-10-26  3:38 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

> On Fri, Oct 25, 2013 at 07:23:48PM +0400, Alexander Shiyan wrote:
> > Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
> > ---
> >  common/console.c  |  4 ++--
> >  drivers/of/base.c | 13 ++++---------
> >  include/of.h      |  2 +-
> >  3 files changed, 7 insertions(+), 12 deletions(-)
...
> Can you elaborate why you need this patch? Normally on devicetree based
> boards I set CONSOLE_ACTIVATE_NONE. In this case I think your patch
> changes nothing. If you set CONSOLE_ACTIVATE_ALL or
> CONSOLE_ACTIVATE_FIRST your patch seems to overwrite the Kconfig setting
> with the devicetree setting. Why don't you set CONSOLE_ACTIVATE_NONE in
> the first place?

You are right. Lets forget this patch.

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

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

end of thread, other threads:[~2013-10-26  3:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-25 15:23 [PATCH] console: Obey "linux, stdout-path" parameter regardless of CONSOLE_ACTIVATE_XX Alexander Shiyan
2013-10-25 23:57 ` Sascha Hauer
2013-10-26  3:38   ` Alexander Shiyan

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