s390/zcrypt: simplify cca_findcard2 loop code
authorHarald Freudenberger <freude@linux.ibm.com>
Wed, 9 Sep 2020 10:02:46 +0000 (12:02 +0200)
committerVasily Gorbik <gor@linux.ibm.com>
Mon, 14 Sep 2020 09:34:20 +0000 (11:34 +0200)
commit0d574ad33e5b70383b4cee81024fcb8763aac591
treeb3362e212130465a42a3cbdb8e8af4a48e03db03
parent180a4c42e541cabe478c3f6e6c986a6b61744407
s390/zcrypt: simplify cca_findcard2 loop code

Instead of two times go through the list of available AP devices
(which may be up to 256 * 256 entries) this patch reworks the code do
only run through once.  The price is instead of reporting all possible
devices to the caller only the first 256 devices are collected.
However, having to choose from 256 AP devices is plenty of resources
and should fulfill the caller's requirements. On the other side
the loop code is much simplier and more easy to maintain.

Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>
Reviewed-by: Ingo Franzki <ifranzki@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
drivers/s390/crypto/zcrypt_ccamisc.c