On Thu, Mar 13, 2025 at 05:25:14PM +0530, Harsha Vardhan V M wrote: > Remove custom string functions and replace them with normal string > functions. Remove the custom strtou32 and replace it with str2long. > > Signed-off-by: Harsha Vardhan V M <[email protected]>
Thanks for doing this.
> ---
> cmd/fuse.c | 27 ++++++++-------------------
> 1 file changed, 8 insertions(+), 19 deletions(-)
>
> diff --git a/cmd/fuse.c b/cmd/fuse.c
> index 598ef496a43..9f489570634 100644
> --- a/cmd/fuse.c
> +++ b/cmd/fuse.c
> @@ -15,17 +15,6 @@
> #include <vsprintf.h>
> #include <linux/errno.h>
>
> -static int strtou32(const char *str, unsigned int base, u32 *result)
> -{
> - char *ep;
> -
> - *result = simple_strtoul(str, &ep, base);
> - if (ep == str || *ep != '\0')
> - return -EINVAL;
> -
> - return 0;
> -}
> -
> static int confirm_prog(void)
> {
> puts("Warning: Programming fuses is an irreversible operation!\n"
> @@ -54,14 +43,14 @@ static int do_fuse(struct cmd_tbl *cmdtp, int flag, int
> argc,
> argc -= 2 + confirmed;
> argv += 2 + confirmed;
>
> - if (argc < 2 || strtou32(argv[0], 0, &bank) ||
> - strtou32(argv[1], 0, &word))
> + if (argc < 2 || !(str2long(argv[0], (ulong *)&bank)) ||
> + !(str2long(argv[1], (ulong *)&word)))
I didn't know we had "str2long" which is a differently rarely used
function. Why not just simple_strtoul inline? Am I missing something?
Thanks.
--
Tom
signature.asc
Description: PGP signature

