Module Name: src Committed By: nonaka Date: Thu Jun 9 17:29:42 UTC 2011
Modified Files: src/sys/arch/arm/xscale: pxa2x0.c pxa2x0_ac97.c pxa2x0_dmac.c pxa2x0_gpio.c pxa2x0_udc.c Log Message: - device_t/softc split. - use aprint_* function. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/arch/arm/xscale/pxa2x0.c cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/xscale/pxa2x0_ac97.c cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/xscale/pxa2x0_dmac.c cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/xscale/pxa2x0_gpio.c cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/xscale/pxa2x0_udc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/arm/xscale/pxa2x0.c diff -u src/sys/arch/arm/xscale/pxa2x0.c:1.18 src/sys/arch/arm/xscale/pxa2x0.c:1.19 --- src/sys/arch/arm/xscale/pxa2x0.c:1.18 Sun Aug 9 06:12:33 2009 +++ src/sys/arch/arm/xscale/pxa2x0.c Thu Jun 9 17:29:42 2011 @@ -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); Index: src/sys/arch/arm/xscale/pxa2x0_ac97.c diff -u src/sys/arch/arm/xscale/pxa2x0_ac97.c:1.7 src/sys/arch/arm/xscale/pxa2x0_ac97.c:1.8 --- src/sys/arch/arm/xscale/pxa2x0_ac97.c:1.7 Wed Oct 17 19:53:44 2007 +++ src/sys/arch/arm/xscale/pxa2x0_ac97.c Thu Jun 9 17:29:42 2011 @@ -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(); Index: src/sys/arch/arm/xscale/pxa2x0_dmac.c diff -u src/sys/arch/arm/xscale/pxa2x0_dmac.c:1.6 src/sys/arch/arm/xscale/pxa2x0_dmac.c:1.7 --- src/sys/arch/arm/xscale/pxa2x0_dmac.c:1.6 Mon Mar 16 11:42:31 2009 +++ src/sys/arch/arm/xscale/pxa2x0_dmac.c Thu Jun 9 17:29:42 2011 @@ -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; bus_space_tag_t sc_bust; bus_dma_tag_t sc_dmat; bus_space_handle_t sc_bush; @@ -216,10 +216,10 @@ #endif }; -static int pxadmac_match(struct device *, struct cfdata *, void *); -static void pxadmac_attach(struct device *, struct device *, void *); +static int pxadmac_match(device_t, cfdata_t, void *); +static void pxadmac_attach(device_t, device_t, void *); -CFATTACH_DECL(pxadmac, sizeof(struct pxadmac_softc), +CFATTACH_DECL_NEW(pxadmac, sizeof(struct pxadmac_softc), pxadmac_match, pxadmac_attach, NULL, NULL); static struct pxadmac_softc *pxadmac_sc; @@ -278,7 +278,7 @@ } static int -pxadmac_match(struct device *parent, struct cfdata *cf, void *aux) +pxadmac_match(device_t parent, cfdata_t cf, void *aux) { struct pxaip_attach_args *pxa = aux; @@ -292,13 +292,14 @@ } static void -pxadmac_attach(struct device *parent, struct device *self, void *aux) +pxadmac_attach(device_t parent, device_t self, void *aux) { - struct pxadmac_softc *sc = (struct pxadmac_softc *)self; + struct pxadmac_softc *sc = device_private(self); struct pxaip_attach_args *pxa = aux; struct pxa2x0_dma_desc *dd; int i, nsegs; + sc->sc_dev = self; sc->sc_bust = pxa->pxa_iot; sc->sc_dmat = pxa->pxa_dmat; @@ -306,7 +307,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; } @@ -1186,8 +1187,9 @@ dmac_reg_write(sc, DMAC_DCSR(channel), dcsr & ~DCSR_RUN); if ((dxs = sc->sc_active[channel]) == NULL) { - printf("%s: Stray DMAC interrupt for unallocated channel %d\n", - sc->sc_dev.dv_xname, channel); + aprint_error_dev(sc->sc_dev, + "Stray DMAC interrupt for unallocated channel %d\n", + channel); return (0); } Index: src/sys/arch/arm/xscale/pxa2x0_gpio.c diff -u src/sys/arch/arm/xscale/pxa2x0_gpio.c:1.13 src/sys/arch/arm/xscale/pxa2x0_gpio.c:1.14 --- src/sys/arch/arm/xscale/pxa2x0_gpio.c:1.13 Tue Aug 4 12:11:33 2009 +++ src/sys/arch/arm/xscale/pxa2x0_gpio.c Thu Jun 9 17:29:42 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: pxa2x0_gpio.c,v 1.13 2009/08/04 12:11:33 kiyohara Exp $ */ +/* $NetBSD: pxa2x0_gpio.c,v 1.14 2011/06/09 17:29:42 nonaka Exp $ */ /* * Copyright 2003 Wasabi Systems, Inc. @@ -36,7 +36,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pxa2x0_gpio.c,v 1.13 2009/08/04 12:11:33 kiyohara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pxa2x0_gpio.c,v 1.14 2011/06/09 17:29:42 nonaka Exp $"); #include "opt_pxa2x0_gpio.h" @@ -65,7 +65,7 @@ }; struct pxagpio_softc { - struct device sc_dev; + device_t sc_dev; bus_space_tag_t sc_bust; bus_space_handle_t sc_bush; void *sc_irqcookie[4]; @@ -77,10 +77,10 @@ #endif }; -static int pxagpio_match(struct device *, struct cfdata *, void *); -static void pxagpio_attach(struct device *, struct device *, void *); +static int pxagpio_match(device_t, cfdata_t, void *); +static void pxagpio_attach(device_t, device_t, void *); -CFATTACH_DECL(pxagpio, sizeof(struct pxagpio_softc), +CFATTACH_DECL_NEW(pxagpio, sizeof(struct pxagpio_softc), pxagpio_match, pxagpio_attach, NULL, NULL); static struct pxagpio_softc *pxagpio_softc; @@ -120,7 +120,7 @@ } static int -pxagpio_match(struct device *parent, struct cfdata *cf, void *aux) +pxagpio_match(device_t parent, cfdata_t cf, void *aux) { struct pxaip_attach_args *pxa = aux; @@ -133,18 +133,19 @@ } static void -pxagpio_attach(struct device *parent, struct device *self, void *aux) +pxagpio_attach(device_t parent, device_t self, void *aux) { - struct pxagpio_softc *sc = (struct pxagpio_softc *)self; + struct pxagpio_softc *sc = device_private(self); struct pxaip_attach_args *pxa = aux; + sc->sc_dev = self; sc->sc_bust = pxa->pxa_iot; aprint_normal(": GPIO Controller\n"); 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; } @@ -176,8 +177,7 @@ sc->sc_irqcookie[2] = pxa2x0_intr_establish(PXA2X0_INT_GPION, IPL_BIO, gpio_intrN, sc); if (sc->sc_irqcookie[2] == NULL) { - aprint_error("%s: failed to hook main GPIO interrupt\n", - sc->sc_dev.dv_xname); + aprint_error_dev(self, "failed to hook main GPIO interrupt\n"); return; } #endif @@ -323,8 +323,7 @@ #ifdef DIAGNOSTIC if (sc->sc_handlers[0] == NULL) { - printf("%s: stray GPIO#0 edge interrupt\n", - sc->sc_dev.dv_xname); + aprint_error_dev(sc->sc_dev, "stray GPIO#0 edge interrupt\n"); return (0); } #endif @@ -342,8 +341,7 @@ #ifdef DIAGNOSTIC if (sc->sc_handlers[1] == NULL) { - printf("%s: stray GPIO#1 edge interrupt\n", - sc->sc_dev.dv_xname); + aprint_error_dev(sc->sc_dev, "stray GPIO#1 edge interrupt\n"); return (0); } #endif @@ -385,8 +383,9 @@ */ #ifdef DEBUG if ((gedr & sc->sc_mask[bank]) == 0) { - printf("%s: stray GPIO interrupt. Bank %d, GEDR 0x%08x, mask 0x%08x\n", - sc->sc_dev.dv_xname, bank, gedr, sc->sc_mask[bank]); + aprint_error_dev(sc->sc_dev, + "stray GPIO interrupt. Bank %d, GEDR 0x%08x, mask 0x%08x\n", + bank, gedr, sc->sc_mask[bank]); return (1); /* XXX: Pretend we dealt with it */ } #endif @@ -405,8 +404,9 @@ gedr &= ~mask; if ((gh = *ghp) == NULL) { - printf("%s: unhandled GPIO interrupt. GPIO#%d\n", - sc->sc_dev.dv_xname, gpio_base + i); + aprint_error_dev(sc->sc_dev, + "unhandled GPIO interrupt. GPIO#%d\n", + gpio_base + i); continue; } Index: src/sys/arch/arm/xscale/pxa2x0_udc.c diff -u src/sys/arch/arm/xscale/pxa2x0_udc.c:1.3 src/sys/arch/arm/xscale/pxa2x0_udc.c:1.4 --- src/sys/arch/arm/xscale/pxa2x0_udc.c:1.3 Sun Aug 9 06:24:03 2009 +++ src/sys/arch/arm/xscale/pxa2x0_udc.c Thu Jun 9 17:29:42 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: pxa2x0_udc.c,v 1.3 2009/08/09 06:24:03 kiyohara Exp $ */ +/* $NetBSD: pxa2x0_udc.c,v 1.4 2011/06/09 17:29:42 nonaka Exp $ */ /* $OpenBSD: pxa27x_udc.c,v 1.5 2005/03/30 14:24:39 dlg Exp $ */ /* @@ -31,7 +31,7 @@ #include <arm/xscale/pxa2x0_gpio.h> struct pxaudc_softc { - struct device sc_dev; + device_t sc_dev; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; bus_size_t sc_size; @@ -39,18 +39,18 @@ void *sc_powerhook; }; -static int pxaudc_match(struct device *, struct cfdata *, void *); -static void pxaudc_attach(struct device *, struct device *, void *); -static int pxaudc_detach(struct device *, int); +static int pxaudc_match(device_t, cfdata_t, void *); +static void pxaudc_attach(device_t, device_t, void *); +static int pxaudc_detach(device_t, int); -CFATTACH_DECL(pxaudc, sizeof(struct pxaudc_softc), +CFATTACH_DECL_NEW(pxaudc, sizeof(struct pxaudc_softc), pxaudc_match, pxaudc_attach, pxaudc_detach, NULL); static void pxaudc_power(int, void *); static void pxaudc_enable(struct pxaudc_softc *); static int -pxaudc_match(struct device *parent, struct cfdata *cf, void *aux) +pxaudc_match(device_t parent, cfdata_t cf, void *aux) { struct pxaip_attach_args *pxa = aux; @@ -62,24 +62,26 @@ } static void -pxaudc_attach(struct device *parent, struct device *self, void *aux) +pxaudc_attach(device_t parent, device_t self, void *aux) { - struct pxaudc_softc *sc = (struct pxaudc_softc *)self; + struct pxaudc_softc *sc = device_private(self); struct pxaip_attach_args *pxa = (struct pxaip_attach_args *)aux; + sc->sc_dev = self; sc->sc_iot = pxa->pxa_iot; sc->sc_size = 0; sc->sc_powerhook = NULL; + aprint_normal(": USB Device Controller\n"); + aprint_naive("\n"); + if (bus_space_map(sc->sc_iot, pxa->pxa_addr, pxa->pxa_size, 0, &sc->sc_ioh)) { - aprint_error(": couldn't map memory space\n"); + aprint_error_dev(self, "couldn't map memory space\n"); return; } sc->sc_size = pxa->pxa_size; - printf(": PXA2x0 USB Device Controller\n"); - bus_space_barrier(sc->sc_iot, sc->sc_ioh, 0, sc->sc_size, BUS_SPACE_BARRIER_READ|BUS_SPACE_BARRIER_WRITE); @@ -87,18 +89,17 @@ pxaudc_enable(sc); - sc->sc_powerhook = powerhook_establish(sc->sc_dev.dv_xname, + sc->sc_powerhook = powerhook_establish(device_xname(self), pxaudc_power, sc); if (sc->sc_powerhook == NULL) { - aprint_error("%s: unable to establish powerhook.\n", - sc->sc_dev.dv_xname); + aprint_error_dev(self, "unable to establish powerhook.\n"); } } static int -pxaudc_detach(struct device *self, int flags) +pxaudc_detach(device_t self, int flags) { - struct pxaudc_softc *sc = (struct pxaudc_softc *)self; + struct pxaudc_softc *sc = device_private(self); if (sc->sc_powerhook) powerhook_disestablish(sc->sc_powerhook);