diff options
author | Alexander Kurz <akurz@blala.de> | 2017-03-26 17:17:47 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2017-03-29 08:51:15 +0200 |
commit | 8b73b0fab75a17b84738ac4584ece9b63219960d (patch) | |
tree | c82da3138ec89bfdbad7dc9975828b8fd70540c4 /common | |
parent | e6419c64cfcb6001e8ded6fa4ce05aebc9c52eac (diff) | |
download | barebox-8b73b0fab75a17b84738ac4584ece9b63219960d.tar.gz barebox-8b73b0fab75a17b84738ac4584ece9b63219960d.tar.xz |
console: fix usbserial re-connect
With commit b4f55fcf355a ("console: expose consoles in devfs") consoles
got inserted, but never removed from devfs.
When dealing with USB consoles, barebox should be prepared for devices
spontaneously appering and disappering again (user disconnects and re-
connects the cable). If the devfs entry is not removed upon disconnect,
barebox will raise an error "device creation failed with File exists"
when the cable is connected again.
Remove devfs entries when consoles are de-registered.
Also change the error message, it's the devfs entry.
Signed-off-by: Alexander Kurz <akurz@blala.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common')
-rw-r--r-- | common/console.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/common/console.c b/common/console.c index 4127e7617a..74fb684b2c 100644 --- a/common/console.c +++ b/common/console.c @@ -375,7 +375,7 @@ int console_register(struct console_device *newcdev) ret = devfs_create(&newcdev->devfs); if (ret) { - pr_err("device creation failed with %s\n", strerror(-ret)); + pr_err("devfs entry creation failed: %s\n", strerror(-ret)); return ret; } @@ -388,6 +388,8 @@ int console_unregister(struct console_device *cdev) struct device_d *dev = &cdev->class_dev; int status; + devfs_remove(&cdev->devfs); + list_del(&cdev->list); if (list_empty(&console_list)) initialized = CONSOLE_UNINITIALIZED; |