git: 7de88bb4a2e8 - main - xen/grant_table: cleanup max_nr_grant_frames()

Roger Pau Monné royger at FreeBSD.org
Wed Jul 28 15:28:02 UTC 2021


The branch main has been updated by royger:

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

commit 7de88bb4a2e872f72b6d443547c50178799b8366
Author:     Elliott Mitchell <ehem+freebsd at m5p.com>
AuthorDate: 2021-04-10 06:12:25 +0000
Commit:     Roger Pau Monné <royger at FreeBSD.org>
CommitDate: 2021-07-28 15:27:04 +0000

    xen/grant_table: cleanup max_nr_grant_frames()
    
    This is no more or less than returning the smaller of two values.  Since
    this is what min() does, use that to shrink max_nr_grant_frames() down
    to the single line.
    
    Reviewed by: royger
    Differential Revision: https://reviews.freebsd.org/D29840
---
 sys/dev/xen/grant_table/grant_table.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/sys/dev/xen/grant_table/grant_table.c b/sys/dev/xen/grant_table/grant_table.c
index ad43a4121728..6dc11cac1bc4 100644
--- a/sys/dev/xen/grant_table/grant_table.c
+++ b/sys/dev/xen/grant_table/grant_table.c
@@ -471,11 +471,8 @@ __max_nr_grant_frames(void)
 static inline
 unsigned int max_nr_grant_frames(void)
 {
-	unsigned int xen_max = __max_nr_grant_frames();
 
-	if (xen_max > boot_max_nr_grant_frames)
-		return (boot_max_nr_grant_frames);
-	return (xen_max);
+	return (min(__max_nr_grant_frames(), boot_max_nr_grant_frames));
 }
 
 #ifdef notyet


More information about the dev-commits-src-all mailing list