fix net console support
cover fix net console support
Hi,
since
commit e62d4255172540805a77fee1c58382103f43bb2f
Author: Jean-Christophe PLAGNIOL-VILLARD <[email protected]>
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
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
PATCH 1/2 console: add is_ready callbback support
Some console such as net console need some parameter to work (IP & Port). So we can not enable them if not present.
--- common/console.c | 3 +++ include/console.h | 1 + 2 files changed, 4 insertions(+)
common/console.c +3 -0
@@ -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' ;
include/console.h +1 -0
@@ -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);
Signature · 7 lines
1.8.4.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 2/2 net: netconsole: add is_ready support
So we can be sure the console is only available when IP & Port are set.
--- net/netconsole.c | 9 +++++++++ 1 file changed, 9 insertions(+)
net/netconsole.c +9 -0
@@ -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;
Signature · 7 lines
1.8.4.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 1/2] console: add is_ready callbback support
In reply to Jean-Christophe PLAGNIOL-VILLARDQuoted 14 lines · Jean-Christophe PLAGNIOL-VILLARD
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 <[email protected]>--- common/console.c | 3 +++ include/console.h | 1 + 2 files changed, 4 insertions(+)common/console.c +0
-0
common/console.c static int console_std_set(struct device_d *dev, struct param_d *param, · line 66
Quoted 5 lines
common/console.c +2
-0@@ -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
Quoted 25 lines
common/console.c +1
-0+if (val) {if (strchr (val,'i' ) && cdev->getc) { active[i++] ='i' ;include/console.h +1
-0@@ -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);Signature · 7 lines
1.8.4.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Signature · 9 lines
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 [email protected] http://lists.infradead.org/mailman/listinfo/barebox