struct nvdimm *to_nvdimm(struct device *dev) { struct nvdimm *nvdimm = container_of(dev, struct nvdimm, dev); WARN_ON(!is_nvdimm(dev)); return nvdimm; }
static int count_dimms(struct device *dev, void *c) { int *count = c; if (is_nvdimm(dev)) (*count)++; return 0; }