* [PATCH 1/4] console: Allow persistent device names
2014-07-11 8:02 [PATCH] persistent device names for console devices Sascha Hauer
@ 2014-07-11 8:02 ` Sascha Hauer
2014-07-11 8:02 ` [PATCH 2/4] serial: imx: Determine device name from device tree Sascha Hauer
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2014-07-11 8:02 UTC (permalink / raw)
To: barebox
Add a devname field to struct console_device so that the device
name can be set by the driver. This makes it possible to have
persistent device names.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
common/console.c | 10 ++++++++--
include/console.h | 2 ++
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/common/console.c b/common/console.c
index aa9e3ce..f982366 100644
--- a/common/console.c
+++ b/common/console.c
@@ -170,8 +170,14 @@ int console_register(struct console_device *newcdev)
if (initialized == CONSOLE_UNINITIALIZED)
console_init_early();
- dev->id = DEVICE_ID_DYNAMIC;
- strcpy(dev->name, "cs");
+ if (newcdev->devname) {
+ dev->id = DEVICE_ID_SINGLE;
+ strcpy(dev->name, newcdev->devname);
+ } else {
+ dev->id = DEVICE_ID_DYNAMIC;
+ strcpy(dev->name, "cs");
+ }
+
if (newcdev->dev)
dev->parent = newcdev->dev;
platform_device_register(dev);
diff --git a/include/console.h b/include/console.h
index 6da0199..7535a56 100644
--- a/include/console.h
+++ b/include/console.h
@@ -44,6 +44,8 @@ struct console_device {
void (*flush)(struct console_device *cdev);
int (*set_mode)(struct console_device *cdev, enum console_mode mode);
+ char *devname;
+
struct list_head list;
unsigned char f_active;
--
2.0.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/4] serial: imx: Determine device name from device tree
2014-07-11 8:02 [PATCH] persistent device names for console devices Sascha Hauer
2014-07-11 8:02 ` [PATCH 1/4] console: Allow persistent device names Sascha Hauer
@ 2014-07-11 8:02 ` Sascha Hauer
2014-07-11 8:02 ` [PATCH 3/4] netconsole: rename console to "netconsole" Sascha Hauer
2014-07-11 8:02 ` [PATCH 4/4] usb: usbserial gadget: Add persistent device name Sascha Hauer
3 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2014-07-11 8:02 UTC (permalink / raw)
To: barebox
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/serial/serial_imx.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/serial/serial_imx.c b/drivers/serial/serial_imx.c
index cb10627..474bfaf 100644
--- a/drivers/serial/serial_imx.c
+++ b/drivers/serial/serial_imx.c
@@ -313,6 +313,7 @@ static int imx_serial_probe(struct device_d *dev)
uint32_t val;
struct imx_serial_devtype_data *devtype;
int ret;
+ const char *devname;
ret = dev_get_drvdata(dev, (unsigned long *)&devtype);
if (ret)
@@ -337,6 +338,9 @@ static int imx_serial_probe(struct device_d *dev)
cdev->flush = imx_serial_flush;
cdev->setbrg = imx_serial_setbaudrate;
cdev->linux_console_name = "ttymxc";
+ devname = of_alias_get(dev->device_node);
+ if (devname)
+ cdev->devname = xstrdup(devname);
imx_serial_init_port(cdev);
--
2.0.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 3/4] netconsole: rename console to "netconsole"
2014-07-11 8:02 [PATCH] persistent device names for console devices Sascha Hauer
2014-07-11 8:02 ` [PATCH 1/4] console: Allow persistent device names Sascha Hauer
2014-07-11 8:02 ` [PATCH 2/4] serial: imx: Determine device name from device tree Sascha Hauer
@ 2014-07-11 8:02 ` Sascha Hauer
2014-07-11 8:02 ` [PATCH 4/4] usb: usbserial gadget: Add persistent device name Sascha Hauer
3 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2014-07-11 8:02 UTC (permalink / raw)
To: barebox
So that it can be used without guessing the name first.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
net/netconsole.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/netconsole.c b/net/netconsole.c
index 021820b..c817107 100644
--- a/net/netconsole.c
+++ b/net/netconsole.c
@@ -141,6 +141,7 @@ static int netconsole_init(void)
cdev->tstc = nc_tstc;
cdev->putc = nc_putc;
cdev->getc = nc_getc;
+ cdev->devname = "netconsole";
g_priv = priv;
--
2.0.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 4/4] usb: usbserial gadget: Add persistent device name
2014-07-11 8:02 [PATCH] persistent device names for console devices Sascha Hauer
` (2 preceding siblings ...)
2014-07-11 8:02 ` [PATCH 3/4] netconsole: rename console to "netconsole" Sascha Hauer
@ 2014-07-11 8:02 ` Sascha Hauer
3 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2014-07-11 8:02 UTC (permalink / raw)
To: barebox
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/usb/gadget/u_serial.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/gadget/u_serial.c b/drivers/usb/gadget/u_serial.c
index c2072dc..375ec65 100644
--- a/drivers/usb/gadget/u_serial.c
+++ b/drivers/usb/gadget/u_serial.c
@@ -483,7 +483,12 @@ int gserial_connect(struct gserial *gser, u8 port_num)
cdev->getc = serial_getc;
cdev->flush = serial_flush;
cdev->setbrg = serial_setbaudrate;
- console_register(cdev);
+ cdev->devname = "usbserial";
+
+ status = console_register(cdev);
+ if (status)
+ goto fail_out;
+
mycdev = cdev;
return status;
--
2.0.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread