From: Eric Farman Date: Thu, 6 Jun 2019 20:28:28 +0000 (+0200) Subject: vfio-ccw: Adjust the first IDAW outside of the nested loops X-Git-Tag: v5.4-rc1~692^2~17^2~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8aabf0edae4a6cc82042785079075aebf7cd5c79;p=platform%2Fkernel%2Flinux-rpi.git vfio-ccw: Adjust the first IDAW outside of the nested loops Now that pfn_array_table[] is always an array of 1, it seems silly to check for the very first entry in an array in the middle of two nested loops, since we know it'll only ever happen once. Let's move this outside the loops to simplify things, even though the "k" variable is still necessary. Signed-off-by: Eric Farman Reviewed-by: Cornelia Huck Message-Id: <20190606202831.44135-7-farman@linux.ibm.com> Signed-off-by: Cornelia Huck --- diff --git a/drivers/s390/cio/vfio_ccw_cp.c b/drivers/s390/cio/vfio_ccw_cp.c index 86a0e76..ab9f8f0 100644 --- a/drivers/s390/cio/vfio_ccw_cp.c +++ b/drivers/s390/cio/vfio_ccw_cp.c @@ -201,11 +201,12 @@ static inline void pfn_array_table_idal_create_words( pa = pat->pat_pa + i; for (j = 0; j < pa->pa_nr; j++) { idaws[k] = pa->pa_pfn[j] << PAGE_SHIFT; - if (k == 0) - idaws[k] += pa->pa_iova & (PAGE_SIZE - 1); k++; } } + + /* Adjust the first IDAW, since it may not start on a page boundary */ + idaws[0] += pat->pat_pa->pa_iova & (PAGE_SIZE - 1); }