Lines Matching refs:ndd

40 static int validate_dimm(struct nvdimm_drvdata *ndd)
44 if (!ndd)
47 rc = nvdimm_check_config_data(ndd->dev);
49 dev_dbg(ndd->dev, "%ps: %s error: %d\n",
58 int nvdimm_init_nsarea(struct nvdimm_drvdata *ndd)
60 struct nd_cmd_get_config_size *cmd = &ndd->nsarea;
61 struct nvdimm_bus *nvdimm_bus = walk_to_nvdimm_bus(ndd->dev);
63 int rc = validate_dimm(ndd);
74 rc = nd_desc->ndctl(nd_desc, to_nvdimm(ndd->dev),
81 int nvdimm_get_config_data(struct nvdimm_drvdata *ndd, void *buf,
84 struct nvdimm_bus *nvdimm_bus = walk_to_nvdimm_bus(ndd->dev);
86 int rc = validate_dimm(ndd), cmd_rc = 0;
93 if (offset + len > ndd->nsarea.config_size)
96 max_cmd_size = min_t(u32, len, ndd->nsarea.max_xfer);
110 rc = nd_desc->ndctl(nd_desc, to_nvdimm(ndd->dev),
127 int nvdimm_set_config_data(struct nvdimm_drvdata *ndd, size_t offset,
132 int rc = validate_dimm(ndd), cmd_rc = 0;
133 struct nvdimm_bus *nvdimm_bus = walk_to_nvdimm_bus(ndd->dev);
139 if (offset + len > ndd->nsarea.config_size)
142 max_cmd_size = min_t(u32, len, ndd->nsarea.max_xfer);
158 rc = nd_desc->ndctl(nd_desc, to_nvdimm(ndd->dev),
222 struct nvdimm_drvdata *ndd = container_of(kref, typeof(*ndd), kref);
223 struct device *dev = ndd->dev;
228 for_each_dpa_resource_safe(ndd, res, _r)
229 nvdimm_free_dpa(ndd, res);
232 kvfree(ndd->data);
233 kfree(ndd);
237 void get_ndd(struct nvdimm_drvdata *ndd)
239 kref_get(&ndd->kref);
242 void put_ndd(struct nvdimm_drvdata *ndd)
244 if (ndd)
245 kref_put(&ndd->kref, nvdimm_drvdata_release);
317 static ssize_t __available_slots_show(struct nvdimm_drvdata *ndd, char *buf)
323 if (!ndd)
326 dev = ndd->dev;
328 nfree = nd_label_nfree(ndd);
729 struct nvdimm_drvdata *ndd = to_ndd(nd_mapping);
736 if (!ndd)
743 nvdimm_bus = walk_to_nvdimm_bus(ndd->dev);
746 for_each_dpa_resource(ndd, res) {
774 struct nvdimm_drvdata *ndd = to_ndd(nd_mapping);
779 if (!ndd)
788 for_each_dpa_resource(ndd, res) {
795 nd_dbg_dpa(nd_region, ndd, res,
813 void nvdimm_free_dpa(struct nvdimm_drvdata *ndd, struct resource *res)
815 WARN_ON_ONCE(!is_nvdimm_bus_locked(ndd->dev));
817 __release_region(&ndd->dpa, res->start, resource_size(res));
820 struct resource *nvdimm_allocate_dpa(struct nvdimm_drvdata *ndd,
830 WARN_ON_ONCE(!is_nvdimm_bus_locked(ndd->dev));
831 res = __request_region(&ndd->dpa, start, n, name, 0);
842 resource_size_t nvdimm_allocated_dpa(struct nvdimm_drvdata *ndd,
848 for_each_dpa_resource(ndd, res)