Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci Split device_t
details: https://anonhg.NetBSD.org/src/rev/4de4d01d744c
branches: trunk
changeset: 778141:4de4d01d744c
user: martin <martin%NetBSD.org@localhost>
date: Sat Mar 17 20:29:59 2012 +0000
description:
Split device_t
diffstat:
sys/dev/pci/autri.c | 36 ++++++++++++++++++------------------
sys/dev/pci/autrivar.h | 5 ++---
2 files changed, 20 insertions(+), 21 deletions(-)
diffs (181 lines):
diff -r e8a325661049 -r 4de4d01d744c sys/dev/pci/autri.c
--- a/sys/dev/pci/autri.c Sat Mar 17 20:12:09 2012 +0000
+++ b/sys/dev/pci/autri.c Sat Mar 17 20:29:59 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: autri.c,v 1.49 2012/01/30 19:41:18 drochner Exp $ */
+/* $NetBSD: autri.c,v 1.50 2012/03/17 20:29:59 martin Exp $ */
/*
* Copyright (c) 2001 SOMEYA Yoshihiko and KUROSAWA Takahiro.
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autri.c,v 1.49 2012/01/30 19:41:18 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autri.c,v 1.50 2012/03/17 20:29:59 martin Exp $");
#include "midi.h"
@@ -286,7 +286,7 @@
break;
default:
printf("%s: autri_read_codec : unknown device\n",
- device_xname(&sc->sc_dev));
+ device_xname(sc->sc_dev));
return -1;
}
@@ -298,7 +298,7 @@
if (count == 0xffff) {
printf("%s: Codec timeout. Busy reading AC'97 codec.\n",
- device_xname(&sc->sc_dev));
+ device_xname(sc->sc_dev));
return -1;
}
@@ -314,7 +314,7 @@
if (count == 0xffff) {
printf("%s: Codec timeout. Busy reading AC'97 codec.\n",
- device_xname(&sc->sc_dev));
+ device_xname(sc->sc_dev));
return -1;
}
@@ -360,7 +360,7 @@
break;
default:
printf("%s: autri_write_codec : unknown device.\n",
- device_xname(&sc->sc_dev));
+ device_xname(sc->sc_dev));
return -1;
}
@@ -372,7 +372,7 @@
if (count == 0xffff) {
printf("%s: Codec timeout. Busy writing AC'97 codec\n",
- device_xname(&sc->sc_dev));
+ device_xname(sc->sc_dev));
return -1;
}
@@ -443,7 +443,7 @@
break;
default:
printf("%s: autri_reset_codec : unknown device\n",
- device_xname(&sc->sc_dev));
+ device_xname(sc->sc_dev));
return EOPNOTSUPP;
}
@@ -457,7 +457,7 @@
if (count == 0) {
printf("%s: Codec timeout. AC'97 is not ready for operation.\n",
- device_xname(&sc->sc_dev));
+ device_xname(sc->sc_dev));
return ETIMEDOUT;
}
return 0;
@@ -524,6 +524,7 @@
uint32_t reg;
sc = device_private(self);
+ sc->sc_dev = self;
pa = (struct pci_attach_args *)aux;
pc = pa->pa_pc;
@@ -536,7 +537,7 @@
/* map register to memory */
if (pci_mapreg_map(pa, AUTRI_PCI_MEMORY_BASE,
PCI_MAPREG_TYPE_MEM, 0, &sc->memt, &sc->memh, NULL, NULL)) {
- aprint_error_dev(&sc->sc_dev, "can't map memory space\n");
+ aprint_error_dev(sc->sc_dev, "can't map memory space\n");
return;
}
@@ -545,19 +546,19 @@
/* map and establish the interrupt */
if (pci_intr_map(pa, &ih)) {
- aprint_error_dev(&sc->sc_dev, "couldn't map interrupt\n");
+ aprint_error_dev(sc->sc_dev, "couldn't map interrupt\n");
return;
}
intrstr = pci_intr_string(pc, ih);
sc->sc_ih = pci_intr_establish(pc, ih, IPL_AUDIO, autri_intr, sc);
if (sc->sc_ih == NULL) {
- aprint_error_dev(&sc->sc_dev, "couldn't establish interrupt");
+ aprint_error_dev(sc->sc_dev, "couldn't establish interrupt");
if (intrstr != NULL)
aprint_error(" at %s", intrstr);
aprint_error("\n");
return;
}
- aprint_normal_dev(&sc->sc_dev, "interrupting at %s\n", intrstr);
+ aprint_normal_dev(sc->sc_dev, "interrupting at %s\n", intrstr);
sc->sc_dmatag = pa->pa_dmat;
sc->sc_pc = pc;
@@ -573,7 +574,6 @@
/* attach AC'97 codec */
codec = &sc->sc_codec;
- memcpy(&codec->sc_dev, &sc->sc_dev, sizeof(codec->sc_dev));
codec->sc = sc;
codec->host_if.arg = codec;
@@ -585,21 +585,21 @@
r = ac97_attach(&codec->host_if, self, &sc->sc_lock);
if (r != 0) {
- aprint_error_dev(&sc->sc_dev, "can't attach codec (error 0x%X)\n", r);
+ aprint_error_dev(sc->sc_dev, "can't attach codec (error 0x%X)\n", r);
return;
}
if (!pmf_device_register(self, NULL, autri_resume))
aprint_error_dev(self, "couldn't establish power handler\n");
- audio_attach_mi(&autri_hw_if, sc, &sc->sc_dev);
+ audio_attach_mi(&autri_hw_if, sc, sc->sc_dev);
#if NMIDI > 0
- midi_attach_mi(&autri_midi_hw_if, sc, &sc->sc_dev);
+ midi_attach_mi(&autri_midi_hw_if, sc, sc->sc_dev);
#endif
}
-CFATTACH_DECL(autri, sizeof(struct autri_softc),
+CFATTACH_DECL_NEW(autri, sizeof(struct autri_softc),
autri_match, autri_attach, NULL, NULL);
static bool
diff -r e8a325661049 -r 4de4d01d744c sys/dev/pci/autrivar.h
--- a/sys/dev/pci/autrivar.h Sat Mar 17 20:12:09 2012 +0000
+++ b/sys/dev/pci/autrivar.h Sat Mar 17 20:29:59 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: autrivar.h,v 1.5 2011/11/23 23:07:34 jmcneill Exp $ */
+/* $NetBSD: autrivar.h,v 1.6 2012/03/17 20:29:59 martin Exp $ */
/*
* Copyright (c) 2001 SOMEYA Yoshihiko and KUROSAWA Takahiro.
@@ -41,7 +41,6 @@
};
struct autri_codec_softc {
- struct device sc_dev; /* base device */
struct autri_softc *sc;
int id;
int status_data;
@@ -68,7 +67,7 @@
};
struct autri_softc {
- struct device sc_dev; /* base device */
+ device_t sc_dev;
kmutex_t sc_lock;
kmutex_t sc_intr_lock;
pci_chipset_tag_t sc_pc;
Home |
Main Index |
Thread Index |
Old Index