Commit 00c7c81f authored by Russell King's avatar Russell King Committed by Joerg Roedel

iommu/mediatek: Convert DT component matching to component_match_add_release()

Convert DT component matching to use component_match_add_release().
Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
parent 84672f19
...@@ -544,17 +544,19 @@ static int mtk_iommu_probe(struct platform_device *pdev) ...@@ -544,17 +544,19 @@ static int mtk_iommu_probe(struct platform_device *pdev)
continue; continue;
plarbdev = of_find_device_by_node(larbnode); plarbdev = of_find_device_by_node(larbnode);
of_node_put(larbnode);
if (!plarbdev) { if (!plarbdev) {
plarbdev = of_platform_device_create( plarbdev = of_platform_device_create(
larbnode, NULL, larbnode, NULL,
platform_bus_type.dev_root); platform_bus_type.dev_root);
if (!plarbdev) if (!plarbdev) {
of_node_put(larbnode);
return -EPROBE_DEFER; return -EPROBE_DEFER;
}
} }
data->smi_imu.larb_imu[i].dev = &plarbdev->dev; data->smi_imu.larb_imu[i].dev = &plarbdev->dev;
component_match_add(dev, &match, compare_of, larbnode); component_match_add_release(dev, &match, release_of,
compare_of, larbnode);
} }
platform_set_drvdata(pdev, data); platform_set_drvdata(pdev, data);
......
...@@ -54,6 +54,11 @@ static inline int compare_of(struct device *dev, void *data) ...@@ -54,6 +54,11 @@ static inline int compare_of(struct device *dev, void *data)
return dev->of_node == data; return dev->of_node == data;
} }
static inline void release_of(struct device *dev, void *data)
{
of_node_put(data);
}
static inline int mtk_iommu_bind(struct device *dev) static inline int mtk_iommu_bind(struct device *dev)
{ {
struct mtk_iommu_data *data = dev_get_drvdata(dev); struct mtk_iommu_data *data = dev_get_drvdata(dev);
......
...@@ -601,17 +601,19 @@ static int mtk_iommu_probe(struct platform_device *pdev) ...@@ -601,17 +601,19 @@ static int mtk_iommu_probe(struct platform_device *pdev)
continue; continue;
plarbdev = of_find_device_by_node(larb_spec.np); plarbdev = of_find_device_by_node(larb_spec.np);
of_node_put(larb_spec.np);
if (!plarbdev) { if (!plarbdev) {
plarbdev = of_platform_device_create( plarbdev = of_platform_device_create(
larb_spec.np, NULL, larb_spec.np, NULL,
platform_bus_type.dev_root); platform_bus_type.dev_root);
if (!plarbdev) if (!plarbdev) {
of_node_put(larb_spec.np);
return -EPROBE_DEFER; return -EPROBE_DEFER;
}
} }
data->smi_imu.larb_imu[larb_nr].dev = &plarbdev->dev; data->smi_imu.larb_imu[larb_nr].dev = &plarbdev->dev;
component_match_add(dev, &match, compare_of, larb_spec.np); component_match_add_release(dev, &match, release_of,
compare_of, larb_spec.np);
larb_nr++; larb_nr++;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment