* [PATCH] persistent device names for console devices
@ 2014-07-11 8:02 Sascha Hauer
2014-07-11 8:02 ` [PATCH 1/4] console: Allow persistent device names Sascha Hauer
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Sascha Hauer @ 2014-07-11 8:02 UTC (permalink / raw)
To: barebox
Currently the console devices have arbitrary cs0..csx names
which makes them hard to find on the commandline and in scripts.
This series introduces persistent names for console devices and
renames the network console to "netconsole" and the usb serial
console to "usbserial"
Sascha
The following changes since commit 239b6559ed5d65cc3e08eae66eb862fefe651e33:
images: ignore and clean *.mlo/*.mlospi (2014-07-11 08:27:01 +0200)
are available in the git repository at:
none
for you to fetch changes up to c053e2414c2a6c2de81cbbc4e49933042613191b:
usb: usbserial gadget: Add persistent device name (2014-07-11 09:58:53 +0200)
----------------------------------------------------------------
Sascha Hauer (4):
console: Allow persistent device names
serial: imx: Determine device name from device tree
netconsole: rename console to "netconsole"
usb: usbserial gadget: Add persistent device name
common/console.c | 10 ++++++++--
drivers/serial/serial_imx.c | 4 ++++
drivers/usb/gadget/u_serial.c | 7 ++++++-
include/console.h | 2 ++
net/netconsole.c | 1 +
5 files changed, 21 insertions(+), 3 deletions(-)
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* [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
end of thread, other threads:[~2014-07-11 8:02 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox