Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/gpio Use needs-count for # of pseudo instances; sugg...



details:   https://anonhg.NetBSD.org/src/rev/4d777a49ab79
branches:  trunk
changeset: 340029:4d777a49ab79
user:      uebayasi <uebayasi%NetBSD.org@localhost>
date:      Thu Aug 20 12:09:22 2015 +0000

description:
Use needs-count for # of pseudo instances; suggested by cube@.

diffstat:

 sys/dev/gpio/files.gpio |  4 ++--
 sys/dev/gpio/gpiosim.c  |  8 +++++---
 2 files changed, 7 insertions(+), 5 deletions(-)

diffs (54 lines):

diff -r 6bf4f2caab1e -r 4d777a49ab79 sys/dev/gpio/files.gpio
--- a/sys/dev/gpio/files.gpio   Thu Aug 20 12:04:30 2015 +0000
+++ b/sys/dev/gpio/files.gpio   Thu Aug 20 12:09:22 2015 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.gpio,v 1.12 2015/05/30 15:35:51 jmcneill Exp $
+# $NetBSD: files.gpio,v 1.13 2015/08/20 12:09:22 uebayasi Exp $
 
 define gpio {[offset = -1], [mask = 0], [flag = 0]}
 
@@ -8,7 +8,7 @@
 
 # GPIO simulator
 defpseudodev   gpiosim: gpiobus
-file   dev/gpio/gpiosim.c                      gpiosim
+file   dev/gpio/gpiosim.c                      gpiosim needs-count
 
 # I2C bus bit-banging
 device gpioiic: i2cbus, i2c_bitbang
diff -r 6bf4f2caab1e -r 4d777a49ab79 sys/dev/gpio/gpiosim.c
--- a/sys/dev/gpio/gpiosim.c    Thu Aug 20 12:04:30 2015 +0000
+++ b/sys/dev/gpio/gpiosim.c    Thu Aug 20 12:09:22 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gpiosim.c,v 1.16 2014/02/25 18:30:09 pooka Exp $ */
+/* $NetBSD: gpiosim.c,v 1.17 2015/08/20 12:09:22 uebayasi Exp $ */
 /*      $OpenBSD: gpiosim.c,v 1.1 2008/11/23 18:46:49 mbalmer Exp $    */
 
 /*
@@ -30,6 +30,8 @@
 #include <sys/ioccom.h>
 #include <dev/gpio/gpiovar.h>
 
+#include "gpiosim.h"
+
 #define        GPIOSIM_NPINS   64
 
 struct gpiosim_softc {
@@ -64,7 +66,7 @@
 }
 
 void
-gpiosimattach(int num)
+gpiosimattach(int num __unused)
 {
        cfdata_t cf;
        int n, err;
@@ -73,7 +75,7 @@
        if (err)
                printf("%s: unable to register cfattach\n", gpiosim_cd.cd_name);
 
-       for (n = 0; n < num; n++) {
+       for (n = 0; n < NGPIOSIM; n++) {
                cf = malloc(sizeof(*cf), M_DEVBUF, M_WAITOK);
                cf->cf_name = "gpiosim";
                cf->cf_atname = "gpiosim";



Home | Main Index | Thread Index | Old Index