[PATCH] device-dax: Auto-bind device after successful new_id

From: Dan Williams
Date: Thu Jan 24 2019 - 16:42:52 EST


The typical 'new_id' attribute behavior is to immediately attach a
device to its driver after a new device-id is added. Implement this
behavior for the dax bus.

Reported-by: Alexander Duyck <alexander.h.duyck@xxxxxxxxxxxxxxx>
Cc: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>
Signed-off-by: Dan Williams <dan.j.williams@xxxxxxxxx>
---
drivers/dax/bus.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/dax/bus.c b/drivers/dax/bus.c
index c620ad52d7e5..7053ab6419db 100644
--- a/drivers/dax/bus.c
+++ b/drivers/dax/bus.c
@@ -92,7 +92,10 @@ static ssize_t do_id_store(struct device_driver *drv, const char *buf,
} else
/* dax_id already added */;
mutex_unlock(&dax_bus_lock);
- return rc;
+
+ if (rc < 0)
+ return rc;
+ return driver_attach(drv);
}

static ssize_t new_id_store(struct device_driver *drv, const char *buf,