summaryrefslogtreecommitdiff
path: root/drivers/nvdimm
diff options
context:
space:
mode:
authorFabian Frederick <fabf@skynet.be>2016-12-04 10:48:58 -0800
committerDan Williams <dan.j.williams@intel.com>2016-12-04 10:48:58 -0800
commit0a3f27b9a6a8f76f1df270e1a18b096f8f5d5dbc (patch)
tree3f3b1f067e0c881b83720016ecc27757e33c6b88 /drivers/nvdimm
parentd37806dc37b42b05515849b0444f09f493cb4cba (diff)
libnvdimm, namespace: avoid multiple sector calculations
Use sector_t for cleared Suggested-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Fabian Frederick <fabf@skynet.be> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/nvdimm')
-rw-r--r--drivers/nvdimm/pmem.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c
index 34f16a17c07b..bcc359a4e64d 100644
--- a/drivers/nvdimm/pmem.c
+++ b/drivers/nvdimm/pmem.c
@@ -51,17 +51,16 @@ static void pmem_clear_poison(struct pmem_device *pmem, phys_addr_t offset,
unsigned int len)
{
struct device *dev = to_dev(pmem);
- sector_t sector;
- long cleared;
+ sector_t sector, cleared;
sector = (offset - pmem->data_offset) / 512;
- cleared = nvdimm_clear_poison(dev, pmem->phys_addr + offset, len);
+ cleared = nvdimm_clear_poison(dev, pmem->phys_addr + offset, len) / 512;
- if (cleared > 0 && cleared / 512) {
+ if (cleared) {
dev_dbg(dev, "%s: %#llx clear %ld sector%s\n",
__func__, (unsigned long long) sector,
- cleared / 512, cleared / 512 > 1 ? "s" : "");
- badblocks_clear(&pmem->bb, sector, cleared / 512);
+ cleared, cleared > 1 ? "s" : "");
+ badblocks_clear(&pmem->bb, sector, cleared);
}
invalidate_pmem(pmem->virt_addr + offset, len);
}