440
440
static void device_remove_attrs(struct device *dev)
442
442
struct class *class = dev->class;
443
struct device_type *type = dev->type;
443
const struct device_type *type = dev->type;
445
445
device_remove_groups(dev, dev->groups);
1314
1314
EXPORT_SYMBOL_GPL(device_create_file);
1315
1315
EXPORT_SYMBOL_GPL(device_remove_file);
1317
struct root_device {
1319
1318
struct device dev;
1320
1319
struct module *owner;
1323
#define to_root_device(dev) container_of(dev, struct root_device, dev)
1322
inline struct root_device *to_root_device(struct device *d)
1324
return container_of(d, struct root_device, dev);
1325
1327
static void root_device_release(struct device *dev)
1551
1553
* on the same device to ensure that new_name is valid and
1552
1554
* won't conflict with other devices.
1554
* "Never use this function, bad things will happen" - gregkh
1556
* Note: Don't call this function. Currently, the networking layer calls this
1557
* function, but that will change. The following text from Kay Sievers offers
1560
* Renaming devices is racy at many levels, symlinks and other stuff are not
1561
* replaced atomically, and you get a "move" uevent, but it's not easy to
1562
* connect the event to the old and new device. Device nodes are not renamed at
1563
* all, there isn't even support for that in the kernel now.
1565
* In the meantime, during renaming, your target name might be taken by another
1566
* driver, creating conflicts. Or the old name is taken directly after you
1567
* renamed it -- then you get events for the same DEVPATH, before you even see
1568
* the "move" event. It's just a mess, and nothing new should ever rely on
1569
* kernel device renaming. Besides that, it's not even implemented now for
1570
* other things than (driver-core wise very simple) network devices.
1572
* We are currently about to change network renaming in udev to completely
1573
* disallow renaming of devices in the same namespace as the kernel uses,
1574
* because we can't solve the problems properly, that arise with swapping names
1575
* of multiple interfaces without races. Means, renaming of eth[0-9]* will only
1576
* be allowed to some other name than eth[0-9]*, for the aforementioned
1579
* Make up a "real" name in the driver before you register anything, or add
1580
* some other attributes for userspace to find the device, or use udev to add
1581
* symlinks -- but never rename kernel devices later, it's a complete mess. We
1582
* don't even want to get into that and try to implement the missing pieces in
1583
* the core. We really have other pieces to fix in the driver core mess. :)
1556
1585
int device_rename(struct device *dev, const char *new_name)