Skip to contentSkip to conversation

console: set default console_device devname

PATCH In review [email protected] 2 participants 2 messages Sep 8, 2019 – Sep 9, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 console: set default console_device devname

From: David Dgien <[email protected]>

Some commands (loadb/x/y) rely on console_get_by_name, which searches the list of console devices based on console_device->devname. However, some serial drivers do not set devname, meaning that their respective console_devices can never be found. During console_register, ensure that a default devname is set if one is not already explicitly set.

---
 common/console.c | 4 ++++
 1 file changed, 4 insertions(+)
common/console.c +4 -0
index ee17a508b..dacb6001c 100644
@@ -324,6 +324,10 @@ int console_register(struct console_device *newcdev)
 		dev->parent = newcdev->dev;
 	platform_device_register(dev);
 
+	if (!newcdev->devname) {
+		newcdev->devname = strdup(dev_name(dev));
+	}
+
 	newcdev->open_count = 0;
 
 	/*
Signature · 7 lines
2.17.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw
Quoted 18 lines · On Sun, Sep 08, 2019 at 06:01:11PM -0400, [email protected] wrote:

From: David Dgien <[email protected]>

Some commands (loadb/x/y) rely on console_get_by_name, which searches the list of console devices based on console_device->devname. However, some serial drivers do not set devname, meaning that their respective console_devices can never be found. During console_register, ensure that a default devname is set if one is not already explicitly set.

---
 common/console.c | 4 ++++
 1 file changed, 4 insertions(+)
common/console.c +0 -0
index ee17a508b..dacb6001c 100644

common/console.c int console_register(struct console_device *newcdev) · line 328

Quoted 5 lines
common/console.c +2 -0
@@ -324,6 +324,10 @@ int console_register(struct console_device *newcdev)
 		dev->parent = newcdev->dev;
 	platform_device_register(dev);
 
+	if (!newcdev->devname) {
+		newcdev->devname = strdup(dev_name(dev));

As the return value is not checked I switched to xstrdup. Applied, thanks

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox