Mon Jun 6 17:13:06 2011 UTC ()
CFATTACH_DECL(..., sizeof(struct device), -> CFATTACH_DECL_NEW(..., 0
struct device * -> device_t
struct cfdata * -> cfdata_t
use bool when appropriate
some constification


(matt)
diff -r1.12 -r1.13 src/sys/arch/evbmips/malta/dev/gt.c
diff -r1.11 -r1.12 src/sys/arch/evbmips/malta/dev/mainbus.c
diff -r1.9 -r1.10 src/sys/arch/evbmips/malta/pci/pchb.c
diff -r1.7 -r1.8 src/sys/arch/evbppc/explora/dev/elb.c
diff -r1.10 -r1.11 src/sys/arch/evbppc/walnut/pci/pchb.c
diff -r1.9 -r1.10 src/sys/arch/hpcmips/tx/txioman.c
diff -r1.7 -r1.8 src/sys/arch/mips/alchemy/dev/auaudio.c
diff -r1.16 -r1.17 src/sys/arch/mipsco/obio/obio.c

cvs diff -r1.12 -r1.13 src/sys/arch/evbmips/malta/dev/gt.c (expand / switch to context diff)
--- src/sys/arch/evbmips/malta/dev/gt.c 2011/05/17 17:34:49 1.12
+++ src/sys/arch/evbmips/malta/dev/gt.c 2011/06/06 17:13:05 1.13
@@ -1,4 +1,4 @@
-/*	$NetBSD: gt.c,v 1.12 2011/05/17 17:34:49 dyoung Exp $	*/
+/*	$NetBSD: gt.c,v 1.13 2011/06/06 17:13:05 matt Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gt.c,v 1.12 2011/05/17 17:34:49 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gt.c,v 1.13 2011/06/06 17:13:05 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -58,8 +58,7 @@
 #define	PCI_CONF_LOCK(s)	(s) = splhigh()
 #define	PCI_CONF_UNLOCK(s)	splx((s))
 
-static void	gt_attach_hook(struct device *, struct device *,
-		    struct pcibus_attach_args *);
+static void	gt_attach_hook(device_t, device_t, struct pcibus_attach_args *);
 static int	gt_bus_maxdevs(void *, int);
 static pcitag_t	gt_make_tag(void *, int, int, int);
 static void	gt_decompose_tag(void *, pcitag_t, int *, int *, int *);
@@ -80,28 +79,27 @@
 }
 
 static void
-gt_attach_hook(struct device *parent, struct device *self,
-    struct pcibus_attach_args *pba)
+gt_attach_hook(device_t parent, device_t self, struct pcibus_attach_args *pba)
 {
 
 	/* Nothing to do... */
 }
 
-static int	gt_match(struct device *, struct cfdata *, void *);
-static void	gt_attach(struct device *, struct device *, void *);
+static int	gt_match(device_t, cfdata_t, void *);
+static void	gt_attach(device_t, device_t, void *);
 static int	gt_print(void *aux, const char *pnp);
 
-CFATTACH_DECL(gt, sizeof(struct device),
+CFATTACH_DECL_NEW(gt, 0,
     gt_match, gt_attach, NULL, NULL);
 
 static int
-gt_match(struct device *parent, struct cfdata *match, void *aux)
+gt_match(device_t parent, cfdata_t match, void *aux)
 {
 	return 1;
 }
 
 static void
-gt_attach(struct device *parent, struct device *self, void *aux)
+gt_attach(device_t parent, device_t self, void *aux)
 {
 	struct malta_config *mcp = &malta_configuration;
 	struct pcibus_attach_args pba;

cvs diff -r1.11 -r1.12 src/sys/arch/evbmips/malta/dev/mainbus.c (expand / switch to context diff)
--- src/sys/arch/evbmips/malta/dev/mainbus.c 2009/03/14 15:36:06 1.11
+++ src/sys/arch/evbmips/malta/dev/mainbus.c 2011/06/06 17:13:05 1.12
@@ -1,4 +1,4 @@
-/*	$NetBSD: mainbus.c,v 1.11 2009/03/14 15:36:06 dsl Exp $	*/
+/*	$NetBSD: mainbus.c,v 1.12 2011/06/06 17:13:05 matt Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.11 2009/03/14 15:36:06 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.12 2011/06/06 17:13:05 matt Exp $");
 
 #include "opt_pci.h"
 
@@ -67,17 +67,16 @@
 #include "locators.h"
 #include "pci.h"
 
-static int	mainbus_match(struct device *, struct cfdata *, void *);
-static void	mainbus_attach(struct device *, struct device *, void *);
-static int	mainbus_submatch(struct device *, struct cfdata *,
-				 const int *, void *);
+static int	mainbus_match(device_t, cfdata_t, void *);
+static void	mainbus_attach(device_t, device_t, void *);
+static int	mainbus_submatch(device_t, cfdata_t, const int *, void *);
 static int	mainbus_print(void *, const char *);
 
-CFATTACH_DECL(mainbus, sizeof(struct device),
+CFATTACH_DECL_NEW(mainbus, 0,
     mainbus_match, mainbus_attach, NULL, NULL);
 
 /* There can be only one. */
-int	mainbus_found;
+bool mainbus_found;
 
 struct mainbusdev {
 	const char *md_name;
@@ -85,7 +84,7 @@
 	int md_intr;
 };
 
-struct mainbusdev mainbusdevs[] = {
+const struct mainbusdev mainbusdevs[] = {
 	{ "cpu",		-1,			-1 },
 	{ "gt",			MALTA_CORECTRL_BASE,	-1 },
 	{ "com",		MALTA_CBUSUART,		MALTA_CBUSUART_INTR },
@@ -95,7 +94,7 @@
 };
 
 static int
-mainbus_match(struct device *parent, struct cfdata *match, void *aux)
+mainbus_match(device_t parent, cfdata_t match, void *aux)
 {
 
 	if (mainbus_found)
@@ -105,10 +104,10 @@
 }
 
 static void
-mainbus_attach(struct device *parent, struct device *self, void *aux)
+mainbus_attach(device_t parent, device_t self, void *aux)
 {
 	struct mainbus_attach_args ma;
-	struct mainbusdev *md;
+	const struct mainbusdev *md;
 #if defined(PCI_NETBSD_CONFIGURE)
 	struct extent *ioext, *memext;
 #endif
@@ -119,7 +118,7 @@
 	pcireg_t idetim;
 #endif
 
-	mainbus_found = 1;
+	mainbus_found = true;
 	printf("\n");
 
 #if defined(PCI_NETBSD_CONFIGURE)
@@ -162,7 +161,7 @@
 }
 
 static int
-mainbus_submatch(struct device *parent, struct cfdata *cf,
+mainbus_submatch(device_t parent, cfdata_t cf,
 		 const int *ldesc, void *aux)
 {
 	struct mainbus_attach_args *ma = aux;

cvs diff -r1.9 -r1.10 src/sys/arch/evbmips/malta/pci/pchb.c (expand / switch to context diff)
--- src/sys/arch/evbmips/malta/pci/pchb.c 2006/08/22 21:42:19 1.9
+++ src/sys/arch/evbmips/malta/pci/pchb.c 2011/06/06 17:13:05 1.10
@@ -1,4 +1,4 @@
-/*	$NetBSD: pchb.c,v 1.9 2006/08/22 21:42:19 riz Exp $	*/
+/*	$NetBSD: pchb.c,v 1.10 2011/06/06 17:13:05 matt Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pchb.c,v 1.9 2006/08/22 21:42:19 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pchb.c,v 1.10 2011/06/06 17:13:05 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -45,16 +45,16 @@
 #include <dev/pci/pcivar.h>
 #include <dev/pci/pcidevs.h>
 
-static int	pchb_match(struct device *, struct cfdata *, void *);
-static void	pchb_attach(struct device *, struct device *, void *);
+static int	pchb_match(device_t, cfdata_t, void *);
+static void	pchb_attach(device_t, device_t, void *);
 
-CFATTACH_DECL(pchb, sizeof(struct device),
+CFATTACH_DECL_NEW(pchb, 0,
     pchb_match, pchb_attach, NULL, NULL);
 
-static int pcifound = 0;
+static bool pcifound;
 
 static int
-pchb_match(struct device *parent, struct cfdata *match, void *aux)
+pchb_match(device_t parent, cfdata_t match, void *aux)
 {
 	struct pci_attach_args *pa = aux;
 
@@ -76,13 +76,13 @@
 }
 
 static void
-pchb_attach(struct device *parent, struct device *self, void *aux)
+pchb_attach(device_t parent, device_t self, void *aux)
 {
 	struct pci_attach_args *pa = aux;
 	char devinfo[256];
 
 	printf("\n");
-	pcifound++;
+	pcifound = true;
 
 	/*
 	 * All we do is print out a description.  Eventually, we

cvs diff -r1.7 -r1.8 src/sys/arch/evbppc/explora/dev/elb.c (expand / switch to context diff)
--- src/sys/arch/evbppc/explora/dev/elb.c 2011/06/06 16:42:17 1.7
+++ src/sys/arch/evbppc/explora/dev/elb.c 2011/06/06 17:13:06 1.8
@@ -1,4 +1,4 @@
-/*	$NetBSD: elb.c,v 1.7 2011/06/06 16:42:17 matt Exp $	*/
+/*	$NetBSD: elb.c,v 1.8 2011/06/06 17:13:06 matt Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: elb.c,v 1.7 2011/06/06 16:42:17 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: elb.c,v 1.8 2011/06/06 17:13:06 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -64,20 +64,21 @@
 	BASE_PCKBC,
 	BASE_PCKBC + 0x6ff
 };
-static char elb_ex_storage[EXTENT_FIXED_STORAGE_SIZE(8)]
-    __attribute__((aligned(8)));
-static int elb_tag_init_done;
-
 static struct powerpc_bus_space elb_fb_tag = {
 	_BUS_SPACE_LITTLE_ENDIAN | _BUS_SPACE_MEM_TYPE,
 	0x00000000,
 	BASE_FB,
 	BASE_FB2 + SIZE_FB - 1
 };
+
+static char elb_ex_storage[EXTENT_FIXED_STORAGE_SIZE(8)]
+    __attribute__((aligned(8)));
 static char elbfb_ex_storage[EXTENT_FIXED_STORAGE_SIZE(8)]
     __attribute__((aligned(8)));
-static int elbfb_tag_init_done;
 
+static bool elb_tag_init_done;
+static bool elbfb_tag_init_done;
+
 /*
  * DMA struct, nothing special.
  */
@@ -100,7 +101,7 @@
 	_bus_dma_bus_mem_to_phys_generic,
 };
 
-static struct elb_dev elb_devs[] = {
+static const struct elb_dev elb_devs[] = {
 	{ "cpu",	0,		0,		-1, NULL },
 	{ "pckbc",	BASE_PCKBC,	BASE_PCKBC2,	31, &elb_tag },
 	{ "com",	BASE_COM,	0,		30, &elb_tag },
@@ -128,16 +129,17 @@
 elb_attach(device_t parent, device_t self, void *aux)
 {
 	struct elb_attach_args eaa;
-	int i;
+	const struct elb_dev *elb;
+	size_t i;
 
 	printf("\n");
-	for (i = 0; i < sizeof(elb_devs)/sizeof(elb_devs[0]); i++) {
-		eaa.elb_name = elb_devs[i].elb_name;
-		eaa.elb_bt = elb_get_bus_space_tag(elb_devs[i].elb_addr);
+	for (i = 0, elb = elb_devs; i < __arraycount(elb_devs); i++, elb++) {
+		eaa.elb_name = elb->elb_name;
+		eaa.elb_bt = elb_get_bus_space_tag(elb->elb_addr);
 		eaa.elb_dmat = &elb_bus_dma_tag;
-		eaa.elb_base = elb_devs[i].elb_addr;
-		eaa.elb_base2 = elb_devs[i].elb_addr2;
-		eaa.elb_irq = elb_devs[i].elb_irq;
+		eaa.elb_base = elb->elb_addr;
+		eaa.elb_base2 = elb->elb_addr2;
+		eaa.elb_irq = elb->elb_irq;
 
 		(void) config_found(self, &eaa, elb_print);
 	}
@@ -166,7 +168,7 @@
 			    elb_ex_storage, sizeof(elb_ex_storage)))
 				panic("elb_get_bus_space_tag: elb_tag");
 
-			elb_tag_init_done = 1;
+			elb_tag_init_done = true;
 		}
 		return (&elb_tag);
 	} else {
@@ -175,7 +177,7 @@
 			    elbfb_ex_storage, sizeof(elbfb_ex_storage)))
 				panic("elb_get_bus_space_tag: elb_fb_tag");
 
-			elbfb_tag_init_done = 1;
+			elbfb_tag_init_done = true;
 		}
 		return (&elb_fb_tag);
 	}

cvs diff -r1.10 -r1.11 src/sys/arch/evbppc/walnut/pci/Attic/pchb.c (expand / switch to context diff)
--- src/sys/arch/evbppc/walnut/pci/Attic/pchb.c 2011/06/06 16:42:18 1.10
+++ src/sys/arch/evbppc/walnut/pci/Attic/pchb.c 2011/06/06 17:13:06 1.11
@@ -1,4 +1,4 @@
-/*	$NetBSD: pchb.c,v 1.10 2011/06/06 16:42:18 matt Exp $	*/
+/*	$NetBSD: pchb.c,v 1.11 2011/06/06 17:13:06 matt Exp $	*/
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pchb.c,v 1.10 2011/06/06 16:42:18 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pchb.c,v 1.11 2011/06/06 17:13:06 matt Exp $");
 
 #include "pci.h"
 #include "opt_pci.h"
@@ -59,7 +59,7 @@
 CFATTACH_DECL_NEW(pchb, 0,
     pchbmatch, pchbattach, NULL, NULL);
 
-static int pcifound = 0;
+static bool pcifound;
 
 /* IO window located @ e8000000 and maps to 0-0xffff */
 static struct powerpc_bus_space pchb_io_tag = {
@@ -139,7 +139,7 @@
 	id = pci_conf_read(pc, tag, PCI_ID_REG);
 
 	printf("\n");
-	pcifound++;
+	pcifound = true;
 	/*
 	 * All we do is print out a description.  Eventually, we
 	 * might want to add code that does something that's

cvs diff -r1.9 -r1.10 src/sys/arch/hpcmips/tx/txioman.c (expand / switch to context diff)
--- src/sys/arch/hpcmips/tx/txioman.c 2008/04/28 20:23:22 1.9
+++ src/sys/arch/hpcmips/tx/txioman.c 2011/06/06 17:13:06 1.10
@@ -1,4 +1,4 @@
-/*	$NetBSD: txioman.c,v 1.9 2008/04/28 20:23:22 martin Exp $ */
+/*	$NetBSD: txioman.c,v 1.10 2011/06/06 17:13:06 matt Exp $ */
 
 /*-
  * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: txioman.c,v 1.9 2008/04/28 20:23:22 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: txioman.c,v 1.10 2011/06/06 17:13:06 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -41,23 +41,23 @@
 
 #include <dev/hpc/hpciovar.h>
 
-int txioman_match(struct device *, struct cfdata *, void *);
-void txioman_attach(struct device *, struct device *, void *);
-void txioman_callback(struct device *);
+int txioman_match(device_t, cfdata_t, void *);
+void txioman_attach(device_t, device_t, void *);
+void txioman_callback(device_t);
 int txioman_print(void *, const char *);
 hpcio_chip_t tx_conf_reference_ioman(void *, int);
 
-CFATTACH_DECL(txioman, sizeof(struct device),
+CFATTACH_DECL_NEW(txioman, 0,
     txioman_match, txioman_attach, NULL, NULL);
 
 int
-txioman_match(struct device *parent, struct cfdata *cf, void *aux)
+txioman_match(device_t parent, cfdata_t cf, void *aux)
 {
 	return (1);
 }
 
 void
-txioman_attach(struct device *parent, struct device *self, void *aux)
+txioman_attach(device_t parent, device_t self, void *aux)
 {
 	printf("\n");
 
@@ -65,7 +65,7 @@
 }
 
 void
-txioman_callback(struct device *self)
+txioman_callback(device_t self)
 {
 	struct hpcio_attach_args haa;
 

cvs diff -r1.7 -r1.8 src/sys/arch/mips/alchemy/dev/auaudio.c (expand / switch to context diff)
--- src/sys/arch/mips/alchemy/dev/auaudio.c 2005/12/11 12:18:06 1.7
+++ src/sys/arch/mips/alchemy/dev/auaudio.c 2011/06/06 17:13:06 1.8
@@ -1,4 +1,4 @@
-/* $NetBSD: auaudio.c,v 1.7 2005/12/11 12:18:06 christos Exp $ */
+/* $NetBSD: auaudio.c,v 1.8 2011/06/06 17:13:06 matt Exp $ */
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: auaudio.c,v 1.7 2005/12/11 12:18:06 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: auaudio.c,v 1.8 2011/06/06 17:13:06 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -45,14 +45,14 @@
 #include <mips/alchemy/include/aureg.h>
 #include <mips/alchemy/include/aubusvar.h>
 
-static int	auaudio_match(struct device *, struct cfdata *, void *);
-static void	auaudio_attach(struct device *, struct device *, void *);
+static int	auaudio_match(device_t, cfdata_t, void *);
+static void	auaudio_attach(device_t, device_t, void *);
 
-CFATTACH_DECL(auaudio, sizeof (struct device),
+CFATTACH_DECL_NEW(auaudio, sizeof (struct device),
     auaudio_match, auaudio_attach, NULL, NULL);
 
 int
-auaudio_match(struct device *parent, struct cfdata *match, void *aux)
+auaudio_match(device_t parent, cfdata_t match, void *aux)
 {
 	struct aubus_attach_args *aa = aux;
 
@@ -64,7 +64,7 @@
 }
 
 void
-auaudio_attach(struct device *parent, struct device *self, void *aux)
+auaudio_attach(device_t parent, device_t self, void *aux)
 {
 
 	printf(": Au1X00 audio\n");	/* \n in clockattach */

cvs diff -r1.16 -r1.17 src/sys/arch/mipsco/obio/obio.c (expand / switch to context diff)
--- src/sys/arch/mipsco/obio/obio.c 2009/03/16 23:11:13 1.16
+++ src/sys/arch/mipsco/obio/obio.c 2011/06/06 17:13:06 1.17
@@ -1,4 +1,4 @@
-/*	$NetBSD: obio.c,v 1.16 2009/03/16 23:11:13 dsl Exp $	*/
+/*	$NetBSD: obio.c,v 1.17 2011/06/06 17:13:06 matt Exp $	*/
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: obio.c,v 1.16 2009/03/16 23:11:13 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: obio.c,v 1.17 2011/06/06 17:13:06 matt Exp $");
 
 #include "locators.h"
 
@@ -43,15 +43,14 @@
 #include <machine/bus.h>
 #include <machine/sysconf.h>
 
-static int	obio_match(struct device *, struct cfdata *, void *);
-static void	obio_attach(struct device *, struct device *, void *);
-static int	obio_search(struct device *, struct cfdata *,
-				 const int *, void *);
+static int	obio_match(device_t, cfdata_t, void *);
+static void	obio_attach(device_t, device_t, void *);
+static int	obio_search(device_t, cfdata_t, const int *, void *);
 static int	obio_print(void *, const char *);
 static void	obio_intr_establish(bus_space_tag_t, int, int, int,
-					  int (*)(void *), void *);
+		    int (*)(void *), void *);
 
-CFATTACH_DECL(obio, sizeof(struct device),
+CFATTACH_DECL_NEW(obio, 0,
     obio_match, obio_attach, NULL, NULL);
 
 extern struct cfdriver obio_cd;
@@ -60,7 +59,7 @@
 struct mipsco_bus_dma_tag obio_dmatag;
  
 static int
-obio_match(struct device *parent, struct cfdata *cf, void *aux)
+obio_match(device_t parent, cfdata_t cf, void *aux)
 {
 	struct confargs *ca = aux;
 
@@ -71,7 +70,7 @@
 }
 
 static void
-obio_attach(struct device *parent, struct device *self, void *aux)
+obio_attach(device_t parent, device_t self, void *aux)
 {
 	struct confargs *ca = aux;
 
@@ -91,7 +90,7 @@
 }
 
 static int
-obio_search(struct device *parent, struct cfdata *cf, const int *ldesc, void *aux)
+obio_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
 {
 	struct confargs *ca = aux;
 
@@ -123,7 +122,8 @@
 }
 
 void
-obio_intr_establish(bus_space_tag_t bst, int level, int pri, int flags, int (*func)(void *), void *arg)
+obio_intr_establish(bus_space_tag_t bst, int level, int pri, int flags,
+	int (*func)(void *), void *arg)
 {
 	(*platform.intr_establish)(level, func, arg);
 }