]> Git Repo - linux.git/commitdiff
libnvdimm/namespace: Clean up holder_class_store()
authorDan Williams <[email protected]>
Mon, 4 Mar 2019 20:14:04 +0000 (12:14 -0800)
committerDan Williams <[email protected]>
Mon, 4 Mar 2019 20:26:41 +0000 (12:26 -0800)
Use sysfs_streq() in place of open-coded strcmp()'s that check for an
optional "\n" at the end of the input.

Reviewed-by: Vishal Verma <[email protected]>
Signed-off-by: Dan Williams <[email protected]>
drivers/nvdimm/namespace_devs.c

index 3677b0c4a33d7e1c23a4a712026b9b93291d5fd9..17fb7f931f0c2ec44477379c23e6c9ad17f6ae20 100644 (file)
@@ -1506,13 +1506,13 @@ static ssize_t __holder_class_store(struct device *dev, const char *buf)
        if (dev->driver || ndns->claim)
                return -EBUSY;
 
-       if (strcmp(buf, "btt") == 0 || strcmp(buf, "btt\n") == 0)
+       if (sysfs_streq(buf, "btt"))
                ndns->claim_class = btt_claim_class(dev);
-       else if (strcmp(buf, "pfn") == 0 || strcmp(buf, "pfn\n") == 0)
+       else if (sysfs_streq(buf, "pfn"))
                ndns->claim_class = NVDIMM_CCLASS_PFN;
-       else if (strcmp(buf, "dax") == 0 || strcmp(buf, "dax\n") == 0)
+       else if (sysfs_streq(buf, "dax"))
                ndns->claim_class = NVDIMM_CCLASS_DAX;
-       else if (strcmp(buf, "") == 0 || strcmp(buf, "\n") == 0)
+       else if (sysfs_streq(buf, ""))
                ndns->claim_class = NVDIMM_CCLASS_NONE;
        else
                return -EINVAL;
This page took 0.061112 seconds and 4 git commands to generate.