Skip to content

Commit 8f6116f

Browse files
Thomas Richterhcahca
authored andcommitted
s390/pai_crypto: Add common pai_read() function
To support one common PAI PMU device driver which handles both PMUs pai_crypto and pai_ext, use a common naming scheme for structures and variables suitable for both device drivers. Add a common usable function pai_read() to read counter values. The function expects a PAI PMU specific read function as second parameter. Signed-off-by: Thomas Richter <tmricht@linux.ibm.com> Reviewed-by: Jan Polensky <japo@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
1 parent 74466e8 commit 8f6116f

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

arch/s390/kernel/perf_pai_crypto.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -365,18 +365,23 @@ static int paicrypt_event_init(struct perf_event *event)
365365
return rc;
366366
}
367367

368-
static void paicrypt_read(struct perf_event *event)
368+
static void pai_read(struct perf_event *event,
369+
u64 (*fct)(struct perf_event *event))
369370
{
370371
u64 prev, new, delta;
371372

372373
prev = local64_read(&event->hw.prev_count);
373-
new = paicrypt_getall(event);
374+
new = fct(event);
374375
local64_set(&event->hw.prev_count, new);
375-
delta = (prev <= new) ? new - prev
376-
: (-1ULL - prev) + new + 1; /* overflow */
376+
delta = (prev <= new) ? new - prev : (-1ULL - prev) + new + 1;
377377
local64_add(delta, &event->count);
378378
}
379379

380+
static void paicrypt_read(struct perf_event *event)
381+
{
382+
pai_read(event, paicrypt_getall);
383+
}
384+
380385
static void paicrypt_start(struct perf_event *event, int flags)
381386
{
382387
struct pai_mapptr *mp = this_cpu_ptr(pai_root.mapptr);

0 commit comments

Comments
 (0)