@@ -464,11 +464,24 @@ static struct nd_device_driver nd_bus_dr
static int nvdimm_bus_match(struct device *dev, struct device_driver *drv)
{
struct nd_device_driver *nd_drv = to_nd_device_driver(drv);
+ bool match;
if (is_nvdimm_bus(dev) && nd_drv == &nd_bus_driver)
return true;
- return !!test_bit(to_nd_device_type(dev), &nd_drv->type);
+ match = !!test_bit(to_nd_device_type(dev), &nd_drv->type);
+
+ /*
+ * We allow PMEM devices to be bound to the KMEM driver.
+ * Force a match if we detect a PMEM device type but
+ * a KMEM device driver.
+ */
+ if (!match &&
+ (to_nd_device_type(dev) == ND_DEVICE_DAX_PMEM) &&
+ (nd_drv->type == ND_DRIVER_DAX_KMEM))
+ match = true;
+
+ return match;
}
static ASYNC_DOMAIN_EXCLUSIVE(nd_async_domain);