Skip to content

Commit 930eec0

Browse files
Siddharth Guptaandersson
authored andcommitted
remoteproc: core: Fix cdev remove and rproc del
The rproc_char_device_remove() call currently unmaps the cdev region instead of simply deleting the cdev that was added as a part of the rproc_char_device_add() call. This change fixes that behaviour, and also fixes the order in which device_del() and cdev_del() need to be called. Signed-off-by: Siddharth Gupta <sidgup@codeaurora.org> Link: https://lore.kernel.org/r/1623723671-5517-4-git-send-email-sidgup@codeaurora.org Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
1 parent 519346e commit 930eec0

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/remoteproc/remoteproc_cdev.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ int rproc_char_device_add(struct rproc *rproc)
124124

125125
void rproc_char_device_remove(struct rproc *rproc)
126126
{
127-
__unregister_chrdev(MAJOR(rproc->dev.devt), rproc->index, 1, "remoteproc");
127+
cdev_del(&rproc->cdev);
128128
}
129129

130130
void __init rproc_init_cdev(void)

drivers/remoteproc/remoteproc_core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2619,7 +2619,6 @@ int rproc_del(struct rproc *rproc)
26192619
mutex_unlock(&rproc->lock);
26202620

26212621
rproc_delete_debug_dir(rproc);
2622-
rproc_char_device_remove(rproc);
26232622

26242623
/* the rproc is downref'ed as soon as it's removed from the klist */
26252624
mutex_lock(&rproc_list_mutex);
@@ -2630,6 +2629,7 @@ int rproc_del(struct rproc *rproc)
26302629
synchronize_rcu();
26312630

26322631
device_del(&rproc->dev);
2632+
rproc_char_device_remove(rproc);
26332633

26342634
return 0;
26352635
}

0 commit comments

Comments
 (0)