Re: [PATCH] bcache: use sysfs_match_string() instead of __sysfs_match_string()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2019/5/7 5:43 下午, Alexandru Ardelean wrote:
> 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 <alexandru.ardelean@xxxxxxxxxx>

This patch is in my testing queue. Thanks.

Coly Li


> ---
>  drivers/md/bcache/sysfs.c | 20 ++++++++------------
>  1 file changed, 8 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/md/bcache/sysfs.c b/drivers/md/bcache/sysfs.c
> index 17bae9c14ca0..0dfd9d4fb1c8 100644
> --- a/drivers/md/bcache/sysfs.c
> +++ b/drivers/md/bcache/sysfs.c
> @@ -21,28 +21,24 @@ static const char * const bch_cache_modes[] = {
>  	"writethrough",
>  	"writeback",
>  	"writearound",
> -	"none",
> -	NULL
> +	"none"
>  };
>  
>  /* Default is 0 ("auto") */
>  static const char * const bch_stop_on_failure_modes[] = {
>  	"auto",
> -	"always",
> -	NULL
> +	"always"
>  };
>  
>  static const char * const cache_replacement_policies[] = {
>  	"lru",
>  	"fifo",
> -	"random",
> -	NULL
> +	"random"
>  };
>  
>  static const char * const error_actions[] = {
>  	"unregister",
> -	"panic",
> -	NULL
> +	"panic"
>  };
>  
>  write_attribute(attach);
> @@ -333,7 +329,7 @@ STORE(__cached_dev)
>  		bch_cached_dev_run(dc);
>  
>  	if (attr == &sysfs_cache_mode) {
> -		v = __sysfs_match_string(bch_cache_modes, -1, buf);
> +		v = sysfs_match_string(bch_cache_modes, buf);
>  		if (v < 0)
>  			return v;
>  
> @@ -344,7 +340,7 @@ STORE(__cached_dev)
>  	}
>  
>  	if (attr == &sysfs_stop_when_cache_set_failed) {
> -		v = __sysfs_match_string(bch_stop_on_failure_modes, -1, buf);
> +		v = sysfs_match_string(bch_stop_on_failure_modes, buf);
>  		if (v < 0)
>  			return v;
>  
> @@ -794,7 +790,7 @@ STORE(__bch_cache_set)
>  			    0, UINT_MAX);
>  
>  	if (attr == &sysfs_errors) {
> -		v = __sysfs_match_string(error_actions, -1, buf);
> +		v = sysfs_match_string(error_actions, buf);
>  		if (v < 0)
>  			return v;
>  
> @@ -1060,7 +1056,7 @@ STORE(__bch_cache)
>  	}
>  
>  	if (attr == &sysfs_cache_replacement_policy) {
> -		v = __sysfs_match_string(cache_replacement_policies, -1, buf);
> +		v = sysfs_match_string(cache_replacement_policies, buf);
>  		if (v < 0)
>  			return v;
>  
> 


-- 

Coly Li



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux ARM Kernel]     [Linux Filesystem Development]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux