mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: barebox@lists.infradead.org
Subject: [PATCH v2] console: allow to specify the device id
Date: Tue, 13 Jan 2015 07:11:49 +0100	[thread overview]
Message-ID: <1421129509-30331-1-git-send-email-plagnioj@jcrosoft.com> (raw)

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

             reply	other threads:[~2015-01-13  6:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-13  6:11 Jean-Christophe PLAGNIOL-VILLARD [this message]
2015-01-13  7:49 ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1421129509-30331-1-git-send-email-plagnioj@jcrosoft.com \
    --to=plagnioj@jcrosoft.com \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox