]> xenbits.xensource.com Git - people/julieng/freebsd.git/commitdiff
return + if dev-console
authorJulien Grall <julien.grall@citrix.com>
Sat, 3 Oct 2015 20:33:48 +0000 (21:33 +0100)
committerJulien Grall <julien.grall@citrix.com>
Sat, 3 Oct 2015 20:33:48 +0000 (21:33 +0100)
sys/dev/xen/console/xen_console.c

index 7eed59c599c195a94bae985f84db3fb4c05aea02..552b3ecf4ac3a0872b53a56e07dafde665ac8d38 100644 (file)
@@ -135,7 +135,7 @@ static inline void xencons_lock(struct xencons_priv *cons)
 
 static inline void xencons_unlock(struct xencons_priv *cons)
 {
-       if (panicstr == NULL )
+       if (panicstr == NULL)
                mtx_unlock_spin(&cons->mtx);
 }
 
@@ -235,10 +235,10 @@ xencons_init_hypervisor(device_t dev, struct tty *tp)
 
        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
@@ -247,7 +247,7 @@ xencons_write_hypervisor(struct xencons_priv *cons, const char *buffer,
 {
        HYPERVISOR_console_io(CONSOLEIO_write, size, buffer);
 
-       return size;
+       return (size);
 }
 
 static int
@@ -256,7 +256,7 @@ xencons_read_hypervisor(struct xencons_priv *cons, char *buffer,
 {
        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 = {
@@ -298,12 +298,12 @@ xencons_init_ring(device_t dev, struct tty *tp)
        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,
@@ -312,7 +312,7 @@ xencons_init_ring(device_t dev, struct tty *tp)
        if (err != 0)
                return (err);
 
-       return 0;
+       return (0);
 }
 
 static void
@@ -347,8 +347,8 @@ xencons_write_ring(struct xencons_priv *cons, const char *buffer,
        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;
@@ -369,7 +369,7 @@ xencons_write_ring(struct xencons_priv *cons, const char *buffer,
 
        xencons_notify_ring(cons);
 
-       return sent;
+       return (sent);
 }
 
 static int
@@ -384,8 +384,8 @@ xencons_read_ring(struct xencons_priv *cons, char *buffer, unsigned int size)
        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;
@@ -404,7 +404,7 @@ xencons_read_ring(struct xencons_priv *cons, char *buffer, unsigned int size)
        if (rsz != 0)
                xencons_notify_ring(cons);
 
-       return rsz;
+       return (rsz);
 }
 
 static const struct xencons_ops xencons_ring_ops = {
@@ -510,7 +510,7 @@ xencons_putc(struct xencons_priv *cons, int c, bool force_flush)
 
        xencons_tx_flush(cons, force_flush);
 
-       return xencons_tx_full(cons);
+       return (xencons_tx_full(cons));
 }
 
 static int
@@ -528,7 +528,7 @@ xencons_getc(struct xencons_priv *cons)
                ret = -1;
        xencons_unlock(cons);
 
-       return ret;
+       return (ret);
 }
 
 static bool
@@ -547,12 +547,12 @@ xencons_tx(struct tty *tp)
         * 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);
 }
 
 /*
@@ -611,7 +611,7 @@ xc_cngetc(struct consdev *dev)
 {
        xencons_rx(&main_cons);
 
-       return xencons_getc(&main_cons);
+       return (xencons_getc(&main_cons));
 }
 
 static void
@@ -728,10 +728,10 @@ xc_attach(device_t dev)
        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 */