FROMLIST: remoteproc: core: Move cdev add before device add
When cdev_add is called after device_add has been called there is no way for the userspace to know about the addition of a cdev as cdev_add itself doesn't trigger a uevent notification, or for the kernel to know about the change to devt. This results in two problems: - mknod is never called for the cdev and hence no cdev appears on devtmpfs. - sysfs links to the new cdev are not established. Based on how cdev_device_add[1] is written, it appears that the correct way to use these APIs is to call cdev_add before device_add is called. Since the cdev is an optional feature for remoteproc we cannot directly use the existing API. Hence moving rproc_char_device_add() before device_add() in rproc_add(). [1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/fs/char_dev.c#n537 Signed-off-by: Siddharth Gupta <sidgup@codeaurora.org> Bug: 185924092 Change-Id: Iad8a45f564996d73cd3f33ed124427cb73497dad Link: https://lore.kernel.org/linux-remoteproc/1618946805-26970-1-git-send-email-sidgup@codeaurora.org/ Signed-off-by: Siddharth Gupta <quic_sidgup@quicinc.com>
This commit is contained in:
parent
35eacb5c87
commit
4ccc2a6dbc
1 changed files with 5 additions and 5 deletions
|
|
@ -1996,6 +1996,11 @@ int rproc_add(struct rproc *rproc)
|
|||
struct device *dev = &rproc->dev;
|
||||
int ret;
|
||||
|
||||
/* add char device for this remoteproc */
|
||||
ret = rproc_char_device_add(rproc);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = device_add(dev);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
|
@ -2009,11 +2014,6 @@ int rproc_add(struct rproc *rproc)
|
|||
/* create debugfs entries */
|
||||
rproc_create_debug_dir(rproc);
|
||||
|
||||
/* add char device for this remoteproc */
|
||||
ret = rproc_char_device_add(rproc);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/*
|
||||
* Remind ourselves the remote processor has been attached to rather
|
||||
* than booted by the remoteproc core. This is important because the
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue