diff options
| author | thorpej <thorpej@NetBSD.org> | 2021-04-24 23:36:23 +0000 |
|---|---|---|
| committer | thorpej <thorpej@NetBSD.org> | 2021-04-24 23:36:23 +0000 |
| commit | 3bee0c110b9ff2a9a0e2833be339e1c873af3a44 (patch) | |
| tree | 82c9f34b9867882723e76eff95e5d7ca6cab69bf /sys/dev/flash | |
| parent | e77b3a7c4b6598de68d8b78f86e7851410840595 (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/flash')
| -rw-r--r-- | sys/dev/flash/flash.c | 8 | ||||
| -rw-r--r-- | sys/dev/flash/flash_mtdparts.c | 8 |
2 files changed, 10 insertions, 6 deletions
diff --git a/sys/dev/flash/flash.c b/sys/dev/flash/flash.c index a13bf9ef95d..c94c77f19a1 100644 --- a/sys/dev/flash/flash.c +++ b/sys/dev/flash/flash.c @@ -1,4 +1,4 @@ -/* $NetBSD: flash.c,v 1.15 2019/12/26 04:53:11 msaitoh Exp $ */ +/* $NetBSD: flash.c,v 1.16 2021/04/24 23:36:53 thorpej Exp $ */ /*- * Copyright (c) 2011 Department of Software Engineering, @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: flash.c,v 1.15 2019/12/26 04:53:11 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: flash.c,v 1.16 2021/04/24 23:36:53 thorpej Exp $"); #include <sys/param.h> #include <sys/types.h> @@ -240,7 +240,9 @@ flash_attach_mi(struct flash_interface * const flash_if, device_t device) #endif arg.flash_if = flash_if; - return config_found_ia(device, "flashbus", &arg, flash_print); + return config_found(device, &arg, flash_print, + CFARG_IATTR, "flashbus", + CFARG_EOL); } /** diff --git a/sys/dev/flash/flash_mtdparts.c b/sys/dev/flash/flash_mtdparts.c index 3ea308359d4..6c1562366de 100644 --- a/sys/dev/flash/flash_mtdparts.c +++ b/sys/dev/flash/flash_mtdparts.c @@ -1,4 +1,4 @@ -/* $NetBSD: flash_mtdparts.c,v 1.1 2017/11/13 17:35:58 jmcneill Exp $ */ +/* $NetBSD: flash_mtdparts.c,v 1.2 2021/04/24 23:36:53 thorpej Exp $ */ /*- * Copyright (c) 2017 Jared McNeill <jmcneill@invisible.ca> @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: flash_mtdparts.c,v 1.1 2017/11/13 17:35:58 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: flash_mtdparts.c,v 1.2 2021/04/24 23:36:53 thorpej Exp $"); #include <sys/param.h> #include <sys/bus.h> @@ -48,7 +48,9 @@ flash_attach_partition(struct flash_interface *flash_if, device_t parent, faa.flash_if = flash_if; faa.partinfo = *part; - config_found_ia(parent, "flashbus", &faa, flash_print); + config_found(parent, &faa, flash_print, + CFARG_IATTR, "flashbus", + CFARG_EOL); } static flash_size_t |
