From: Andy Shevchenko Date: Fri, 9 Jun 2017 12:07:42 +0000 (+0300) Subject: virtio_blk: Use sysfs_match_string() helper X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=f53d5aa050dafe19bb4a1e37d73880aee2490a68;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git virtio_blk: Use sysfs_match_string() helper Use sysfs_match_string() helper instead of open coded variant. Cc: "Michael S. Tsirkin" Cc: Jason Wang Signed-off-by: Andy Shevchenko Signed-off-by: Michael S. Tsirkin Reviewed-by: Jason Wang --- 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, 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);