static inline void xencons_unlock(struct xencons_priv *cons)
{
- if (panicstr == NULL )
+ if (panicstr == NULL)
mtx_unlock_spin(&cons->mtx);
}
err = xen_intr_bind_virq(dev, VIRQ_CONSOLE, 0, NULL,
xencons_intr, tp, INTR_TYPE_TTY, &cons->intr_handle);
- if (err)
+ if (err != 0)
printf("Can't register console interrupt\n");
- return err;
+ return (err);
}
static int
{
HYPERVISOR_console_io(CONSOLEIO_write, size, buffer);
- return size;
+ return (size);
}
static int
{
xencons_lock_assert(cons);
- return HYPERVISOR_console_io(CONSOLEIO_read, size, buffer);
+ return (HYPERVISOR_console_io(CONSOLEIO_read, size, buffer));
}
static const struct xencons_ops xencons_hypervisor_ops = {
if (xen_hvm_domain()) {
cons->evtchn = hvm_get_parameter(HVM_PARAM_CONSOLE_EVTCHN);
pfn = hvm_get_parameter(HVM_PARAM_CONSOLE_PFN);
- if (!pfn)
+ if (pfn == 0)
return (ENODEV);
cons->intf = xen_pmap(pfn << PAGE_SHIFT, PAGE_SIZE);
}
- if (!cons->evtchn)
+ if (cons->evtchn == 0)
return (ENODEV);
err = xen_intr_bind_local_port(dev, cons->evtchn, NULL,
if (err != 0)
return (err);
- return 0;
+ return (0);
}
static void
xencons_lock_assert(cons);
/* The console page may have not yet been initialized for HVM domain */
- if (__predict_false(!intf))
- return -1;
+ if (__predict_false(intf == NULL))
+ return (-1);
wcons = intf->out_cons;
wprod = intf->out_prod;
xencons_notify_ring(cons);
- return sent;
+ return (sent);
}
static int
xencons_lock_assert(cons);
/* The console page may have not yet been initialized for HVM domain */
- if (__predict_false(!intf))
- return 0;
+ if (__predict_false(intf == NULL))
+ return (0);
rcons = intf->in_cons;
rprod = intf->in_prod;
if (rsz != 0)
xencons_notify_ring(cons);
- return rsz;
+ return (rsz);
}
static const struct xencons_ops xencons_ring_ops = {
xencons_tx_flush(cons, force_flush);
- return xencons_tx_full(cons);
+ return (xencons_tx_full(cons));
}
static int
ret = -1;
xencons_unlock(cons);
- return ret;
+ return (ret);
}
static bool
* characters may be lost
*/
if (xencons_tx_full(cons))
- return false;
+ return (false);
while (ttydisc_getc(tp, &c, 1) == 1 && !cons_full)
cons_full = xencons_putc(cons, c, false);
- return !cons_full;
+ return (!cons_full);
}
/*
{
xencons_rx(&main_cons);
- return xencons_getc(&main_cons);
+ return (xencons_getc(&main_cons));
}
static void
callout_init_mtx(&cons->callout, tty_getlock(tp), 0);
err = cons->ops->init(dev, tp);
- if (err) {
+ if (err != 0) {
printf("xencons: Unable to initialize the console (%d)\n",
err);
- return err;
+ return (err);
}
/* register handler to flush console on shutdown */