From patchwork Mon Feb 14 06:08:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?WW9uZyBXdSAo5ZC05YuHKQ==?= X-Patchwork-Id: 12744984 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9C56FC433EF for ; Mon, 14 Feb 2022 06:25:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=57FXifwspkxGw3bpD+nYoyTFKMI82MeCz+2US6WqQZY=; b=FZ3CadwFOokZrE 3UDXIadX3l7FVK6ydHcIr/VymWZEwU0QA2S8kBgsCWbsAghvwDz4fZkf0lX6fARDakNHb2xsoukRt JgjZobBpoUvqK133/EyVlKGQRWzZ9d2yKgNH17VaoTYnU+JUoiFttCZ5yRQyDek2bBhWWlDM25BkY 8jlckgVaaCuz6+xmKHVbp0lFkVPjPzUBXXQq3mWbGdzyPE/EpjFEklTPf5VAhfny4HSeVCDViZ1Nx Ew7aR86ZEuJEUo2qJdcc0Z3YkRavsUMNrCbIdax8ptRFPehCqhgSh1fvuKmQWrfTUJGQTL9BOckdN WCRjVqIdr2BHBAStRZYg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nJUm5-00DQRU-5W; Mon, 14 Feb 2022 06:23:50 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nJUjG-00DOss-M4; Mon, 14 Feb 2022 06:20:56 +0000 X-UUID: f9d860a6156c45b5b4a5fef176bb288a-20220213 X-UUID: f9d860a6156c45b5b4a5fef176bb288a-20220213 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 206076781; Sun, 13 Feb 2022 23:20:53 -0700 Received: from mtkmbs10n1.mediatek.inc (172.21.101.34) by MTKMBS62N2.mediatek.inc (172.29.193.42) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sun, 13 Feb 2022 22:11:51 -0800 Received: from mtkcas11.mediatek.inc (172.21.101.40) by mtkmbs10n1.mediatek.inc (172.21.101.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.792.15; Mon, 14 Feb 2022 14:11:49 +0800 Received: from localhost.localdomain (10.17.3.154) by mtkcas11.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 14 Feb 2022 14:11:47 +0800 From: Yong Wu To: Greg Kroah-Hartman , David Airlie , Daniel Vetter , CC: James Wang , Liviu Dudau , , Matthias Brugger , Krzysztof Kozlowski , , "Joerg Roedel" , Will Deacon , Arnd Bergmann , Laurent Pinchart , , Chun-Kuang Hu , , "Stephen Boyd" , AngeloGioacchino Del Regno , Hsin-Yi Wang , Robin Murphy , Tomasz Figa , , Rob Clark , Srinivas Kandagatla , Sebastian Reichel , Yong Wu , "Yunfei Wang" , Libo Kang , Anan Sun , Mingyuan Ma , Xueqi Zhang Subject: [PATCH 19/23] iommu/mediatek: Make use of the helper component_compare/release_of Date: Mon, 14 Feb 2022 14:08:15 +0800 Message-ID: <20220214060819.7334-20-yong.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20220214060819.7334-1-yong.wu@mediatek.com> References: <20220214060819.7334-1-yong.wu@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220213_222054_758769_A52E30E9 X-CRM114-Status: GOOD ( 14.73 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use the common compare/release helpers from component. Cc: Joerg Roedel Cc: Will Deacon Cc: Matthias Brugger Cc: Yunfei Wang Cc: Libo Kang Cc: Anan Sun Cc: Mingyuan Ma Cc: Xueqi Zhang Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 4 ++-- drivers/iommu/mtk_iommu.h | 10 ---------- drivers/iommu/mtk_iommu_v1.c | 4 ++-- 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index 25b834104790..a2ec9003826c 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -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. */ diff --git a/drivers/iommu/mtk_iommu.h b/drivers/iommu/mtk_iommu.h index f81fa8862ed0..b742432220c5 100644 --- a/drivers/iommu/mtk_iommu.h +++ b/drivers/iommu/mtk_iommu.h @@ -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); diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c index be22fcf988ce..83bd10617c9f 100644 --- a/drivers/iommu/mtk_iommu_v1.c +++ b/drivers/iommu/mtk_iommu_v1.c @@ -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);