From 6572d9c09219c465e46fdac85bdd603662780823 Mon Sep 17 00:00:00 2001 From: tsutsui Date: Sun, 5 Jun 2011 06:31:41 +0000 Subject: [PATCH] - use CFATTACH_DECL_NEW() (no softc) - use device_t, cfdata_t etc. --- sys/arch/atari/atari/autoconf.c | 51 ++++++++++++++++---------------- sys/arch/atari/dev/grf.c | 26 ++++++++-------- sys/arch/atari/dev/kbd.c | 20 ++++++------- sys/arch/atari/pci/pci_machdep.c | 26 ++++++++-------- sys/arch/atari/vme/vme_machdep.c | 22 +++++++------- 5 files changed, 72 insertions(+), 73 deletions(-) diff --git a/sys/arch/atari/atari/autoconf.c b/sys/arch/atari/atari/autoconf.c index 642dc0e6534f..fc13aad80d6e 100644 --- a/sys/arch/atari/atari/autoconf.c +++ b/sys/arch/atari/atari/autoconf.c @@ -1,4 +1,4 @@ -/* $NetBSD: autoconf.c,v 1.59 2010/04/10 17:40:36 tsutsui Exp $ */ +/* $NetBSD: autoconf.c,v 1.60 2011/06/05 06:31:41 tsutsui Exp $ */ /* * Copyright (c) 1995 Leo Weppelman @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.59 2010/04/10 17:40:36 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.60 2011/06/05 06:31:41 tsutsui Exp $"); #include #include @@ -46,8 +46,8 @@ __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.59 2010/04/10 17:40:36 tsutsui Exp $" #include static void findroot(void); -int mbmatch(struct device *, struct cfdata *, void *); -void mbattach(struct device *, struct device *, void *); +int mbmatch(device_t, cfdata_t, void *); +void mbattach(device_t, device_t, void *); #if 0 int mbprint(void *, const char *); #endif @@ -93,11 +93,10 @@ simple_devprint(void *auxp, const char *pnp) * by checking for NULL. */ int -atari_config_found(struct cfdata *pcfp, struct device *pdp, void *auxp, - cfprint_t pfn) +atari_config_found(cfdata_t pcfp, device_t pdp, void *auxp, cfprint_t pfn) { struct device temp; - struct cfdata *cf; + cfdata_t cf; const struct cfattach *ca; if (atari_realconfig) @@ -243,13 +242,13 @@ findroot(void) /* * mainbus driver */ -CFATTACH_DECL(mainbus, sizeof(struct device), +CFATTACH_DECL_NEW(mainbus, 0, mbmatch, mbattach, NULL, NULL); static int mb_attached; int -mbmatch(struct device *pdp, struct cfdata *cfp, void *auxp) +mbmatch(device_t parent, cfdata_t cf, void *aux) { if (mb_attached) @@ -264,35 +263,35 @@ mbmatch(struct device *pdp, struct cfdata *cfp, void *auxp) * "find" all the things that should be there. */ void -mbattach(struct device *pdp, struct device *dp, void *auxp) +mbattach(device_t parent, device_t self, void *aux) { mb_attached = 1; printf ("\n"); - config_found(dp, __UNCONST("clock") , simple_devprint); - config_found(dp, __UNCONST("grfbus") , simple_devprint); - config_found(dp, __UNCONST("kbd") , simple_devprint); - config_found(dp, __UNCONST("fdc") , simple_devprint); - config_found(dp, __UNCONST("ser") , simple_devprint); - config_found(dp, __UNCONST("zs") , simple_devprint); - config_found(dp, __UNCONST("ncrscsi") , simple_devprint); - config_found(dp, __UNCONST("nvr") , simple_devprint); - config_found(dp, __UNCONST("lpt") , simple_devprint); - config_found(dp, __UNCONST("wdc") , simple_devprint); - config_found(dp, __UNCONST("ne") , simple_devprint); - config_found(dp, __UNCONST("isab") , simple_devprint); - config_found(dp, __UNCONST("pcib") , simple_devprint); - config_found(dp, __UNCONST("avmebus") , simple_devprint); + config_found(self, __UNCONST("clock") , simple_devprint); + config_found(self, __UNCONST("grfbus") , simple_devprint); + config_found(self, __UNCONST("kbd") , simple_devprint); + config_found(self, __UNCONST("fdc") , simple_devprint); + config_found(self, __UNCONST("ser") , simple_devprint); + config_found(self, __UNCONST("zs") , simple_devprint); + config_found(self, __UNCONST("ncrscsi") , simple_devprint); + config_found(self, __UNCONST("nvr") , simple_devprint); + config_found(self, __UNCONST("lpt") , simple_devprint); + config_found(self, __UNCONST("wdc") , simple_devprint); + config_found(self, __UNCONST("ne") , simple_devprint); + config_found(self, __UNCONST("isab") , simple_devprint); + config_found(self, __UNCONST("pcib") , simple_devprint); + config_found(self, __UNCONST("avmebus") , simple_devprint); } #if 0 int -mbprint(void *auxp, const char *pnp) +mbprint(void *aux, const char *pnp) { if (pnp) - aprint_normal("%s at %s", (char *)auxp, pnp); + aprint_normal("%s at %s", (char *)aux, pnp); return UNCONF; } #endif diff --git a/sys/arch/atari/dev/grf.c b/sys/arch/atari/dev/grf.c index 4524100c98bc..676c7cf565a6 100644 --- a/sys/arch/atari/dev/grf.c +++ b/sys/arch/atari/dev/grf.c @@ -1,4 +1,4 @@ -/* $NetBSD: grf.c,v 1.44 2011/02/08 20:20:10 rmind Exp $ */ +/* $NetBSD: grf.c,v 1.45 2011/06/05 06:31:41 tsutsui Exp $ */ /* * Copyright (c) 1995 Leo Weppelman @@ -46,7 +46,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: grf.c,v 1.44 2011/02/08 20:20:10 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: grf.c,v 1.45 2011/06/05 06:31:41 tsutsui Exp $"); #include #include @@ -90,16 +90,16 @@ int grfon(dev_t); int grfoff(dev_t); int grfsinfo(dev_t, struct grfdyninfo *); -int grfbusprint(void *auxp, const char *); -int grfbusmatch(struct device *, struct cfdata *, void *); -void grfbusattach(struct device *, struct device *, void *); +int grfbusprint(void *, const char *); +int grfbusmatch(device_t, cfdata_t, void *); +void grfbusattach(device_t, device_t, void *); /* * pointers to grf drivers device structs */ struct grf_softc *grfsp[NGRF]; /* XXX */ -CFATTACH_DECL(grfbus, sizeof(struct device), +CFATTACH_DECL_NEW(grfbus, 0, grfbusmatch, grfbusattach, NULL, NULL); dev_type_open(grfopen); @@ -118,35 +118,35 @@ const struct cdevsw grf_cdevsw = { static struct cfdata *cfdata_gbus = NULL; int -grfbusmatch(struct device *pdp, struct cfdata *cfp, void *auxp) +grfbusmatch(device_t parent, cfdata_t cf, void *aux) { - if (strcmp(auxp, grfbus_cd.cd_name)) + if (strcmp(aux, grfbus_cd.cd_name)) return 0; if (atari_realconfig == 0) - cfdata_gbus = cfp; + cfdata_gbus = cf; return 1; /* Always there */ } void -grfbusattach(struct device *pdp, struct device *dp, void *auxp) +grfbusattach(device_t parent, device_t self, void *aux) { grf_auxp_t grf_auxp; grf_auxp.busprint = grfbusprint; grf_auxp.from_bus_match = 1; - if (dp == NULL) /* Console init */ + if (self == NULL) /* Console init */ atari_config_found(cfdata_gbus, NULL, &grf_auxp, grfbusprint); else { printf("\n"); - config_found(dp, &grf_auxp, grfbusprint); + config_found(self, &grf_auxp, grfbusprint); } } int -grfbusprint(void *auxp, const char *name) +grfbusprint(void *aux, const char *name) { if (name == NULL) diff --git a/sys/arch/atari/dev/kbd.c b/sys/arch/atari/dev/kbd.c index 4f4d87b2d161..55224e0cec14 100644 --- a/sys/arch/atari/dev/kbd.c +++ b/sys/arch/atari/dev/kbd.c @@ -1,4 +1,4 @@ -/* $NetBSD: kbd.c,v 1.41 2010/04/13 11:31:11 tsutsui Exp $ */ +/* $NetBSD: kbd.c,v 1.42 2011/06/05 06:31:41 tsutsui Exp $ */ /* * Copyright (c) 1995 Leo Weppelman @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kbd.c,v 1.41 2010/04/13 11:31:11 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kbd.c,v 1.42 2011/06/05 06:31:41 tsutsui Exp $"); #include "mouse.h" #include "ite.h" @@ -117,15 +117,15 @@ dev_type_kqfilter(kbdkqfilter); void kbdintr(int); static void kbdsoft(void *); -static void kbdattach(struct device *, struct device *, void *); -static int kbdmatch(struct device *, struct cfdata *, void *); +static void kbdattach(device_t, device_t, void *); +static int kbdmatch(device_t, cfdata_t, void *); #if NITE>0 static int kbd_do_modifier(uint8_t); #endif static int kbd_write_poll(const uint8_t *, int); static void kbd_pkg_start(struct kbd_softc *, uint8_t); -CFATTACH_DECL(kbd, sizeof(struct device), +CFATTACH_DECL_NEW(kbd, 0, kbdmatch, kbdattach, NULL, NULL); const struct cdevsw kbd_cdevsw = { @@ -165,17 +165,17 @@ static struct wskbd_mapdata kbd_mapdata = { /*ARGSUSED*/ static int -kbdmatch(struct device *pdp, struct cfdata *cfp, void *auxp) +kbdmatch(device_t parent, cfdata_t cf, void *aux) { - if (!strcmp((char *)auxp, "kbd")) + if (!strcmp((char *)aux, "kbd")) return 1; return 0; } /*ARGSUSED*/ static void -kbdattach(struct device *pdp, struct device *dp, void *auxp) +kbdattach(device_t parent, device_t self, void *aux) { int timeout; const uint8_t kbd_rst[] = { 0x80, 0x01 }; @@ -222,7 +222,7 @@ kbdattach(struct device *pdp, struct device *dp, void *auxp) kbd_softc.k_sicookie = softint_establish(SOFTINT_SERIAL, kbdsoft, NULL); #if NWSKBD>0 - if (dp != NULL) { + if (self != NULL) { /* * Try to attach the wskbd. */ @@ -235,7 +235,7 @@ kbdattach(struct device *pdp, struct device *dp, void *auxp) waa.keymap = &kbd_mapdata; waa.accessops = &kbd_accessops; waa.accesscookie = NULL; - kbd_softc.k_wskbddev = config_found(dp, &waa, wskbddevprint); + kbd_softc.k_wskbddev = config_found(self, &waa, wskbddevprint); kbd_softc.k_pollingmode = 0; diff --git a/sys/arch/atari/pci/pci_machdep.c b/sys/arch/atari/pci/pci_machdep.c index 3aaf3d94c624..568ad2f15346 100644 --- a/sys/arch/atari/pci/pci_machdep.c +++ b/sys/arch/atari/pci/pci_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: pci_machdep.c,v 1.50 2011/05/17 17:34:48 dyoung Exp $ */ +/* $NetBSD: pci_machdep.c,v 1.51 2011/06/05 06:31:41 tsutsui Exp $ */ /* * Copyright (c) 1996 Leo Weppelman. All rights reserved. @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.50 2011/05/17 17:34:48 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.51 2011/06/05 06:31:41 tsutsui Exp $"); #include "opt_mbtype.h" @@ -120,16 +120,16 @@ struct atari_bus_dma_tag pci_bus_dma_tag = { _bus_dmamap_sync, }; -int ataripcibusprint(void *auxp, const char *); -int pcibusmatch(struct device *, struct cfdata *, void *); -void pcibusattach(struct device *, struct device *, void *); +int ataripcibusprint(void *, const char *); +int pcibusmatch(device_t, cfdata_t, void *); +void pcibusattach(device_t, device_t, void *); static void enable_pci_devices(void); static void insert_into_list(PCI_MEMREG *head, struct pci_memreg *elem); static int overlap_pci_areas(struct pci_memreg *p, struct pci_memreg *self, u_int addr, u_int size, u_int what); -CFATTACH_DECL(pcib, sizeof(struct device), +CFATTACH_DECL_NEW(pcib, 0, pcibusmatch, pcibusattach, NULL, NULL); /* @@ -139,11 +139,11 @@ CFATTACH_DECL(pcib, sizeof(struct device), static struct atari_bus_space bs_storage[2]; /* 1 iot, 1 memt */ int -pcibusmatch(struct device *pdp, struct cfdata *cfp, void *auxp) +pcibusmatch(device_t parent, cfdata_t cf, void *aux) { static int nmatched = 0; - if (strcmp((char *)auxp, "pcib")) + if (strcmp((char *)aux, "pcib")) return 0; /* Wrong number... */ if (atari_realconfig == 0) @@ -162,7 +162,7 @@ pcibusmatch(struct device *pdp, struct cfdata *cfp, void *auxp) } void -pcibusattach(struct device *pdp, struct device *dp, void *auxp) +pcibusattach(device_t parent, device_t self, void *aux) { struct pcibus_attach_args pba; @@ -180,7 +180,7 @@ pcibusattach(struct device *pdp, struct device *dp, void *auxp) pba.pba_iot->base = PCI_IO_PHYS; pba.pba_memt->base = PCI_MEM_PHYS; - if (dp == NULL) { + if (self == NULL) { /* * Scan the bus for a VGA-card that we support. If we * find one, try to initialize it to a 'standard' text @@ -198,11 +198,11 @@ pcibusattach(struct device *pdp, struct device *dp, void *auxp) printf("\n"); - config_found_ia(dp, "pcibus", &pba, ataripcibusprint); + config_found_ia(self, "pcibus", &pba, ataripcibusprint); } int -ataripcibusprint(void *auxp, const char *name) +ataripcibusprint(void *aux, const char *name) { if (name == NULL) @@ -211,7 +211,7 @@ ataripcibusprint(void *auxp, const char *name) } void -pci_attach_hook(struct device *parent, struct device *self, struct pcibus_attach_args *pba) +pci_attach_hook(device_t parent, device_t self, struct pcibus_attach_args *pba) { } diff --git a/sys/arch/atari/vme/vme_machdep.c b/sys/arch/atari/vme/vme_machdep.c index db7b3157d493..fbdff1422658 100644 --- a/sys/arch/atari/vme/vme_machdep.c +++ b/sys/arch/atari/vme/vme_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: vme_machdep.c,v 1.19 2010/04/13 11:31:11 tsutsui Exp $ */ +/* $NetBSD: vme_machdep.c,v 1.20 2011/06/05 06:31:42 tsutsui Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vme_machdep.c,v 1.19 2010/04/13 11:31:11 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vme_machdep.c,v 1.20 2011/06/05 06:31:42 tsutsui Exp $"); #include #include @@ -46,28 +46,28 @@ __KERNEL_RCSID(0, "$NetBSD: vme_machdep.c,v 1.19 2010/04/13 11:31:11 tsutsui Exp #include #include -static int vmebusprint(void *auxp, const char *); -static int vmebusmatch(struct device *, struct cfdata *, void *); -static void vmebusattach(struct device *, struct device *, void *); +static int vmebusprint(void *, const char *); +static int vmebusmatch(device_t, cfdata_t, void *); +static void vmebusattach(device_t, device_t, void *); -CFATTACH_DECL(avmebus, sizeof(struct device), +CFATTACH_DECL_NEW(avmebus, 0, vmebusmatch, vmebusattach, NULL, NULL); int vmebus_attached; int -vmebusmatch(struct device *pdp, struct cfdata *cfp, void *auxp) +vmebusmatch(device_t parent, cfdata_t cf, void *aux) { if (atari_realconfig == 0) return 0; - if (strcmp((char *)auxp, "avmebus") || vmebus_attached) + if (strcmp((char *)aux, "avmebus") || vmebus_attached) return 0; return (machineid & ATARI_FALCON) ? 0 : 1; } void -vmebusattach(struct device *pdp, struct device *dp, void *auxp) +vmebusattach(device_t parent, device_t self, void *aux) { struct vmebus_attach_args vba; @@ -88,11 +88,11 @@ vmebusattach(struct device *pdp, struct device *dp, void *auxp) vba.vba_memt->base = 0; printf("\n"); - config_found(dp, &vba, vmebusprint); + config_found(self, &vba, vmebusprint); } int -vmebusprint(void *auxp, const char *name) +vmebusprint(void *aux, const char *name) { if (name == NULL)