diff options
| author | xtraeme <xtraeme@NetBSD.org> | 2008-04-04 09:49:49 +0000 |
|---|---|---|
| committer | xtraeme <xtraeme@NetBSD.org> | 2008-04-04 09:49:49 +0000 |
| commit | 74fc6cf06ccc3f114e7939a0991e84fa1d4cfae7 (patch) | |
| tree | f6c6ed58307406c6282d0564664bb78ca2030aa1 /sys/dev | |
| parent | 00d02da16b1df9bb4a4d1140ca9a3769ed776dd4 (diff) | |
Split device_t/softc and other related cosmetic changes.
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/i2c/adt7463.c | 20 | ||||
| -rw-r--r-- | sys/dev/i2c/adt7463reg.h | 5 | ||||
| -rw-r--r-- | sys/dev/isa/nsclpcsio_isa.c | 34 |
3 files changed, 29 insertions, 30 deletions
diff --git a/sys/dev/i2c/adt7463.c b/sys/dev/i2c/adt7463.c index a2bee420e1d..44d5c132cf6 100644 --- a/sys/dev/i2c/adt7463.c +++ b/sys/dev/i2c/adt7463.c @@ -1,4 +1,4 @@ -/* $NetBSD: adt7463.c,v 1.14 2007/11/16 22:46:56 njoly Exp $ */ +/* $NetBSD: adt7463.c,v 1.15 2008/04/04 09:55:58 xtraeme Exp $ */ /* * Copyright (c) 2005 Anil Gopinath (anil_public@yahoo.com) @@ -35,7 +35,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: adt7463.c,v 1.14 2007/11/16 22:46:56 njoly Exp $"); +__KERNEL_RCSID(0, "$NetBSD: adt7463.c,v 1.15 2008/04/04 09:55:58 xtraeme Exp $"); /* Fan speed control added by Hanns Hartman */ #include <sys/param.h> @@ -60,15 +60,14 @@ static void adt7463c_refresh_temp(struct adt7463c_softc *, envsys_data_t *); static void adt7463c_refresh_fan(struct adt7463c_softc *, envsys_data_t *); static int adt7463c_verify(struct adt7463c_softc *sc); -static int adt7463c_match(struct device *, struct cfdata *, void *); -static void adt7463c_attach(struct device *, struct device *, void *); +static int adt7463c_match(device_t, cfdata_t, void *); +static void adt7463c_attach(device_t, device_t, void *); - -CFATTACH_DECL(adt7463c, sizeof(struct adt7463c_softc), +CFATTACH_DECL_NEW(adt7463c, sizeof(struct adt7463c_softc), adt7463c_match, adt7463c_attach, NULL, NULL); static int -adt7463c_match(struct device *parent, struct cfdata *cf, void *aux) +adt7463c_match(device_t parent, cfdata_t cf, void *aux) { struct i2c_attach_args *ia = aux; struct adt7463c_softc sc; @@ -82,7 +81,7 @@ adt7463c_match(struct device *parent, struct cfdata *cf, void *aux) } static void -adt7463c_attach(struct device *parent, struct device *self, void *aux) +adt7463c_attach(device_t parent, device_t self, void *aux) { struct adt7463c_softc *sc = device_private(self); struct i2c_attach_args *ia = aux; @@ -145,13 +144,12 @@ adt7463c_attach(struct device *parent, struct device *self, void *aux) } /* Hook into the System Monitor. */ - sc->sc_sme->sme_name = sc->sc_dev.dv_xname; + sc->sc_sme->sme_name = device_xname(self); sc->sc_sme->sme_cookie = sc; sc->sc_sme->sme_refresh = adt7463c_refresh; if (sysmon_envsys_register(sc->sc_sme)) { - aprint_error("%s: unable to register with sysmon\n", - sc->sc_dev.dv_xname); + aprint_error_dev(self, "unable to register with sysmon\n"); sysmon_envsys_destroy(sc->sc_sme); } } diff --git a/sys/dev/i2c/adt7463reg.h b/sys/dev/i2c/adt7463reg.h index c5f9588a093..ca3bc08694a 100644 --- a/sys/dev/i2c/adt7463reg.h +++ b/sys/dev/i2c/adt7463reg.h @@ -1,4 +1,4 @@ -/* $NetBSD: adt7463reg.h,v 1.7 2007/11/16 08:00:14 xtraeme Exp $ */ +/* $NetBSD: adt7463reg.h,v 1.8 2008/04/04 09:55:58 xtraeme Exp $ */ /* * Copyright (c) 2005 Anil Gopinath (anil_public@yahoo.com) @@ -79,11 +79,10 @@ #define ADT7463_RPM_CONST (90000 * 60) struct adt7463c_softc { - struct device sc_dev; /* generic device structures */ i2c_tag_t sc_tag; i2c_addr_t sc_address; - envsys_data_t sc_sensor[ADT7463_MAX_ENVSYS_RANGE]; struct sysmon_envsys *sc_sme; + envsys_data_t sc_sensor[ADT7463_MAX_ENVSYS_RANGE]; }; /* diff --git a/sys/dev/isa/nsclpcsio_isa.c b/sys/dev/isa/nsclpcsio_isa.c index e98dfecfd88..b98bebfe7f4 100644 --- a/sys/dev/isa/nsclpcsio_isa.c +++ b/sys/dev/isa/nsclpcsio_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: nsclpcsio_isa.c,v 1.25 2008/01/02 10:21:08 dyoung Exp $ */ +/* $NetBSD: nsclpcsio_isa.c,v 1.26 2008/04/04 09:49:49 xtraeme Exp $ */ /* * Copyright (c) 2002 @@ -32,7 +32,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: nsclpcsio_isa.c,v 1.25 2008/01/02 10:21:08 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nsclpcsio_isa.c,v 1.26 2008/04/04 09:49:49 xtraeme Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -167,7 +167,8 @@ static const struct { #define SIO_VREF 1235 /* 1000.0 * VREF */ struct nsclpcsio_softc { - struct device sc_dev; + device_t sc_dev; + bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; @@ -205,16 +206,16 @@ struct nsclpcsio_softc { bus_space_read_1((sc)->sc_iot, \ (sc)->sc_ld_ioh[SIO_LDN_VLM], (reg)) -static int nsclpcsio_isa_match(struct device *, struct cfdata *, void *); -static void nsclpcsio_isa_attach(struct device *, struct device *, void *); -static int nsclpcsio_isa_detach(struct device *, int); +static int nsclpcsio_isa_match(device_t, cfdata_t, void *); +static void nsclpcsio_isa_attach(device_t, device_t, void *); +static int nsclpcsio_isa_detach(device_t, int); -CFATTACH_DECL(nsclpcsio_isa, sizeof(struct nsclpcsio_softc), +CFATTACH_DECL_NEW(nsclpcsio_isa, sizeof(struct nsclpcsio_softc), nsclpcsio_isa_match, nsclpcsio_isa_attach, nsclpcsio_isa_detach, NULL); static uint8_t nsread(bus_space_tag_t, bus_space_handle_t, int); static void nswrite(bus_space_tag_t, bus_space_handle_t, int, uint8_t); -static int nscheck(bus_space_tag_t, int); +static int nscheck(bus_space_tag_t, int); static void nsclpcsio_tms_init(struct nsclpcsio_softc *); static void nsclpcsio_vlm_init(struct nsclpcsio_softc *); @@ -260,7 +261,7 @@ nscheck(bus_space_tag_t iot, int base) } static int -nsclpcsio_isa_match(struct device *parent, struct cfdata *match, void *aux) +nsclpcsio_isa_match(device_t parent, cfdata_t match, void *aux) { struct isa_attach_args *ia = aux; int iobase; @@ -309,7 +310,7 @@ nsclpcsio_envsys_init(struct nsclpcsio_softc *sc) sme = sysmon_envsys_create(); for (i = 0; i < SIO_NUM_SENSORS; i++) { if (sysmon_envsys_sensor_attach(sme, &sc->sc_sensor[i]) != 0) { - aprint_error_dev(&sc->sc_dev, + aprint_error_dev(sc->sc_dev, "could not attach sensor %d", i); goto err; } @@ -318,13 +319,13 @@ nsclpcsio_envsys_init(struct nsclpcsio_softc *sc) /* * Hook into the System Monitor. */ - sme->sme_name = device_xname(&sc->sc_dev); + sme->sme_name = device_xname(sc->sc_dev); sme->sme_cookie = sc; sme->sme_refresh = nsclpcsio_refresh; - if (sysmon_envsys_register(sme) != 0) { - aprint_error("%s: unable to register with sysmon\n", - sc->sc_dev.dv_xname); + if ((i = sysmon_envsys_register(sme)) != 0) { + aprint_error_dev(sc->sc_dev, + "unable to register with sysmon (%d)\n", i); goto err; } return sme; @@ -334,7 +335,7 @@ err: } static void -nsclpcsio_isa_attach(struct device *parent, struct device *self, void *aux) +nsclpcsio_isa_attach(device_t parent, device_t self, void *aux) { struct nsclpcsio_softc *sc = device_private(self); struct isa_attach_args *ia = aux; @@ -345,6 +346,7 @@ nsclpcsio_isa_attach(struct device *parent, struct device *self, void *aux) mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_NONE); + sc->sc_dev = self; sc->sc_iot = ia->ia_iot; iobase = ia->ia_io[0].ir_addr; @@ -403,7 +405,7 @@ nsclpcsio_isa_attach(struct device *parent, struct device *self, void *aux) } static int -nsclpcsio_isa_detach(struct device *self, int flags) +nsclpcsio_isa_detach(device_t self, int flags) { int i, rc; struct nsclpcsio_softc *sc = device_private(self); |
