[PATCH 8/9] console: allow to specify the device id
Jean-Christophe PLAGNIOL-VILLARD
plagnioj at jcrosoft.com
Tue Dec 23 10:21:57 PST 2014
so we can use dynamic number id with specific devname
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>
---
common/console.c | 2 +-
drivers/usb/gadget/u_serial.c | 1 +
include/console.h | 1 +
3 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/common/console.c b/common/console.c
index bba13a5..602ab2e 100644
--- a/common/console.c
+++ b/common/console.c
@@ -188,7 +188,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/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 89514b6..32938aa 100644
--- a/include/console.h
+++ b/include/console.h
@@ -47,6 +47,7 @@ struct console_device {
int (*set_mode)(struct console_device *cdev, enum console_mode mode);
char *devname;
+ int devid;
struct list_head list;
--
2.1.3
More information about the barebox
mailing list