Compress two lines into a single line if immediate return statement is found.
It also remove variables retval, freq, effective, vector, ovf and now
as they are no longer needed.
Signed-off-by: Simran Singhal <singhalsimran0@gmail.com>
Reviewed-by: Wei Liu <wl@xen.org>
Acked-by: Jan Beulich <jbeulich@suse.com>
struct cpufreq_policy *policy;
struct perf_pair readin, cur, *saved;
unsigned int perf_percent;
- unsigned int retval;
if (!cpu_online(cpu))
return 0;
else
perf_percent = 0;
- retval = policy->cpuinfo.max_freq * perf_percent / 100;
-
- return retval;
+ return policy->cpuinfo.max_freq * perf_percent / 100;
}
static unsigned int get_cur_freq_on_cpu(unsigned int cpu)
{
struct cpufreq_policy *policy;
struct acpi_cpufreq_data *data;
- unsigned int freq;
if (!cpu_online(cpu))
return 0;
data->acpi_data == NULL || data->freq_table == NULL))
return 0;
- freq = extract_freq(get_cur_val(cpumask_of(cpu)), data);
- return freq;
+ return extract_freq(get_cur_val(cpumask_of(cpu)), data);
}
static void feature_detect(void *info)
uint32_t pte_flags,
uint8_t gmtrr_mtype)
{
- uint8_t mtrr_mtype, pat_value, effective;
+ uint8_t mtrr_mtype, pat_value;
/* if get_pat_flags() gives a dedicated MTRR type,
* just use it
pat_value = page_pat_type(pat, pte_flags);
- effective = mm_type_tbl[mtrr_mtype][pat_value];
-
- return effective;
+ return mm_type_tbl[mtrr_mtype][pat_value];
}
uint32_t get_pat_flags(struct vcpu *v,
int vpic_ack_pending_irq(struct vcpu *v)
{
- int irq, vector;
+ int irq;
struct hvm_hw_vpic *vpic = &v->domain->arch.hvm.vpic[0];
ASSERT(has_vpic(v->domain));
if ( irq == -1 )
return -1;
- vector = vpic[irq >> 3].irq_base + (irq & 7);
- return vector;
+ return vpic[irq >> 3].irq_base + (irq & 7);
}
/*
{
uint64_t msr_content;
int i;
- int ovf = 0;
unsigned long eip = regs->rip;
int mode = 0;
struct vcpu *v = current;
if (CTR_OVERFLOWED(msr_content)) {
xenoprof_log_event(current, regs, eip, mode, i);
CTR_WRITE(reset_value[i], msrs, i);
- ovf = 1;
}
}
- ovf = handle_ibs(mode, regs);
/* See op_model_ppro.c */
- return ovf;
+ return handle_ibs(mode, regs);
}
static inline void start_ibs(void)
{
const struct cpu_time *t = &this_cpu(cpu_time);
u64 tsc, delta;
- s_time_t now;
if ( at_tsc )
tsc = at_tsc;
else
tsc = rdtsc_ordered();
delta = tsc - t->stamp.local_tsc;
- now = t->stamp.local_stime + scale_delta(delta, &t->tsc_scale);
-
- return now;
+ return t->stamp.local_stime + scale_delta(delta, &t->tsc_scale);
}
s_time_t get_s_time()