Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/hp300/stand Misc cleanup:
details: https://anonhg.NetBSD.org/src/rev/89e43a207627
branches: trunk
changeset: 555327:89e43a207627
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Fri Nov 14 16:52:40 2003 +0000
description:
Misc cleanup:
- KNF
- WARNSfy
- remove __P()
- remove register declarations
- const'ify some variables
- make some local functions/variables static
- bcopy -> memcpy
- bcmp -> memcmp
- bzero -> memset
- space/TAB fix
etc.
diffstat:
sys/arch/hp300/stand/common/apci.c | 17 +-
sys/arch/hp300/stand/common/autoconf.c | 36 ++-
sys/arch/hp300/stand/common/clock.c | 40 +++-
sys/arch/hp300/stand/common/conf.c | 61 ++-----
sys/arch/hp300/stand/common/conf.h | 58 +++++++
sys/arch/hp300/stand/common/cons.c | 10 +-
sys/arch/hp300/stand/common/consdefs.h | 34 ++--
sys/arch/hp300/stand/common/ct.c | 128 +++++++++------
sys/arch/hp300/stand/common/dca.c | 21 +-
sys/arch/hp300/stand/common/dcm.c | 36 ++--
sys/arch/hp300/stand/common/devopen.c | 260 ++++++++++++++++---------------
sys/arch/hp300/stand/common/dnkbd.c | 14 +-
sys/arch/hp300/stand/common/exec.c | 9 +-
sys/arch/hp300/stand/common/fhpib.c | 73 +++++---
sys/arch/hp300/stand/common/hil.c | 21 +-
sys/arch/hp300/stand/common/hpib.c | 52 +++--
sys/arch/hp300/stand/common/hpibvar.h | 29 +++-
sys/arch/hp300/stand/common/if_le.c | 174 +++++++++++---------
sys/arch/hp300/stand/common/if_lereg.h | 12 +-
sys/arch/hp300/stand/common/ite.c | 42 +++--
sys/arch/hp300/stand/common/ite_dv.c | 99 ++++++-----
sys/arch/hp300/stand/common/ite_gb.c | 111 ++++++------
sys/arch/hp300/stand/common/ite_hy.c | 207 +++++++++++-------------
sys/arch/hp300/stand/common/ite_rb.c | 78 ++++----
sys/arch/hp300/stand/common/ite_subr.c | 17 +-
sys/arch/hp300/stand/common/ite_tc.c | 71 ++++----
sys/arch/hp300/stand/common/itevar.h | 74 ++++----
sys/arch/hp300/stand/common/kbd.c | 6 +-
sys/arch/hp300/stand/common/kbdvar.h | 23 +-
sys/arch/hp300/stand/common/machdep.c | 10 +-
sys/arch/hp300/stand/common/netio.c | 48 +++--
sys/arch/hp300/stand/common/nhpib.c | 85 +++++----
sys/arch/hp300/stand/common/prf.c | 22 +-
sys/arch/hp300/stand/common/rawfs.c | 25 +-
sys/arch/hp300/stand/common/rawfs.h | 16 +-
sys/arch/hp300/stand/common/rd.c | 173 ++++++++++++---------
sys/arch/hp300/stand/common/samachdep.h | 59 +++++-
sys/arch/hp300/stand/common/scsi.c | 138 +++++++++-------
sys/arch/hp300/stand/common/scsivar.h | 11 +-
sys/arch/hp300/stand/common/sd.c | 93 ++++++----
sys/arch/hp300/stand/common/tgets.c | 106 ++++++------
sys/arch/hp300/stand/inst/inst.c | 89 +++++-----
sys/arch/hp300/stand/uboot/uboot.c | 3 +-
43 files changed, 1492 insertions(+), 1199 deletions(-)
diffs (truncated from 5747 to 300 lines):
diff -r 47b095f6770b -r 89e43a207627 sys/arch/hp300/stand/common/apci.c
--- a/sys/arch/hp300/stand/common/apci.c Fri Nov 14 16:43:57 2003 +0000
+++ b/sys/arch/hp300/stand/common/apci.c Fri Nov 14 16:52:40 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: apci.c,v 1.5 2003/11/08 12:02:33 tsutsui Exp $ */
+/* $NetBSD: apci.c,v 1.6 2003/11/14 16:52:40 tsutsui Exp $ */
/*-
* Copyright (c) 1997, 1999 The NetBSD Foundation, Inc.
@@ -112,6 +112,8 @@
#include <sys/param.h>
#include <dev/cons.h>
+#include <lib/libsa/stand.h>
+
#include <hp300/dev/frodoreg.h> /* for APCI offsets */
#include <hp300/stand/common/apcireg.h> /* for register map */
@@ -125,8 +127,8 @@
apciprobe(cp)
struct consdev *cp;
{
- struct apciregs *apci = apcicnaddr =
- (struct apciregs *)IIOV(FRODO_BASE + FRODO_APCI_OFFSET(1));
+
+ apcicnaddr = (void *)IIOV(FRODO_BASE + FRODO_APCI_OFFSET(1));
cp->cn_pri = CN_DEAD;
@@ -176,21 +178,22 @@
apcigetchar(dev)
dev_t dev;
{
- register struct apciregs *apci = apcicnaddr;
+ struct apciregs *apci = apcicnaddr;
short stat;
int c;
if (((stat = apci->ap_lsr) & LSR_RXRDY) == 0)
- return (0);
+ return 0;
c = apci->ap_data;
- return (c);
+ return c;
}
#else
int
apcigetchar(dev)
dev_t dev;
{
- return (0);
+
+ return 0;
}
#endif
diff -r 47b095f6770b -r 89e43a207627 sys/arch/hp300/stand/common/autoconf.c
--- a/sys/arch/hp300/stand/common/autoconf.c Fri Nov 14 16:43:57 2003 +0000
+++ b/sys/arch/hp300/stand/common/autoconf.c Fri Nov 14 16:52:40 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: autoconf.c,v 1.3 2003/08/07 16:27:40 agc Exp $ */
+/* $NetBSD: autoconf.c,v 1.4 2003/11/14 16:52:40 tsutsui Exp $ */
/*
* Copyright (c) 1990, 1993
@@ -82,6 +82,9 @@
#include <hp300/stand/common/samachdep.h>
#include <hp300/stand/common/rominfo.h>
#include <hp300/stand/common/device.h>
+#include <hp300/stand/common/hpibvar.h>
+#include <hp300/stand/common/scsireg.h>
+#include <hp300/stand/common/scsivar.h>
#include <hp300/dev/grfreg.h>
@@ -89,7 +92,7 @@
* Mapping of ROM MSUS types to BSD major device numbers
* WARNING: major numbers must match bdevsw indices in hp300/conf.c.
*/
-char rom2mdev[] = {
+static const char rom2mdev[] = {
0, 0, /* 0-1: none */
6, /* 2: network device; special */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 3-13: none */
@@ -103,9 +106,11 @@
struct hp_hw sc_table[MAXCTLRS];
int cpuspeed;
-extern int internalhpib;
+static u_long msustobdev(void);
+static void find_devs(void);
#ifdef PRINTROMINFO
+void
printrominfo()
{
struct rominfo *rp = (struct rominfo *)ROMADDR;
@@ -117,9 +122,9 @@
}
#endif
+void
configure()
{
- u_long msustobdev();
switch (machineid) {
case HP_320:
@@ -168,12 +173,12 @@
* ADAPTER comes from SCSI/HPIB driver logical unit number
* (passed back via unused hw_pa field)
*/
-u_long
+static u_long
msustobdev()
{
struct rominfo *rp = (struct rominfo *) ROMADDR;
u_long bdev = 0;
- register struct hp_hw *hw;
+ struct hp_hw *hw;
int sc, type, ctlr, slave, punit;
sc = (rp->msus >> 8) & 0xFF;
@@ -191,21 +196,23 @@
#ifdef PRINTROMINFO
printf("msus %x -> bdev %x\n", rp->msus, bdev);
#endif
- return (bdev);
+ return bdev;
}
+int
sctoaddr(sc)
int sc;
{
+
if (sc == -1)
- return(GRFIADDR);
+ return GRFIADDR ;
if (sc == 7 && internalhpib)
- return(internalhpib);
+ return internalhpib ;
if (sc < 32)
- return(DIOBASE + sc * DIOCSIZE);
+ return DIOBASE + sc * DIOCSIZE ;
if (sc >= 132)
- return(DIOIIBASE + (sc - 132) * DIOIICSIZE);
- return(sc);
+ return DIOIIBASE + (sc - 132) * DIOIICSIZE ;
+ return sc;
}
/*
@@ -214,12 +221,13 @@
*
* Note that we only care about displays, LANCEs, SCSIs and HP-IBs.
*/
+static void
find_devs()
{
short sc, sctop;
u_char *id_reg;
- register caddr_t addr;
- register struct hp_hw *hw;
+ caddr_t addr;
+ struct hp_hw *hw;
hw = sc_table;
sctop = machineid == HP_320 ? 32 : 256;
diff -r 47b095f6770b -r 89e43a207627 sys/arch/hp300/stand/common/clock.c
--- a/sys/arch/hp300/stand/common/clock.c Fri Nov 14 16:43:57 2003 +0000
+++ b/sys/arch/hp300/stand/common/clock.c Fri Nov 14 16:52:40 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: clock.c,v 1.3 2003/08/07 16:27:40 agc Exp $ */
+/* $NetBSD: clock.c,v 1.4 2003/11/14 16:52:40 tsutsui Exp $ */
/*
* Copyright (c) 1982, 1990, 1993
@@ -78,11 +78,19 @@
#include <sys/param.h>
+#include <net/if_ether.h>
+#include <netinet/in.h>
+#include <netinet/in_systm.h>
+
#include <hp300/dev/hilreg.h>
+#include <lib/libsa/stand.h>
+#include <lib/libsa/net.h>
+#include <hp300/stand/common/samachdep.h>
+
#define FEBRUARY 2
#define STARTOFTIME 1970
-#define SECDAY 86400L
+#define SECDAY (60L * 60L * 24L)
#define SECYR (SECDAY * 365)
#define BBC_SET_REG 0xe0
@@ -91,40 +99,41 @@
#define NUM_BBC_REGS 12
#define leapyear(year) ((year) % 4 == 0)
-#define range_test(n, l, h) if ((n) < (l) || (n) > (h)) return(0)
+#define range_test(n, l, h) if ((n) < (l) || (n) > (h)) return 0
#define days_in_year(a) (leapyear(a) ? 366 : 365)
#define days_in_month(a) (month_days[(a) - 1])
#define bbc_to_decimal(a,b) (bbc_registers[a] * 10 + bbc_registers[b])
-#include <hp300/stand/common/samachdep.h>
-
-static int month_days[12] = {
+static const int month_days[12] = {
31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
};
u_char bbc_registers[13];
-u_char read_bbc_reg();
struct hil_dev *bbcaddr = BBCADDR;
-getsecs()
+static int bbc_to_gmt(u_long *);
+
+time_t
+getsecs(void)
{
static int bbcinited = 0;
- u_long timbuf = 0;
+ time_t timbuf = 0;
if (!bbc_to_gmt(&timbuf) && !bbcinited)
printf("WARNING: bad date in battery clock\n");
bbcinited = 1;
/* Battery clock does not store usec's, so forget about it. */
- return(timbuf);
+ return timbuf;
}
+static int
bbc_to_gmt(timbuf)
u_long *timbuf;
{
- register int i;
- register u_long tmp;
+ int i;
+ u_long tmp;
int year, month, day, hour, min, sec;
read_bbc();
@@ -159,12 +168,13 @@
tmp = ((tmp * 24 + hour) * 60 + min) * 60 + sec;
*timbuf = tmp;
- return(1);
+ return 1;
}
+void
read_bbc()
{
- register int i, read_okay;
+ int i, read_okay;
read_okay = 0;
while (!read_okay) {
@@ -198,5 +208,5 @@
data = bbcaddr->hil_data;
#endif
}
- return(data);
+ return data;
}
diff -r 47b095f6770b -r 89e43a207627 sys/arch/hp300/stand/common/conf.c
--- a/sys/arch/hp300/stand/common/conf.c Fri Nov 14 16:43:57 2003 +0000
+++ b/sys/arch/hp300/stand/common/conf.c Fri Nov 14 16:52:40 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: conf.c,v 1.6 2003/08/07 16:27:40 agc Exp $ */
+/* $NetBSD: conf.c,v 1.7 2003/11/14 16:52:40 tsutsui Exp $ */
/*
* Copyright (c) 1982, 1986, 1990, 1993
@@ -42,66 +42,44 @@
#include <lib/libsa/nfs.h>
#include <lib/libsa/ufs.h>
+#include <hp300/stand/common/conf.h>
#include <hp300/stand/common/rawfs.h>
#include <hp300/stand/common/samachdep.h>
int debug = 0; /* XXX */
#define xxstrategy \
- (int (*) __P((void *, int, daddr_t, size_t, void *, size_t *)))nullsys
-#define xxopen (int (*) __P((struct open_file *, ...)))nodev
-#define xxclose (int (*) __P((struct open_file *)))nullsys
+ (int (*)(void *, int, daddr_t, size_t, void *, size_t *))nullsys
+#define xxopen (int (*)(struct open_file *, ...))nodev
+#define xxclose (int (*)(struct open_file *))nullsys
Home |
Main Index |
Thread Index |
Old Index