diff mbox

[7/8] gnttab: use DIV_ROUND_UP() instead of open-coding it

Message ID 5993245E020000780016FF18@prv-mh.provo.novell.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jan Beulich Aug. 15, 2017, 2:42 p.m. UTC
Also adjust formatting of nearby code.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

Comments

Andrew Cooper Aug. 15, 2017, 5:15 p.m. UTC | #1
On 15/08/17 15:42, Jan Beulich wrote:
> Also adjust formatting of nearby code.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
diff mbox

Patch

--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -206,11 +206,13 @@  static inline void gnttab_flush_tlb(cons
 static inline unsigned int
 num_act_frames_from_sha_frames(const unsigned int num)
 {
-    /* How many frames are needed for the active grant table,
-     * given the size of the shared grant table? */
+    /*
+     * How many frames are needed for the active grant table,
+     * given the size of the shared grant table?
+     */
     unsigned int sha_per_page = PAGE_SIZE / sizeof(grant_entry_v1_t);
-    unsigned int num_sha_entries = num * sha_per_page;
-    return (num_sha_entries + (ACGNT_PER_PAGE - 1)) / ACGNT_PER_PAGE;
+
+    return DIV_ROUND_UP(num * sha_per_page, ACGNT_PER_PAGE);
 }
 
 #define max_nr_active_grant_frames \