diff mbox

dax: clarify driver_data ownership

Message ID 148178519905.7385.6307065431345873736.stgit@dwillia2-desk3.amr.corp.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Dan Williams Dec. 15, 2016, 6:59 a.m. UTC
Johannes points out that the warning in alloc_dax_region() seems to
imply that multiple devices might claim a dax region. In fact it's a
warning to driver developers that the dax core wants to own the
driver_data pointer for the hosting device of a dax_region. Add a
clarification.

Reported-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 drivers/dax/dax.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Johannes Thumshirn Dec. 15, 2016, 8:53 a.m. UTC | #1
On Wed, Dec 14, 2016 at 10:59:59PM -0800, Dan Williams wrote:
> Johannes points out that the warning in alloc_dax_region() seems to
> imply that multiple devices might claim a dax region. In fact it's a
> warning to driver developers that the dax core wants to own the
> driver_data pointer for the hosting device of a dax_region. Add a
> clarification.
> 
> Reported-by: Johannes Thumshirn <jthumshirn@suse.de>
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> ---

Looks good,
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
diff mbox

Patch

diff --git a/drivers/dax/dax.c b/drivers/dax/dax.c
index d1641e69a088..c7b23d52f945 100644
--- a/drivers/dax/dax.c
+++ b/drivers/dax/dax.c
@@ -359,8 +359,13 @@  struct dax_region *alloc_dax_region(struct device *parent, int region_id,
 {
 	struct dax_region *dax_region;
 
+	/*
+	 * The DAX core assumes that it can store its private data in
+	 * parent->driver_data. This WARN is a reminder / safeguard for
+	 * developers of device-dax drivers.
+	 */
 	if (dev_get_drvdata(parent)) {
-		dev_WARN(parent, "dax core found drvdata already in use\n");
+		dev_WARN(parent, "dax core failed to setup private data\n");
 		return NULL;
 	}