All of lore.kernel.org
 help / color / mirror / Atom feed
From: Janosch Frank <frankja@linux.ibm.com>
To: kvm@vger.kernel.org
Cc: linux-s390@vger.kernel.org, imbrenda@linux.ibm.com,
	david@redhat.com, thuth@redhat.com, nrb@linux.ibm.com,
	seiden@linux.ibm.com
Subject: [kvm-unit-tests PATCH 3/8] s390x: pfmf: Initialize pfmf_r1 union on declaration
Date: Tue,  5 Apr 2022 07:52:20 +0000	[thread overview]
Message-ID: <20220405075225.15903-4-frankja@linux.ibm.com> (raw)
In-Reply-To: <20220405075225.15903-1-frankja@linux.ibm.com>

Let's make this test look a bit nicer.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
---
 s390x/pfmf.c | 39 +++++++++++++++++++--------------------
 1 file changed, 19 insertions(+), 20 deletions(-)

diff --git a/s390x/pfmf.c b/s390x/pfmf.c
index aa130529..178abb5a 100644
--- a/s390x/pfmf.c
+++ b/s390x/pfmf.c
@@ -28,7 +28,11 @@ static void test_priv(void)
 
 static void test_4k_key(void)
 {
-	union pfmf_r1 r1;
+	union pfmf_r1 r1 = {
+		.reg.sk = 1,
+		.reg.fsc = PFMF_FSC_4K,
+		.reg.key = 0x30,
+	};
 	union skey skey;
 
 	report_prefix_push("4K");
@@ -36,10 +40,6 @@ static void test_4k_key(void)
 		report_skip("storage key removal facility is active");
 		goto out;
 	}
-	r1.val = 0;
-	r1.reg.sk = 1;
-	r1.reg.fsc = PFMF_FSC_4K;
-	r1.reg.key = 0x30;
 	pfmf(r1.val, pagebuf);
 	skey.val = get_storage_key(pagebuf);
 	skey.val &= SKEY_ACC | SKEY_FP;
@@ -52,18 +52,19 @@ static void test_1m_key(void)
 {
 	int i;
 	bool rp = true;
-	union pfmf_r1 r1;
 	union skey skey;
+	union pfmf_r1 r1 = {
+		.reg.fsc = PFMF_FSC_1M,
+		.reg.key = 0x30,
+		.reg.sk = 1,
+	};
 
 	report_prefix_push("1M");
 	if (test_facility(169)) {
 		report_skip("storage key removal facility is active");
 		goto out;
 	}
-	r1.val = 0;
-	r1.reg.sk = 1;
-	r1.reg.fsc = PFMF_FSC_1M;
-	r1.reg.key = 0x30;
+
 	pfmf(r1.val, pagebuf);
 	for (i = 0; i < 256; i++) {
 		skey.val = get_storage_key(pagebuf + i * PAGE_SIZE);
@@ -80,11 +81,10 @@ out:
 
 static void test_4k_clear(void)
 {
-	union pfmf_r1 r1;
-
-	r1.val = 0;
-	r1.reg.cf = 1;
-	r1.reg.fsc = PFMF_FSC_4K;
+	union pfmf_r1 r1 = {
+		.reg.cf = 1,
+		.reg.fsc = PFMF_FSC_4K,
+	};
 
 	report_prefix_push("4K");
 	memset(pagebuf, 42, PAGE_SIZE);
@@ -97,13 +97,12 @@ static void test_4k_clear(void)
 static void test_1m_clear(void)
 {
 	int i;
-	union pfmf_r1 r1;
+	union pfmf_r1 r1 = {
+		.reg.cf = 1,
+		.reg.fsc = PFMF_FSC_1M,
+	};
 	unsigned long sum = 0;
 
-	r1.val = 0;
-	r1.reg.cf = 1;
-	r1.reg.fsc = PFMF_FSC_1M;
-
 	report_prefix_push("1M");
 	memset(pagebuf, 42, PAGE_SIZE * 256);
 	pfmf(r1.val, pagebuf);
-- 
2.32.0


  parent reply	other threads:[~2022-04-05  8:03 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-05  7:52 [kvm-unit-tests PATCH 0/8] s390x: Cleanup and maintenance 4 Janosch Frank
2022-04-05  7:52 ` [kvm-unit-tests PATCH 1/8] s390x: css: Skip if we're not run by qemu Janosch Frank
2022-04-05  8:34   ` Thomas Huth
2022-04-05 10:59   ` Claudio Imbrenda
2022-04-05  7:52 ` [kvm-unit-tests PATCH 2/8] s390x: diag308: Only test subcode 2 under QEMU Janosch Frank
2022-04-05  9:18   ` Thomas Huth
2022-04-05  9:33     ` Janosch Frank
2022-04-05  9:50       ` Thomas Huth
2022-04-05 10:24         ` Janosch Frank
2022-04-05  7:52 ` Janosch Frank [this message]
2022-04-05  9:52   ` [kvm-unit-tests PATCH 3/8] s390x: pfmf: Initialize pfmf_r1 union on declaration Thomas Huth
2022-04-05 11:03   ` Claudio Imbrenda
2022-04-05  7:52 ` [kvm-unit-tests PATCH 4/8] s390x: snippets: asm: Add license and copyright headers Janosch Frank
2022-04-05 11:04   ` Claudio Imbrenda
2022-04-05  7:52 ` [kvm-unit-tests PATCH 5/8] s390x: pv-diags: Cleanup includes Janosch Frank
2022-04-05 11:04   ` Claudio Imbrenda
2022-04-06  6:50   ` Thomas Huth
2022-04-06 15:27     ` Janosch Frank
2022-04-05  7:52 ` [kvm-unit-tests PATCH 6/8] s390x: css: " Janosch Frank
2022-04-05 11:04   ` Claudio Imbrenda
2022-04-05  7:52 ` [kvm-unit-tests PATCH 7/8] s390x: iep: " Janosch Frank
2022-04-05 11:05   ` Claudio Imbrenda
2022-04-05  7:52 ` [kvm-unit-tests PATCH 8/8] s390x: mvpg: " Janosch Frank
2022-04-05 11:05   ` Claudio Imbrenda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220405075225.15903-4-frankja@linux.ibm.com \
    --to=frankja@linux.ibm.com \
    --cc=david@redhat.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=nrb@linux.ibm.com \
    --cc=seiden@linux.ibm.com \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.