The IOMMU configuration will be deferred if the IOMMU driver
isn't probed by the time. Make this deferral only in the
initialization stage with driver_deferred_probe_check_state().
Otherwise the devices depends on IOMMU will be deferred forever
in case the IOMMU device probe failed or it doesn't appear in
the ACPI namespace.
Fixes: 8f7729552582 ("ACPI: RISC-V: Add support for RIMT")
Signed-off-by: Yicong Yang <yang.yicong@picoheart.com>
Link: https://patch.msgid.link/20260625094702.11558-1-yang.yicong@picoheart.com
[pjw@kernel.org: added Fixes line]
Signed-off-by: Paul Walmsley <pjw@kernel.org>
#include <linux/acpi.h>
#include <linux/acpi_rimt.h>
+#include <linux/device/driver.h>
#include <linux/iommu.h>
#include <linux/list.h>
#include <linux/pci.h>
rimt_fwnode = rimt_get_fwnode(node);
/*
- * The IOMMU drivers may not be probed yet.
- * Defer the IOMMU configuration
+ * The IOMMU drivers may not be probed yet. Defer the IOMMU
+ * configuration if it's still in initialization stage.
*/
if (!rimt_fwnode)
- return -EPROBE_DEFER;
+ return driver_deferred_probe_check_state(dev);
/*
* EPROBE_DEFER ensures IOMMU is probed before the devices that