projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
520eccd
)
virtio_blk: Use sysfs_match_string() helper
author
Andy Shevchenko
<
[email protected]
>
Fri, 9 Jun 2017 12:07:42 +0000
(15:07 +0300)
committer
Michael S. Tsirkin
<
[email protected]
>
Tue, 25 Jul 2017 13:37:34 +0000
(16:37 +0300)
Use sysfs_match_string() helper instead of open coded variant.
Cc: "Michael S. Tsirkin" <
[email protected]
>
Cc: Jason Wang <
[email protected]
>
Signed-off-by: Andy Shevchenko <
[email protected]
>
Signed-off-by: Michael S. Tsirkin <
[email protected]
>
Reviewed-by: Jason Wang <
[email protected]
>
drivers/block/virtio_blk.c
patch
|
blob
|
history
diff --git
a/drivers/block/virtio_blk.c
b/drivers/block/virtio_blk.c
index 4e02aa5fdac053dfa254fb05aac1b2c252e4c1be..1498b899a593e31951c835f4f537d1bb03d0e596 100644
(file)
--- 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);