Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/mips/alchemy/dev Use device_t instead of 'struct de...
details: https://anonhg.NetBSD.org/src/rev/f8f6466c0a8f
branches: trunk
changeset: 772419:f8f6466c0a8f
user: kiyohara <kiyohara%NetBSD.org@localhost>
date: Tue Jan 03 07:36:02 2012 +0000
description:
Use device_t instead of 'struct device *'.
Call aprint_* in auto-config time.
diffstat:
sys/arch/mips/alchemy/dev/augpio.c | 26 +++++----
sys/arch/mips/alchemy/dev/aupci.c | 37 +++++-------
sys/arch/mips/alchemy/dev/aupcmcia.c | 34 ++++++-----
sys/arch/mips/alchemy/dev/aupsc.c | 32 +++++-----
sys/arch/mips/alchemy/dev/aupscvar.h | 4 +-
sys/arch/mips/alchemy/dev/aurtc.c | 19 +++---
sys/arch/mips/alchemy/dev/ausmbus_psc.c | 22 ++++---
sys/arch/mips/alchemy/dev/auspi.c | 18 +++--
sys/arch/mips/alchemy/dev/if_aumac.c | 92 +++++++++++++++-----------------
9 files changed, 142 insertions(+), 142 deletions(-)
diffs (truncated from 932 to 300 lines):
diff -r 56f7aa1723d7 -r f8f6466c0a8f sys/arch/mips/alchemy/dev/augpio.c
--- a/sys/arch/mips/alchemy/dev/augpio.c Tue Jan 03 06:18:24 2012 +0000
+++ b/sys/arch/mips/alchemy/dev/augpio.c Tue Jan 03 07:36:02 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: augpio.c,v 1.6 2011/07/01 18:39:29 dyoung Exp $ */
+/* $NetBSD: augpio.c,v 1.7 2012/01/03 07:36:02 kiyohara Exp $ */
/*-
* Copyright (c) 2006 Itronix Inc.
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: augpio.c,v 1.6 2011/07/01 18:39:29 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: augpio.c,v 1.7 2012/01/03 07:36:02 kiyohara Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -53,7 +53,7 @@
#include <mips/alchemy/dev/augpiovar.h>
struct augpio_softc {
- struct device sc_dev;
+ device_t sc_dev;
struct gpio_chipset_tag sc_gc;
gpio_pin_t sc_pins[AUGPIO_NPINS];
int sc_npins;
@@ -63,10 +63,10 @@
int (*sc_getctl)(void *, int);
};
-static int augpio_match(struct device *, struct cfdata *, void *);
-static void augpio_attach(struct device *, struct device *, void *);
+static int augpio_match(device_t, struct cfdata *, void *);
+static void augpio_attach(device_t, device_t, void *);
-CFATTACH_DECL(augpio, sizeof(struct augpio_softc),
+CFATTACH_DECL_NEW(augpio, sizeof(struct augpio_softc),
augpio_match, augpio_attach, NULL, NULL);
#define GETREG(x) \
@@ -80,7 +80,7 @@
#define PUTGPIO2(x,v) PUTREG(GPIO2_BASE + (x), (v))
int
-augpio_match(struct device *parent, struct cfdata *match, void *aux)
+augpio_match(device_t parent, struct cfdata *match, void *aux)
{
struct aubus_attach_args *aa = (struct aubus_attach_args *)aux;
@@ -91,14 +91,15 @@
}
void
-augpio_attach(struct device *parent, struct device *self, void *aux)
+augpio_attach(device_t parent, device_t self, void *aux)
{
int pin;
- struct augpio_softc *sc = (struct augpio_softc *)self;
+ struct augpio_softc *sc = device_private(self);
struct aubus_attach_args *aa = aux;
struct gpiobus_attach_args gba;
+ sc->sc_dev = self;
sc->sc_bst = aa->aa_st;
sc->sc_npins = aa->aa_addrs[1];
sc->sc_gc.gp_cookie = sc;
@@ -128,7 +129,7 @@
sc->sc_name = "secondary block";
} else {
- printf(": unidentified block\n");
+ aprint_error(": unidentified block\n");
return;
}
@@ -145,8 +146,9 @@
gba.gba_pins = sc->sc_pins;
gba.gba_npins = sc->sc_npins;
- printf(": Alchemy GPIO, %s\n", sc->sc_name);
- config_found_ia(&sc->sc_dev, "gpiobus", &gba, gpiobus_print);
+ aprint_normal(": Alchemy GPIO, %s\n", sc->sc_name);
+ aprint_naive("\n");
+ config_found_ia(self, "gpiobus", &gba, gpiobus_print);
}
int
diff -r 56f7aa1723d7 -r f8f6466c0a8f sys/arch/mips/alchemy/dev/aupci.c
--- a/sys/arch/mips/alchemy/dev/aupci.c Tue Jan 03 06:18:24 2012 +0000
+++ b/sys/arch/mips/alchemy/dev/aupci.c Tue Jan 03 07:36:02 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: aupci.c,v 1.11 2011/07/01 18:39:29 dyoung Exp $ */
+/* $NetBSD: aupci.c,v 1.12 2012/01/03 07:36:02 kiyohara Exp $ */
/*-
* Copyright (c) 2006 Itronix Inc.
@@ -35,7 +35,7 @@
#include "pci.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: aupci.c,v 1.11 2011/07/01 18:39:29 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aupci.c,v 1.12 2012/01/03 07:36:02 kiyohara Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -69,7 +69,7 @@
#include <mips/alchemy/dev/aupcivar.h>
struct aupci_softc {
- struct device sc_dev;
+ device_t sc_dev;
struct mips_pci_chipset sc_pc;
struct mips_bus_space sc_mem_space;
struct mips_bus_space sc_io_space;
@@ -89,12 +89,11 @@
/* XXX: dma tag */
};
-int aupcimatch(struct device *, struct cfdata *, void *);
-void aupciattach(struct device *, struct device *, void *);
+int aupcimatch(device_t, struct cfdata *, void *);
+void aupciattach(device_t, device_t, void *);
#if NPCI > 0
-static void aupci_attach_hook(struct device *, struct device *,
- struct pcibus_attach_args *);
+static void aupci_attach_hook(device_t, device_t, struct pcibus_attach_args *);
static int aupci_bus_maxdevs(void *, int);
static pcitag_t aupci_make_tag(void *, int, int, int);
static void aupci_decompose_tag(void *, pcitag_t, int *, int *, int *);
@@ -116,7 +115,7 @@
#endif /* NPCI > 0 */
-CFATTACH_DECL(aupci, sizeof(struct aupci_softc),
+CFATTACH_DECL_NEW(aupci, sizeof(struct aupci_softc),
aupcimatch, aupciattach, NULL, NULL);
int aupci_found = 0;
@@ -132,7 +131,7 @@
#endif
int
-aupcimatch(struct device *parent, struct cfdata *match, void *aux)
+aupcimatch(device_t parent, struct cfdata *match, void *aux)
{
struct aubus_attach_args *aa = (struct aubus_attach_args *)aux;
@@ -146,9 +145,9 @@
}
void
-aupciattach(struct device *parent, struct device *self, void *aux)
+aupciattach(device_t parent, device_t self, void *aux)
{
- struct aupci_softc *sc = (struct aupci_softc *)self;
+ struct aupci_softc *sc = device_private(self);
struct aubus_attach_args *aa = (struct aubus_attach_args *)aux;
uint32_t cfg;
#if NPCI > 0
@@ -159,11 +158,11 @@
aupci_found = 1;
+ sc->sc_dev = self;
sc->sc_bust = aa->aa_st;
if (bus_space_map(sc->sc_bust, aa->aa_addrs[0], 512, 0,
&sc->sc_bush) != 0) {
- printf("\n%s: unable to map PCI registers\n",
- sc->sc_dev.dv_xname);
+ aprint_error(": unable to map PCI registers\n");
return;
}
@@ -204,13 +203,9 @@
cfg = bus_space_read_4(sc->sc_bust, sc->sc_bush, AUPCI_COMMAND_STATUS);
- printf(": Alchemy Host-PCI Bridge");
- if (cfg & PCI_STATUS_66MHZ_SUPPORT)
- printf(", 66MHz");
- else
- printf(", 33MHz");
-
- printf("\n");
+ aprint_normal(": Alchemy Host-PCI Bridge, %sMHz\n",
+ (cfg & PCI_STATUS_66MHZ_SUPPORT) ? "66" : "33");
+ aprint_naive("\n");
#if NPCI > 0
/*
@@ -292,7 +287,7 @@
#if NPCI > 0
void
-aupci_attach_hook(struct device *parent, struct device *self,
+aupci_attach_hook(device_t parent, device_t self,
struct pcibus_attach_args *pba)
{
}
diff -r 56f7aa1723d7 -r f8f6466c0a8f sys/arch/mips/alchemy/dev/aupcmcia.c
--- a/sys/arch/mips/alchemy/dev/aupcmcia.c Tue Jan 03 06:18:24 2012 +0000
+++ b/sys/arch/mips/alchemy/dev/aupcmcia.c Tue Jan 03 07:36:02 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: aupcmcia.c,v 1.7 2011/07/26 22:52:49 dyoung Exp $ */
+/* $NetBSD: aupcmcia.c,v 1.8 2012/01/03 07:36:02 kiyohara Exp $ */
/*-
* Copyright (c) 2006 Itronix Inc.
@@ -35,7 +35,7 @@
/* #include "pci.h" */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: aupcmcia.c,v 1.7 2011/07/26 22:52:49 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aupcmcia.c,v 1.8 2012/01/03 07:36:02 kiyohara Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -107,8 +107,8 @@
static void aupcm_slot_disable(pcmcia_chipset_handle_t);
static void aupcm_slot_settype(pcmcia_chipset_handle_t, int);
-static int aupcm_match(struct device *, struct cfdata *, void *);
-static void aupcm_attach(struct device *, struct device *, void *);
+static int aupcm_match(device_t, struct cfdata *, void *);
+static void aupcm_attach(device_t, device_t, void *);
static void aupcm_event_thread(void *);
static int aupcm_card_intr(void *);
@@ -133,12 +133,12 @@
struct mips_bus_space as_memt;
void *as_wins[AUPCMCIA_NWINS];
- struct device *as_pcmcia;
+ device_t as_pcmcia;
};
/* this structure needs to be exposed... */
struct aupcm_softc {
- struct device sc_dev;
+ device_t sc_dev;
pcmcia_chipset_tag_t sc_pct;
void (*sc_slot_enable)(int);
@@ -175,11 +175,11 @@
static struct mips_bus_space aupcm_memt;
-CFATTACH_DECL(aupcmcia, sizeof (struct aupcm_softc),
+CFATTACH_DECL_NEW(aupcmcia, sizeof (struct aupcm_softc),
aupcm_match, aupcm_attach, NULL, NULL);
int
-aupcm_match(struct device *parent, struct cfdata *cf, void *aux)
+aupcm_match(device_t parent, struct cfdata *cf, void *aux)
{
struct aubus_attach_args *aa = aux;
static int found = 0;
@@ -196,14 +196,16 @@
}
void
-aupcm_attach(struct device *parent, struct device *self, void *aux)
+aupcm_attach(device_t parent, device_t self, void *aux)
{
/* struct aubus_attach_args *aa = aux; */
- struct aupcm_softc *sc = (struct aupcm_softc *)self;
+ struct aupcm_softc *sc = device_private(self);
static int done = 0;
int slot;
struct aupcmcia_machdep *md;
+ sc->sc_dev = self;
+
/* initialize bus space */
if (done) {
/* there can be only one. */
@@ -221,8 +223,7 @@
AU_HIMEM_SPACE_LITTLE_ENDIAN);
if ((md = aupcmcia_machdep()) == NULL) {
- printf("\n%s:unable to get machdep structure\n",
- sc->sc_dev.dv_xname);
+ aprint_error(": unable to get machdep structure\n");
return;
}
@@ -231,7 +232,8 @@
sc->sc_slot_disable = md->am_slot_disable;
sc->sc_slot_status = md->am_slot_status;
- printf(": Alchemy PCMCIA, %d slots\n", sc->sc_nslots);
+ aprint_normal(": Alchemy PCMCIA, %d slots\n", sc->sc_nslots);
+ aprint_naive("\n");
sc->sc_pct = (pcmcia_chipset_tag_t)&aupcm_functions;
@@ -268,7 +270,7 @@
Home |
Main Index |
Thread Index |
Old Index