Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751438AbeAQFov (ORCPT + 1 other); Wed, 17 Jan 2018 00:44:51 -0500 Received: from mail-vk0-f68.google.com ([209.85.213.68]:46924 "EHLO mail-vk0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750877AbeAQFou (ORCPT ); Wed, 17 Jan 2018 00:44:50 -0500 X-Google-Smtp-Source: ACJfBovOy4Sv7Yklnm6/jSKrwLbNzd+a0jsVMlNkXaW9xJORG/DQtaqQKG8ByktvyfecQiixJdVZhw== MIME-Version: 1.0 In-Reply-To: <20180116132540.18939-12-jeffy.chen@rock-chips.com> References: <20180116132540.18939-1-jeffy.chen@rock-chips.com> <20180116132540.18939-12-jeffy.chen@rock-chips.com> From: Tomasz Figa Date: Wed, 17 Jan 2018 14:44:26 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 11/13] iommu/rockchip: Use OF_IOMMU to attach devices automatically To: Jeffy Chen Cc: linux-kernel@vger.kernel.org, Ricky Liang , Robin Murphy , simon xue , Heiko Stuebner , "open list:ARM/Rockchip SoC..." , "open list:IOMMU DRIVERS" , Joerg Roedel , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On Tue, Jan 16, 2018 at 10:25 PM, Jeffy Chen wrote: > Converts the rockchip-iommu driver to use the OF_IOMMU infrastructure, > which allows attaching master devices to their IOMMUs automatically > according to DT properties. > > Signed-off-by: Jeffy Chen > --- > > Changes in v2: None > > drivers/iommu/rockchip-iommu.c | 116 +++++++++++------------------------------ > 1 file changed, 31 insertions(+), 85 deletions(-) > > diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c > index 51e4f982c4a6..c2d3ac82184e 100644 > --- a/drivers/iommu/rockchip-iommu.c > +++ b/drivers/iommu/rockchip-iommu.c [snip] > +static int rk_iommu_of_xlate(struct device *dev, > + struct of_phandle_args *args) > +{ > + struct platform_device *iommu_dev; > + > + iommu_dev = of_find_device_by_node(args->np); > + if (!iommu_dev) { > + dev_err(dev, "iommu %pOF not found\n", args->np); > + return -ENODEV; > + } > + > + dev->archdata.iommu = platform_get_drvdata(iommu_dev); This will work only if that iommu was already probed. Do we have any guarantees that this callback is not called earlier? Best regards, Tomasz