git: a527b9cb721a - main - axgbe: use standard rounddown_pow_of_two

From: Doug Moore <dougm_at_FreeBSD.org>
Date: Thu, 18 Jul 2024 18:59:05 UTC
The branch main has been updated by dougm:

URL: https://cgit.FreeBSD.org/src/commit/?id=a527b9cb721a597a0bc5313ac55290cc6a91deac

commit a527b9cb721a597a0bc5313ac55290cc6a91deac
Author:     Doug Moore <dougm@FreeBSD.org>
AuthorDate: 2024-07-18 18:56:31 +0000
Commit:     Doug Moore <dougm@FreeBSD.org>
CommitDate: 2024-07-18 18:56:31 +0000

    axgbe: use standard rounddown_pow_of_two
    
    Drop an implementation of __rounddown_pow_of_two, which triggers
    Coverity warnings, and use the libkern implementation of
    rounddown_pow_of_two instead.
    
    Reviewed by:    markj
    Differential Revision:  https://reviews.freebsd.org/D46022
---
 sys/dev/axgbe/xgbe-sysctl.c | 20 ++------------------
 1 file changed, 2 insertions(+), 18 deletions(-)

diff --git a/sys/dev/axgbe/xgbe-sysctl.c b/sys/dev/axgbe/xgbe-sysctl.c
index 16523381e1a3..df81b1d7f0ae 100644
--- a/sys/dev/axgbe/xgbe-sysctl.c
+++ b/sys/dev/axgbe/xgbe-sysctl.c
@@ -244,22 +244,6 @@ exit_bad_op(void)
 	return(-EINVAL);
 }
 
-static inline unsigned
-fls_long(unsigned long l)
-{
-
-	if (sizeof(l) == 4)
-		return (fls(l));
-	return (fls64(l));
-}
-
-static inline __attribute__((const))
-unsigned long __rounddown_pow_of_two(unsigned long n)
-{
-
-	return (1UL << (fls_long(n) - 1));
-}
-
 static inline int
 get_ubuf(struct sysctl_req *req, char *ubuf)
 {
@@ -1049,12 +1033,12 @@ sysctl_ringparam_handler(SYSCTL_HANDLER_ARGS)
 			return (-EINVAL);
 		}
 
-		rx = __rounddown_pow_of_two(sys_op->rx_pending);
+		rx = rounddown_pow_of_two(sys_op->rx_pending);
 		if (rx != sys_op->rx_pending)
 			axgbe_printf(1,	"rx ring param rounded to power of 2: %u\n",
 			    rx);
 
-		tx = __rounddown_pow_of_two(sys_op->tx_pending);
+		tx = rounddown_pow_of_two(sys_op->tx_pending);
 		if (tx != sys_op->tx_pending)
 			axgbe_printf(1, "tx ring param rounded to power of 2: %u\n",
 			    tx);