Skip to content

Commit 1a33aee

Browse files
Thomas RichterVasily Gorbik
authored andcommitted
s390/cpum_cf: remove function validate_ctr_auth() by inline code
Remove function validate_ctr_auth() and replace this very small function by its body. No functional change. Signed-off-by: Thomas Richter <tmricht@linux.ibm.com> Acked-by: Heiko Carstens <hca@linux.ibm.com> Acked-by: Sumanth Korikkar <sumanthk@linux.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
1 parent 9ae9b86 commit 1a33aee

1 file changed

Lines changed: 9 additions & 22 deletions

File tree

arch/s390/kernel/perf_cpum_cf.c

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -444,21 +444,6 @@ static int validate_ctr_version(const u64 config, enum cpumf_ctr_set set)
444444
return err;
445445
}
446446

447-
static int validate_ctr_auth(const struct hw_perf_event *hwc)
448-
{
449-
int err = -ENOENT;
450-
451-
/* Check authorization for cpu counter sets.
452-
* If the particular CPU counter set is not authorized,
453-
* return with -ENOENT in order to fall back to other
454-
* PMUs that might suffice the event request.
455-
*/
456-
if ((hwc->config_base & cpumf_ctr_info.auth_ctl))
457-
err = 0;
458-
459-
return err;
460-
}
461-
462447
/*
463448
* Change the CPUMF state to active.
464449
* Enable and activate the CPU-counter sets according
@@ -596,7 +581,6 @@ static int __hw_perf_event_init(struct perf_event *event, unsigned int type)
596581
struct perf_event_attr *attr = &event->attr;
597582
struct hw_perf_event *hwc = &event->hw;
598583
enum cpumf_ctr_set set;
599-
int err = 0;
600584
u64 ev;
601585

602586
switch (type) {
@@ -672,12 +656,15 @@ static int __hw_perf_event_init(struct perf_event *event, unsigned int type)
672656
cpumf_hw_inuse();
673657
event->destroy = hw_perf_event_destroy;
674658

675-
/* Finally, validate version and authorization of the counter set */
676-
err = validate_ctr_auth(hwc);
677-
if (!err)
678-
err = validate_ctr_version(hwc->config, set);
679-
680-
return err;
659+
/*
660+
* Finally, validate version and authorization of the counter set.
661+
* If the particular CPU counter set is not authorized,
662+
* return with -ENOENT in order to fall back to other
663+
* PMUs that might suffice the event request.
664+
*/
665+
if (!(hwc->config_base & cpumf_ctr_info.auth_ctl))
666+
return -ENOENT;
667+
return validate_ctr_version(hwc->config, set);
681668
}
682669

683670
/* Events CPU_CYLCES and INSTRUCTIONS can be submitted with two different

0 commit comments

Comments
 (0)