Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm/xscale - device_t/softc split.
details: https://anonhg.NetBSD.org/src/rev/32395ff15061
branches: trunk
changeset: 765902:32395ff15061
user: nonaka <nonaka%NetBSD.org@localhost>
date: Thu Jun 09 17:29:42 2011 +0000
description:
- device_t/softc split.
- use aprint_* function.
diffstat:
sys/arch/arm/xscale/pxa2x0.c | 35 ++++++++++++-------------
sys/arch/arm/xscale/pxa2x0_ac97.c | 52 ++++++++++++++++++--------------------
sys/arch/arm/xscale/pxa2x0_dmac.c | 24 +++++++++--------
sys/arch/arm/xscale/pxa2x0_gpio.c | 40 +++++++++++++++---------------
sys/arch/arm/xscale/pxa2x0_udc.c | 35 +++++++++++++------------
5 files changed, 93 insertions(+), 93 deletions(-)
diffs (truncated from 588 to 300 lines):
diff -r 6613c8c88b79 -r 32395ff15061 sys/arch/arm/xscale/pxa2x0.c
--- a/sys/arch/arm/xscale/pxa2x0.c Thu Jun 09 14:52:01 2011 +0000
+++ b/sys/arch/arm/xscale/pxa2x0.c Thu Jun 09 17:29:42 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pxa2x0.c,v 1.18 2009/08/09 06:12:33 kiyohara Exp $ */
+/* $NetBSD: pxa2x0.c,v 1.19 2011/06/09 17:29:42 nonaka Exp $ */
/*
* Copyright (c) 2002, 2005 Genetec Corporation. All rights reserved.
@@ -99,7 +99,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pxa2x0.c,v 1.18 2009/08/09 06:12:33 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pxa2x0.c,v 1.19 2011/06/09 17:29:42 nonaka Exp $");
#include "pxaintc.h"
#include "pxagpio.h"
@@ -126,7 +126,7 @@
#include <arm/xscale/xscalereg.h>
struct pxaip_softc {
- struct device sc_dev;
+ device_t sc_dev;
bus_space_tag_t sc_bust;
bus_dma_tag_t sc_dmat;
bus_space_handle_t sc_bush_clk;
@@ -134,10 +134,9 @@
};
/* prototypes */
-static int pxaip_match(struct device *, struct cfdata *, void *);
-static void pxaip_attach(struct device *, struct device *, void *);
-static int pxaip_search(struct device *, struct cfdata *,
- const int *, void *);
+static int pxaip_match(device_t, cfdata_t, void *);
+static void pxaip_attach(device_t, device_t, void *);
+static int pxaip_search(device_t, cfdata_t, const int *, void *);
static void pxaip_attach_critical(struct pxaip_softc *);
static int pxaip_print(void *, const char *);
@@ -154,7 +153,7 @@
#endif
/* attach structures */
-CFATTACH_DECL(pxaip, sizeof(struct pxaip_softc),
+CFATTACH_DECL_NEW(pxaip, sizeof(struct pxaip_softc),
pxaip_match, pxaip_attach, NULL, NULL);
static struct pxaip_softc *pxaip_sc;
@@ -166,7 +165,7 @@
(*((volatile uint32_t *)(pxaclkman_regs + (reg))))
static int
-pxaip_match(struct device *parent, struct cfdata *match, void *aux)
+pxaip_match(device_t parent, cfdata_t match, void *aux)
{
#if !defined(CPU_XSCALE_PXA270)
@@ -190,16 +189,17 @@
}
static void
-pxaip_attach(struct device *parent, struct device *self, void *aux)
+pxaip_attach(device_t parent, device_t self, void *aux)
{
- struct pxaip_softc *sc = (struct pxaip_softc *)self;
+ struct pxaip_softc *sc = device_private(self);
int cpuclock;
pxaip_sc = sc;
+ sc->sc_dev = self;
sc->sc_bust = &pxa2x0_bs_tag;
sc->sc_dmat = &pxa2x0_bus_dma_tag;
- aprint_normal(": PXA2x0 Onchip Peripheral Bus\n");
+ aprint_normal(": Onchip Peripheral Bus\n");
if (bus_space_map(sc->sc_bust, PXA2X0_CLKMAN_BASE, PXA2X0_CLKMAN_SIZE,
0, &sc->sc_bush_clk))
@@ -234,8 +234,7 @@
}
static int
-pxaip_search(struct device *parent, struct cfdata *cf,
- const int *ldesc, void *aux)
+pxaip_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
{
struct pxaip_softc *sc = aux;
struct pxaip_attach_args aa;
@@ -265,7 +264,7 @@
aa.pxa_addr = PXA2X0_INTCTL_BASE;
aa.pxa_size = PXA2X0_INTCTL_SIZE;
aa.pxa_intr = PXAIPCF_INTR_DEFAULT;
- if (config_found(&sc->sc_dev, &aa, pxaip_print) == NULL)
+ if (config_found(sc->sc_dev, &aa, pxaip_print) == NULL)
panic("pxaip_attach_critical: failed to attach INTC!");
#if NPXAGPIO > 0
@@ -275,7 +274,7 @@
aa.pxa_addr = PXA2X0_GPIO_BASE;
aa.pxa_size = PXA2X0_GPIO_SIZE;
aa.pxa_intr = PXAIPCF_INTR_DEFAULT;
- if (config_found(&sc->sc_dev, &aa, pxaip_print) == NULL)
+ if (config_found(sc->sc_dev, &aa, pxaip_print) == NULL)
panic("pxaip_attach_critical: failed to attach GPIO!");
#endif
@@ -286,7 +285,7 @@
aa.pxa_addr = PXA2X0_DMAC_BASE;
aa.pxa_size = PXA2X0_DMAC_SIZE;
aa.pxa_intr = PXA2X0_INT_DMA;
- if (config_found(&sc->sc_dev, &aa, pxaip_print) == NULL)
+ if (config_found(sc->sc_dev, &aa, pxaip_print) == NULL)
panic("pxaip_attach_critical: failed to attach DMAC!");
#endif
}
@@ -294,7 +293,7 @@
static int
pxaip_print(void *aux, const char *name)
{
- struct pxaip_attach_args *sa = (struct pxaip_attach_args*)aux;
+ struct pxaip_attach_args *sa = (struct pxaip_attach_args *)aux;
if (sa->pxa_addr != PXAIPCF_ADDR_DEFAULT) {
aprint_normal(" addr 0x%lx", sa->pxa_addr);
diff -r 6613c8c88b79 -r 32395ff15061 sys/arch/arm/xscale/pxa2x0_ac97.c
--- a/sys/arch/arm/xscale/pxa2x0_ac97.c Thu Jun 09 14:52:01 2011 +0000
+++ b/sys/arch/arm/xscale/pxa2x0_ac97.c Thu Jun 09 17:29:42 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pxa2x0_ac97.c,v 1.7 2007/10/17 19:53:44 garbled Exp $ */
+/* $NetBSD: pxa2x0_ac97.c,v 1.8 2011/06/09 17:29:42 nonaka Exp $ */
/*
* Copyright (c) 2003, 2005 Wasabi Systems, Inc.
@@ -75,7 +75,7 @@
#define KERNADDR(ad) ((void *)((ad)->ad_addr))
struct acu_softc {
- struct device sc_dev;
+ device_t sc_dev;
bus_space_tag_t sc_bust;
bus_dma_tag_t sc_dmat;
bus_space_handle_t sc_bush;
@@ -113,10 +113,10 @@
struct audio_encoding_set *sc_encodings;
};
-static int pxaacu_match(struct device *, struct cfdata *, void *);
-static void pxaacu_attach(struct device *, struct device *, void *);
+static int pxaacu_match(device_t, cfdata_t, void *);
+static void pxaacu_attach(device_t, device_t, void *);
-CFATTACH_DECL(pxaacu, sizeof(struct acu_softc),
+CFATTACH_DECL_NEW(pxaacu, sizeof(struct acu_softc),
pxaacu_match, pxaacu_attach, NULL, NULL);
static int acu_codec_attach(void *, struct ac97_codec_if *);
@@ -230,7 +230,7 @@
}
static int
-pxaacu_match(struct device *parent, struct cfdata *cf, void *aux)
+pxaacu_match(device_t parent, cfdata_t cf, void *aux)
{
struct pxaip_attach_args *pxa = aux;
struct pxa2x0_gpioconf *gpioconf;
@@ -256,11 +256,12 @@
}
static void
-pxaacu_attach(struct device *parent, struct device *self, void *aux)
+pxaacu_attach(device_t parent, device_t self, void *aux)
{
- struct acu_softc *sc = (struct acu_softc *)self;
+ struct acu_softc *sc = device_private(self);
struct pxaip_attach_args *pxa = aux;
+ sc->sc_dev = self;
sc->sc_bust = pxa->pxa_iot;
sc->sc_dmat = pxa->pxa_dmat;
@@ -269,7 +270,7 @@
if (bus_space_map(sc->sc_bust, pxa->pxa_addr, pxa->pxa_size, 0,
&sc->sc_bush)) {
- aprint_error("%s: Can't map registers!\n", sc->sc_dev.dv_xname);
+ aprint_error_dev(self, "Can't map registers!\n");
return;
}
@@ -293,8 +294,7 @@
delay(100);
pxa2x0_clkman_config(CKEN_AC97, false);
bus_space_unmap(sc->sc_bust, sc->sc_bush, pxa->pxa_size);
- aprint_error("%s: Primary codec not ready\n",
- sc->sc_dev.dv_xname);
+ aprint_error_dev(self, "Primary codec not ready\n");
return;
}
@@ -311,9 +311,8 @@
sc->sc_in_reset = 0;
sc->sc_dac_rate = sc->sc_adc_rate = 0;
- if (ac97_attach(&sc->sc_host_if, &sc->sc_dev)) {
- aprint_error("%s: Failed to attach primary codec\n",
- sc->sc_dev.dv_xname);
+ if (ac97_attach(&sc->sc_host_if, sc->sc_dev)) {
+ aprint_error_dev(self, "Failed to attach primary codec\n");
fail:
acu_reg_write(sc, AC97_GCR, 0);
delay(100);
@@ -324,14 +323,13 @@
if (auconv_create_encodings(acu_formats, ACU_NFORMATS,
&sc->sc_encodings)) {
- aprint_error("%s: Failed to create encodings\n",
- sc->sc_dev.dv_xname);
+ aprint_error_dev(self, "Failed to create encodings\n");
if (sc->sc_codec_if != NULL)
(sc->sc_codec_if->vtbl->detach)(sc->sc_codec_if);
goto fail;
}
- sc->sc_audiodev = audio_attach_mi(&acu_hw_if, sc, &sc->sc_dev);
+ sc->sc_audiodev = audio_attach_mi(&acu_hw_if, sc, sc->sc_dev);
/*
* As a work-around for braindamage in the PXA250's AC97 controller
@@ -463,8 +461,8 @@
delay(100);
if (acu_wait_gsr(sc, GSR_PCR)) {
- printf("%s: acu_codec_reset: failed to ready after reset\n",
- sc->sc_dev.dv_xname);
+ aprint_error_dev(sc->sc_dev,
+ "acu_codec_reset: failed to ready after reset\n");
return (ETIMEDOUT);
}
@@ -488,7 +486,7 @@
acu_reg_write(sc, AC97_POCR, 0);
reg = acu_reg_read(sc, AC97_POSR);
acu_reg_write(sc, AC97_POSR, reg);
- printf("%s: Tx PCM Fifo underrun\n", sc->sc_dev.dv_xname);
+ aprint_error_dev(sc->sc_dev, "Tx PCM Fifo underrun\n");
}
/*
@@ -502,7 +500,7 @@
acu_reg_write(sc, AC97_PICR, 0);
reg = acu_reg_read(sc, AC97_PISR);
acu_reg_write(sc, AC97_PISR, reg);
- printf("%s: Rx PCM Fifo overrun\n", sc->sc_dev.dv_xname);
+ aprint_error_dev(sc->sc_dev, "Rx PCM Fifo overrun\n");
}
return (1);
@@ -925,9 +923,9 @@
panic("acu_tx_loop_segment: xfer mismatch!");
if (status) {
- printf(
- "%s: acu_tx_loop_segment: non-zero completion status %d\n",
- sc->sc_dev.dv_xname, status);
+ aprint_error_dev(sc->sc_dev,
+ "acu_tx_loop_segment: non-zero completion status %d\n",
+ status);
}
s = splaudio();
@@ -949,9 +947,9 @@
panic("acu_rx_loop_segment: xfer mismatch!");
if (status) {
- printf(
- "%s: acu_rx_loop_segment: non-zero completion status %d\n",
- sc->sc_dev.dv_xname, status);
+ aprint_error_dev(sc->sc_dev,
+ "acu_rx_loop_segment: non-zero completion status %d\n",
+ status);
}
s = splaudio();
diff -r 6613c8c88b79 -r 32395ff15061 sys/arch/arm/xscale/pxa2x0_dmac.c
--- a/sys/arch/arm/xscale/pxa2x0_dmac.c Thu Jun 09 14:52:01 2011 +0000
+++ b/sys/arch/arm/xscale/pxa2x0_dmac.c Thu Jun 09 17:29:42 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pxa2x0_dmac.c,v 1.6 2009/03/16 11:42:31 nonaka Exp $ */
+/* $NetBSD: pxa2x0_dmac.c,v 1.7 2011/06/09 17:29:42 nonaka Exp $ */
/*
* Copyright (c) 2003, 2005 Wasabi Systems, Inc.
@@ -163,7 +163,7 @@
#endif
struct pxadmac_softc {
- struct device sc_dev;
+ device_t sc_dev;
Home |
Main Index |
Thread Index |
Old Index