From: hdoyu@nvidia.com (Hiroshi Doyu) Date: Thu, 21 Nov 2013 15:38:45 +0200 Subject: [PATCHv5 4/9] iommu/tegra: smmu: register device to iommu dynamically In-Reply-To: <20131121132322.EFDD1C40A2C@trevor.secretlab.ca> References: <1384853593-32202-1-git-send-email-hdoyu@nvidia.com> <1384853593-32202-5-git-send-email-hdoyu@nvidia.com> <528BDAAA.4000203@ wwwdotorg.org> <20131121132322.EFDD1C40A2C@trevor.secretlab.ca> Message-ID: <20131121153845.e37c01b2f384883e3611790a@nvidia.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Thu, 21 Nov 2013 14:23:22 +0100 Grant Likely wrote: > > > +static int smmu_iommu_add_device(struct device *dev) > > > +{ > > > + int err = -EPROBE_DEFER; > > > + u32 swgroups = dev->platform_data; > > > + struct dma_iommu_mapping *map = NULL; > > > + > > > + if (test_bit(TEGRA_SWGROUP_PPCS, swgroups)) > > > + map = smmu_handle->map[SYSTEM_PROTECTED]; > > > + else > > > + map = smmu_handle->map[SYSTEM_DEFAULT]; > > > + > > > + if (map) > > > + err = arm_iommu_attach_device(dev, map); > > > + else > > > + return -EPROBE_DEFER; > > > > Given that patch 2 exists, if this test fails, then surely the > > appropriate error code is some fatal error, not -EPROBE_DEFER; any > > deferrals should have happened long before this point. > > Will need to be revisited. Patching into the core really_probe() like > patch #2 does is a really bad approach which would mean that returning > EPROBE_DEFER is appropriate here. I'm going to send PATCHv6, where it's a little bit easier to discuss further since some code are cleaned up with feedback. We once discussed to make use of bus_notifier instead of embedding a hook in really_probe(). This would require some change where bus_notifer return code needs to be used to postpone device population.