minor cleanup: some "const", global namespace sanity and fix a maclo name

This commit is contained in:
drochner 2005-07-20 15:11:57 +00:00
parent c678505909
commit e7bf69a733
5 changed files with 31 additions and 30 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: firewire.c,v 1.1 2005/07/11 15:29:05 kiyohara Exp $ */
/* $NetBSD: firewire.c,v 1.2 2005/07/20 15:11:57 drochner Exp $ */
/*-
* Copyright (c) 2003 Hidetoshi Shimokawa
* Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
@ -232,7 +232,7 @@ static device_method_t firewire_methods[] = {
CFATTACH_DECL(ieee1394if, sizeof (struct firewire_softc),
firewirematch, firewireattach, firewiredetach, NULL);
#endif
const char *linkspeed[] = {
const char *fw_linkspeed[] = {
"S100", "S200", "S400", "S800",
"S1600", "S3200", "undef", "undef"
};
@ -306,7 +306,7 @@ fw_asyreq(struct firewire_comm *fc, int sub, struct fw_xfer *xfer)
int tl = -1, len;
struct fw_pkt *fp;
int tcode;
struct tcode_info *info;
const struct tcode_info *info;
if(xfer == NULL) return EINVAL;
if(xfer->hand == NULL){
@ -782,7 +782,7 @@ fw_busreset(struct firewire_comm *fc)
fw_reset_csr(fc);
fw_reset_crom(fc);
FIREWIRE_CHILDLEN_FOREACH_FUNC(post_busreset, fdc);
FIREWIRE_CHILDREN_FOREACH_FUNC(post_busreset, fdc);
newrom = malloc(CROMSIZE, M_FW, M_NOWAIT | M_ZERO);
src = &fc->crom_src_buf->src;
@ -1568,7 +1568,7 @@ fw_explore_node(struct fw_device *dfwdev)
STAILQ_INSERT_AFTER(&fc->devices, pfwdev, fwdev, link);
device_printf(fc->bdev, "New %s device ID:%08x%08x\n",
linkspeed[spd],
fw_linkspeed[spd],
fwdev->eui.hi, fwdev->eui.lo);
} else
@ -1722,7 +1722,7 @@ fw_attach_dev(struct firewire_comm *fc)
}
}
FIREWIRE_CHILDLEN_FOREACH_FUNC(post_explore, fdc);
FIREWIRE_CHILDREN_FOREACH_FUNC(post_explore, fdc);
for (fwdev = STAILQ_FIRST(&fc->devices); fwdev != NULL; fwdev = next) {
next = STAILQ_NEXT(fwdev, link);
@ -1779,7 +1779,7 @@ fw_rcv_copy(struct fw_rcv_buf *rb)
{
struct fw_pkt *pkt;
u_char *p;
struct tcode_info *tinfo;
const struct tcode_info *tinfo;
u_int res, i, len, plen;
rb->xfer->recv.spd = rb->spd;

View File

@ -1,4 +1,4 @@
/* $NetBSD: firewirereg.h,v 1.1 2005/07/11 15:29:05 kiyohara Exp $ */
/* $NetBSD: firewirereg.h,v 1.2 2005/07/20 15:11:57 drochner Exp $ */
/*-
* Copyright (c) 2003 Hidetoshi Shimokawa
* Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
@ -168,7 +168,7 @@ struct firewire_comm{
void (*set_intr) (struct firewire_comm *, int);
void (*irx_post) (struct firewire_comm *, uint32_t *);
void (*itx_post) (struct firewire_comm *, uint32_t *);
struct tcode_info *tcode;
const struct tcode_info *tcode;
bus_dma_tag_t dmat;
};
#define CSRARC(sc, offset) ((sc)->csr_arc[(offset)/4])

View File

@ -1,4 +1,4 @@
/* $NetBSD: fw_port.h,v 1.1 2005/07/11 15:29:05 kiyohara Exp $ */
/* $NetBSD: fw_port.h,v 1.2 2005/07/20 15:11:57 drochner Exp $ */
/*
* Copyright (c) 2004 KIYOHARA Takashi
* All rights reserved.
@ -271,7 +271,7 @@ typedef struct proc fw_proc;
if (device_detach(fwdev->sbp) != 0) \
return; \
} while (0)
#define FIREWIRE_CHILDLEN_FOREACH_FUNC(func, fdc) \
#define FIREWIRE_CHILDREN_FOREACH_FUNC(func, fdc) \
do { \
device_t *devlistp; \
int i, devcnt; \
@ -876,7 +876,7 @@ struct fwbus_attach_args {
return; \
} \
} while (0)
#define FIREWIRE_CHILDLEN_FOREACH_FUNC(func, fdc) \
#define FIREWIRE_CHILDREN_FOREACH_FUNC(func, fdc) \
do { \
struct firewire_dev_list *devlist; \
struct firewire_softc *sc = (struct firewire_softc *)fc->bdev;\

View File

@ -1,4 +1,4 @@
/* $NetBSD: fwdev.c,v 1.1 2005/07/11 15:29:05 kiyohara Exp $ */
/* $NetBSD: fwdev.c,v 1.2 2005/07/20 15:11:57 drochner Exp $ */
/*-
* Copyright (c) 2003 Hidetoshi Shimokawa
* Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
@ -334,7 +334,7 @@ fw_read_async(struct fw_drv1 *d, struct uio *uio, int ioflag)
struct fw_xfer *xfer;
struct fw_bind *fwb;
struct fw_pkt *fp;
struct tcode_info *tinfo;
const struct tcode_info *tinfo;
while ((xfer = STAILQ_FIRST(&d->rq)) == NULL && err == 0)
err = tsleep(&d->rq, FWPRI, "fwra", 0);
@ -445,7 +445,7 @@ fw_write_async(struct fw_drv1 *d, struct uio *uio, int ioflag)
{
struct fw_xfer *xfer;
struct fw_pkt pkt;
struct tcode_info *tinfo;
const struct tcode_info *tinfo;
int err;
bzero(&pkt, sizeof(struct fw_pkt));
@ -679,7 +679,7 @@ FW_IOCTL(fw)
break;
case FW_ASYREQ:
{
struct tcode_info *tinfo;
const struct tcode_info *tinfo;
int pay_len = 0;
fp = &asyreq->pkt;

View File

@ -1,4 +1,4 @@
/* $NetBSD: fwohci.c,v 1.89 2005/07/11 15:37:00 kiyohara Exp $ */
/* $NetBSD: fwohci.c,v 1.90 2005/07/20 15:11:57 drochner Exp $ */
/*-
* Copyright (c) 2003 Hidetoshi Shimokawa
* Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
@ -149,13 +149,14 @@ err:
}
#endif
static char dbcode[16][0x10]={"OUTM", "OUTL","INPM","INPL",
"STOR","LOAD","NOP ","STOP",};
static const char * const dbcode[16] = {"OUTM", "OUTL","INPM","INPL",
"STOR","LOAD","NOP ","STOP",
"", "", "", "", "", "", "", ""};
static char dbkey[8][0x10]={"ST0", "ST1","ST2","ST3",
static const char * const dbkey[8] = {"ST0", "ST1","ST2","ST3",
"UNDEF","REG","SYS","DEV"};
static char dbcond[4][0x10]={"NEV","C=1", "C=0", "ALL"};
char fwohcicode[32][0x20]={
static const char * const dbcond[4] = {"NEV","C=1", "C=0", "ALL"};
static const char * const fwohcicode[32] = {
"No stat","Undef","long","miss Ack err",
"underrun","overrun","desc err", "data read err",
"data write err","bus reset","timeout","tcode err",
@ -166,10 +167,10 @@ char fwohcicode[32][0x20]={
"Undef","ack data_err","ack type_err",""};
#define MAX_SPEED 3
extern char *linkspeed[];
uint32_t tagbit[4] = { 1 << 28, 1 << 29, 1 << 30, 1 << 31};
extern const char *fw_linkspeed[];
static uint32_t const tagbit[4] = { 1 << 28, 1 << 29, 1 << 30, 1 << 31};
static struct tcode_info tinfo[] = {
static const struct tcode_info tinfo[] = {
/* hdr_len block flag*/
/* 0 WREQQ */ {16, FWTI_REQ | FWTI_TLABEL},
/* 1 WREQB */ {16, FWTI_REQ | FWTI_TLABEL | FWTI_BLOCK_ASY},
@ -515,7 +516,7 @@ fwohci_probe_phy(struct fwohci_softc *sc, device_t dev)
}
device_printf(dev,
"Phy 1394 only %s, %d ports.\n",
linkspeed[sc->fc.speed], sc->fc.nport);
fw_linkspeed[sc->fc.speed], sc->fc.nport);
}else{
reg2 = fwphy_rddata(sc, FW_PHY_ESPD_REG);
sc->fc.mode |= FWPHYASYST;
@ -528,7 +529,7 @@ fwohci_probe_phy(struct fwohci_softc *sc, device_t dev)
}
device_printf(dev,
"Phy 1394a available %s, %d ports.\n",
linkspeed[sc->fc.speed], sc->fc.nport);
fw_linkspeed[sc->fc.speed], sc->fc.nport);
/* check programPhyEnable */
reg2 = fwphy_rddata(sc, 5);
@ -606,7 +607,7 @@ fwohci_reset(struct fwohci_softc *sc, device_t dev)
max_rec = (reg & 0x0000f000) >> 12;
speed = (reg & 0x00000007);
device_printf(dev, "Link %s, max_rec %d bytes.\n",
linkspeed[speed], MAXREC(max_rec));
fw_linkspeed[speed], MAXREC(max_rec));
/* XXX fix max_rec */
sc->fc.maxrec = sc->fc.speed + 8;
if (max_rec != sc->fc.maxrec) {
@ -930,7 +931,7 @@ fwohci_start(struct fwohci_softc *sc, struct fwohci_dbch *dbch)
struct fwohcidb_tr *db_tr;
struct fwohcidb *db;
uint32_t *ld;
struct tcode_info *info;
const struct tcode_info *info;
static int maxdesc=0;
if(&sc->atrq == dbch){
@ -2811,7 +2812,7 @@ fwohci_arcv_swap(struct fw_pkt *fp, int len)
static int
fwohci_get_plen(struct fwohci_softc *sc, struct fwohci_dbch *dbch, struct fw_pkt *fp)
{
struct tcode_info *info;
const struct tcode_info *info;
int r;
info = &tinfo[fp->mode.common.tcode];