Skip to content

Commit 89e0341

Browse files
commodoaxboe
authored andcommitted
bcache: use sysfs_match_string() instead of __sysfs_match_string()
The arrays (of strings) that are passed to __sysfs_match_string() are static, so use sysfs_match_string() which does an implicit ARRAY_SIZE() over these arrays. Functionally, this doesn't change anything. The change is more cosmetic. It only shrinks the static arrays by 1 byte each. Signed-off-by: Alexandru Ardelean <[email protected]> Signed-off-by: Coly Li <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent f960fac commit 89e0341

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

drivers/md/bcache/sysfs.c

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,28 +21,24 @@ static const char * const bch_cache_modes[] = {
2121
"writethrough",
2222
"writeback",
2323
"writearound",
24-
"none",
25-
NULL
24+
"none"
2625
};
2726

2827
/* Default is 0 ("auto") */
2928
static const char * const bch_stop_on_failure_modes[] = {
3029
"auto",
31-
"always",
32-
NULL
30+
"always"
3331
};
3432

3533
static const char * const cache_replacement_policies[] = {
3634
"lru",
3735
"fifo",
38-
"random",
39-
NULL
36+
"random"
4037
};
4138

4239
static const char * const error_actions[] = {
4340
"unregister",
44-
"panic",
45-
NULL
41+
"panic"
4642
};
4743

4844
write_attribute(attach);
@@ -333,7 +329,7 @@ STORE(__cached_dev)
333329
bch_cached_dev_run(dc);
334330

335331
if (attr == &sysfs_cache_mode) {
336-
v = __sysfs_match_string(bch_cache_modes, -1, buf);
332+
v = sysfs_match_string(bch_cache_modes, buf);
337333
if (v < 0)
338334
return v;
339335

@@ -344,7 +340,7 @@ STORE(__cached_dev)
344340
}
345341

346342
if (attr == &sysfs_stop_when_cache_set_failed) {
347-
v = __sysfs_match_string(bch_stop_on_failure_modes, -1, buf);
343+
v = sysfs_match_string(bch_stop_on_failure_modes, buf);
348344
if (v < 0)
349345
return v;
350346

@@ -799,7 +795,7 @@ STORE(__bch_cache_set)
799795
0, UINT_MAX);
800796

801797
if (attr == &sysfs_errors) {
802-
v = __sysfs_match_string(error_actions, -1, buf);
798+
v = sysfs_match_string(error_actions, buf);
803799
if (v < 0)
804800
return v;
805801

@@ -1063,7 +1059,7 @@ STORE(__bch_cache)
10631059
}
10641060

10651061
if (attr == &sysfs_cache_replacement_policy) {
1066-
v = __sysfs_match_string(cache_replacement_policies, -1, buf);
1062+
v = sysfs_match_string(cache_replacement_policies, buf);
10671063
if (v < 0)
10681064
return v;
10691065

0 commit comments

Comments
 (0)