CVS commit: src/sys/arch/dreamcast/dev/maple

2019-05-06 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Mon May  6 17:16:41 UTC 2019

Modified Files:
src/sys/arch/dreamcast/dev/maple: maple.c

Log Message:
cv_init() must be done before calling maple_scanbus().
ok tsutsui@


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/dreamcast/dev/maple/maple.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/dreamcast/dev/maple/maple.c
diff -u src/sys/arch/dreamcast/dev/maple/maple.c:1.52 src/sys/arch/dreamcast/dev/maple/maple.c:1.53
--- src/sys/arch/dreamcast/dev/maple/maple.c:1.52	Sun Dec  6 02:04:10 2015
+++ src/sys/arch/dreamcast/dev/maple/maple.c	Mon May  6 17:16:41 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: maple.c,v 1.52 2015/12/06 02:04:10 tsutsui Exp $	*/
+/*	$NetBSD: maple.c,v 1.53 2019/05/06 17:16:41 ryo Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: maple.c,v 1.52 2015/12/06 02:04:10 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: maple.c,v 1.53 2019/05/06 17:16:41 ryo Exp $");
 
 #include 
 #include 
@@ -246,14 +246,14 @@ mapleattach(device_t parent, device_t se
 
 	MAPLE_ENABLE = 1;
 
-	maple_polling = 1;
-	maple_scanbus(sc);
-
 	mutex_init(>sc_dma_lock, MUTEX_DEFAULT, IPL_MAPLE);
 	cv_init(>sc_dma_cv, device_xname(self));
 	mutex_init(>sc_event_lock, MUTEX_DEFAULT, IPL_SOFTCLOCK);
 	cv_init(>sc_event_cv, device_xname(self));
 
+	maple_polling = 1;
+	maple_scanbus(sc);
+
 	callout_init(>maple_callout_ch, 0);
 
 	sc->sc_intrhand = sysasic_intr_establish(SYSASIC_EVENT_MAPLE_DMADONE,



CVS commit: src/sys/arch/dreamcast/dev/maple

2015-12-06 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Dec  6 02:04:10 UTC 2015

Modified Files:
src/sys/arch/dreamcast/dev/maple: maple.c maplevar.h

Log Message:
Convert tsleep(9)/wakeup(9) pairs to condvar(9) with mutex(9).

Briefly tested with mkbd(4).


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/dreamcast/dev/maple/maple.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/dreamcast/dev/maple/maplevar.h

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/dreamcast/dev/maple/maple.c
diff -u src/sys/arch/dreamcast/dev/maple/maple.c:1.51 src/sys/arch/dreamcast/dev/maple/maple.c:1.52
--- src/sys/arch/dreamcast/dev/maple/maple.c:1.51	Fri Jul 25 08:10:32 2014
+++ src/sys/arch/dreamcast/dev/maple/maple.c	Sun Dec  6 02:04:10 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: maple.c,v 1.51 2014/07/25 08:10:32 dholland Exp $	*/
+/*	$NetBSD: maple.c,v 1.52 2015/12/06 02:04:10 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: maple.c,v 1.51 2014/07/25 08:10:32 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: maple.c,v 1.52 2015/12/06 02:04:10 tsutsui Exp $");
 
 #include 
 #include 
@@ -76,6 +76,8 @@ __KERNEL_RCSID(0, "$NetBSD: maple.c,v 1.
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 
@@ -247,6 +249,11 @@ mapleattach(device_t parent, device_t se
 	maple_polling = 1;
 	maple_scanbus(sc);
 
+	mutex_init(>sc_dma_lock, MUTEX_DEFAULT, IPL_MAPLE);
+	cv_init(>sc_dma_cv, device_xname(self));
+	mutex_init(>sc_event_lock, MUTEX_DEFAULT, IPL_SOFTCLOCK);
+	cv_init(>sc_event_cv, device_xname(self));
+
 	callout_init(>maple_callout_ch, 0);
 
 	sc->sc_intrhand = sysasic_intr_establish(SYSASIC_EVENT_MAPLE_DMADONE,
@@ -835,13 +842,12 @@ maple_command(device_t dev, struct maple
 {
 	struct maple_softc *sc = device_private(dev);
 	struct maple_func *fn;
-	int s;
 
 	KASSERT(func >= 0 && func < 32);
 	KASSERT(command);
 	KASSERT((flags & ~MAPLE_FLAG_CMD_PERIODIC_TIMING) == 0);
 
-	s = splsoftclock();
+	mutex_enter(>sc_event_lock);
 
 	fn = >u_func[func];
 #if 1 /*def DIAGNOSTIC*/
@@ -860,9 +866,9 @@ maple_command(device_t dev, struct maple
 	} else {
 		fn->f_cmdstat = MAPLE_CMDSTAT_ASYNC;
 		TAILQ_INSERT_TAIL(>sc_acmdq, fn, f_cmdq);
-		wakeup(>sc_event);	/* wake for async event */
+		cv_broadcast(>sc_event_cv);	/* wake for async event */
 	}
-	splx(s);
+	mutex_exit(>sc_event_lock);
 }
 
 static void
@@ -1422,7 +1428,6 @@ maple_event_thread(void *arg)
 {
 	struct maple_softc *sc = arg;
 	unsigned cnt = 1;	/* timing counter */
-	int s;
 #if defined(MAPLE_DEBUG) && MAPLE_DEBUG > 1
 	int noreq = 0;
 #endif
@@ -1485,19 +1490,19 @@ maple_event_thread(void *arg)
 			/*
 			 * start DMA
 			 */
-			s = splmaple();
+			mutex_enter(>sc_dma_lock);
 			maple_start(sc);
 
 			/*
 			 * wait until DMA done
 			 */
-			if (tsleep(>sc_dmadone, PWAIT, "mdma", hz)
+			if (cv_timedwait(>sc_dma_cv, >sc_dma_lock, hz)
 			== EWOULDBLOCK) {
 /* was DDB active? */
 printf("%s: timed out\n",
 device_xname(sc->sc_dev));
 			}
-			splx(s);
+			mutex_exit(>sc_dma_lock);
 
 			/*
 			 * call handlers
@@ -1522,17 +1527,17 @@ maple_event_thread(void *arg)
 		/*
 		 * wait for an event
 		 */
-		s = splsoftclock();
+		mutex_enter(>sc_event_lock);
 		if (TAILQ_EMPTY(>sc_acmdq) && sc->sc_event == 0 &&
 		TAILQ_EMPTY(>sc_periodicdeferq)) {
-			if (tsleep(>sc_event, PWAIT, "mslp", hz)
-			== EWOULDBLOCK) {
+			if (cv_timedwait(>sc_event_cv, >sc_event_lock,
+			hz) == EWOULDBLOCK) {
 printf("%s: event timed out\n",
 device_xname(sc->sc_dev));
 			}
 
 		}
-		splx(s);
+		mutex_exit(>sc_event_lock);
 
 	}
 
@@ -1547,7 +1552,9 @@ maple_intr(void *arg)
 {
 	struct maple_softc *sc = arg;
 
-	wakeup(>sc_dmadone);
+	mutex_enter(>sc_dma_lock);
+	cv_broadcast(>sc_dma_cv);
+	mutex_exit(>sc_dma_lock);
 
 	return 1;
 }
@@ -1557,8 +1564,10 @@ maple_callout(void *ctx)
 {
 	struct maple_softc *sc = ctx;
 
+	mutex_enter(>sc_event_lock);
 	sc->sc_event = 1;	/* mark as periodic event */
-	wakeup(>sc_event);
+	cv_broadcast(>sc_event_cv);
+	mutex_exit(>sc_event_lock);
 }
 
 /*

Index: src/sys/arch/dreamcast/dev/maple/maplevar.h
diff -u src/sys/arch/dreamcast/dev/maple/maplevar.h:1.14 src/sys/arch/dreamcast/dev/maple/maplevar.h:1.15
--- src/sys/arch/dreamcast/dev/maple/maplevar.h:1.14	Sat Oct 27 17:17:45 2012
+++ src/sys/arch/dreamcast/dev/maple/maplevar.h	Sun Dec  6 02:04:10 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: maplevar.h,v 1.14 2012/10/27 17:17:45 chs Exp $	*/
+/*	$NetBSD: maplevar.h,v 1.15 2015/12/06 02:04:10 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -184,9 +184,13 @@ struct maple_softc {
 	uint32_t sc_txbuf_phys;	/* 29-bit physical address */
 
 	void	*sc_intrhand;
-	int	sc_dmadone;		/* wchan */
 
-	int	sc_event;		/* periodic event is active / wchan */
+	kmutex_t sc_dma_lock;
+	

CVS commit: src/sys/arch/dreamcast/dev/maple

2014-03-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Mar 14 08:55:41 UTC 2014

Modified Files:
src/sys/arch/dreamcast/dev/maple: maple.c mlcd.c

Log Message:
Remove unused variables


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/dreamcast/dev/maple/maple.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/dreamcast/dev/maple/mlcd.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/dreamcast/dev/maple/maple.c
diff -u src/sys/arch/dreamcast/dev/maple/maple.c:1.46 src/sys/arch/dreamcast/dev/maple/maple.c:1.47
--- src/sys/arch/dreamcast/dev/maple/maple.c:1.46	Sun Oct 13 06:55:34 2013
+++ src/sys/arch/dreamcast/dev/maple/maple.c	Fri Mar 14 08:55:40 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: maple.c,v 1.46 2013/10/13 06:55:34 riz Exp $	*/
+/*	$NetBSD: maple.c,v 1.47 2014/03/14 08:55:40 martin Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: maple.c,v 1.46 2013/10/13 06:55:34 riz Exp $);
+__KERNEL_RCSID(0, $NetBSD: maple.c,v 1.47 2014/03/14 08:55:40 martin Exp $);
 
 #include sys/param.h
 #include sys/device.h
@@ -554,10 +554,7 @@ static void
 maple_check_unit_change(struct maple_softc *sc, struct maple_unit *u)
 {
 	struct maple_devinfo *newinfo = (void *) (u-u_rxbuf + 1);
-	int port, subunit;
 
-	port = u-port;
-	subunit = u-subunit;
 	if (memcmp(u-devinfo, newinfo, sizeof(struct maple_devinfo)) == 0)
 		goto out;	/* no change */
 

Index: src/sys/arch/dreamcast/dev/maple/mlcd.c
diff -u src/sys/arch/dreamcast/dev/maple/mlcd.c:1.14 src/sys/arch/dreamcast/dev/maple/mlcd.c:1.15
--- src/sys/arch/dreamcast/dev/maple/mlcd.c:1.14	Sun Oct 17 14:17:49 2010
+++ src/sys/arch/dreamcast/dev/maple/mlcd.c	Fri Mar 14 08:55:40 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: mlcd.c,v 1.14 2010/10/17 14:17:49 tsutsui Exp $	*/
+/*	$NetBSD: mlcd.c,v 1.15 2014/03/14 08:55:40 martin Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: mlcd.c,v 1.14 2010/10/17 14:17:49 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: mlcd.c,v 1.15 2014/03/14 08:55:40 martin Exp $);
 
 #include sys/param.h
 #include sys/device.h
@@ -526,10 +526,8 @@ static void
 mlcdstart_bp(struct mlcd_softc *sc)
 {
 	struct mlcd_buf *bp;
-	struct mlcd_pt *pt;
 
 	bp = sc-sc_bp;
-	pt = sc-sc_pt[bp-lb_partno];
 
 	/* handle retry */
 	if (sc-sc_retry++  MLCD_MAXRETRY) {
@@ -720,14 +718,11 @@ mlcdwrite(dev_t dev, struct uio *uio, in
 int
 mlcdioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
 {
-	int unit, part;
+	int unit;
 	struct mlcd_softc *sc;
-	struct mlcd_pt *pt;
 
 	unit = MLCD_UNIT(dev);
-	part = MLCD_PART(dev);
 	sc = device_lookup_private(mlcd_cd, unit);
-	pt = sc-sc_pt[part];
 
 	switch (cmd) {
 



CVS commit: src/sys/arch/dreamcast/dev/maple

2010-10-17 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Oct 17 14:13:44 UTC 2010

Modified Files:
src/sys/arch/dreamcast/dev/maple: maple.c maple.h maplevar.h mkbd.c
mkbdvar.h mlcd.c mmemcard.c mms.c

Log Message:
Split device_t/softc.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/dreamcast/dev/maple/maple.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/dreamcast/dev/maple/maple.h
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/dreamcast/dev/maple/maplevar.h \
src/sys/arch/dreamcast/dev/maple/mlcd.c
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/dreamcast/dev/maple/mkbd.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/dreamcast/dev/maple/mkbdvar.h
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/dreamcast/dev/maple/mmemcard.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/dreamcast/dev/maple/mms.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/dreamcast/dev/maple/maple.c
diff -u src/sys/arch/dreamcast/dev/maple/maple.c:1.40 src/sys/arch/dreamcast/dev/maple/maple.c:1.41
--- src/sys/arch/dreamcast/dev/maple/maple.c:1.40	Sun Oct 19 14:05:49 2008
+++ src/sys/arch/dreamcast/dev/maple/maple.c	Sun Oct 17 14:13:44 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: maple.c,v 1.40 2008/10/19 14:05:49 mjf Exp $	*/
+/*	$NetBSD: maple.c,v 1.41 2010/10/17 14:13:44 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: maple.c,v 1.40 2008/10/19 14:05:49 mjf Exp $);
+__KERNEL_RCSID(0, $NetBSD: maple.c,v 1.41 2010/10/17 14:13:44 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/device.h
@@ -107,8 +107,8 @@
 /*
  * Function declarations.
  */
-static int	maplematch(struct device *, struct cfdata *, void *);
-static void	mapleattach(struct device *, struct device *, void *);
+static int	maplematch(device_t, cfdata_t, void *);
+static void	mapleattach(device_t, device_t, void *);
 static void	maple_scanbus(struct maple_softc *);
 static char *	maple_unit_name(char *, int port, int subunit);
 static void	maple_begin_txbuf(struct maple_softc *);
@@ -157,7 +157,7 @@
  */
 int	maple_polling;		/* Are we polling?  (Debugger mode) */
 
-CFATTACH_DECL(maple, sizeof(struct maple_softc),
+CFATTACH_DECL_NEW(maple, sizeof(struct maple_softc),
 maplematch, mapleattach, NULL, NULL);
 
 extern struct cfdriver maple_cd;
@@ -172,14 +172,14 @@
 };
 
 static int
-maplematch(struct device *parent, struct cfdata *cf, void *aux)
+maplematch(device_t parent, cfdata_t cf, void *aux)
 {
 
 	return 1;
 }
 
 static void
-mapleattach(struct device *parent, struct device *self, void *aux)
+mapleattach(device_t parent, device_t self, void *aux)
 {
 	struct maple_softc *sc;
 	struct maple_unit *u;
@@ -188,13 +188,14 @@
 	uint32_t *p;
 	int port, subunit, f;
 
-	sc = (struct maple_softc *)self;
+	sc = device_private(self);
+	sc-sc_dev = self;
 
 	printf(: %s\n, sysasic_intr_string(IRL_MAPLE));
 
 	if (maple_alloc_dma(MAPLE_DMABUF_SIZE, dmabuffer, dmabuffer_phys)) {
 		printf(%s: unable to allocate DMA buffers.\n,
-		sc-sc_dev.dv_xname);
+		device_xname(self));
 		return;
 	}
 
@@ -246,10 +247,10 @@
 	config_pending_incr();	/* create thread before mounting root */
 
 	if (kthread_create(PRI_NONE, 0, NULL, maple_event_thread, sc,
-	sc-event_thread, %s, sc-sc_dev.dv_xname) == 0)
+	sc-event_thread, %s, device_xname(self)) == 0)
 		return;
 
-	panic(%s: unable to create event thread, sc-sc_dev.dv_xname);
+	panic(%s: unable to create event thread, device_xname(self));
 }
 
 /*
@@ -304,13 +305,13 @@
 }
 
 void
-maple_run_polling(struct device *dev)
+maple_run_polling(device_t dev)
 {
 	struct maple_softc *sc;
 	int port, subunit;
 	int i;
 
-	sc = (struct maple_softc *)dev;
+	sc = device_private(dev);
 
 	/*
 	 * first, make sure polling works
@@ -672,10 +673,10 @@
 	ma.ma_basedevinfo = sc-sc_unit[u-port][0].devinfo;
 	func = be32toh(ma.ma_devinfo-di_func);
 
-	maple_print_unit(ma, sc-sc_dev.dv_xname);
+	maple_print_unit(ma, device_xname(sc-sc_dev));
 	printf(\n);
-	strcpy(oldxname, sc-sc_dev.dv_xname);
-	maple_unit_name(sc-sc_dev.dv_xname, u-port, u-subunit);
+	strcpy(oldxname, device_xname(sc-sc_dev));
+	maple_unit_name(sc-sc_dev-dv_xname, u-port, u-subunit);
 
 	for (f = 0; f  MAPLE_NFUNC; f++) {
 		u-u_func[f].f_callback = NULL;
@@ -684,7 +685,7 @@
 		u-u_func[f].f_dev = NULL;
 		if (func  MAPLE_FUNC(f)) {
 			ma.ma_function = f;
-			u-u_func[f].f_dev = config_found_sm_loc(sc-sc_dev,
+			u-u_func[f].f_dev = config_found_sm_loc(sc-sc_dev,
 			maple, NULL, ma, mapleprint, maplesubmatch);
 			u-u_ping_func = f;	/* XXX using largest func */
 		}
@@ -702,7 +703,7 @@
 		u-u_ping_stat = MAPLE_PING_NORMAL;
 	}
 #endif
-	strcpy(sc-sc_dev.dv_xname, oldxname);
+	strcpy(sc-sc_dev-dv_xname, oldxname);
 
 	sc-sc_port_units[u-port] |= 1  u-subunit;
 }
@@ -760,11 +761,11 @@
 			if ((error = config_detach(fn-f_dev, DETACH_FORCE))) {
 printf(%s: 

CVS commit: src/sys/arch/dreamcast/dev/maple

2010-10-17 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Oct 17 14:16:22 UTC 2010

Modified Files:
src/sys/arch/dreamcast/dev/maple: mms.c

Log Message:
Make local functions static.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/dreamcast/dev/maple/mms.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/dreamcast/dev/maple/mms.c
diff -u src/sys/arch/dreamcast/dev/maple/mms.c:1.15 src/sys/arch/dreamcast/dev/maple/mms.c:1.16
--- src/sys/arch/dreamcast/dev/maple/mms.c:1.15	Sun Oct 17 14:13:44 2010
+++ src/sys/arch/dreamcast/dev/maple/mms.c	Sun Oct 17 14:16:21 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: mms.c,v 1.15 2010/10/17 14:13:44 tsutsui Exp $	*/
+/*	$NetBSD: mms.c,v 1.16 2010/10/17 14:16:21 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: mms.c,v 1.15 2010/10/17 14:13:44 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: mms.c,v 1.16 2010/10/17 14:16:21 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/device.h
@@ -91,16 +91,16 @@
 	struct device *sc_wsmousedev;
 };
 
-int	mms_match(device_t, cfdata_t, void *);
-void	mms_attach(device_t, device_t, void *);
-int	mms_detach(device_t, int);
+static int	mms_match(device_t, cfdata_t, void *);
+static void	mms_attach(device_t, device_t, void *);
+static int	mms_detach(device_t, int);
 
 CFATTACH_DECL_NEW(mms, sizeof(struct mms_softc),
 mms_match, mms_attach, mms_detach, NULL);
 
-int	mms_enable(void *);
-int	mms_ioctl(void *, u_long, void *, int, struct lwp *);
-void	mms_disable(void *);
+static int	mms_enable(void *);
+static int	mms_ioctl(void *, u_long, void *, int, struct lwp *);
+static void	mms_disable(void *);
 
 const struct wsmouse_accessops mms_accessops = {
 	mms_enable,
@@ -108,9 +108,9 @@
 	mms_disable,
 };
 
-void	mms_intr(void *, struct maple_response *, int, int);
+static void	mms_intr(void *, struct maple_response *, int, int);
 
-int
+static int
 mms_match(device_t parent, cfdata_t cf, void *aux)
 {
 	struct maple_attach_args *ma = aux;
@@ -118,7 +118,7 @@
 	return ma-ma_function == MAPLE_FN_MOUSE ? MAPLE_MATCH_FUNC : 0;
 }
 
-void
+static void
 mms_attach(device_t parent, device_t self, void *aux)
 {
 	struct mms_softc *sc = device_private(self);
@@ -163,7 +163,7 @@
 	maple_set_callback(parent, sc-sc_unit, MAPLE_FN_MOUSE, mms_intr, sc);
 }
 
-int
+static int
 mms_detach(device_t self, int flags)
 {
 	struct mms_softc *sc = device_private(self);
@@ -175,7 +175,7 @@
 	return rv;
 }
 
-int
+static int
 mms_enable(void *v)
 {
 	struct mms_softc *sc = v;
@@ -184,7 +184,7 @@
 	return 0;
 }
 
-void
+static void
 mms_disable(void *v)
 {
 	struct mms_softc *sc = v;
@@ -192,7 +192,7 @@
 	maple_enable_periodic(sc-sc_parent, sc-sc_unit, MAPLE_FN_MOUSE, 0);
 }
 
-int
+static int
 mms_ioctl(void *v, u_long cmd, void *data, int flag, struct lwp *l)
 {
 
@@ -212,7 +212,7 @@
 	return 0;
 }
 
-void
+static void
 mms_intr(void *arg, struct maple_response *response, int size, int flags)
 {
 	struct mms_softc *sc = arg;



CVS commit: src/sys/arch/dreamcast/dev/maple

2010-10-17 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Oct 17 14:17:49 UTC 2010

Modified Files:
src/sys/arch/dreamcast/dev/maple: maple.c mlcd.c mmemcard.c

Log Message:
Include ioconf.h for struct cfdriver.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/dreamcast/dev/maple/maple.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/dreamcast/dev/maple/mlcd.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/dreamcast/dev/maple/mmemcard.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/dreamcast/dev/maple/maple.c
diff -u src/sys/arch/dreamcast/dev/maple/maple.c:1.41 src/sys/arch/dreamcast/dev/maple/maple.c:1.42
--- src/sys/arch/dreamcast/dev/maple/maple.c:1.41	Sun Oct 17 14:13:44 2010
+++ src/sys/arch/dreamcast/dev/maple/maple.c	Sun Oct 17 14:17:49 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: maple.c,v 1.41 2010/10/17 14:13:44 tsutsui Exp $	*/
+/*	$NetBSD: maple.c,v 1.42 2010/10/17 14:17:49 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: maple.c,v 1.41 2010/10/17 14:13:44 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: maple.c,v 1.42 2010/10/17 14:17:49 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/device.h
@@ -89,6 +89,7 @@
 #include dreamcast/dev/maple/maplereg.h
 #include dreamcast/dev/maple/mapleio.h
 
+#include ioconf.h
 #include locators.h
 
 /* Internal macros, functions, and variables. */
@@ -160,8 +161,6 @@
 CFATTACH_DECL_NEW(maple, sizeof(struct maple_softc),
 maplematch, mapleattach, NULL, NULL);
 
-extern struct cfdriver maple_cd;
-
 dev_type_open(mapleopen);
 dev_type_close(mapleclose);
 dev_type_ioctl(mapleioctl);

Index: src/sys/arch/dreamcast/dev/maple/mlcd.c
diff -u src/sys/arch/dreamcast/dev/maple/mlcd.c:1.13 src/sys/arch/dreamcast/dev/maple/mlcd.c:1.14
--- src/sys/arch/dreamcast/dev/maple/mlcd.c:1.13	Sun Oct 17 14:13:44 2010
+++ src/sys/arch/dreamcast/dev/maple/mlcd.c	Sun Oct 17 14:17:49 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: mlcd.c,v 1.13 2010/10/17 14:13:44 tsutsui Exp $	*/
+/*	$NetBSD: mlcd.c,v 1.14 2010/10/17 14:17:49 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: mlcd.c,v 1.13 2010/10/17 14:13:44 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: mlcd.c,v 1.14 2010/10/17 14:17:49 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/device.h
@@ -44,6 +44,8 @@
 #include dreamcast/dev/maple/maple.h
 #include dreamcast/dev/maple/mapleconf.h
 
+#include ioconf.h
+
 #define MLCD_MAXACCSIZE	1012	/* (255*4) - 8  =  253*32 / 8 */
 
 struct mlcd_funcdef {	/* XXX assuming little-endian structure packing */
@@ -174,8 +176,6 @@
 CFATTACH_DECL_NEW(mlcd, sizeof(struct mlcd_softc),
 mlcdmatch, mlcdattach, mlcddetach, NULL);
 
-extern struct cfdriver mlcd_cd;
-
 /* initial image NetBSD dreamcast */
 static const char initimg48x32[192] = {
 	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,

Index: src/sys/arch/dreamcast/dev/maple/mmemcard.c
diff -u src/sys/arch/dreamcast/dev/maple/mmemcard.c:1.19 src/sys/arch/dreamcast/dev/maple/mmemcard.c:1.20
--- src/sys/arch/dreamcast/dev/maple/mmemcard.c:1.19	Sun Oct 17 14:13:44 2010
+++ src/sys/arch/dreamcast/dev/maple/mmemcard.c	Sun Oct 17 14:17:49 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: mmemcard.c,v 1.19 2010/10/17 14:13:44 tsutsui Exp $	*/
+/*	$NetBSD: mmemcard.c,v 1.20 2010/10/17 14:17:49 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: mmemcard.c,v 1.19 2010/10/17 14:13:44 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: mmemcard.c,v 1.20 2010/10/17 14:17:49 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/buf.h
@@ -49,6 +49,8 @@
 #include dreamcast/dev/maple/maple.h
 #include dreamcast/dev/maple/mapleconf.h
 
+#include ioconf.h
+
 #define MMEM_MAXACCSIZE	1012	/* (255*4) - 8  =  253*32 / 8 */
 
 struct mmem_funcdef {	/* XXX assuming little-endian structure packing */
@@ -199,8 +201,6 @@
 CFATTACH_DECL_NEW(mmem, sizeof(struct mmem_softc),
 mmemmatch, mmemattach, mmemdetach, NULL);
 
-extern struct cfdriver mmem_cd;
-
 struct dkdriver mmemdkdriver = { mmemstrategy };
 
 static int



CVS commit: src/sys/arch/dreamcast/dev/maple

2010-02-24 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Feb 24 22:58:45 UTC 2010

Modified Files:
src/sys/arch/dreamcast/dev/maple: mlcd.c

Log Message:
Use device_t, device_private().


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/dreamcast/dev/maple/mlcd.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/dreamcast/dev/maple/mlcd.c
diff -u src/sys/arch/dreamcast/dev/maple/mlcd.c:1.11 src/sys/arch/dreamcast/dev/maple/mlcd.c:1.12
--- src/sys/arch/dreamcast/dev/maple/mlcd.c:1.11	Wed Jun 11 14:55:30 2008
+++ src/sys/arch/dreamcast/dev/maple/mlcd.c	Wed Feb 24 22:58:45 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: mlcd.c,v 1.11 2008/06/11 14:55:30 tsutsui Exp $	*/
+/*	$NetBSD: mlcd.c,v 1.12 2010/02/24 22:58:45 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: mlcd.c,v 1.11 2008/06/11 14:55:30 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: mlcd.c,v 1.12 2010/02/24 22:58:45 dyoung Exp $);
 
 #include sys/param.h
 #include sys/device.h
@@ -93,7 +93,7 @@
 struct mlcd_softc {
 	struct device	sc_dev;
 
-	struct device	*sc_parent;
+	device_t sc_parent;
 	struct maple_unit *sc_unit;
 	int		sc_direction;
 	enum mlcd_stat {
@@ -148,9 +148,9 @@
 #define MLCD_UNIT(dev)		(minor(dev)  8)
 #define MLCD_MINOR(unit, part)	(((unit)  8) | (part))
 
-static int	mlcdmatch(struct device *, struct cfdata *, void *);
-static void	mlcdattach(struct device *, struct device *, void *);
-static int	mlcddetach(struct device *, int);
+static int	mlcdmatch(device_t, struct cfdata *, void *);
+static void	mlcdattach(device_t, device_t, void *);
+static int	mlcddetach(device_t, int);
 static void	mlcd_intr(void *, struct maple_response *, int, int);
 static void	mlcd_printerror(const char *, uint32_t);
 static struct mlcd_buf *mlcd_buf_alloc(int /*dev*/, int /*flags*/);
@@ -198,7 +198,7 @@
 
 /* ARGSUSED */
 static int
-mlcdmatch(struct device *parent, struct cfdata *cf, void *aux)
+mlcdmatch(device_t parent, struct cfdata *cf, void *aux)
 {
 	struct maple_attach_args *ma = aux;
 
@@ -206,9 +206,9 @@
 }
 
 static void
-mlcdattach(struct device *parent, struct device *self, void *aux)
+mlcdattach(device_t parent, device_t self, void *aux)
 {
-	struct mlcd_softc *sc = (void *) self;
+	struct mlcd_softc *sc = device_private(self);
 	struct maple_attach_args *ma = aux;
 	int i;
 	union {
@@ -282,9 +282,9 @@
 
 /* ARGSUSED1 */
 static int
-mlcddetach(struct device *self, int flags)
+mlcddetach(device_t self, int flags)
 {
-	struct mlcd_softc *sc = (struct mlcd_softc *) self;
+	struct mlcd_softc *sc = device_private(self);
 	struct mlcd_buf *bp;
 	int minor_l, minor_h;