* [PATCH 1/2] driver-core: document restrictions on device_rename()
@ 2010-12-13 20:08 Timur Tabi
2010-12-13 20:08 ` [PATCH 2/2] tty: fix typos/errors in tty_driver.h comments Timur Tabi
0 siblings, 1 reply; 2+ messages in thread
From: Timur Tabi @ 2010-12-13 20:08 UTC (permalink / raw)
To: linux-next, greg
Add text, courtesy of Kay Sievers, that provides some background on
device_rename() and why it shouldn't be used.
Signed-off-by: Timur Tabi <timur@freescale•com>
---
This patch is for linux-next
drivers/base/core.c | 29 ++++++++++++++++++++++++++++-
1 files changed, 28 insertions(+), 1 deletions(-)
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 080e9ca..9cd3b5c 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -1551,7 +1551,34 @@ EXPORT_SYMBOL_GPL(device_destroy);
* on the same device to ensure that new_name is valid and
* won't conflict with other devices.
*
- * "Never use this function, bad things will happen" - gregkh
+ * Note: Don't call this function. Currently, the networking layer calls this
+ * function, but that will change. The following text from Kay Sievers offers
+ * some insight:
+ *
+ * Renaming devices is racy at many levels, symlinks and other stuff are not
+ * replaced atomically, and you get a "move" uevent, but it's not easy to
+ * connect the event to the old and new device. Device nodes are not renamed at
+ * all, there isn't even support for that in the kernel now.
+ *
+ * In the meantime, during renaming, your target name might be taken by another
+ * driver, creating conflicts. Or the old name is taken directly after you
+ * renamed it -- then you get events for the same DEVPATH, before you even see
+ * the "move" event. It's just a mess, and nothing new should ever rely on
+ * kernel device renaming. Besides that, it's not even implemented now for
+ * other things than (driver-core wise very simple) network devices.
+ *
+ * We are currently about to change network renaming in udev to completely
+ * disallow renaming of devices in the same namespace as the kernel uses,
+ * because we can't solve the problems properly, that arise with swapping names
+ * of multiple interfaces without races. Means, renaming of eth[0-9]* will only
+ * be allowed to some other name than eth[0-9]*, for the aforementioned
+ * reasons.
+ *
+ * Make up a "real" name in the driver before you register anything, or add
+ * some other attributes for userspace to find the device, or use udev to add
+ * symlinks -- but never rename kernel devices later, it's a complete mess. We
+ * don't even want to get into that and try to implement the missing pieces in
+ * the core. We really have other pieces to fix in the driver core mess. :)
*/
int device_rename(struct device *dev, const char *new_name)
{
--
1.7.2.3
^ permalink raw reply related [flat|nested] 2+ messages in thread* [PATCH 2/2] tty: fix typos/errors in tty_driver.h comments
2010-12-13 20:08 [PATCH 1/2] driver-core: document restrictions on device_rename() Timur Tabi
@ 2010-12-13 20:08 ` Timur Tabi
0 siblings, 0 replies; 2+ messages in thread
From: Timur Tabi @ 2010-12-13 20:08 UTC (permalink / raw)
To: linux-next, greg
Fix various typos and other errors in comments of tty_driver.h. The most
significant is the wrong name of a function for the description of
TTY_DRIVER_DYNAMIC_DEV.
Signed-off-by: Timur Tabi <timur@freescale•com>
---
This patch is for linux-next
include/linux/tty_driver.h | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h
index 09678ed..6a8a1fd 100644
--- a/include/linux/tty_driver.h
+++ b/include/linux/tty_driver.h
@@ -102,7 +102,7 @@
* unsigned int cmd, unsigned long arg);
*
* This routine allows the tty driver to implement
- * device-specific ioctl's. If the ioctl number passed in cmd
+ * device-specific ioctls. If the ioctl number passed in cmd
* is not recognized by the driver, it should return ENOIOCTLCMD.
*
* Optional
@@ -167,12 +167,12 @@
*
* void (*hangup)(struct tty_struct *tty);
*
- * This routine notifies the tty driver that it should hangup the
+ * This routine notifies the tty driver that it should hang up the
* tty device.
*
* Optional:
*
- * int (*break_ctl)(struct tty_stuct *tty, int state);
+ * int (*break_ctl)(struct tty_struct *tty, int state);
*
* This optional routine requests the tty driver to turn on or
* off BREAK status on the RS-232 port. If state is -1,
@@ -358,7 +358,7 @@ static inline struct tty_driver *tty_driver_kref_get(struct tty_driver *d)
* overruns, either.)
*
* TTY_DRIVER_DYNAMIC_DEV --- if set, the individual tty devices need
- * to be registered with a call to tty_register_driver() when the
+ * to be registered with a call to tty_register_device() when the
* device is found in the system and unregistered with a call to
* tty_unregister_device() so the devices will be show up
* properly in sysfs. If not set, driver->num entries will be
--
1.7.2.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-12-13 20:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-13 20:08 [PATCH 1/2] driver-core: document restrictions on device_rename() Timur Tabi
2010-12-13 20:08 ` [PATCH 2/2] tty: fix typos/errors in tty_driver.h comments Timur Tabi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox