diff --git a/sys/arch/sparc64/dev/psm.c b/sys/arch/sparc64/dev/psm.c index d837a95d9a41..dafbf3fb8dd7 100644 --- a/sys/arch/sparc64/dev/psm.c +++ b/sys/arch/sparc64/dev/psm.c @@ -1,4 +1,4 @@ -/* $NetBSD: psm.c,v 1.7 2008/04/05 13:40:05 cegger Exp $ */ +/* $NetBSD: psm.c,v 1.8 2011/06/03 03:09:02 christos Exp $ */ /* * Copyright (c) 2006 Itronix Inc. * All rights reserved. @@ -36,7 +36,7 @@ * time with APM at this point, and some of sysmon seems "lacking". */ #include -__KERNEL_RCSID(0, "$NetBSD: psm.c,v 1.7 2008/04/05 13:40:05 cegger Exp $"); +__KERNEL_RCSID(0, "$NetBSD: psm.c,v 1.8 2011/06/03 03:09:02 christos Exp $"); #include #include @@ -60,7 +60,7 @@ __KERNEL_RCSID(0, "$NetBSD: psm.c,v 1.7 2008/04/05 13:40:05 cegger Exp $"); #include struct psm_softc { - struct device sc_dev; + device_t sc_dev; bus_space_tag_t sc_memt; bus_space_handle_t sc_memh; @@ -120,15 +120,15 @@ STATIC int psm_ecmd_rd8(struct psm_softc *, uint8_t *, uint8_t, uint8_t, uint8_t); STATIC int psm_ecmd_wr8(struct psm_softc *, uint8_t, uint8_t, uint8_t, uint8_t); -STATIC int psm_match(struct device *, struct cfdata *, void *); -STATIC void psm_attach(struct device *, struct device *, void *); +STATIC int psm_match(device_t, cfdata_t, void *); +STATIC void psm_attach(device_t, device_t, void *); -CFATTACH_DECL(psm, sizeof(struct psm_softc), +CFATTACH_DECL_NEW(psm, sizeof(struct psm_softc), psm_match, psm_attach, NULL, NULL); int -psm_match(struct device *parent, struct cfdata *cf, void *aux) +psm_match(struct device *parent, cfdata_t cf, void *aux) { struct ebus_attach_args *ea = aux; @@ -140,16 +140,17 @@ psm_match(struct device *parent, struct cfdata *cf, void *aux) void psm_attach(struct device *parent, struct device *self, void *aux) { - struct psm_softc *sc = (struct psm_softc *)self; + struct psm_softc *sc = device_private(self); struct ebus_attach_args *ea = aux; bus_addr_t devaddr; const char *xname; - xname = device_xname(&sc->sc_dev); + sc->sc_dev = self; sc->sc_memt = ea->ea_bustag; devaddr = EBUS_ADDR_FROM_REG(&ea->ea_reg[0]); + xname = device_xname(sc->sc_dev); if (bus_space_map(sc->sc_memt, devaddr, ea->ea_reg[0].size, 0, &sc->sc_memh) != 0) { printf(": unable to map device registers\n"); @@ -165,8 +166,8 @@ psm_attach(struct device *parent, struct device *self, void *aux) psm_sysmon_setup(sc); if (kthread_create(PRI_NONE, 0, NULL, psm_event_thread, sc, - &sc->sc_thread, "%s", device_xname(&sc->sc_dev)) != 0) { - aprint_error_dev(&sc->sc_dev, "unable to create event kthread\n"); + &sc->sc_thread, "%s", xname) != 0) { + aprint_error_dev(sc->sc_dev, "unable to create event kthread\n"); } /* @@ -175,7 +176,7 @@ psm_attach(struct device *parent, struct device *self, void *aux) (void) bus_intr_establish(sc->sc_memt, ea->ea_intr[0], IPL_HIGH, psm_intr, sc); evcnt_attach_dynamic(&sc->sc_intrcnt, EVCNT_TYPE_INTR, NULL, - device_xname(&sc->sc_dev), "intr"); + xname, "intr"); } /* @@ -184,7 +185,7 @@ psm_attach(struct device *parent, struct device *self, void *aux) void psm_sysmon_setup(struct psm_softc *sc) { - const char *xname = device_xname(&sc->sc_dev); + const char *xname = device_xname(sc->sc_dev); /* @@ -271,7 +272,7 @@ psm_init(struct psm_softc *sc) /* make sure that UPS battery is reasonable */ if (psm_misc_rd(sc, PSM_MISC_UPS, &batt) || (batt > PSM_MAX_BATTERIES)) if (psm_misc_wr(sc, PSM_MISC_UPS, batt)) - aprint_error_dev(&sc->sc_dev, "cannot set UPS battery"); + aprint_error_dev(sc->sc_dev, "cannot set UPS battery"); return (0); } diff --git a/sys/arch/sparc64/dev/pyrovar.h b/sys/arch/sparc64/dev/pyrovar.h index 30274122e3e0..e26a26ed9530 100644 --- a/sys/arch/sparc64/dev/pyrovar.h +++ b/sys/arch/sparc64/dev/pyrovar.h @@ -55,7 +55,7 @@ struct pyro_pbm { }; struct pyro_softc { - struct device sc_dv; + device_t sc_dev; int sc_node; int sc_ign; bus_dma_tag_t sc_dmat; diff --git a/sys/arch/sparc64/dev/upa.c b/sys/arch/sparc64/dev/upa.c index 248c8bd45891..1a32101941bc 100644 --- a/sys/arch/sparc64/dev/upa.c +++ b/sys/arch/sparc64/dev/upa.c @@ -50,7 +50,7 @@ struct upa_range { }; struct upa_softc { - struct device sc_dev; + device_t sc_dev; bus_space_tag_t sc_bt; bus_space_handle_t sc_reg[3]; struct upa_range *sc_range; @@ -59,10 +59,10 @@ struct upa_softc { bus_space_tag_t sc_cbt; }; -int upa_match(struct device*, struct cfdata*, void *); -void upa_attach(struct device*, struct device*, void *); +int upa_match(device_t, cfdata_t, void *); +void upa_attach(device_t, device_t, void *); -CFATTACH_DECL(upa, sizeof(struct upa_softc), +CFATTACH_DECL_NEW(upa, sizeof(struct upa_softc), upa_match, upa_attach, NULL, NULL); int upa_print(void *, const char *); @@ -72,7 +72,7 @@ int upa_bus_map(bus_space_tag_t, bus_addr_t, paddr_t upa_bus_mmap(bus_space_tag_t, bus_addr_t, off_t, int, int); int -upa_match(struct device *parent, struct cfdata *match, void *aux) +upa_match(device_t parent, cfdata_t match, void *aux) { struct mainbus_attach_args *ma = aux; @@ -83,12 +83,13 @@ upa_match(struct device *parent, struct cfdata *match, void *aux) } void -upa_attach(struct device *parent, struct device *self, void *aux) +upa_attach(device_t parent, device_t self, void *aux) { struct upa_softc *sc = device_private(self); struct mainbus_attach_args *ma = aux; int i, node; + sc->sc_dev = self; sc->sc_bt = ma->ma_bustag; sc->sc_node = ma->ma_node; @@ -128,7 +129,7 @@ upa_attach(struct device *parent, struct device *self, void *aux) map.ma_name = buf; map.ma_bustag = sc->sc_cbt; map.ma_dmatag = ma->ma_dmatag; - config_found(&sc->sc_dev, &map, upa_print); + config_found(sc->sc_dev, &map, upa_print); } }