Skip to content

Commit c6659ee

Browse files
Siddharth Guptaandersson
authored andcommitted
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. The cdev needs to be added and devt assigned before device_add() is called in order for the relevant sysfs and devtmpfs entries to be created and the uevent to be properly populated. Signed-off-by: Siddharth Gupta <sidgup@codeaurora.org> Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org> Link: https://lore.kernel.org/r/1623723671-5517-2-git-send-email-sidgup@codeaurora.org Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
1 parent 0740ec0 commit c6659ee

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

drivers/remoteproc/remoteproc_core.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2333,6 +2333,11 @@ int rproc_add(struct rproc *rproc)
23332333
struct device *dev = &rproc->dev;
23342334
int ret;
23352335

2336+
/* add char device for this remoteproc */
2337+
ret = rproc_char_device_add(rproc);
2338+
if (ret < 0)
2339+
return ret;
2340+
23362341
ret = device_add(dev);
23372342
if (ret < 0)
23382343
return ret;
@@ -2346,11 +2351,6 @@ int rproc_add(struct rproc *rproc)
23462351
/* create debugfs entries */
23472352
rproc_create_debug_dir(rproc);
23482353

2349-
/* add char device for this remoteproc */
2350-
ret = rproc_char_device_add(rproc);
2351-
if (ret < 0)
2352-
return ret;
2353-
23542354
/* if rproc is marked always-on, request it to boot */
23552355
if (rproc->auto_boot) {
23562356
ret = rproc_trigger_auto_boot(rproc);

0 commit comments

Comments
 (0)