in bus.c [1096:1124]
static ssize_t mapping_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t len)
{
struct dev_dax *dev_dax = to_dev_dax(dev);
struct dax_region *dax_region = dev_dax->region;
size_t to_alloc;
struct range r;
ssize_t rc;
rc = range_parse(buf, len, &r);
if (rc)
return rc;
rc = -ENXIO;
device_lock(dax_region->dev);
if (!dax_region->dev->driver) {
device_unlock(dax_region->dev);
return rc;
}
device_lock(dev);
to_alloc = range_len(&r);
if (alloc_is_aligned(dev_dax, to_alloc))
rc = alloc_dev_dax_range(dev_dax, r.start, to_alloc);
device_unlock(dev);
device_unlock(dax_region->dev);
return rc == 0 ? len : rc;
}