summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2006-01-14 20:05:07 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2006-01-14 20:05:07 +0000
commitbc29e9e720e9ca8a392d1a5b7edfb0a1c9e68a3a (patch)
treedad3eb6bf43e9fdffac51ca8eef417ac47c27896
parentdc020d5edad184ce0746299844a3d25b9cbc3264 (diff)
Move isa-specific members of struct lm_softc into lm_isa.c.
-rw-r--r--sys/dev/ic/lm78var.h6
-rw-r--r--sys/dev/isa/lm_isa.c40
2 files changed, 26 insertions, 20 deletions
diff --git a/sys/dev/ic/lm78var.h b/sys/dev/ic/lm78var.h
index 69d08a7843a..862e7444e64 100644
--- a/sys/dev/ic/lm78var.h
+++ b/sys/dev/ic/lm78var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: lm78var.h,v 1.1 2006/01/14 15:14:33 kettenis Exp $ */
+/* $OpenBSD: lm78var.h,v 1.2 2006/01/14 20:05:06 kettenis Exp $ */
/*
* Copyright (c) 2005, 2006 Mark Kettenis
@@ -130,10 +130,6 @@ struct lm_sensor {
struct lm_softc {
struct device sc_dev;
- bus_space_tag_t lm_iot;
- bus_space_handle_t lm_ioh;
-
- int sc_flags;
struct sensor sensors[WB_MAX_SENSORS];
struct lm_sensor *lm_sensors;
u_int numsensors;
diff --git a/sys/dev/isa/lm_isa.c b/sys/dev/isa/lm_isa.c
index 1007a66872a..f5da1a23882 100644
--- a/sys/dev/isa/lm_isa.c
+++ b/sys/dev/isa/lm_isa.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lm_isa.c,v 1.5 2006/01/14 15:14:33 kettenis Exp $ */
+/* $OpenBSD: lm_isa.c,v 1.6 2006/01/14 20:05:06 kettenis Exp $ */
/* $NetBSD: lm_isa.c,v 1.9 2002/11/15 14:55:44 ad Exp $ */
/*-
@@ -58,6 +58,13 @@
#define DPRINTF(x)
#endif
+struct lm_isa_softc {
+ struct lm_softc sc_lmsc;
+
+ bus_space_tag_t sc_iot;
+ bus_space_handle_t sc_ioh;
+};
+
int lm_isa_match(struct device *, void *, void *);
void lm_isa_attach(struct device *, struct device *, void *);
u_int8_t lm_isa_readreg(struct lm_softc *, int);
@@ -127,35 +134,38 @@ lm_isa_match(struct device *parent, void *match, void *aux)
void
lm_isa_attach(struct device *parent, struct device *self, void *aux)
{
- struct lm_softc *sc = (struct lm_softc *)self;
- int iobase;
- bus_space_tag_t iot;
+ struct lm_isa_softc *sc = (struct lm_isa_softc *)self;
struct isa_attach_args *ia = aux;
+ int iobase;
+ sc->sc_iot = ia->ia_iot;
iobase = ia->ipa_io[0].base;
- iot = sc->lm_iot = ia->ia_iot;
- if (bus_space_map(iot, iobase, 8, 0, &sc->lm_ioh)) {
+ if (bus_space_map(sc->sc_iot, iobase, 8, 0, &sc->sc_ioh)) {
printf(": can't map i/o space\n");
return;
}
/* Bus-independant attachment */
- sc->lm_writereg = lm_isa_writereg;
- sc->lm_readreg = lm_isa_readreg;
- lm_attach(sc);
+ sc->sc_lmsc.lm_writereg = lm_isa_writereg;
+ sc->sc_lmsc.lm_readreg = lm_isa_readreg;
+ lm_attach(&sc->sc_lmsc);
}
u_int8_t
-lm_isa_readreg(struct lm_softc *sc, int reg)
+lm_isa_readreg(struct lm_softc *lmsc, int reg)
{
- bus_space_write_1(sc->lm_iot, sc->lm_ioh, LMC_ADDR, reg);
- return (bus_space_read_1(sc->lm_iot, sc->lm_ioh, LMC_DATA));
+ struct lm_isa_softc *sc = (struct lm_isa_softc *)lmsc;
+
+ bus_space_write_1(sc->sc_iot, sc->sc_ioh, LMC_ADDR, reg);
+ return (bus_space_read_1(sc->sc_iot, sc->sc_ioh, LMC_DATA));
}
void
-lm_isa_writereg(struct lm_softc *sc, int reg, int val)
+lm_isa_writereg(struct lm_softc *lmsc, int reg, int val)
{
- bus_space_write_1(sc->lm_iot, sc->lm_ioh, LMC_ADDR, reg);
- bus_space_write_1(sc->lm_iot, sc->lm_ioh, LMC_DATA, val);
+ struct lm_isa_softc *sc = (struct lm_isa_softc *)lmsc;
+
+ bus_space_write_1(sc->sc_iot, sc->sc_ioh, LMC_ADDR, reg);
+ bus_space_write_1(sc->sc_iot, sc->sc_ioh, LMC_DATA, val);
}