Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/ppbus KNF & fix typo. No functional change.
details: https://anonhg.NetBSD.org/src/rev/26beabc0f9ae
branches: trunk
changeset: 323674:26beabc0f9ae
user: msaitoh <msaitoh%NetBSD.org@localhost>
date: Mon Jun 25 13:28:12 2018 +0000
description:
KNF & fix typo. No functional change.
diffstat:
sys/dev/ppbus/if_plip.c | 196 ++++++++++++++++++++++++------------------------
1 files changed, 98 insertions(+), 98 deletions(-)
diffs (truncated from 630 to 300 lines):
diff -r 9fc45201b08c -r 26beabc0f9ae sys/dev/ppbus/if_plip.c
--- a/sys/dev/ppbus/if_plip.c Mon Jun 25 12:18:22 2018 +0000
+++ b/sys/dev/ppbus/if_plip.c Mon Jun 25 13:28:12 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_plip.c,v 1.28 2017/06/25 12:27:13 maxv Exp $ */
+/* $NetBSD: if_plip.c,v 1.29 2018/06/25 13:28:12 msaitoh Exp $ */
/*-
* Copyright (c) 1997 Poul-Henning Kamp
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_plip.c,v 1.28 2017/06/25 12:27:13 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_plip.c,v 1.29 2018/06/25 13:28:12 msaitoh Exp $");
/*
* Parallel port TCP/IP interfaces added. I looked at the driver from
@@ -41,7 +41,7 @@
* This driver sends two bytes (0x08, 0x00) in front of each packet,
* to allow us to distinguish another format later.
*
- * Now added an Linux/Crynwr compatibility mode which is enabled using
+ * Now added a Linux/Crynwr compatibility mode which is enabled using
* IF_LINK0 - Tim Wilkinson.
*
* TODO:
@@ -194,7 +194,7 @@
static void lpfreetables(void);
static int lpioctl(struct ifnet *, u_long, void *);
static int lpoutput(struct ifnet *, struct mbuf *, const struct sockaddr *,
- const struct rtentry *);
+ const struct rtentry *);
static void lpstart(struct ifnet *);
static void lp_intr(void *);
@@ -205,7 +205,7 @@
struct ppbus_attach_args * args = aux;
/* Fail if ppbus is not interrupt capable */
- if(args->capabilities & PPBUS_HAS_INTR)
+ if (args->capabilities & PPBUS_HAS_INTR)
return 1;
printf("%s(%s): not an interrupt-driven port.\n", __func__,
@@ -243,7 +243,7 @@
bpf_attach(ifp, DLT_NULL, sizeof(u_int32_t));
- if(lp_count++ == 0)
+ if (lp_count++ == 0)
lpinittables();
printf("\n");
}
@@ -255,8 +255,8 @@
struct lp_softc * lp = device_private(self);
device_t ppbus = device_parent(self);
- if(lp->sc_dev_ok) {
- if(!(flags & DETACH_QUIET))
+ if (lp->sc_dev_ok) {
+ if (!(flags & DETACH_QUIET))
LP_PRINTF("%s(%s): device not properly attached! "
"Skipping detach....\n", __func__,
device_xname(self));
@@ -264,33 +264,33 @@
}
/* If interface is up, bring it down and release ppbus */
- if(lp->sc_if.if_flags & IFF_RUNNING) {
+ if (lp->sc_if.if_flags & IFF_RUNNING) {
ppbus_wctr(ppbus, 0x00);
if_detach(&lp->sc_if);
error = ppbus_remove_handler(ppbus, lp_intr);
- if(error) {
- if(!(flags & DETACH_QUIET))
+ if (error) {
+ if (!(flags & DETACH_QUIET))
LP_PRINTF("%s(%s): unable to remove interrupt "
"callback.\n", __func__,
device_xname(self));
- if(!(flags & DETACH_FORCE))
+ if (!(flags & DETACH_FORCE))
return error;
}
error = ppbus_release_bus(ppbus, self, 0, 0);
- if(error) {
- if(!(flags & DETACH_QUIET))
+ if (error) {
+ if (!(flags & DETACH_QUIET))
LP_PRINTF("%s(%s): error releasing bus %s.\n",
__func__, device_xname(self),
device_xname(ppbus));
- if(!(flags & DETACH_FORCE))
+ if (!(flags & DETACH_FORCE))
return error;
}
}
- if(lp->sc_ifbuf)
+ if (lp->sc_ifbuf)
free(lp->sc_ifbuf, M_DEVBUF);
- if(--lp_count == 0)
+ if (--lp_count == 0)
lpfreetables();
return error;
}
@@ -301,7 +301,7 @@
* precalculate them when we initialize.
*/
static void
-lpinittables (void)
+lpinittables(void)
{
int i;
@@ -311,14 +311,14 @@
if (!ctxmith)
ctxmith = malloc(4*LPIPTBLSIZE, M_DEVBUF, M_WAITOK);
- for(i = 0; i < LPIPTBLSIZE; i++) {
+ for (i = 0; i < LPIPTBLSIZE; i++) {
ctxmith[i] = (i & 0xF0) >> 4;
ctxmitl[i] = 0x10 | (i & 0x0F);
ctrecvh[i] = (i & 0x78) << 1;
ctrecvl[i] = (i & 0x78) >> 3;
}
- for(i = 0; i < LPIPTBLSIZE; i++) {
+ for (i = 0; i < LPIPTBLSIZE; i++) {
txmith[i] = ((i & 0x80) >> 3) | ((i & 0x70) >> 4) | 0x08;
txmitl[i] = ((i & 0x08) << 1) | (i & 0x07);
trecvh[i] = ((~i) & 0x80) | ((i & 0x38) << 1);
@@ -328,7 +328,7 @@
/* Free translation tables */
static void
-lpfreetables (void)
+lpfreetables(void)
{
if (txmith)
free(txmith, M_DEVBUF);
@@ -353,7 +353,7 @@
error = 0;
s = splnet();
- if(sc->sc_dev_ok) {
+ if (sc->sc_dev_ok) {
LP_PRINTF("%s(%s): device not properly attached!", __func__,
device_xname(dev));
error = ENODEV;
@@ -377,15 +377,15 @@
case SIOCSIFFLAGS:
if ((error = ifioctl_common(ifp, cmd, data)) != 0)
break;
- if((ifp->if_flags & (IFF_UP|IFF_RUNNING)) == IFF_UP) {
- if((error = ppbus_request_bus(ppbus, dev, 0, 0)))
+ if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) == IFF_UP) {
+ if ((error = ppbus_request_bus(ppbus, dev, 0, 0)))
break;
error = ppbus_set_mode(ppbus, PPBUS_COMPATIBLE, 0);
- if(error)
+ if (error)
break;
error = ppbus_add_handler(ppbus, lp_intr, dev);
- if(error) {
+ if (error) {
LP_PRINTF("%s(%s): unable to register interrupt"
" callback.\n", __func__,
device_xname(dev));
@@ -394,7 +394,7 @@
}
/* Allocate a buffer if necessary */
- if(sc->sc_ifbuf == NULL) {
+ if (sc->sc_ifbuf == NULL) {
sc->sc_ifbuf = malloc(sc->sc_if.if_mtu +
MLPIPHDRLEN, M_DEVBUF, M_NOWAIT);
if (!sc->sc_ifbuf) {
@@ -407,7 +407,7 @@
ppbus_wctr(ppbus, IRQENABLE);
ifp->if_flags |= IFF_RUNNING;
}
- if((ifp->if_flags & (IFF_UP|IFF_RUNNING)) == IFF_RUNNING) {
+ if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) == IFF_RUNNING) {
ppbus_remove_handler(ppbus, lp_intr);
error = ppbus_release_bus(ppbus, dev, 0, 0);
ifp->if_flags &= ~IFF_RUNNING;
@@ -417,7 +417,7 @@
break;
case SIOCSIFMTU:
- if(sc->sc_if.if_mtu == ifr->ifr_mtu)
+ if (sc->sc_if.if_mtu == ifr->ifr_mtu)
break;
ptr = sc->sc_ifbuf;
sc->sc_ifbuf = malloc(ifr->ifr_mtu+MLPIPHDRLEN, M_DEVBUF,
@@ -427,7 +427,7 @@
error = ENOBUFS;
break;
}
- if(ptr)
+ if (ptr)
free(ptr,M_DEVBUF);
/*FALLTHROUGH*/
case SIOCGIFMTU:
@@ -466,7 +466,7 @@
}
static inline int
-clpoutbyte (u_char byte, int spin, device_t ppbus)
+clpoutbyte(u_char byte, int spin, device_t ppbus)
{
int s = spin;
ppbus_wdtr(ppbus, ctxmitl[byte]);
@@ -486,13 +486,13 @@
}
static inline int
-clpinbyte (int spin, device_t ppbus)
+clpinbyte(int spin, device_t ppbus)
{
u_char c, cl;
int s = spin;
- while(ppbus_rstr(ppbus) & CLPIP_SHAKE) {
- if(!--s) {
+ while (ppbus_rstr(ppbus) & CLPIP_SHAKE) {
+ if (!--s) {
return -1;
}
}
@@ -500,8 +500,8 @@
ppbus_wdtr(ppbus, 0x10);
s = spin;
- while(!(ppbus_rstr(ppbus) & CLPIP_SHAKE)) {
- if(!--s) {
+ while (!(ppbus_rstr(ppbus) & CLPIP_SHAKE)) {
+ if (!--s) {
return -1;
}
}
@@ -531,7 +531,7 @@
/* Soft interrupt handler called by hardware interrupt handler */
static void
-lp_intr (void *arg)
+lp_intr(void *arg)
{
device_t dev = (device_t)arg;
device_t ppbus = device_parent(dev);
@@ -545,18 +545,18 @@
s = splnet();
/* Do nothing if device not properly attached */
- if(sc->sc_dev_ok) {
+ if (sc->sc_dev_ok) {
LP_PRINTF("%s(%s): device not properly attached!", __func__,
device_xname(dev));
goto done;
}
/* Do nothing if interface is not up */
- if((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING))
+ if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING))
goto done;
/* If other side is no longer transmitting, do nothing */
- if(!(ppbus_rstr(ppbus) & LPIP_SHAKE))
+ if (!(ppbus_rstr(ppbus) & LPIP_SHAKE))
goto done;
/* Disable interrupts until we finish */
@@ -565,23 +565,23 @@
top = NULL;
bp = sc->sc_ifbuf;
/* Linux/crynwyr protocol receiving */
- if(ifp->if_flags & IFF_LINK0) {
+ if (ifp->if_flags & IFF_LINK0) {
/* Ack. the request */
ppbus_wdtr(ppbus, 0x01);
/* Get the packet length */
j = clpinbyte(LPMAXSPIN2, ppbus);
- if(j == -1)
+ if (j == -1)
goto err;
len = j;
j = clpinbyte(LPMAXSPIN2, ppbus);
- if(j == -1)
+ if (j == -1)
goto err;
len = len + (j << 8);
- if(len > ifp->if_mtu + MLPIPHDRLEN)
+ if (len > ifp->if_mtu + MLPIPHDRLEN)
goto err;
Home |
Main Index |
Thread Index |
Old Index