mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH v2] console: allow to specify the device id
@ 2015-01-13  6:11 Jean-Christophe PLAGNIOL-VILLARD
  2015-01-13  7:49 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2015-01-13  6:11 UTC (permalink / raw)
  To: barebox

so we can use dynamic number id with specific devname

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
v2:
add missing imx

Best Regards,
J.
 common/console.c              | 2 +-
 drivers/serial/serial_imx.c   | 4 +++-
 drivers/usb/gadget/u_serial.c | 1 +
 include/console.h             | 1 +
 net/netconsole.c              | 1 +
 5 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/common/console.c b/common/console.c
index c092621..0c32f06 100644
--- a/common/console.c
+++ b/common/console.c
@@ -194,7 +194,7 @@ int console_register(struct console_device *newcdev)
 		console_init_early();
 
 	if (newcdev->devname) {
-		dev->id = DEVICE_ID_SINGLE;
+		dev->id = newcdev->devid;
 		strcpy(dev->name, newcdev->devname);
 	} else {
 		dev->id = DEVICE_ID_DYNAMIC;
diff --git a/drivers/serial/serial_imx.c b/drivers/serial/serial_imx.c
index 21189cb..cd954c2 100644
--- a/drivers/serial/serial_imx.c
+++ b/drivers/serial/serial_imx.c
@@ -340,8 +340,10 @@ static int imx_serial_probe(struct device_d *dev)
 	cdev->linux_console_name = "ttymxc";
 	if (dev->device_node) {
 		devname = of_alias_get(dev->device_node);
-		if (devname)
+		if (devname) {
 			cdev->devname = xstrdup(devname);
+			cdev->devid = DEVICE_ID_SINGLE;
+		}
 	}
 
 	imx_serial_init_port(cdev);
diff --git a/drivers/usb/gadget/u_serial.c b/drivers/usb/gadget/u_serial.c
index 8c58746..1e5e809 100644
--- a/drivers/usb/gadget/u_serial.c
+++ b/drivers/usb/gadget/u_serial.c
@@ -530,6 +530,7 @@ int gserial_connect(struct gserial *gser, u8 port_num)
 	cdev->flush = serial_flush;
 	cdev->setbrg = serial_setbaudrate;
 	cdev->devname = "usbserial";
+	cdev->devid = DEVICE_ID_SINGLE;
 
 	status = console_register(cdev);
 	if (status)
diff --git a/include/console.h b/include/console.h
index beafb4d..72b4a44 100644
--- a/include/console.h
+++ b/include/console.h
@@ -47,6 +47,7 @@ struct console_device {
 	int (*set_active)(struct console_device *cdev, unsigned active);
 
 	char *devname;
+	int devid;
 
 	struct list_head list;
 
diff --git a/net/netconsole.c b/net/netconsole.c
index 99b9984..0ee6a76 100644
--- a/net/netconsole.c
+++ b/net/netconsole.c
@@ -154,6 +154,7 @@ static int netconsole_init(void)
 	cdev->putc = nc_putc;
 	cdev->getc = nc_getc;
 	cdev->devname = "netconsole";
+	cdev->devid = DEVICE_ID_SINGLE;
 	cdev->set_active = nc_set_active;
 
 	g_priv = priv;
-- 
2.1.3


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

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

end of thread, other threads:[~2015-01-13  7:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-13  6:11 [PATCH v2] console: allow to specify the device id Jean-Christophe PLAGNIOL-VILLARD
2015-01-13  7:49 ` Sascha Hauer

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