Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/sparc64/dev CFATTACH_DECL_NEW
details: https://anonhg.NetBSD.org/src/rev/fac274e7a8eb
branches: trunk
changeset: 765694:fac274e7a8eb
user: christos <christos%NetBSD.org@localhost>
date: Fri Jun 03 03:05:21 2011 +0000
description:
CFATTACH_DECL_NEW
diffstat:
sys/arch/sparc64/dev/psm.c | 29 +++++++++++++++--------------
sys/arch/sparc64/dev/pyrovar.h | 2 +-
sys/arch/sparc64/dev/upa.c | 15 ++++++++-------
3 files changed, 24 insertions(+), 22 deletions(-)
diffs (176 lines):
diff -r baf91b939943 -r fac274e7a8eb sys/arch/sparc64/dev/psm.c
--- a/sys/arch/sparc64/dev/psm.c Fri Jun 03 03:02:36 2011 +0000
+++ b/sys/arch/sparc64/dev/psm.c Fri Jun 03 03:05:21 2011 +0000
@@ -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 <sys/cdefs.h>
-__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 <sys/param.h>
#include <sys/systm.h>
@@ -60,7 +60,7 @@
#include <sparc64/dev/psmreg.h>
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 @@
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 @@
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_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 @@
(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 @@
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 @@
/* 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 -r baf91b939943 -r fac274e7a8eb sys/arch/sparc64/dev/pyrovar.h
--- a/sys/arch/sparc64/dev/pyrovar.h Fri Jun 03 03:02:36 2011 +0000
+++ b/sys/arch/sparc64/dev/pyrovar.h Fri Jun 03 03:05:21 2011 +0000
@@ -55,7 +55,7 @@
};
struct pyro_softc {
- struct device sc_dv;
+ device_t sc_dev;
int sc_node;
int sc_ign;
bus_dma_tag_t sc_dmat;
diff -r baf91b939943 -r fac274e7a8eb sys/arch/sparc64/dev/upa.c
--- a/sys/arch/sparc64/dev/upa.c Fri Jun 03 03:02:36 2011 +0000
+++ b/sys/arch/sparc64/dev/upa.c Fri Jun 03 03:05:21 2011 +0000
@@ -50,7 +50,7 @@
};
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 @@
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 @@
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 @@
}
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 @@
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);
}
}
Home |
Main Index |
Thread Index |
Old Index