diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2017-06-09 08:07:42 -0400 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2017-07-25 09:37:34 -0400 |
commit | f53d5aa050dafe19bb4a1e37d73880aee2490a68 (patch) | |
tree | 3ddc3d6babe1d30029d4fde4f50e225363d2222c | |
parent | 520eccdfe187591a51ea9ab4c1a024ae4d0f68d9 (diff) |
virtio_blk: Use sysfs_match_string() helper
Use sysfs_match_string() helper instead of open coded variant.
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Jason Wang <jasowang@redhat.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Jason Wang <jasowang@redhat.com>
-rw-r--r-- | drivers/block/virtio_blk.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 4e02aa5fdac0..1498b899a593 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, | |||
541 | int i; | 541 | int i; |
542 | 542 | ||
543 | BUG_ON(!virtio_has_feature(vblk->vdev, VIRTIO_BLK_F_CONFIG_WCE)); | 543 | BUG_ON(!virtio_has_feature(vblk->vdev, VIRTIO_BLK_F_CONFIG_WCE)); |
544 | for (i = ARRAY_SIZE(virtblk_cache_types); --i >= 0; ) | 544 | i = sysfs_match_string(virtblk_cache_types, buf); |
545 | if (sysfs_streq(buf, virtblk_cache_types[i])) | ||
546 | break; | ||
547 | |||
548 | if (i < 0) | 545 | if (i < 0) |
549 | return -EINVAL; | 546 | return i; |
550 | 547 | ||
551 | virtio_cwrite8(vdev, offsetof(struct virtio_blk_config, wce), i); | 548 | virtio_cwrite8(vdev, offsetof(struct virtio_blk_config, wce), i); |
552 | virtblk_update_cache_mode(vdev); | 549 | virtblk_update_cache_mode(vdev); |