~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to drivers/base/core.c

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
400
400
static int device_add_attrs(struct device *dev)
401
401
{
402
402
        struct class *class = dev->class;
403
 
        struct device_type *type = dev->type;
 
403
        const struct device_type *type = dev->type;
404
404
        int error;
405
405
 
406
406
        if (class) {
440
440
static void device_remove_attrs(struct device *dev)
441
441
{
442
442
        struct class *class = dev->class;
443
 
        struct device_type *type = dev->type;
 
443
        const struct device_type *type = dev->type;
444
444
 
445
445
        device_remove_groups(dev, dev->groups);
446
446
 
1314
1314
EXPORT_SYMBOL_GPL(device_create_file);
1315
1315
EXPORT_SYMBOL_GPL(device_remove_file);
1316
1316
 
1317
 
struct root_device
1318
 
{
 
1317
struct root_device {
1319
1318
        struct device dev;
1320
1319
        struct module *owner;
1321
1320
};
1322
1321
 
1323
 
#define to_root_device(dev) container_of(dev, struct root_device, dev)
 
1322
inline struct root_device *to_root_device(struct device *d)
 
1323
{
 
1324
        return container_of(d, struct root_device, dev);
 
1325
}
1324
1326
 
1325
1327
static void root_device_release(struct device *dev)
1326
1328
{
1551
1553
 * on the same device to ensure that new_name is valid and
1552
1554
 * won't conflict with other devices.
1553
1555
 *
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
 
1558
 * some insight:
 
1559
 *
 
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.
 
1564
 *
 
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.
 
1571
 *
 
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
 
1577
 * reasons.
 
1578
 *
 
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. :)
1555
1584
 */
1556
1585
int device_rename(struct device *dev, const char *new_name)
1557
1586
{