[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <767a9f59-be14-2103-6675-a2028742e663@arm.com>
Date: Mon, 8 Jan 2018 11:45:03 +0000
From: Robin Murphy <robin.murphy@....com>
To: Jeffy Chen <jeffy.chen@...k-chips.com>,
linux-kernel@...r.kernel.org
Cc: jcliang@...omium.org, iommu@...ts.linux-foundation.org
Subject: Re: [PATCH] iommu/of: Only do IOMMU lookup for available ones
Hi Jeffy,
On 03/01/18 06:09, Jeffy Chen wrote:
> The for_each_matching_node_and_match() would return every matching
> nodes including unavailable ones.
>
> It's pointless to init unavailable IOMMUs, so add a sanity check to
> avoid that.
Even better would be to clean up the last remaining init_fn user and get
rid of the whole business. With the probe-deferral mechanism, early
initialisation hooks are no longer needed, and the IOMMU_OF_DECLARE
section really only remains as a way of detecting builtin drivers long
before their registration initcalls run.
Robin.
> Signed-off-by: Jeffy Chen <jeffy.chen@...k-chips.com>
> ---
>
> drivers/iommu/of_iommu.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/iommu/of_iommu.c b/drivers/iommu/of_iommu.c
> index 50947ebb6d17..6f7456caa30d 100644
> --- a/drivers/iommu/of_iommu.c
> +++ b/drivers/iommu/of_iommu.c
> @@ -240,6 +240,9 @@ static int __init of_iommu_init(void)
> for_each_matching_node_and_match(np, matches, &match) {
> const of_iommu_init_fn init_fn = match->data;
>
> + if (!of_device_is_available(np))
> + continue;
> +
> if (init_fn && init_fn(np))
> pr_err("Failed to initialise IOMMU %pOF\n", np);
> }
>
Powered by blists - more mailing lists