From 0d5f0dc83073cd36d1e92bbcbcc3bc046918bc69 Mon Sep 17 00:00:00 2001 From: Thomas Richter Date: Tue, 24 Jan 2023 12:20:55 +0100 Subject: [PATCH] s390/cpum_cf: simplify PMC_INIT and PMC_RELEASE usage Simplify the use of constants PMC_INIT and PMC_RELEASE. Suggested-by: Heiko Carstens Signed-off-by: Thomas Richter Signed-off-by: Heiko Carstens --- arch/s390/kernel/perf_cpum_cf.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/arch/s390/kernel/perf_cpum_cf.c b/arch/s390/kernel/perf_cpum_cf.c index 940c717e6531..0cbca3165496 100644 --- a/arch/s390/kernel/perf_cpum_cf.c +++ b/arch/s390/kernel/perf_cpum_cf.c @@ -506,14 +506,14 @@ static void cpumf_pmu_disable(struct pmu *pmu) cpuhw->flags &= ~PMU_F_ENABLED; } -#define PMC_INIT 0 -#define PMC_RELEASE 1 +#define PMC_INIT 0UL +#define PMC_RELEASE 1UL static void cpum_cf_setup_cpu(void *flags) { struct cpu_cf_events *cpuhw = this_cpu_ptr(&cpu_cf_events); - switch (*((int *)flags)) { + switch ((unsigned long)flags) { case PMC_INIT: memset(&cpuhw->info, 0, sizeof(cpuhw->info)); qctri(&cpuhw->info); @@ -535,9 +535,7 @@ static void cpum_cf_setup_cpu(void *flags) /* Initialize the CPU-measurement counter facility */ static int __kernel_cpumcf_begin(void) { - int flags = PMC_INIT; - - on_each_cpu(cpum_cf_setup_cpu, &flags, 1); + on_each_cpu(cpum_cf_setup_cpu, (void *)PMC_INIT, 1); irq_subclass_register(IRQ_SUBCLASS_MEASUREMENT_ALERT); return 0; @@ -546,9 +544,7 @@ static int __kernel_cpumcf_begin(void) /* Release the CPU-measurement counter facility */ static void __kernel_cpumcf_end(void) { - int flags = PMC_RELEASE; - - on_each_cpu(cpum_cf_setup_cpu, &flags, 1); + on_each_cpu(cpum_cf_setup_cpu, (void *)PMC_RELEASE, 1); irq_subclass_unregister(IRQ_SUBCLASS_MEASUREMENT_ALERT); } @@ -937,10 +933,10 @@ static struct pmu cpumf_pmu = { .read = cpumf_pmu_read, }; -static int cpum_cf_setup(unsigned int cpu, int flags) +static int cpum_cf_setup(unsigned int cpu, unsigned long flags) { local_irq_disable(); - cpum_cf_setup_cpu(&flags); + cpum_cf_setup_cpu((void *)flags); local_irq_enable(); return 0; }