Merge branch 'pu/devchild'
This commit is contained in:
commit
2c9ebcb856
|
@ -151,7 +151,7 @@ int console_register(struct console_device *newcdev)
|
|||
dev->id = DEVICE_ID_DYNAMIC;
|
||||
strcpy(dev->name, "cs");
|
||||
if (newcdev->dev)
|
||||
dev_add_child(newcdev->dev, dev);
|
||||
dev->parent = newcdev->dev;
|
||||
platform_device_register(dev);
|
||||
|
||||
if (newcdev->setbrg) {
|
||||
|
|
|
@ -133,20 +133,20 @@ int register_device(struct device_d *new_device)
|
|||
INIT_LIST_HEAD(&new_device->parameters);
|
||||
INIT_LIST_HEAD(&new_device->active);
|
||||
|
||||
if (!new_device->bus)
|
||||
return 0;
|
||||
if (new_device->bus) {
|
||||
if (!new_device->parent)
|
||||
new_device->parent = &new_device->bus->dev;
|
||||
|
||||
if (!new_device->parent) {
|
||||
new_device->parent = &new_device->bus->dev;
|
||||
dev_add_child(new_device->parent, new_device);
|
||||
list_add_tail(&new_device->bus_list, &new_device->bus->device_list);
|
||||
|
||||
bus_for_each_driver(new_device->bus, drv) {
|
||||
if (!match(drv, new_device))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
list_add_tail(&new_device->bus_list, &new_device->bus->device_list);
|
||||
|
||||
bus_for_each_driver(new_device->bus, drv) {
|
||||
if (!match(drv, new_device))
|
||||
break;
|
||||
}
|
||||
if (new_device->parent)
|
||||
list_add_tail(&new_device->sibling, &new_device->parent->children);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -186,16 +186,6 @@ int unregister_device(struct device_d *old_dev)
|
|||
}
|
||||
EXPORT_SYMBOL(unregister_device);
|
||||
|
||||
int dev_add_child(struct device_d *dev, struct device_d *child)
|
||||
{
|
||||
child->parent = dev;
|
||||
|
||||
list_add_tail(&child->sibling, &dev->children);
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(dev_add_child);
|
||||
|
||||
struct driver_d *get_driver_by_name(const char *name)
|
||||
{
|
||||
struct driver_d *drv;
|
||||
|
|
|
@ -258,7 +258,6 @@ struct i2c_client *i2c_new_device(struct i2c_adapter *adapter,
|
|||
client->addr = chip->addr;
|
||||
|
||||
client->dev.parent = &adapter->dev;
|
||||
dev_add_child(client->dev.parent, &client->dev);
|
||||
|
||||
status = register_device(&client->dev);
|
||||
|
||||
|
@ -403,9 +402,6 @@ int i2c_add_numbered_adapter(struct i2c_adapter *adapter)
|
|||
adapter->dev.id = adapter->nr;
|
||||
strcpy(adapter->dev.name, "i2c");
|
||||
|
||||
if (adapter->dev.parent)
|
||||
dev_add_child(adapter->dev.parent, &adapter->dev);
|
||||
|
||||
ret = register_device(&adapter->dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
|
|
@ -1557,7 +1557,7 @@ int mci_register(struct mci_host *host)
|
|||
mci_dev->id = DEVICE_ID_DYNAMIC;
|
||||
strcpy(mci_dev->name, mci_driver.name);
|
||||
mci_dev->platform_data = host;
|
||||
dev_add_child(host->hw_dev, mci_dev);
|
||||
mci_dev->parent = host->hw_dev;
|
||||
|
||||
return platform_device_register(mci_dev);
|
||||
}
|
||||
|
|
|
@ -184,10 +184,8 @@ int add_mtd_device(struct mtd_info *mtd, char *devname)
|
|||
devname = "mtd";
|
||||
strcpy(mtd->class_dev.name, devname);
|
||||
mtd->class_dev.id = DEVICE_ID_DYNAMIC;
|
||||
if (mtd->parent) {
|
||||
if (mtd->parent)
|
||||
mtd->class_dev.parent = mtd->parent;
|
||||
dev_add_child(mtd->class_dev.parent, &mtd->class_dev);
|
||||
}
|
||||
register_device(&mtd->class_dev);
|
||||
|
||||
mtd->cdev.ops = &mtd_ops;
|
||||
|
|
|
@ -47,8 +47,6 @@ int mdiobus_register(struct mii_bus *bus)
|
|||
bus->dev.id = DEVICE_ID_DYNAMIC;
|
||||
strcpy(bus->dev.name, "miibus");
|
||||
bus->dev.parent = bus->parent;
|
||||
if (bus->parent)
|
||||
dev_add_child(bus->parent, &bus->dev);
|
||||
|
||||
err = register_device(&bus->dev);
|
||||
if (err) {
|
||||
|
@ -157,8 +155,6 @@ static int mdio_bus_probe(struct device_d *_dev)
|
|||
char str[16];
|
||||
|
||||
dev->attached_dev->phydev = dev;
|
||||
dev->dev.parent = &dev->attached_dev->dev;
|
||||
dev_add_child(dev->dev.parent, _dev);
|
||||
|
||||
if (drv->probe) {
|
||||
ret = drv->probe(dev);
|
||||
|
|
|
@ -157,7 +157,6 @@ static struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int p
|
|||
dev->phy_id = phy_id;
|
||||
|
||||
dev->bus = bus;
|
||||
dev->dev.parent = bus->parent;
|
||||
dev->dev.bus = &mdio_bus_type;
|
||||
|
||||
strcpy(dev->dev.name, "phy");
|
||||
|
@ -229,6 +228,8 @@ static int phy_register_device(struct phy_device* dev)
|
|||
{
|
||||
int ret;
|
||||
|
||||
dev->dev.parent = &dev->attached_dev->dev;
|
||||
|
||||
ret = register_device(&dev->dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
|
|
@ -81,7 +81,7 @@ struct spi_device *spi_new_device(struct spi_master *master,
|
|||
proxy->dev.id = DEVICE_ID_DYNAMIC;
|
||||
proxy->dev.type_data = proxy;
|
||||
proxy->dev.device_node = chip->device_node;
|
||||
dev_add_child(master->dev, &proxy->dev);
|
||||
proxy->dev.parent = master->dev;
|
||||
|
||||
/* drivers may modify this initial i/o setup */
|
||||
status = master->setup(proxy);
|
||||
|
|
|
@ -413,7 +413,6 @@ static int w1_device_register(struct w1_bus *bus, struct w1_device *dev)
|
|||
dev->bus = bus;
|
||||
|
||||
dev->dev.parent = &bus->dev;
|
||||
dev_add_child(dev->dev.parent, &dev->dev);
|
||||
|
||||
ret = register_device(&dev->dev);
|
||||
if (ret)
|
||||
|
@ -600,10 +599,7 @@ int w1_bus_register(struct w1_bus *bus)
|
|||
|
||||
strcpy(bus->dev.name, "w1_bus");
|
||||
bus->dev.id = DEVICE_ID_DYNAMIC;
|
||||
|
||||
bus->dev.parent = bus->parent;
|
||||
if (bus->parent)
|
||||
dev_add_child(bus->parent, &bus->dev);
|
||||
|
||||
ret = register_device(&bus->dev);
|
||||
if (ret)
|
||||
|
|
10
fs/fs.c
10
fs/fs.c
|
@ -1107,11 +1107,6 @@ static int fs_probe(struct device_d *dev)
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (fsdev->cdev) {
|
||||
dev_add_child(fsdev->cdev->dev, &fsdev->dev);
|
||||
fsdev->parent_device = fsdev->cdev->dev;
|
||||
}
|
||||
|
||||
fsdev->driver = fsdrv;
|
||||
|
||||
list_add_tail(&fsdev->list, &fs_device_list);
|
||||
|
@ -1231,6 +1226,11 @@ int mount(const char *device, const char *fsname, const char *_path)
|
|||
if (!strncmp(device, "/dev/", 5))
|
||||
fsdev->cdev = cdev_by_name(device + 5);
|
||||
|
||||
if (fsdev->cdev) {
|
||||
fsdev->dev.parent = fsdev->cdev->dev;
|
||||
fsdev->parent_device = fsdev->cdev->dev;
|
||||
}
|
||||
|
||||
ret = register_device(&fsdev->dev);
|
||||
if (ret)
|
||||
goto err_register;
|
||||
|
|
|
@ -158,11 +158,6 @@ int device_probe(struct device_d *dev);
|
|||
*/
|
||||
int unregister_device(struct device_d *);
|
||||
|
||||
/* Organize devices in a tree. These functions do _not_ register or
|
||||
* unregister a device. Only registered devices are allowed here.
|
||||
*/
|
||||
int dev_add_child(struct device_d *dev, struct device_d *child);
|
||||
|
||||
/* Iterate over a devices children
|
||||
*/
|
||||
#define device_for_each_child(dev, child) \
|
||||
|
|
Loading…
Reference in New Issue