All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Ahern <dsahern@kernel.org>
To: netdev@vger.kernel.org
Cc: stephen@networkplumber.org, parav@nvidia.com, jiri@nvidia.com,
	David Ahern <dsahern@kernel.org>
Subject: [PATCH iproute2-next 4/4] devlink: Remove strtouint8_t in favor of get_u8
Date: Wed, 16 Feb 2022 19:57:11 -0700	[thread overview]
Message-ID: <20220217025711.9369-5-dsahern@kernel.org> (raw)
In-Reply-To: <20220217025711.9369-1-dsahern@kernel.org>

strtouint8_t duplicates get_u8; remove it.

Signed-off-by: David Ahern <dsahern@kernel.org>
---
 devlink/devlink.c | 18 ++----------------
 1 file changed, 2 insertions(+), 16 deletions(-)

diff --git a/devlink/devlink.c b/devlink/devlink.c
index 54570df94b7f..da9f97788bcf 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -857,20 +857,6 @@ static int ifname_map_rev_lookup(struct dl *dl, const char *bus_name,
 	return -ENOENT;
 }
 
-static int strtouint8_t(const char *str, uint8_t *p_val)
-{
-	char *endptr;
-	unsigned long int val;
-
-	val = strtoul(str, &endptr, 10);
-	if (endptr == str || *endptr != '\0')
-		return -EINVAL;
-	if (val > UCHAR_MAX)
-		return -ERANGE;
-	*p_val = val;
-	return 0;
-}
-
 static int strtobool(const char *str, bool *p_val)
 {
 	bool val;
@@ -3123,7 +3109,7 @@ static int cmd_dev_param_set(struct dl *dl)
 						      &val_u32);
 			val_u8 = val_u32;
 		} else {
-			err = strtouint8_t(dl->opts.param_value, &val_u8);
+			err = get_u8(&val_u8, dl->opts.param_value, 10);
 		}
 		if (err)
 			goto err_param_value_parse;
@@ -4385,7 +4371,7 @@ static int cmd_port_param_set(struct dl *dl)
 						      &val_u32);
 			val_u8 = val_u32;
 		} else {
-			err = strtouint8_t(dl->opts.param_value, &val_u8);
+			err = get_u8(&val_u8, dl->opts.param_value, 10);
 		}
 		if (err)
 			goto err_param_value_parse;
-- 
2.24.3 (Apple Git-128)


  parent reply	other threads:[~2022-02-17  2:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-17  2:57 [PATCH iproute2-next 0/4] devlink: Remove custom string conversions David Ahern
2022-02-17  2:57 ` [PATCH iproute2-next 1/4] devlink: Remove strtouint64_t in favor of get_u64 David Ahern
2022-02-17  2:57 ` [PATCH iproute2-next 2/4] devlink: Remove strtouint32_t in favor of get_u32 David Ahern
2022-02-17  2:57 ` [PATCH iproute2-next 3/4] devlink: Remove strtouint16_t in favor of get_u16 David Ahern
2022-02-17  2:57 ` David Ahern [this message]
2022-02-21 16:40 ` [PATCH iproute2-next 0/4] devlink: Remove custom string conversions patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220217025711.9369-5-dsahern@kernel.org \
    --to=dsahern@kernel.org \
    --cc=jiri@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=parav@nvidia.com \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.