virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: virtualization@lists.linux-foundation.org, Jens Axboe <axboe@fb.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [PATCH v1] virtio_blk: Use sysfs_match_string() helper
Date: Mon, 03 Jul 2017 15:05:30 +0300	[thread overview]
Message-ID: <1499083530.22624.239.camel@linux.intel.com> (raw)
In-Reply-To: <20170609120742.21959-1-andriy.shevchenko@linux.intel.com>

On Fri, 2017-06-09 at 15:07 +0300, Andy Shevchenko wrote:
> Use sysfs_match_string() helper instead of open coded variant.

Did I miss maintainer?

> 
> Cc: "Michael S. Tsirkin" <mst@redhat.com>
> Cc: Jason Wang <jasowang@redhat.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/block/virtio_blk.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
> index 553cc4c542b4..0e707b8cce9d 100644
> --- a/drivers/block/virtio_blk.c
> +++ b/drivers/block/virtio_blk.c
> @@ -541,12 +541,9 @@ virtblk_cache_type_store(struct device *dev,
> struct device_attribute *attr,
>  	int i;
>  
>  	BUG_ON(!virtio_has_feature(vblk->vdev,
> VIRTIO_BLK_F_CONFIG_WCE));
> -	for (i = ARRAY_SIZE(virtblk_cache_types); --i >= 0; )
> -		if (sysfs_streq(buf, virtblk_cache_types[i]))
> -			break;
> -
> +	i = sysfs_match_string(virtblk_cache_types, buf);
>  	if (i < 0)
> -		return -EINVAL;
> +		return i;
>  
>  	virtio_cwrite8(vdev, offsetof(struct virtio_blk_config, wce),
> i);
>  	virtblk_update_cache_mode(vdev);

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

  reply	other threads:[~2017-07-03 12:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-09 12:07 [PATCH v1] virtio_blk: Use sysfs_match_string() helper Andy Shevchenko
2017-07-03 12:05 ` Andy Shevchenko [this message]
2017-07-03 16:37   ` Michael S. Tsirkin
2017-07-18 15:46     ` Andy Shevchenko
2017-07-18 16:25       ` Michael S. Tsirkin
2017-07-04 12:17   ` Jason Wang

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=1499083530.22624.239.camel@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=axboe@fb.com \
    --cc=mst@redhat.com \
    --cc=virtualization@lists.linux-foundation.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).