diff options
author | Bjorn Andersson <bjorn.andersson@linaro.org> | 2017-03-16 06:18:35 +0100 |
---|---|---|
committer | Bjorn Andersson <bjorn.andersson@linaro.org> | 2017-05-17 19:30:22 +0200 |
commit | b0b03b8119633de0649da9bd506e4850c401ff2b (patch) | |
tree | 08ea0e214cfd9014133c220dab519e3dc197a0fe /drivers/rpmsg/qcom_smd.c | |
parent | Linux 4.12-rc1 (diff) | |
download | linux-b0b03b8119633de0649da9bd506e4850c401ff2b.tar.xz linux-b0b03b8119633de0649da9bd506e4850c401ff2b.zip |
rpmsg: Release rpmsg devices in backends
The rpmsg devices are allocated in the backends and as such must be
freed there as well.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Diffstat (limited to 'drivers/rpmsg/qcom_smd.c')
-rw-r--r-- | drivers/rpmsg/qcom_smd.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/rpmsg/qcom_smd.c b/drivers/rpmsg/qcom_smd.c index beaef5dd973e..a0a39a8821a3 100644 --- a/drivers/rpmsg/qcom_smd.c +++ b/drivers/rpmsg/qcom_smd.c @@ -969,6 +969,14 @@ static const struct rpmsg_endpoint_ops qcom_smd_endpoint_ops = { .poll = qcom_smd_poll, }; +static void qcom_smd_release_device(struct device *dev) +{ + struct rpmsg_device *rpdev = to_rpmsg_device(dev); + struct qcom_smd_device *qsdev = to_smd_device(rpdev); + + kfree(qsdev); +} + /* * Create a smd client device for channel that is being opened. */ @@ -998,6 +1006,7 @@ static int qcom_smd_create_device(struct qcom_smd_channel *channel) rpdev->dev.of_node = qcom_smd_match_channel(edge->of_node, channel->name); rpdev->dev.parent = &edge->dev; + rpdev->dev.release = qcom_smd_release_device; return rpmsg_register_device(rpdev); } @@ -1013,6 +1022,8 @@ static int qcom_smd_create_chrdev(struct qcom_smd_edge *edge) qsdev->edge = edge; qsdev->rpdev.ops = &qcom_smd_device_ops; qsdev->rpdev.dev.parent = &edge->dev; + qsdev->rpdev.dev.release = qcom_smd_release_device; + return rpmsg_chrdev_register_device(&qsdev->rpdev); } |