mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 0/2] fix net console support
@ 2013-11-20 12:26 Jean-Christophe PLAGNIOL-VILLARD
  2013-11-20 12:39 ` [PATCH 1/2] console: add is_ready callbback support Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 4+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-11-20 12:26 UTC (permalink / raw)
  To: barebox

Hi,

	since 

	commit e62d4255172540805a77fee1c58382103f43bb2f
	Author: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
	Date:   Fri Sep 20 05:31:29 2013 +0200

	console: drop f_caps and check the function pointer getc/putc instead

	the net console is broken as the driver was using the f_caps to
	specify when the drvier can enable or not.

	Instead of tweking the API provide is_ready callback for this

The following changes since commit 7c1091bd5895204b109c5a79996aa9367692a78a:

  of: fdt: reorder fdt_header initialization (2013-11-08 15:42:55 +0100)

are available in the git repository at:

  git://git.jcrosoft.org/barebox.git delivery/net_console

for you to fetch changes up to 18f198052d242f9ca388e6ce50fe448e08cdbdd8:

  net: netconsole: add is_ready support (2013-11-20 20:21:58 +0800)

----------------------------------------------------------------
Jean-Christophe PLAGNIOL-VILLARD (2):
      console: add is_ready callbback support
      net: netconsole: add is_ready support

 common/console.c  | 3 +++
 include/console.h | 1 +
 net/netconsole.c  | 9 +++++++++
 3 files changed, 13 insertions(+)

Best Regards,
J.

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

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

* [PATCH 1/2] console: add is_ready callbback support
  2013-11-20 12:26 [PATCH 0/2] fix net console support Jean-Christophe PLAGNIOL-VILLARD
@ 2013-11-20 12:39 ` Jean-Christophe PLAGNIOL-VILLARD
  2013-11-20 12:39   ` [PATCH 2/2] net: netconsole: add is_ready support Jean-Christophe PLAGNIOL-VILLARD
  2013-11-22  7:03   ` [PATCH 1/2] console: add is_ready callbback support Sascha Hauer
  0 siblings, 2 replies; 4+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-11-20 12:39 UTC (permalink / raw)
  To: barebox

Some console such as net console need some parameter to work (IP & Port).
So we can not enable them if not present.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 common/console.c  | 3 +++
 include/console.h | 1 +
 2 files changed, 4 insertions(+)

diff --git a/common/console.c b/common/console.c
index 56bc864..32c5d38 100644
--- a/common/console.c
+++ b/common/console.c
@@ -62,6 +62,9 @@ static int console_std_set(struct device_d *dev, struct param_d *param,
 	char active[4];
 	unsigned int flag = 0, i = 0;
 
+	if (cdev->is_ready && !cdev->is_ready(cdev))
+		return -EIO;
+
 	if (val) {
 		if (strchr(val, 'i') && cdev->getc) {
 			active[i++] = 'i';
diff --git a/include/console.h b/include/console.h
index 550b440..b4caf55 100644
--- a/include/console.h
+++ b/include/console.h
@@ -37,6 +37,7 @@ struct console_device {
 	struct device_d *dev;
 	struct device_d class_dev;
 
+	int (*is_ready)(struct console_device *cdev);
 	int (*tstc)(struct console_device *cdev);
 	void (*putc)(struct console_device *cdev, char c);
 	int  (*getc)(struct console_device *cdev);
-- 
1.8.4.3


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

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

* [PATCH 2/2] net: netconsole: add is_ready support
  2013-11-20 12:39 ` [PATCH 1/2] console: add is_ready callbback support Jean-Christophe PLAGNIOL-VILLARD
@ 2013-11-20 12:39   ` Jean-Christophe PLAGNIOL-VILLARD
  2013-11-22  7:03   ` [PATCH 1/2] console: add is_ready callbback support Sascha Hauer
  1 sibling, 0 replies; 4+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-11-20 12:39 UTC (permalink / raw)
  To: barebox

So we can be sure the console is only available when IP & Port are set.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 net/netconsole.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/net/netconsole.c b/net/netconsole.c
index 2ab19de..f6e9701 100644
--- a/net/netconsole.c
+++ b/net/netconsole.c
@@ -129,6 +129,14 @@ static int nc_port_set(struct param_d *p, void *_priv)
 	return 0;
 }
 
+static int nc_is_ready(struct console_device *cdev)
+{
+	struct nc_priv *priv = container_of(cdev,
+					struct nc_priv, cdev);
+
+	return priv->ip && priv->port;
+}
+
 static int netconsole_init(void)
 {
 	struct nc_priv *priv;
@@ -140,6 +148,7 @@ static int netconsole_init(void)
 	cdev->tstc = nc_tstc;
 	cdev->putc = nc_putc;
 	cdev->getc = nc_getc;
+	cdev->is_ready = nc_is_ready;
 
 	g_priv = priv;
 
-- 
1.8.4.3


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

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

* Re: [PATCH 1/2] console: add is_ready callbback support
  2013-11-20 12:39 ` [PATCH 1/2] console: add is_ready callbback support Jean-Christophe PLAGNIOL-VILLARD
  2013-11-20 12:39   ` [PATCH 2/2] net: netconsole: add is_ready support Jean-Christophe PLAGNIOL-VILLARD
@ 2013-11-22  7:03   ` Sascha Hauer
  1 sibling, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2013-11-22  7:03 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

On Wed, Nov 20, 2013 at 01:39:11PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> Some console such as net console need some parameter to work (IP & Port).
> So we can not enable them if not present.
> 
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
>  common/console.c  | 3 +++
>  include/console.h | 1 +
>  2 files changed, 4 insertions(+)
> 
> diff --git a/common/console.c b/common/console.c
> index 56bc864..32c5d38 100644
> --- a/common/console.c
> +++ b/common/console.c
> @@ -62,6 +62,9 @@ static int console_std_set(struct device_d *dev, struct param_d *param,
>  	char active[4];
>  	unsigned int flag = 0, i = 0;
>  
> +	if (cdev->is_ready && !cdev->is_ready(cdev))
> +		return -EIO;

Instead of asking whether a console is ready please add a ->set_active
callback and pass the CONSOLE_* flags.

Sascha

> +
>  	if (val) {
>  		if (strchr(val, 'i') && cdev->getc) {
>  			active[i++] = 'i';
> diff --git a/include/console.h b/include/console.h
> index 550b440..b4caf55 100644
> --- a/include/console.h
> +++ b/include/console.h
> @@ -37,6 +37,7 @@ struct console_device {
>  	struct device_d *dev;
>  	struct device_d class_dev;
>  
> +	int (*is_ready)(struct console_device *cdev);
>  	int (*tstc)(struct console_device *cdev);
>  	void (*putc)(struct console_device *cdev, char c);
>  	int  (*getc)(struct console_device *cdev);
> -- 
> 1.8.4.3
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
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] 4+ messages in thread

end of thread, other threads:[~2013-11-22  7:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-20 12:26 [PATCH 0/2] fix net console support Jean-Christophe PLAGNIOL-VILLARD
2013-11-20 12:39 ` [PATCH 1/2] console: add is_ready callbback support Jean-Christophe PLAGNIOL-VILLARD
2013-11-20 12:39   ` [PATCH 2/2] net: netconsole: add is_ready support Jean-Christophe PLAGNIOL-VILLARD
2013-11-22  7:03   ` [PATCH 1/2] console: add is_ready callbback support Sascha Hauer

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