Commit f53d5aa0 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Michael S. Tsirkin

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: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Reviewed-by: default avatarJason Wang <jasowang@redhat.com>
parent 520eccdf
...@@ -541,12 +541,9 @@ virtblk_cache_type_store(struct device *dev, struct device_attribute *attr, ...@@ -541,12 +541,9 @@ virtblk_cache_type_store(struct device *dev, struct device_attribute *attr,
int i; int i;
BUG_ON(!virtio_has_feature(vblk->vdev, VIRTIO_BLK_F_CONFIG_WCE)); BUG_ON(!virtio_has_feature(vblk->vdev, VIRTIO_BLK_F_CONFIG_WCE));
for (i = ARRAY_SIZE(virtblk_cache_types); --i >= 0; ) i = sysfs_match_string(virtblk_cache_types, buf);
if (sysfs_streq(buf, virtblk_cache_types[i]))
break;
if (i < 0) if (i < 0)
return -EINVAL; return i;
virtio_cwrite8(vdev, offsetof(struct virtio_blk_config, wce), i); virtio_cwrite8(vdev, offsetof(struct virtio_blk_config, wce), i);
virtblk_update_cache_mode(vdev); virtblk_update_cache_mode(vdev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment