iommu/mediatek: Make use of the helper component_compare/release_of
authorYong Wu <yong.wu@mediatek.com>
Mon, 14 Feb 2022 06:08:15 +0000 (14:08 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 25 Feb 2022 11:16:13 +0000 (12:16 +0100)
Use the common compare/release helpers from component.

Cc: Joerg Roedel <joro@8bytes.org>
Cc: Will Deacon <will@kernel.org>
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Cc: Yunfei Wang <yf.wang@mediatek.com>
Cc: Libo Kang <libo.kang@mediatek.com>
Cc: Anan Sun <anan.sun@mediatek.com>
Cc: Mingyuan Ma <mingyuan.ma@mediatek.com>
Cc: Xueqi Zhang <xueqi.zhang@mediatek.com>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Link: https://lore.kernel.org/r/20220214060819.7334-20-yong.wu@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/iommu/mtk_iommu.c
drivers/iommu/mtk_iommu.h
drivers/iommu/mtk_iommu_v1.c

index 25b834104790cd97f111ac7f934365aa6695bc62..a2ec9003826c945bb464aad218250d418baf5fc3 100644 (file)
@@ -852,8 +852,8 @@ static int mtk_iommu_probe(struct platform_device *pdev)
                }
                data->larb_imu[id].dev = &plarbdev->dev;
 
-               component_match_add_release(dev, &match, release_of,
-                                           compare_of, larbnode);
+               component_match_add_release(dev, &match, component_release_of,
+                                           component_compare_of, larbnode);
        }
 
        /* Get smi-common dev from the last larb. */
index f81fa8862ed04b22f997bf45700e58dd90fc068b..b742432220c5ff4d4994dab7fa4ca58e91c53239 100644 (file)
@@ -84,16 +84,6 @@ struct mtk_iommu_data {
        struct mtk_smi_larb_iommu       larb_imu[MTK_LARB_NR_MAX];
 };
 
-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 be22fcf988cee31a388b7d355f43cfe64473134f..83bd10617c9feaa8bfafc0f2e54c02c857273db0 100644 (file)
@@ -599,8 +599,8 @@ static int mtk_iommu_probe(struct platform_device *pdev)
                }
                data->larb_imu[i].dev = &plarbdev->dev;
 
-               component_match_add_release(dev, &match, release_of,
-                                           compare_of, larbnode);
+               component_match_add_release(dev, &match, component_release_of,
+                                           component_compare_of, larbnode);
        }
 
        platform_set_drvdata(pdev, data);