console: allow to specify the device id
so we can use dynamic number id with specific devname Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
6570288f2d
commit
a1a582f4e0
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -47,6 +47,7 @@ struct console_device {
|
|||
int (*set_active)(struct console_device *cdev, unsigned active);
|
||||
|
||||
char *devname;
|
||||
int devid;
|
||||
|
||||
struct list_head list;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue