lkml.org 
[lkml]   [2016]   [Feb]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 45/45] staging/lustre: Convert cfs_str2num_check to use kstrtoul
    Date
    From: Oleg Drokin <green@linuxhacker.ru>

    simple_strtoul is obsolete

    Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
    ---
    drivers/staging/lustre/lustre/libcfs/libcfs_string.c | 11 +++--------
    1 file changed, 3 insertions(+), 8 deletions(-)

    diff --git a/drivers/staging/lustre/lustre/libcfs/libcfs_string.c b/drivers/staging/lustre/lustre/libcfs/libcfs_string.c
    index 09ab0e4..9dca666 100644
    --- a/drivers/staging/lustre/lustre/libcfs/libcfs_string.c
    +++ b/drivers/staging/lustre/lustre/libcfs/libcfs_string.c
    @@ -229,18 +229,13 @@ int
    cfs_str2num_check(char *str, int nob, unsigned *num,
    unsigned min, unsigned max)
    {
    - char *endp;
    + int rc;

    str = cfs_trimwhite(str);
    - *num = simple_strtoul(str, &endp, 0);
    - if (endp == str)
    + rc = kstrtouint(str, 10, num);
    + if (rc)
    return 0;

    - for (; endp < str + nob; endp++) {
    - if (!isspace(*endp))
    - return 0;
    - }
    -
    return (*num >= min && *num <= max);
    }
    EXPORT_SYMBOL(cfs_str2num_check);
    --
    2.1.0
    \
     
     \ /
      Last update: 2016-02-16 07:22    [W:4.321 / U:0.080 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site