diff options
author | Trent Piepho <tpiepho@kymetacorp.com> | 2015-12-11 00:23:11 +0000 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2016-01-08 08:30:55 +0100 |
commit | 94a4dc04d4cbdf3e4f209e17ad2d5aa0de9f48b3 (patch) | |
tree | 5e7e699e3f4fa33bbb18ef2190276c8765fa49e2 /fs/devfs-core.c | |
parent | a3544b162ee647a5df5026cf5e7b7ce31e8635d8 (diff) | |
download | barebox-94a4dc04d4cbdf3e4f209e17ad2d5aa0de9f48b3.tar.gz barebox-94a4dc04d4cbdf3e4f209e17ad2d5aa0de9f48b3.tar.xz |
cdev: When creating a new cdev, initialize device_node
If a new cdev doesn't have a device_node defined when passed to
devfs_create(), set it to the device_node of the parent device, if one
exists.
For non-partitions, like ocotp or eeprom devices, this is the correct
thing to do. Partitions need to use, and do use, a different node.
The code from commit 274e0b8dc48956babeaa2faf70bf8066e656b621 to set
device_node in ocotp can be removed.
Signed-off-by: Trent Piepho <tpiepho@kymetacorp.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'fs/devfs-core.c')
-rw-r--r-- | fs/devfs-core.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/devfs-core.c b/fs/devfs-core.c index 2541ea36e6..a5ac5a3843 100644 --- a/fs/devfs-core.c +++ b/fs/devfs-core.c @@ -260,8 +260,11 @@ int devfs_create(struct cdev *new) return -EEXIST; list_add_tail(&new->list, &cdev_list); - if (new->dev) + if (new->dev) { list_add_tail(&new->devices_list, &new->dev->cdevs); + if (!new->device_node) + new->device_node = new->dev->device_node; + } return 0; } |