s390/cpum_sf: simplify function setup_pmu_cpu
Print the error message when the FAILURE flag is set. This saves on pr_err statement as the text of the error message is identical in both failures. Also observe reverse Xmas tree variable declarations in this function. No functional change. Signed-off-by: Thomas Richter <tmricht@linux.ibm.com> Acked-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
This commit is contained in:
parent
f4767f9f32
commit
eeeff534e9
@ -594,10 +594,9 @@ static DEFINE_MUTEX(pmc_reserve_mutex);
|
|||||||
#define PMC_FAILURE 2
|
#define PMC_FAILURE 2
|
||||||
static void setup_pmc_cpu(void *flags)
|
static void setup_pmc_cpu(void *flags)
|
||||||
{
|
{
|
||||||
int err;
|
|
||||||
struct cpu_hw_sf *cpusf = this_cpu_ptr(&cpu_hw_sf);
|
struct cpu_hw_sf *cpusf = this_cpu_ptr(&cpu_hw_sf);
|
||||||
|
int err = 0;
|
||||||
|
|
||||||
err = 0;
|
|
||||||
switch (*((int *) flags)) {
|
switch (*((int *) flags)) {
|
||||||
case PMC_INIT:
|
case PMC_INIT:
|
||||||
memset(cpusf, 0, sizeof(*cpusf));
|
memset(cpusf, 0, sizeof(*cpusf));
|
||||||
@ -606,22 +605,18 @@ static void setup_pmc_cpu(void *flags)
|
|||||||
break;
|
break;
|
||||||
cpusf->flags |= PMU_F_RESERVED;
|
cpusf->flags |= PMU_F_RESERVED;
|
||||||
err = sf_disable();
|
err = sf_disable();
|
||||||
if (err)
|
|
||||||
pr_err("Switching off the sampling facility failed "
|
|
||||||
"with rc %i\n", err);
|
|
||||||
break;
|
break;
|
||||||
case PMC_RELEASE:
|
case PMC_RELEASE:
|
||||||
cpusf->flags &= ~PMU_F_RESERVED;
|
cpusf->flags &= ~PMU_F_RESERVED;
|
||||||
err = sf_disable();
|
err = sf_disable();
|
||||||
if (err) {
|
if (!err)
|
||||||
pr_err("Switching off the sampling facility failed "
|
|
||||||
"with rc %i\n", err);
|
|
||||||
} else
|
|
||||||
deallocate_buffers(cpusf);
|
deallocate_buffers(cpusf);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (err)
|
if (err) {
|
||||||
*((int *) flags) |= PMC_FAILURE;
|
*((int *) flags) |= PMC_FAILURE;
|
||||||
|
pr_err("Switching off the sampling facility failed with rc %i\n", err);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void release_pmc_hardware(void)
|
static void release_pmc_hardware(void)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user