Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/evbarm device_t/softc split
details: https://anonhg.NetBSD.org/src/rev/37cab9435443
branches: trunk
changeset: 779336:37cab9435443
user: skrll <skrll%NetBSD.org@localhost>
date: Sun May 20 10:28:44 2012 +0000
description:
device_t/softc split
struct device * -> device_t
struct cfdata * -> cfdata_t
diffstat:
sys/arch/evbarm/dev/plcom.c | 40 +++++++++++++++++-----------------
sys/arch/evbarm/dev/plcomvar.h | 8 +++---
sys/arch/evbarm/ifpga/plcom_ifpga.c | 23 ++++++++++---------
sys/arch/evbarm/ifpga/plcom_ifpgavar.h | 5 ++-
4 files changed, 39 insertions(+), 37 deletions(-)
diffs (287 lines):
diff -r df6e82d1940a -r 37cab9435443 sys/arch/evbarm/dev/plcom.c
--- a/sys/arch/evbarm/dev/plcom.c Sun May 20 07:57:34 2012 +0000
+++ b/sys/arch/evbarm/dev/plcom.c Sun May 20 10:28:44 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: plcom.c,v 1.37 2012/05/20 07:57:34 skrll Exp $ */
+/* $NetBSD: plcom.c,v 1.38 2012/05/20 10:28:44 skrll Exp $ */
/*-
* Copyright (c) 2001 ARM Ltd
@@ -94,7 +94,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: plcom.c,v 1.37 2012/05/20 07:57:34 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: plcom.c,v 1.38 2012/05/20 10:28:44 skrll Exp $");
#include "opt_plcom.h"
#include "opt_ddb.h"
@@ -242,7 +242,7 @@
#define PLCOMDIALOUT(x) (minor(x) & PLCOMDIALOUT_MASK)
#define PLCOM_ISALIVE(sc) ((sc)->enabled != 0 && \
- device_is_active(&(sc)->sc_dev))
+ device_is_active((sc)->sc_dev))
#define BR BUS_SPACE_BARRIER_READ
#define BW BUS_SPACE_BARRIER_WRITE
@@ -284,7 +284,7 @@
struct tty *tp = sc->sc_tty;
printf("%s: %s %sclocal %sdcd %sts_carr_on %sdtr %stx_stopped\n",
- sc->sc_dev.dv_xname, str,
+ device_xname(sc->sc_dev), str,
ISSET(tp->t_cflag, CLOCAL) ? "+" : "-",
ISSET(sc->sc_msr, PL01X_MSR_DCD) ? "+" : "-",
ISSET(tp->t_state, TS_CARR_ON) ? "+" : "-",
@@ -292,7 +292,7 @@
sc->sc_tx_stopped ? "+" : "-");
printf("%s: %s %scrtscts %scts %sts_ttstop %srts %xrx_flags\n",
- sc->sc_dev.dv_xname, str,
+ device_xname(sc->sc_dev), str,
ISSET(tp->t_cflag, CRTSCTS) ? "+" : "-",
ISSET(sc->sc_msr, PL01X_MSR_CTS) ? "+" : "-",
ISSET(tp->t_state, TS_TTSTOP) ? "+" : "-",
@@ -341,7 +341,7 @@
bus_space_write_1(sc->sc_iot, sc->sc_ioh, plcom_cr, sc->sc_cr);
SET(sc->sc_mcr, PL01X_MCR_DTR | PL01X_MCR_RTS);
/* XXX device_unit() abuse */
- sc->sc_set_mcr(sc->sc_set_mcr_arg, device_unit(&sc->sc_dev),
+ sc->sc_set_mcr(sc->sc_set_mcr_arg, device_unit(sc->sc_dev),
sc->sc_mcr);
}
@@ -383,7 +383,7 @@
if (ISSET(sc->sc_hwflags, PLCOM_HW_TXFIFO_DISABLE)) {
sc->sc_fifolen = 1;
- printf("%s: txfifo disabled\n", sc->sc_dev.dv_xname);
+ printf("%s: txfifo disabled\n", device_xname(sc->sc_dev));
}
if (sc->sc_fifolen > 1)
@@ -400,7 +400,7 @@
sc->sc_rbavail = plcom_rbuf_size;
if (sc->sc_rbuf == NULL) {
printf("%s: unable to allocate ring buffer\n",
- sc->sc_dev.dv_xname);
+ device_xname(sc->sc_dev));
return;
}
sc->sc_ebuf = sc->sc_rbuf + (plcom_rbuf_size << 1);
@@ -413,9 +413,9 @@
/* locate the major number */
maj = cdevsw_lookup_major(&plcom_cdevsw);
- cn_tab->cn_dev = makedev(maj, device_unit(&sc->sc_dev));
+ cn_tab->cn_dev = makedev(maj, device_unit(sc->sc_dev));
- printf("%s: console\n", sc->sc_dev.dv_xname);
+ printf("%s: console\n", device_xname(sc->sc_dev));
}
#ifdef KGDB
@@ -427,14 +427,14 @@
plcom_kgdb_attached = 1;
SET(sc->sc_hwflags, PLCOM_HW_KGDB);
- printf("%s: kgdb\n", sc->sc_dev.dv_xname);
+ printf("%s: kgdb\n", device_xname(sc->sc_dev));
}
#endif
sc->sc_si = softint_establish(SOFTINT_SERIAL, plcomsoft, sc);
#ifdef RND_COM
- rnd_attach_source(&sc->rnd_source, sc->sc_dev.dv_xname,
+ rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev)),
RND_TYPE_TTY, 0);
#endif
@@ -463,9 +463,9 @@
}
int
-plcom_detach(struct device *self, int flags)
+plcom_detach(device_t self, int flags)
{
- struct plcom_softc *sc = (struct plcom_softc *)self;
+ struct plcom_softc *sc = device_private(self);
int maj, mn;
if (sc->sc_hwflags & (PLCOM_HW_CONSOLE|PLCOM_HW_KGDB))
@@ -585,7 +585,7 @@
sc->sc_rbuf == NULL)
return ENXIO;
- if (!device_is_active(&sc->sc_dev))
+ if (!device_is_active(sc->sc_dev))
return ENXIO;
#ifdef KGDB
@@ -615,7 +615,7 @@
if ((*sc->enable)(sc)) {
splx(s);
printf("%s: device enable failed\n",
- sc->sc_dev.dv_xname);
+ device_xname(sc->sc_dev));
return EIO;
}
mutex_spin_enter(&sc->sc_lock);
@@ -1307,7 +1307,7 @@
bus_space_read_1(iot, ioh, plcom_dr);
#ifdef DIAGNOSTIC
if (!timo)
- printf("%s: plcom_iflush timeout %02x\n", sc->sc_dev.dv_xname,
+ printf("%s: plcom_iflush timeout %02x\n", device_xname(sc->sc_dev),
reg);
#endif
}
@@ -1327,7 +1327,7 @@
bus_space_write_1(iot, ioh, plcom_dlbh, sc->sc_dlbh);
bus_space_write_1(iot, ioh, plcom_lcr, sc->sc_lcr);
/* XXX device_unit() abuse */
- sc->sc_set_mcr(sc->sc_set_mcr_arg, device_unit(&sc->sc_dev),
+ sc->sc_set_mcr(sc->sc_set_mcr_arg, device_unit(sc->sc_dev),
sc->sc_mcr_active = sc->sc_mcr);
bus_space_write_1(iot, ioh, plcom_cr, sc->sc_cr);
@@ -1384,7 +1384,7 @@
SET(sc->sc_mcr_active, sc->sc_mcr_rts);
}
/* XXX device_unit() abuse */
- sc->sc_set_mcr(sc->sc_set_mcr_arg, device_unit(&sc->sc_dev),
+ sc->sc_set_mcr(sc->sc_set_mcr_arg, device_unit(sc->sc_dev),
sc->sc_mcr_active);
}
@@ -1485,7 +1485,7 @@
mutex_spin_exit(&sc->sc_lock);
log(LOG_WARNING, "%s: %d silo overflow%s, %d ibuf flood%s\n",
- sc->sc_dev.dv_xname,
+ device_xname(sc->sc_dev),
overflows, overflows == 1 ? "" : "s",
floods, floods == 1 ? "" : "s");
}
diff -r df6e82d1940a -r 37cab9435443 sys/arch/evbarm/dev/plcomvar.h
--- a/sys/arch/evbarm/dev/plcomvar.h Sun May 20 07:57:34 2012 +0000
+++ b/sys/arch/evbarm/dev/plcomvar.h Sun May 20 10:28:44 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: plcomvar.h,v 1.9 2012/05/20 07:54:40 skrll Exp $ */
+/* $NetBSD: plcomvar.h,v 1.10 2012/05/20 10:28:44 skrll Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
@@ -67,7 +67,7 @@
#define PLCOM_RING_SIZE 2048
struct plcom_softc {
- struct device sc_dev;
+ device_t sc_dev;
void *sc_si;
struct tty *sc_tty;
@@ -142,6 +142,6 @@
int plcomprobe1 (bus_space_tag_t, bus_space_handle_t);
int plcomintr (void *);
void plcom_attach_subr (struct plcom_softc *);
-int plcom_detach (struct device *, int);
-int plcom_activate (struct device *, enum devact);
+int plcom_detach (device_t, int);
+int plcom_activate (device_t, enum devact);
diff -r df6e82d1940a -r 37cab9435443 sys/arch/evbarm/ifpga/plcom_ifpga.c
--- a/sys/arch/evbarm/ifpga/plcom_ifpga.c Sun May 20 07:57:34 2012 +0000
+++ b/sys/arch/evbarm/ifpga/plcom_ifpga.c Sun May 20 10:28:44 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: plcom_ifpga.c,v 1.12 2012/05/14 19:40:06 skrll Exp $ */
+/* $NetBSD: plcom_ifpga.c,v 1.13 2012/05/20 10:28:44 skrll Exp $ */
/*
* Copyright (c) 2001 ARM Ltd
@@ -32,7 +32,7 @@
/* Interface to plcom (PL010) serial driver. */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: plcom_ifpga.c,v 1.12 2012/05/14 19:40:06 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: plcom_ifpga.c,v 1.13 2012/05/20 10:28:44 skrll Exp $");
#include <sys/types.h>
#include <sys/device.h>
@@ -53,29 +53,30 @@
#include <evbarm/ifpga/ifpgareg.h>
#include <evbarm/ifpga/ifpgavar.h>
-static int plcom_ifpga_match(struct device *, struct cfdata *, void *);
-static void plcom_ifpga_attach(struct device *, struct device *, void *);
+static int plcom_ifpga_match(device_t, cfdata_t, void *);
+static void plcom_ifpga_attach(device_t, device_t, void *);
static void plcom_ifpga_set_mcr(void *, int, u_int);
-CFATTACH_DECL(plcom_ifpga, sizeof(struct plcom_softc),
+CFATTACH_DECL_NEW(plcom_ifpga, sizeof(struct plcom_ifpga_softc),
plcom_ifpga_match, plcom_ifpga_attach, NULL, NULL);
static int
-plcom_ifpga_match(struct device *parent, struct cfdata *cf, void *aux)
+plcom_ifpga_match(device_t parent, cfdata_t cf, void *aux)
{
return 1;
}
static void
-plcom_ifpga_attach(struct device *parent, struct device *self, void *aux)
+plcom_ifpga_attach(device_t parent, device_t self, void *aux)
{
- struct plcom_ifpga_softc *isc = (struct plcom_ifpga_softc *)self;
+ struct plcom_ifpga_softc *isc = device_private(self);
struct plcom_softc *sc = &isc->sc_plcom;
struct ifpga_attach_args *ifa = aux;
isc->sc_iot = ifa->ifa_iot;
isc->sc_ioh = ifa->ifa_sc_ioh;
- sc->sc_iounit = device_unit(&sc->sc_dev);
+ sc->sc_dev = self;
+ sc->sc_iounit = device_unit(sc->sc_dev);
sc->sc_frequency = IFPGA_UART_CLK;
sc->sc_iot = ifa->ifa_iot;
sc->sc_hwflags = 0;
@@ -85,7 +86,7 @@
if (bus_space_map(ifa->ifa_iot, ifa->ifa_addr, PLCOM_UART_SIZE, 0,
&sc->sc_ioh)) {
- printf("%s: unable to map device\n", sc->sc_dev.dv_xname);
+ printf("%s: unable to map device\n", device_xname(sc->sc_dev));
return;
}
@@ -94,7 +95,7 @@
sc);
if (isc->sc_ih == NULL)
panic("%s: cannot install interrupt handler",
- sc->sc_dev.dv_xname);
+ device_xname(sc->sc_dev));
}
static void plcom_ifpga_set_mcr(void *aux, int unit, u_int mcr)
diff -r df6e82d1940a -r 37cab9435443 sys/arch/evbarm/ifpga/plcom_ifpgavar.h
--- a/sys/arch/evbarm/ifpga/plcom_ifpgavar.h Sun May 20 07:57:34 2012 +0000
+++ b/sys/arch/evbarm/ifpga/plcom_ifpgavar.h Sun May 20 10:28:44 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: plcom_ifpgavar.h,v 1.1 2001/10/27 16:19:10 rearnsha Exp $ */
+/* $NetBSD: plcom_ifpgavar.h,v 1.2 2012/05/20 10:28:44 skrll Exp $ */
/*
* Copyright (c) 2001 ARM Ltd
@@ -32,7 +32,8 @@
/* Interface to plcom (PL010) serial driver. */
struct plcom_ifpga_softc {
- struct plcom_softc sc_plcom;
+ struct plcom_softc sc_plcom;
+
bus_space_tag_t sc_iot;
bus_space_handle_t sc_ioh;
void *sc_ih;
Home |
Main Index |
Thread Index |
Old Index