Skip to content

Commit

Permalink
vfio-ccw: Adjust the first IDAW outside of the nested loops
Browse files Browse the repository at this point in the history
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 <farman@linux.ibm.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Message-Id: <20190606202831.44135-7-farman@linux.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
  • Loading branch information
Eric Farman authored and Cornelia Huck committed Jun 17, 2019
1 parent cc06ee9 commit 8aabf0e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/s390/cio/vfio_ccw_cp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}


Expand Down

0 comments on commit 8aabf0e

Please sign in to comment.