git: 65c4ec887eec - main - gdma: use ispower2

From: Doug Moore <dougm_at_FreeBSD.org>
Date: Sat, 28 Sep 2024 21:26:49 UTC
The branch main has been updated by dougm:

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

commit 65c4ec887eec1f1967557cc3f2656df76b5898bb
Author:     Doug Moore <dougm@FreeBSD.org>
AuthorDate: 2024-09-28 21:17:03 +0000
Commit:     Doug Moore <dougm@FreeBSD.org>
CommitDate: 2024-09-28 21:17:03 +0000

    gdma: use ispower2
    
    It's faster to use ispower2(n) than it is to compute
    roundup_pow_of_two and do a comparison.  So do the former.
    
    Reviewed by:    kib
    Differential Revision:  https://reviews.freebsd.org/D46838
---
 sys/dev/mana/gdma_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/dev/mana/gdma_main.c b/sys/dev/mana/gdma_main.c
index 13f2617ad7d4..59ac6911c784 100644
--- a/sys/dev/mana/gdma_main.c
+++ b/sys/dev/mana/gdma_main.c
@@ -221,7 +221,7 @@ mana_gd_alloc_memory(struct gdma_context *gc, unsigned int length,
 	if (!gc || !gmi)
 		return EINVAL;
 
-	if (length < PAGE_SIZE || (length != roundup_pow_of_two(length)))
+	if (length < PAGE_SIZE || !powerof2(length))
 		return EINVAL;
 
 	err = bus_dma_tag_create(bus_get_dma_tag(gc->dev),	/* parent */