]> git.karo-electronics.de Git - linux-beck.git/commitdiff
iommu/mediatek: Convert DT component matching to component_match_add_release()
authorRussell King <rmk+kernel@armlinux.org.uk>
Wed, 19 Oct 2016 10:30:34 +0000 (11:30 +0100)
committerJoerg Roedel <jroedel@suse.de>
Thu, 10 Nov 2016 11:25:16 +0000 (12:25 +0100)
Convert DT component matching to use component_match_add_release().

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/mtk_iommu.c
drivers/iommu/mtk_iommu.h
drivers/iommu/mtk_iommu_v1.c

index 13bb57995cd3d364c2f4f864e1162d6f88ed7589..55b29620fd4fae09101424529e16a851cae3d8c6 100644 (file)
@@ -544,17 +544,19 @@ static int mtk_iommu_probe(struct platform_device *pdev)
                        continue;
 
                plarbdev = of_find_device_by_node(larbnode);
-               of_node_put(larbnode);
                if (!plarbdev) {
                        plarbdev = of_platform_device_create(
                                                larbnode, NULL,
                                                platform_bus_type.dev_root);
-                       if (!plarbdev)
+                       if (!plarbdev) {
+                               of_node_put(larbnode);
                                return -EPROBE_DEFER;
+                       }
                }
                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);
index f59609f20270a08642293fc1a05ed82c2428facb..50177f738e4e012251795149241ecaff890dbbd7 100644 (file)
@@ -54,6 +54,11 @@ static inline int compare_of(struct device *dev, void *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)
 {
        struct mtk_iommu_data *data = dev_get_drvdata(dev);
index 884c80cb795e618423c94a93f377160cacff547e..af70040038e9b831efa060d3f8dac15fac9b7f9a 100644 (file)
@@ -601,17 +601,19 @@ static int mtk_iommu_probe(struct platform_device *pdev)
                        continue;
 
                plarbdev = of_find_device_by_node(larb_spec.np);
-               of_node_put(larb_spec.np);
                if (!plarbdev) {
                        plarbdev = of_platform_device_create(
                                                larb_spec.np, NULL,
                                                platform_bus_type.dev_root);
-                       if (!plarbdev)
+                       if (!plarbdev) {
+                               of_node_put(larb_spec.np);
                                return -EPROBE_DEFER;
+                       }
                }
 
                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++;
        }