summaryrefslogtreecommitdiff
path: root/sys/kern/tty_nmea.c
diff options
context:
space:
mode:
authorandre <andre@cvs.openbsd.org>2014-03-21 21:46:48 +0000
committerandre <andre@cvs.openbsd.org>2014-03-21 21:46:48 +0000
commit2beb05f4123653966ec1daef26ebeb57fc607196 (patch)
treee6683462477a41ea76d071fb1f03edbc0a8856ac /sys/kern/tty_nmea.c
parent57bc6cc4323fa81fea8daebe464192763080ded1 (diff)
Some knf, no functional changes.
ok sthen@
Diffstat (limited to 'sys/kern/tty_nmea.c')
-rw-r--r--sys/kern/tty_nmea.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/sys/kern/tty_nmea.c b/sys/kern/tty_nmea.c
index edb678fd691..395d85a5ad2 100644
--- a/sys/kern/tty_nmea.c
+++ b/sys/kern/tty_nmea.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty_nmea.c,v 1.39 2010/05/27 17:18:23 sthen Exp $ */
+/* $OpenBSD: tty_nmea.c,v 1.40 2014/03/21 21:46:47 andre Exp $ */
/*
* Copyright (c) 2006, 2007, 2008 Marc Balmer <mbalmer@openbsd.org>
@@ -88,6 +88,7 @@ void nmea_timeout(void *);
void
nmeaattach(int dummy)
{
+ /* noop */
}
int
@@ -97,9 +98,9 @@ nmeaopen(dev_t dev, struct tty *tp, struct proc *p)
int error;
if (tp->t_line == NMEADISC)
- return ENODEV;
+ return (ENODEV);
if ((error = suser(p, 0)) != 0)
- return error;
+ return (error);
np = malloc(sizeof(struct nmea), M_DEVBUF, M_WAITOK | M_ZERO);
snprintf(np->timedev.xname, sizeof(np->timedev.xname), "nmea%d",
nmea_nxid++);
@@ -140,7 +141,7 @@ nmeaopen(dev_t dev, struct tty *tp, struct proc *p)
sensordev_install(&np->timedev);
timeout_set(&np->nmea_tout, nmea_timeout, np);
}
- return error;
+ return (error);
}
int
@@ -156,7 +157,7 @@ nmeaclose(struct tty *tp, int flags, struct proc *p)
nmea_count--;
if (nmea_count == 0)
nmea_nxid = 0;
- return linesw[TTYDISC].l_close(tp, flags, p);
+ return (linesw[TTYDISC].l_close(tp, flags, p));
}
/* Collect NMEA sentences from the tty. */
@@ -229,7 +230,7 @@ nmeainput(int c, struct tty *tp)
break;
}
/* pass data to termios */
- return linesw[TTYDISC].l_rint(c, tp);
+ return (linesw[TTYDISC].l_rint(c, tp));
}
/* Scan the NMEA sentence just received. */
@@ -429,7 +430,7 @@ nmea_degrees(int64_t *dst, char *src, int neg)
break;
if (*p == '\0')
- return -1; /* no decimal point */
+ return (-1); /* no decimal point */
for (n = 0; *src && n + 2 < ppos; n++)
deg = deg * 10 + (*src++ - '0');
@@ -448,7 +449,7 @@ nmea_degrees(int64_t *dst, char *src, int neg)
deg = deg * 1000000 + (min/60);
*dst = neg ? -deg : deg;
- return 0;
+ return (0);
}
/*
@@ -468,7 +469,7 @@ nmea_date_to_nano(char *s, int64_t *nano)
for (n = 0, p = s; n < 6 && *p && *p >= '0' && *p <= '9'; n++, p++)
;
if (n != 6 || (*p != '\0'))
- return -1;
+ return (-1);
ymd.dt_year = 2000 + (s[4] - '0') * 10 + (s[5] - '0');
ymd.dt_mon = (s[2] - '0') * 10 + (s[3] - '0');
@@ -477,7 +478,7 @@ nmea_date_to_nano(char *s, int64_t *nano)
secs = clock_ymdhms_to_secs(&ymd);
*nano = secs * 1000000000LL;
- return 0;
+ return (0);
}
/*
@@ -514,7 +515,7 @@ nmea_time_to_nano(char *s, int64_t *nano)
}
}
if (fac)
- return -1;
+ return (-1);
/* Handle the fractions of a second, up to a maximum of 6 digits. */
div = 1L;
@@ -527,10 +528,10 @@ nmea_time_to_nano(char *s, int64_t *nano)
}
if (*s != '\0')
- return -1;
+ return (-1);
*nano = secs * 1000000000LL + (int64_t)frac * (1000000000 / div);
- return 0;
+ return (0);
}
/*