]> www.infradead.org Git - nvme.git/commitdiff
s390/pai: cleanup event initialization
authorThomas Richter <tmricht@linux.ibm.com>
Mon, 30 Oct 2023 10:41:33 +0000 (11:41 +0100)
committerAlexander Gordeev <agordeev@linux.ibm.com>
Wed, 22 Nov 2023 12:54:57 +0000 (13:54 +0100)
Setting event::hw.last_tag to zero is not necessary. The memory
for each event is dynamically allocated by the kernel common code and
initialized to zero already.  Remove this unnecessary assignment.
Move the comment to function paicrypt_start() for clarification.

Suggested-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
Acked-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
arch/s390/kernel/perf_pai_crypto.c
arch/s390/kernel/perf_pai_ext.c

index 77fd24e6cbb643bccb79777da90481c748f4feaf..39a91b00438a7f6ba48fb541d8f24b51070391d2 100644 (file)
@@ -279,12 +279,6 @@ static int paicrypt_event_init(struct perf_event *event)
        if (IS_ERR(cpump))
                return PTR_ERR(cpump);
 
-       /* Event initialization sets last_tag to 0. When later on the events
-        * are deleted and re-added, do not reset the event count value to zero.
-        * Events are added, deleted and re-added when 2 or more events
-        * are active at the same time.
-        */
-       event->hw.last_tag = 0;
        event->destroy = paicrypt_event_destroy;
 
        if (a->sample_period) {
@@ -318,6 +312,11 @@ static void paicrypt_start(struct perf_event *event, int flags)
 {
        u64 sum;
 
+       /* Event initialization sets last_tag to 0. When later on the events
+        * are deleted and re-added, do not reset the event count value to zero.
+        * Events are added, deleted and re-added when 2 or more events
+        * are active at the same time.
+        */
        if (!event->hw.last_tag) {
                event->hw.last_tag = 1;
                sum = paicrypt_getall(event);           /* Get current value */
index 8ba0f1a3a39dc0b7b4a2a2e300604a1b7968208c..e7013a2e8960508566083cfa9344e6daa60638fb 100644 (file)
@@ -260,7 +260,6 @@ static int paiext_event_init(struct perf_event *event)
        rc = paiext_alloc(a, event);
        if (rc)
                return rc;
-       event->hw.last_tag = 0;
        event->destroy = paiext_event_destroy;
 
        if (a->sample_period) {