Commit 2c9e8c01 authored by Nicolin Chen's avatar Nicolin Chen Committed by Alex Williamson

drm/i915/gvt: Replace roundup with DIV_ROUND_UP

It's a bit redundant for the maths here using roundup.
Suggested-by: default avatarJason Gunthorpe <jgg@nvidia.com>
Tested-by: default avatarTerrence Xu <terrence.xu@intel.com>
Signed-off-by: default avatarNicolin Chen <nicolinc@nvidia.com>
Link: https://lore.kernel.org/r/20220723020256.30081-3-nicolinc@nvidia.comSigned-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
parent e8f90717
...@@ -231,11 +231,9 @@ static void intel_gvt_cleanup_vgpu_type_groups(struct intel_gvt *gvt) ...@@ -231,11 +231,9 @@ static void intel_gvt_cleanup_vgpu_type_groups(struct intel_gvt *gvt)
static void gvt_unpin_guest_page(struct intel_vgpu *vgpu, unsigned long gfn, static void gvt_unpin_guest_page(struct intel_vgpu *vgpu, unsigned long gfn,
unsigned long size) unsigned long size)
{ {
int total_pages; int total_pages = DIV_ROUND_UP(size, PAGE_SIZE);
int npage; int npage;
total_pages = roundup(size, PAGE_SIZE) / PAGE_SIZE;
for (npage = 0; npage < total_pages; npage++) { for (npage = 0; npage < total_pages; npage++) {
unsigned long cur_gfn = gfn + npage; unsigned long cur_gfn = gfn + npage;
...@@ -247,12 +245,11 @@ static void gvt_unpin_guest_page(struct intel_vgpu *vgpu, unsigned long gfn, ...@@ -247,12 +245,11 @@ static void gvt_unpin_guest_page(struct intel_vgpu *vgpu, unsigned long gfn,
static int gvt_pin_guest_page(struct intel_vgpu *vgpu, unsigned long gfn, static int gvt_pin_guest_page(struct intel_vgpu *vgpu, unsigned long gfn,
unsigned long size, struct page **page) unsigned long size, struct page **page)
{ {
int total_pages = DIV_ROUND_UP(size, PAGE_SIZE);
unsigned long base_pfn = 0; unsigned long base_pfn = 0;
int total_pages;
int npage; int npage;
int ret; int ret;
total_pages = roundup(size, PAGE_SIZE) / PAGE_SIZE;
/* /*
* We pin the pages one-by-one to avoid allocating a big arrary * We pin the pages one-by-one to avoid allocating a big arrary
* on stack to hold pfns. * on stack to hold pfns.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment