device-dax: Move resource pinning+mapping into the common driver

Move the responsibility of calling devm_request_resource() and
devm_memremap_pages() into the common device-dax driver. This is another
preparatory step to allowing an alternate personality driver for a
device-dax range.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This commit is contained in:
Dan Williams
2018-10-29 15:52:42 -07:00
parent 9567da0b40
commit 89ec9f2cfa
5 changed files with 90 additions and 79 deletions

View File

@@ -42,15 +42,22 @@ struct dax_region {
};
/**
* struct dev_dax - instance data for a subdivision of a dax region
* struct dev_dax - instance data for a subdivision of a dax region, and
* data while the device is activated in the driver.
* @region - parent region
* @dax_dev - core dax functionality
* @dev - device core
* @pgmap - pgmap for memmap setup / lifetime (driver owned)
* @ref: pgmap reference count (driver owned)
* @cmp: @ref final put completion (driver owned)
*/
struct dev_dax {
struct dax_region *region;
struct dax_device *dax_dev;
struct device dev;
struct dev_pagemap pgmap;
struct percpu_ref ref;
struct completion cmp;
};
static inline struct dev_dax *to_dev_dax(struct device *dev)