summaryrefslogtreecommitdiff
path: root/sys/dev/hpc
diff options
context:
space:
mode:
authorthorpej <thorpej@NetBSD.org>2021-04-24 23:36:23 +0000
committerthorpej <thorpej@NetBSD.org>2021-04-24 23:36:23 +0000
commit3bee0c110b9ff2a9a0e2833be339e1c873af3a44 (patch)
tree82c9f34b9867882723e76eff95e5d7ca6cab69bf /sys/dev/hpc
parente77b3a7c4b6598de68d8b78f86e7851410840595 (diff)
Merge thorpej-cfargs branch:
Simplify and make extensible the config_search() / config_found() / config_attach() interfaces: rather than having different variants for which arguments you want pass along, just have a single call that takes a variadic list of tag-value arguments. Adjust all call sites: - Simplify wherever possible; don't pass along arguments that aren't actually needed. - Don't be explicit about what interface attribute is attaching if the device only has one. (More simplification.) - Add a config_probe() function to be used in indirect configuiration situations, making is visibly easier to see when indirect config is in play, and allowing for future change in semantics. (As of now, this is just a wrapper around config_match(), but that is an implementation detail.) Remove unnecessary or redundant interface attributes where they're not needed. There are currently 5 "cfargs" defined: - CFARG_SUBMATCH (submatch function for direct config) - CFARG_SEARCH (search function for indirect config) - CFARG_IATTR (interface attribte) - CFARG_LOCATORS (locators array) - CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles) ...and a sentinel value CFARG_EOL. Add some extra sanity checking to ensure that interface attributes aren't ambiguous. Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark ports to associate those device handles with device_t instance. This will trickle trough to more places over time (need back-end for pre-OFW Sun OBP; any others?).
Diffstat (limited to 'sys/dev/hpc')
-rw-r--r--sys/dev/hpc/bivideo.c6
-rw-r--r--sys/dev/hpc/btnmgr.c6
-rw-r--r--sys/dev/hpc/hpcapm.c6
-rw-r--r--sys/dev/hpc/hpcfb.c7
-rw-r--r--sys/dev/hpc/hpcioman.c10
-rw-r--r--sys/dev/hpc/hpckbd.c7
-rw-r--r--sys/dev/hpc/hpf1275a_tty.c6
7 files changed, 26 insertions, 22 deletions
diff --git a/sys/dev/hpc/bivideo.c b/sys/dev/hpc/bivideo.c
index d76c0a9e38c..a6e38dc27a3 100644
--- a/sys/dev/hpc/bivideo.c
+++ b/sys/dev/hpc/bivideo.c
@@ -1,4 +1,4 @@
-/* $NetBSD: bivideo.c,v 1.34 2017/06/13 19:13:55 spz Exp $ */
+/* $NetBSD: bivideo.c,v 1.35 2021/04/24 23:36:54 thorpej Exp $ */
/*-
* Copyright (c) 1999-2001
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bivideo.c,v 1.34 2017/06/13 19:13:55 spz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bivideo.c,v 1.35 2021/04/24 23:36:54 thorpej Exp $");
#ifdef _KERNEL_OPT
#include "opt_hpcfb.h"
@@ -195,7 +195,7 @@ bivideoattach(device_t parent, device_t self, void *aux)
ha.ha_ndspconf = 1;
ha.ha_dspconflist = &sc->sc_dspconf;
- config_found(self, &ha, hpcfbprint);
+ config_found(self, &ha, hpcfbprint, CFARG_EOL);
}
int
diff --git a/sys/dev/hpc/btnmgr.c b/sys/dev/hpc/btnmgr.c
index 4a299fdd2bb..c66cd448c55 100644
--- a/sys/dev/hpc/btnmgr.c
+++ b/sys/dev/hpc/btnmgr.c
@@ -1,4 +1,4 @@
-/* $NetBSD: btnmgr.c,v 1.29 2016/09/06 06:27:17 skrll Exp $ */
+/* $NetBSD: btnmgr.c,v 1.30 2021/04/24 23:36:54 thorpej Exp $ */
/*-
* Copyright (c) 1999
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: btnmgr.c,v 1.29 2016/09/06 06:27:17 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: btnmgr.c,v 1.30 2021/04/24 23:36:54 thorpej Exp $");
#ifdef _KERNEL_OPT
#include "opt_btnmgr.h"
@@ -219,7 +219,7 @@ btnmgrattach(device_t parent,
wa.accessops = &btnmgr_wskbd_accessops;
wa.accesscookie = sc;
- sc->sc_wskbddev = config_found(self, &wa, wskbddevprint);
+ sc->sc_wskbddev = config_found(self, &wa, wskbddevprint, CFARG_EOL);
if (!pmf_device_register(self, NULL, NULL))
aprint_error_dev(self, "unable to establish power handler\n");
diff --git a/sys/dev/hpc/hpcapm.c b/sys/dev/hpc/hpcapm.c
index 9ab4cfc9909..fd5aeb07ee1 100644
--- a/sys/dev/hpc/hpcapm.c
+++ b/sys/dev/hpc/hpcapm.c
@@ -1,4 +1,4 @@
-/* $NetBSD: hpcapm.c,v 1.22 2017/10/28 04:53:56 riastradh Exp $ */
+/* $NetBSD: hpcapm.c,v 1.23 2021/04/24 23:36:54 thorpej Exp $ */
/*
* Copyright (c) 2000 Takemura Shin
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hpcapm.c,v 1.22 2017/10/28 04:53:56 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hpcapm.c,v 1.23 2021/04/24 23:36:54 thorpej Exp $");
#ifdef _KERNEL_OPT
#include "opt_hpcapm.h"
@@ -149,7 +149,7 @@ hpcapm_attach(device_t parent, device_t self, void *aux)
aaa.accesscookie = sc;
aaa.apm_detail = 0x0102;
- sc->sc_apmdev = config_found_ia(self, "apmdevif", &aaa, apmprint);
+ sc->sc_apmdev = config_found(self, &aaa, apmprint, CFARG_EOL);
if (!pmf_device_register(self, NULL, NULL))
aprint_error_dev(self, "unable to establish power handler\n");
diff --git a/sys/dev/hpc/hpcfb.c b/sys/dev/hpc/hpcfb.c
index f01c40da898..38be56a1ea2 100644
--- a/sys/dev/hpc/hpcfb.c
+++ b/sys/dev/hpc/hpcfb.c
@@ -1,4 +1,4 @@
-/* $NetBSD: hpcfb.c,v 1.60 2015/04/07 01:24:32 ozaki-r Exp $ */
+/* $NetBSD: hpcfb.c,v 1.61 2021/04/24 23:36:54 thorpej Exp $ */
/*-
* Copyright (c) 1999
@@ -43,7 +43,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hpcfb.c,v 1.60 2015/04/07 01:24:32 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hpcfb.c,v 1.61 2021/04/24 23:36:54 thorpej Exp $");
#ifdef _KERNEL_OPT
#include "opt_hpcfb.h"
@@ -324,7 +324,8 @@ hpcfbattach(device_t parent, device_t self, void *aux)
wa.accessops = &hpcfb_accessops;
wa.accesscookie = sc;
- sc->sc_wsdisplay = config_found(self, &wa, wsemuldisplaydevprint);
+ sc->sc_wsdisplay = config_found(self, &wa, wsemuldisplaydevprint,
+ CFARG_EOL);
#ifdef HPCFB_JUMP
/*
diff --git a/sys/dev/hpc/hpcioman.c b/sys/dev/hpc/hpcioman.c
index b653a025402..d1cd723fe00 100644
--- a/sys/dev/hpc/hpcioman.c
+++ b/sys/dev/hpc/hpcioman.c
@@ -1,4 +1,4 @@
-/* $NetBSD: hpcioman.c,v 1.19 2012/10/27 17:18:17 chs Exp $ */
+/* $NetBSD: hpcioman.c,v 1.20 2021/04/24 23:36:54 thorpej Exp $ */
/*-
* Copyright (c) 1999-2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hpcioman.c,v 1.19 2012/10/27 17:18:17 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hpcioman.c,v 1.20 2021/04/24 23:36:54 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -73,7 +73,9 @@ hpcioman_attach(device_t parent, device_t self, void *aux)
{
printf("\n");
- config_search_ia(hpcioman_search, self, "hpcioman", aux);
+ config_search(self, aux,
+ CFARG_SEARCH, hpcioman_search,
+ CFARG_EOL);
}
int
@@ -153,7 +155,7 @@ hpcioman_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
}
hma.hma_connect = cf->cf_connect;
- config_attach(parent, cf, &hma, hpcioman_print);
+ config_attach(parent, cf, &hma, hpcioman_print, CFARG_EOL);
return (0);
}
diff --git a/sys/dev/hpc/hpckbd.c b/sys/dev/hpc/hpckbd.c
index 4df83a26718..2d4a519bf6f 100644
--- a/sys/dev/hpc/hpckbd.c
+++ b/sys/dev/hpc/hpckbd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: hpckbd.c,v 1.35 2018/09/18 14:57:32 uwe Exp $ */
+/* $NetBSD: hpckbd.c,v 1.36 2021/04/24 23:36:54 thorpej Exp $ */
/*-
* Copyright (c) 1999-2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hpckbd.c,v 1.35 2018/09/18 14:57:32 uwe Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hpckbd.c,v 1.36 2021/04/24 23:36:54 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -183,7 +183,8 @@ hpckbd_attach(device_t parent, device_t self, void *aux)
wa.keymap = &hpckbd_keymapdata;
wa.accessops = &hpckbd_accessops;
wa.accesscookie = sc->sc_core;
- sc->sc_core->hc_wskbddev = config_found(self, &wa, wskbddevprint);
+ sc->sc_core->hc_wskbddev = config_found(self, &wa, wskbddevprint,
+ CFARG_EOL);
if (!pmf_device_register(self, NULL, NULL))
aprint_error_dev(self, "unable to establish power handler\n");
diff --git a/sys/dev/hpc/hpf1275a_tty.c b/sys/dev/hpc/hpf1275a_tty.c
index 0cba7e6b84c..6ad2365548e 100644
--- a/sys/dev/hpc/hpf1275a_tty.c
+++ b/sys/dev/hpc/hpf1275a_tty.c
@@ -1,4 +1,4 @@
-/* $NetBSD: hpf1275a_tty.c,v 1.29 2017/10/28 04:53:56 riastradh Exp $ */
+/* $NetBSD: hpf1275a_tty.c,v 1.30 2021/04/24 23:36:54 thorpej Exp $ */
/*
* Copyright (c) 2004 Valeriy E. Ushakov
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hpf1275a_tty.c,v 1.29 2017/10/28 04:53:56 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hpf1275a_tty.c,v 1.30 2021/04/24 23:36:54 thorpej Exp $");
#include "opt_wsdisplay_compat.h"
@@ -271,7 +271,7 @@ hpf1275a_attach(device_t parent, device_t self, void *aux)
#ifdef WSDISPLAY_COMPAT_RAWKBD
sc->sc_rawkbd = 0;
#endif
- sc->sc_wskbd = config_found(self, &wska, wskbddevprint);
+ sc->sc_wskbd = config_found(self, &wska, wskbddevprint, CFARG_EOL);
}