Lines Matching refs:nsio

255 	struct nd_namespace_io *nsio = to_nd_namespace_io(&ndns->dev);  in nsio_rw_bytes()  local
263 if (unlikely(offset + size > nsio->size)) { in nsio_rw_bytes()
269 if (unlikely(is_bad_pmem(&nsio->bb, sector, sz_align))) in nsio_rw_bytes()
271 if (copy_mc_to_kernel(buf, nsio->addr + offset, size) != 0) in nsio_rw_bytes()
276 if (unlikely(is_bad_pmem(&nsio->bb, sector, sz_align))) { in nsio_rw_bytes()
283 nsio->res.start + offset, size); in nsio_rw_bytes()
288 badblocks_clear(&nsio->bb, sector, cleared); in nsio_rw_bytes()
290 arch_invalidate_pmem(nsio->addr + offset, size); in nsio_rw_bytes()
295 memcpy_flushcache(nsio->addr + offset, buf, size); in nsio_rw_bytes()
303 int devm_nsio_enable(struct device *dev, struct nd_namespace_io *nsio, in devm_nsio_enable() argument
306 struct nd_namespace_common *ndns = &nsio->common; in devm_nsio_enable()
308 .start = nsio->res.start, in devm_nsio_enable()
309 .end = nsio->res.end, in devm_nsio_enable()
312 nsio->size = size; in devm_nsio_enable()
315 dev_warn(dev, "could not reserve region %pR\n", &nsio->res); in devm_nsio_enable()
320 if (devm_init_badblocks(dev, &nsio->bb)) in devm_nsio_enable()
322 nvdimm_badblocks_populate(to_nd_region(ndns->dev.parent), &nsio->bb, in devm_nsio_enable()
325 nsio->addr = devm_memremap(dev, range.start, size, ARCH_MEMREMAP_PMEM); in devm_nsio_enable()
327 return PTR_ERR_OR_ZERO(nsio->addr); in devm_nsio_enable()
330 void devm_nsio_disable(struct device *dev, struct nd_namespace_io *nsio) in devm_nsio_disable() argument
332 struct resource *res = &nsio->res; in devm_nsio_disable()
334 devm_memunmap(dev, nsio->addr); in devm_nsio_disable()
335 devm_exit_badblocks(dev, &nsio->bb); in devm_nsio_disable()
336 devm_release_mem_region(dev, res->start, nsio->size); in devm_nsio_disable()