summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgibbs <gibbs@FreeBSD.org>2013-09-01 23:49:36 +0000
committergibbs <gibbs@FreeBSD.org>2013-09-01 23:49:36 +0000
commit55177c016f41c0fa9187ddec1534559ecefea8bb (patch)
tree9a7032e7effec7b350f6e8715e010c99622aef03
parent3e4464bbe3ad0bffe28f58f47e8994d9ac6bc860 (diff)
downloadFreeBSD-src-55177c016f41c0fa9187ddec1534559ecefea8bb.zip
FreeBSD-src-55177c016f41c0fa9187ddec1534559ecefea8bb.tar.gz
Conform to style(9). No functional changes.
sys/x86/xen/hvm.c: Do not rely on implicit conversion to boolean in expressions (e.g. use "if (rc != 0)" instead of "if (rc)". Line continuations for functions are indented an additional 4 spaces. Insert an empty line if the function has no local variables. Prefer separate initializtion statements to initialzing local variables in their declaration. Braces that are not necessary may be left out. MFC after: 2 weeks
-rw-r--r--sys/x86/xen/hvm.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/sys/x86/xen/hvm.c b/sys/x86/xen/hvm.c
index 0730d94..c689b47 100644
--- a/sys/x86/xen/hvm.c
+++ b/sys/x86/xen/hvm.c
@@ -92,7 +92,7 @@ xen_hvm_init_hypercall_stubs(void)
int i;
base = xen_hvm_cpuid_base();
- if (!base)
+ if (base == 0)
return (ENXIO);
if (hypercall_stubs == NULL) {
@@ -151,7 +151,7 @@ xen_hvm_set_callback(device_t dev)
xhp.domid = DOMID_SELF;
xhp.index = HVM_PARAM_CALLBACK_IRQ;
- if (xen_feature(XENFEAT_hvm_callback_vector)) {
+ if (xen_feature(XENFEAT_hvm_callback_vector) != 0) {
int error;
xhp.value = HVM_CALLBACK_VECTOR(IDT_EVTCHN);
@@ -161,8 +161,7 @@ xen_hvm_set_callback(device_t dev)
return;
}
printf("Xen HVM callback vector registration failed (%d). "
- "Falling back to emulated device interrupt\n",
- error);
+ "Falling back to emulated device interrupt\n", error);
}
xen_vector_callback_enabled = 0;
if (dev == NULL) {
@@ -185,7 +184,7 @@ xen_hvm_set_callback(device_t dev)
xhp.value = HVM_CALLBACK_PCI_INTX(slot, pin);
}
- if (HYPERVISOR_hvm_op(HVMOP_set_param, &xhp))
+ if (HYPERVISOR_hvm_op(HVMOP_set_param, &xhp) != 0)
panic("Can't set evtchn callback");
}
@@ -216,6 +215,7 @@ xen_hvm_suspend(void)
void
xen_hvm_resume(void)
{
+
xen_hvm_init_hypercall_stubs();
xen_hvm_init_shared_info_page();
}
@@ -223,6 +223,7 @@ xen_hvm_resume(void)
static void
xen_hvm_init(void *dummy __unused)
{
+
if (xen_hvm_init_hypercall_stubs() != 0)
return;
@@ -235,21 +236,20 @@ xen_hvm_init(void *dummy __unused)
void xen_hvm_init_cpu(void)
{
- int cpu = PCPU_GET(acpi_id);
- struct vcpu_info *vcpu_info;
struct vcpu_register_vcpu_info info;
- int rc;
+ struct vcpu_info *vcpu_info;
+ int cpu, rc;
+ cpu = PCPU_GET(acpi_id);
vcpu_info = DPCPU_PTR(vcpu_local_info);
info.mfn = vtophys(vcpu_info) >> PAGE_SHIFT;
info.offset = vtophys(vcpu_info) - trunc_page(vtophys(vcpu_info));
rc = HYPERVISOR_vcpu_op(VCPUOP_register_vcpu_info, cpu, &info);
- if (rc) {
+ if (rc != 0)
DPCPU_SET(vcpu_info, &HYPERVISOR_shared_info->vcpu_info[cpu]);
- } else {
+ else
DPCPU_SET(vcpu_info, vcpu_info);
- }
}
SYSINIT(xen_hvm_init, SI_SUB_HYPERVISOR, SI_ORDER_FIRST, xen_hvm_init, NULL);
OpenPOWER on IntegriCloud