Print "interrupting at". Improved style guide conformance.

This commit is contained in:
phx 2011-02-24 19:32:34 +00:00
parent 8b3e490633
commit 356132d33a
2 changed files with 32 additions and 28 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: com_eumb.c,v 1.5 2009/07/30 05:57:27 nisimura Exp $ */ /* $NetBSD: com_eumb.c,v 1.6 2011/02/24 19:32:34 phx Exp $ */
/*- /*-
* Copyright (c) 2007 The NetBSD Foundation, Inc. * Copyright (c) 2007 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: com_eumb.c,v 1.5 2009/07/30 05:57:27 nisimura Exp $"); __KERNEL_RCSID(0, "$NetBSD: com_eumb.c,v 1.6 2011/02/24 19:32:34 phx Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/device.h> #include <sys/device.h>
@ -56,12 +56,12 @@ static int found;
static struct com_regs cnregs; static struct com_regs cnregs;
/* /*
* There are two different UART configurations, single 4-wire UART * There are two different UART configurations: single 4-wire UART
* and dual 2-wire. DCR register selects one of the two operating * and dual 2-wire. The DCR register selects one of the two operating
* mode. A certain group of NAS boxes uses the 2nd UART as system * modes. A certain group of NAS boxes uses the 2nd UART as system
* console while the 1st to communicate power management satellite * console while using the 1st to communicate with the power management
* processor. "unit" locator helps to reverse the two. Default is a * satellite processor. The "unit" locator helps to reverse the two.
* single 4-wire UART as console. * Default is a single 4-wire UART as console.
*/ */
int int
com_eumb_match(device_t parent, cfdata_t cf, void *aux) com_eumb_match(device_t parent, cfdata_t cf, void *aux)
@ -70,10 +70,10 @@ com_eumb_match(device_t parent, cfdata_t cf, void *aux)
int unit = eaa->eumb_unit; int unit = eaa->eumb_unit;
if (unit == EUMBCF_UNIT_DEFAULT && found == 0) if (unit == EUMBCF_UNIT_DEFAULT && found == 0)
return (1); return 1;
if (unit == 0 || unit == 1) if (unit == 0 || unit == 1)
return (1); return 1;
return (0); return 0;
} }
void void
@ -92,8 +92,7 @@ com_eumb_attach(device_t parent, device_t self, void *aux)
if (com_is_console(eaa->eumb_bt, comaddr, &ioh)) { if (com_is_console(eaa->eumb_bt, comaddr, &ioh)) {
cnregs.cr_ioh = ioh; cnregs.cr_ioh = ioh;
sc->sc_regs = cnregs; sc->sc_regs = cnregs;
} } else {
else {
bus_space_map(eaa->eumb_bt, comaddr, COM_NPORTS, 0, &ioh); bus_space_map(eaa->eumb_bt, comaddr, COM_NPORTS, 0, &ioh);
COM_INIT_REGS(sc->sc_regs, eaa->eumb_bt, ioh, comaddr); COM_INIT_REGS(sc->sc_regs, eaa->eumb_bt, ioh, comaddr);
} }
@ -101,7 +100,9 @@ com_eumb_attach(device_t parent, device_t self, void *aux)
epicirq = (eaa->eumb_unit == 1) ? 25 : 24; epicirq = (eaa->eumb_unit == 1) ? 25 : 24;
com_attach_subr(sc); com_attach_subr(sc);
intr_establish(epicirq + 16, IST_LEVEL, IPL_SERIAL, comintr, sc); intr_establish(epicirq + 16, IST_LEVEL, IPL_SERIAL, comintr, sc);
aprint_normal_dev(self, "interrupting at irq %d\n", epicirq + 16);
} }
int int

View File

@ -1,4 +1,4 @@
/* $NetBSD: satmgr.c,v 1.3 2011/02/10 13:54:45 nisimura Exp $ */ /* $NetBSD: satmgr.c,v 1.4 2011/02/24 19:32:34 phx Exp $ */
/*- /*-
* Copyright (c) 2010 The NetBSD Foundation, Inc. * Copyright (c) 2010 The NetBSD Foundation, Inc.
@ -71,10 +71,12 @@ struct satmgr_softc {
uint32_t sc_ierror, sc_overr; uint32_t sc_ierror, sc_overr;
kmutex_t sc_lock; kmutex_t sc_lock;
kcondvar_t sc_rdcv, sc_wrcv; kcondvar_t sc_rdcv, sc_wrcv;
char sc_rd_buf[16], *sc_rd_lim, *sc_rd_cur, *sc_rd_ptr; char sc_rd_buf[16];
char sc_wr_buf[16], *sc_wr_lim, *sc_wr_cur, *sc_wr_ptr; char *sc_rd_lim, *sc_rd_cur, *sc_rd_ptr;
int sc_rd_cnt, sc_wr_cnt; char sc_wr_buf[16];
int sc_btnstate; char *sc_wr_lim, *sc_wr_cur, *sc_wr_ptr;
int sc_rd_cnt, sc_wr_cnt;
int sc_btnstate;
struct satops *sc_ops; struct satops *sc_ops;
}; };
@ -155,10 +157,10 @@ satmgr_match(device_t parent, cfdata_t match, void *aux)
int unit = eaa->eumb_unit; int unit = eaa->eumb_unit;
if (unit == EUMBCF_UNIT_DEFAULT && found == 0) if (unit == EUMBCF_UNIT_DEFAULT && found == 0)
return (1); return 1;
if (unit == 0 || unit == 1) if (unit == 0 || unit == 1)
return (1); return 1;
return (0); return 0;
} }
static void static void
@ -208,6 +210,7 @@ satmgr_attach(device_t parent, device_t self, void *aux)
epicirq = (eaa->eumb_unit == 0) ? 24 : 25; epicirq = (eaa->eumb_unit == 0) ? 24 : 25;
intr_establish(epicirq + 16, IST_LEVEL, IPL_SERIAL, hwintr, sc); intr_establish(epicirq + 16, IST_LEVEL, IPL_SERIAL, hwintr, sc);
aprint_normal_dev(self, "interrupting at irq %d\n", epicirq + 16);
sc->sc_si = softint_establish(SOFTINT_SERIAL, swintr, sc); sc->sc_si = softint_establish(SOFTINT_SERIAL, swintr, sc);
CSR_WRITE(sc, IER, 0x7f); /* all but MSR */ CSR_WRITE(sc, IER, 0x7f); /* all but MSR */
@ -289,8 +292,7 @@ satmgr_sysctl_wdogenable(SYSCTLFN_ARGS)
callout_setfunc(&sc->sc_ch_wdog, wdog_tickle, sc); callout_setfunc(&sc->sc_ch_wdog, wdog_tickle, sc);
callout_schedule(&sc->sc_ch_wdog, 90 * hz); callout_schedule(&sc->sc_ch_wdog, 90 * hz);
send_sat(sc, "JJ"); send_sat(sc, "JJ");
} } else {
else {
callout_stop(&sc->sc_ch_wdog); callout_stop(&sc->sc_ch_wdog);
send_sat(sc, "KK"); send_sat(sc, "KK");
} }
@ -466,8 +468,9 @@ filt_read(struct knote *kn, long hint)
return (kn->kn_data > 0); return (kn->kn_data > 0);
} }
static const struct filterops read_filtops = static const struct filterops read_filtops = {
{ 1, NULL, filt_rdetach, filt_read }; 1, NULL, filt_rdetach, filt_read
};
static int static int
satkqfilter(dev_t dev, struct knote *kn) satkqfilter(dev_t dev, struct knote *kn)
@ -482,7 +485,7 @@ satkqfilter(dev_t dev, struct knote *kn)
break; break;
default: default:
return (EINVAL); return EINVAL;
} }
kn->kn_hook = sc; kn->kn_hook = sc;
@ -491,7 +494,7 @@ satkqfilter(dev_t dev, struct knote *kn)
SLIST_INSERT_HEAD(klist, kn, kn_selnext); SLIST_INSERT_HEAD(klist, kn, kn_selnext);
mutex_exit(&sc->sc_lock); mutex_exit(&sc->sc_lock);
return (0); return 0;
} }
static int static int
@ -595,7 +598,7 @@ swintr(void *arg)
sc->sc_rd_cnt = 0; sc->sc_rd_cnt = 0;
sc->sc_rd_ptr = ptr; sc->sc_rd_ptr = ptr;
mutex_spin_exit(&sc->sc_lock); mutex_spin_exit(&sc->sc_lock);
return; /* drop characters down to floor */ return; /* drop characters down to the floor */
} }
cv_signal(&sc->sc_rdcv); cv_signal(&sc->sc_rdcv);
selnotify(&sc->sc_rsel, 0, 0); selnotify(&sc->sc_rsel, 0, 0);