mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
video: rockchip: mpp: put node for attach mpp service
relative function: of_parse_phandle ==> of_node_put of_find_device_by_node ==> platform_device_put Change-Id: I06ef97baa675efff79b2bc653fabda54e3f707df Signed-off-by: Ding Wei <leo.ding@rock-chips.com>
This commit is contained in:
@@ -602,17 +602,19 @@ static int mpp_attach_service(struct mpp_dev *mpp, struct device *dev)
|
||||
}
|
||||
|
||||
pdev = of_find_device_by_node(np);
|
||||
of_node_put(np);
|
||||
if (!pdev) {
|
||||
dev_err(dev, "failed to get mpp service from node\n");
|
||||
ret = -ENODEV;
|
||||
goto fail;
|
||||
goto err_put_pdev;
|
||||
}
|
||||
|
||||
mpp->pdev_srv = pdev;
|
||||
mpp->srv = platform_get_drvdata(pdev);
|
||||
if (!mpp->srv) {
|
||||
dev_err(&pdev->dev, "failed attach service\n");
|
||||
ret = -EINVAL;
|
||||
goto fail;
|
||||
goto err_put_pdev;
|
||||
}
|
||||
|
||||
of_property_read_u32(dev->of_node,
|
||||
@@ -621,7 +623,7 @@ static int mpp_attach_service(struct mpp_dev *mpp, struct device *dev)
|
||||
dev_err(dev, "rockchip,taskqueue-node %d must less than %d\n",
|
||||
taskqueue_node, mpp->srv->taskqueue_cnt);
|
||||
ret = -ENODEV;
|
||||
goto fail;
|
||||
goto err_put_pdev;
|
||||
}
|
||||
|
||||
of_property_read_u32(dev->of_node,
|
||||
@@ -630,7 +632,7 @@ static int mpp_attach_service(struct mpp_dev *mpp, struct device *dev)
|
||||
dev_err(dev, "rockchip,resetgroup-node %d must less than %d\n",
|
||||
reset_group_node, mpp->srv->reset_group_cnt);
|
||||
ret = -ENODEV;
|
||||
goto fail;
|
||||
goto err_put_pdev;
|
||||
}
|
||||
|
||||
device_lock(&pdev->dev);
|
||||
@@ -642,10 +644,12 @@ static int mpp_attach_service(struct mpp_dev *mpp, struct device *dev)
|
||||
mpp->reset_group = mpp->srv->reset_groups[reset_group_node];
|
||||
mpp->srv->hw_support |= BIT(mpp->var->device_type);
|
||||
device_unlock(&pdev->dev);
|
||||
put_device(&pdev->dev);
|
||||
|
||||
fail:
|
||||
of_node_put(np);
|
||||
return 0;
|
||||
|
||||
err_put_pdev:
|
||||
platform_device_put(pdev);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1523,6 +1527,7 @@ int mpp_dev_remove(struct mpp_dev *mpp)
|
||||
mpp->hw_ops->exit(mpp);
|
||||
|
||||
mpp_iommu_remove(mpp->iommu_info);
|
||||
platform_device_put(mpp->pdev_srv);
|
||||
|
||||
if (mpp->workq) {
|
||||
destroy_workqueue(mpp->workq);
|
||||
|
||||
@@ -200,6 +200,7 @@ struct mpp_dev {
|
||||
struct mpp_taskqueue *queue;
|
||||
struct mpp_reset_group *reset_group;
|
||||
/* point to MPP Service */
|
||||
struct platform_device *pdev_srv;
|
||||
struct mpp_service *srv;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user