From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753227AbeAQN2M (ORCPT + 1 other); Wed, 17 Jan 2018 08:28:12 -0500 Received: from 8bytes.org ([81.169.241.247]:34748 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752864AbeAQN2K (ORCPT ); Wed, 17 Jan 2018 08:28:10 -0500 Date: Wed, 17 Jan 2018 14:28:08 +0100 From: Joerg Roedel To: Jeffy Chen Cc: linux-kernel@vger.kernel.org, jcliang@chromium.org, tfiga@chromium.org, iommu@lists.linux-foundation.org, Robin Murphy , Will Deacon Subject: Re: [PATCH] iommu/of: Only do IOMMU lookup for available ones Message-ID: <20180117132808.s5henw63oseg3ufd@8bytes.org> References: <20180103060920.23475-1-jeffy.chen@rock-chips.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180103060920.23475-1-jeffy.chen@rock-chips.com> User-Agent: NeoMutt/20170421 (1.8.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On Wed, Jan 03, 2018 at 02:09:20PM +0800, 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. > > Signed-off-by: Jeffy Chen > --- > > 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; > + Makes sense to me, but I'd like to have an OK from Robin or Will (added to Cc) before applying this. Joerg