A small bit of const poisoning.

This commit is contained in:
thorpej 2021-05-07 16:55:58 +00:00
parent 26802ffd8d
commit e2840100a9
4 changed files with 17 additions and 16 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ioasic_subr.c,v 1.14 2021/04/24 23:36:59 thorpej Exp $ */
/* $NetBSD: ioasic_subr.c,v 1.15 2021/05/07 16:55:58 thorpej Exp $ */
/*
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@ -29,7 +29,7 @@
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ioasic_subr.c,v 1.14 2021/04/24 23:36:59 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: ioasic_subr.c,v 1.15 2021/05/07 16:55:58 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -53,8 +53,8 @@ ioasicprint(void *aux, const char *pnp)
}
void
ioasic_attach_devs(struct ioasic_softc *sc, struct ioasic_dev *ioasic_devs,
int ioasic_ndevs)
ioasic_attach_devs(struct ioasic_softc *sc,
const struct ioasic_dev *ioasic_devs, int ioasic_ndevs)
{
struct ioasicdev_attach_args idev;
int i;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ioasicvar.h,v 1.22 2011/06/04 01:49:44 tsutsui Exp $ */
/* $NetBSD: ioasicvar.h,v 1.23 2021/05/07 16:55:58 thorpej Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
@ -67,6 +67,6 @@ void ioasic_intr_establish(device_t, void *,
int, int (*)(void *), void *);
void ioasic_intr_disestablish(device_t, void *);
void ioasic_attach_devs(struct ioasic_softc *,
struct ioasic_dev *, int);
const struct ioasic_dev *, int);
#endif /* _DEV_TC_IOASICVAR_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: tc.c,v 1.57 2021/04/24 23:36:59 thorpej Exp $ */
/* $NetBSD: tc.c,v 1.58 2021/05/07 16:55:58 thorpej Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: tc.c,v 1.57 2021/04/24 23:36:59 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: tc.c,v 1.58 2021/05/07 16:55:58 thorpej Exp $");
#include "opt_tcverbose.h"
@ -73,7 +73,7 @@ tcattach(device_t parent, device_t self, void *aux)
struct tcbus_attach_args *tba = aux;
struct tc_attach_args ta;
const struct tc_builtin *builtin;
struct tc_slotdesc *slot;
const struct tc_slotdesc *slot;
tc_addr_t tcaddr;
int i;
int locs[TCCF_NLOCS];
@ -129,7 +129,8 @@ tcattach(device_t parent, device_t self, void *aux)
/*
* Mark the slot as used, so we don't check it later.
*/
sc->sc_slots[builtin->tcb_slot].tcs_used = 1;
KASSERT(builtin->tcb_slot >=0 && builtin->tcb_slot <= 31);
sc->sc_slots_used |= __BIT(builtin->tcb_slot);
locs[TCCF_SLOT] = builtin->tcb_slot;
locs[TCCF_OFFSET] = builtin->tcb_offset;
@ -149,7 +150,7 @@ tcattach(device_t parent, device_t self, void *aux)
slot = &sc->sc_slots[i];
/* If already checked above, don't look again now. */
if (slot->tcs_used)
if (sc->sc_slots_used & __BIT(i))
continue;
/*
@ -175,7 +176,7 @@ tcattach(device_t parent, device_t self, void *aux)
/*
* Mark the slot as used.
*/
slot->tcs_used = 1;
sc->sc_slots_used |= __BIT(i);
locs[TCCF_SLOT] = i;
locs[TCCF_OFFSET] = 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: tcvar.h,v 1.27 2017/06/09 17:55:18 flxd Exp $ */
/* $NetBSD: tcvar.h,v 1.28 2021/05/07 16:55:58 thorpej Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
@ -68,7 +68,8 @@ struct tc_softc {
int sc_speed;
int sc_nslots;
struct tc_slotdesc *sc_slots;
const struct tc_slotdesc *sc_slots;
uint32_t sc_slots_used;
const struct evcnt *(*sc_intr_evcnt)(device_t, void *);
void (*sc_intr_establish)(device_t, void *,
@ -87,7 +88,7 @@ struct tcbus_attach_args {
/* Bus information */
u_int tba_speed; /* see TC_SPEED_* below */
u_int tba_nslots;
struct tc_slotdesc *tba_slots;
const struct tc_slotdesc *tba_slots;
u_int tba_nbuiltins;
const struct tc_builtin *tba_builtins;
@ -122,7 +123,6 @@ struct tc_attach_args {
struct tc_slotdesc {
tc_addr_t tcs_addr;
void *tcs_cookie;
int tcs_used;
};
/*