linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Verma, Vishal L" <vishal.l.verma@intel.com>
To: "Williams, Dan J" <dan.j.williams@intel.com>,
	"linux-nvdimm@lists.01.org" <linux-nvdimm@lists.01.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] libnvdimm/namespace: Clean up holder_class_store()
Date: Mon, 4 Mar 2019 20:36:35 +0000	[thread overview]
Message-ID: <a96203c060b8e7d589a251f53bec2cd0e57292d7.camel@intel.com> (raw)
In-Reply-To: <155173044436.4154095.17954771880753980013.stgit@dwillia2-desk3.amr.corp.intel.com>

On Mon, 2019-03-04 at 12:14 -0800, Dan Williams wrote:
> Use sysfs_streq() in place of open-coded strcmp()'s that check for an
> optional "\n" at the end of the input.
> 
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> ---
>  drivers/nvdimm/namespace_devs.c |    8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

Looks good,
Reviewed-by: Vishal Verma <vishal.l.verma@intel.com>

> 
> diff --git a/drivers/nvdimm/namespace_devs.c
> b/drivers/nvdimm/namespace_devs.c
> index 3677b0c4a33d..17fb7f931f0c 100644
> --- a/drivers/nvdimm/namespace_devs.c
> +++ b/drivers/nvdimm/namespace_devs.c
> @@ -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;
> 


      reply	other threads:[~2019-03-04 20:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-04 20:14 [PATCH] libnvdimm/namespace: Clean up holder_class_store() Dan Williams
2019-03-04 20:36 ` Verma, Vishal L [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a96203c060b8e7d589a251f53bec2cd0e57292d7.camel@intel.com \
    --to=vishal.l.verma@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvdimm@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).