Source-Changes-HG archive

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

[src/thorpej-cfargs]: src/sys/dev/isa In "rescan" routines, always pass locat...



details:   https://anonhg.NetBSD.org/src/rev/f64d10d57935
branches:  thorpej-cfargs
changeset: 981668:f64d10d57935
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sun Mar 21 19:06:19 2021 +0000

description:
In "rescan" routines, always pass locators and the interface attribute
straight through to config_search().  Also, for devices that carry only
one interface attribute, no need to do an ifattr_match(), because
rescan_with_cfdata() will have already validated that the parent is
eligible, which includes an interface attribute check.

diffstat:

 sys/arch/x86/pci/amdnb_misc.c |   7 ++-----
 sys/arch/x86/pci/amdsmn.c     |   7 ++++---
 sys/dev/audio/audio.c         |  12 +++++-------
 sys/dev/i2c/i2c.c             |   5 +++--
 sys/dev/isa/pcppi.c           |  15 +++++++--------
 5 files changed, 21 insertions(+), 25 deletions(-)

diffs (173 lines):

diff -r e64ea1e1dc0a -r f64d10d57935 sys/arch/x86/pci/amdnb_misc.c
--- a/sys/arch/x86/pci/amdnb_misc.c     Sun Mar 21 18:03:32 2021 +0000
+++ b/sys/arch/x86/pci/amdnb_misc.c     Sun Mar 21 19:06:19 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amdnb_misc.c,v 1.3.14.2 2021/03/21 17:35:48 thorpej Exp $ */
+/*     $NetBSD: amdnb_misc.c,v 1.3.14.3 2021/03/21 19:06:19 thorpej Exp $ */
 /*
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdnb_misc.c,v 1.3.14.2 2021/03/21 17:35:48 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdnb_misc.c,v 1.3.14.3 2021/03/21 19:06:19 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -158,9 +158,6 @@
 {
        struct amdnb_misc_softc *sc = device_private(self);
 
-       if (!ifattr_match(ifattr, "amdnb_miscbus"))
-               return 0;
-
        config_search(self, &sc->sc_pa,
            CFARG_SUBMATCH, amdnb_misc_search,
            CFARG_IATTR, ifattr,
diff -r e64ea1e1dc0a -r f64d10d57935 sys/arch/x86/pci/amdsmn.c
--- a/sys/arch/x86/pci/amdsmn.c Sun Mar 21 18:03:32 2021 +0000
+++ b/sys/arch/x86/pci/amdsmn.c Sun Mar 21 19:06:19 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amdsmn.c,v 1.10.4.1 2021/03/20 19:33:39 thorpej Exp $  */
+/*     $NetBSD: amdsmn.c,v 1.10.4.2 2021/03/21 19:06:19 thorpej Exp $  */
 
 /*-
  * Copyright (c) 2017, 2019 Conrad Meyer <cem%FreeBSD.org@localhost>
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdsmn.c,v 1.10.4.1 2021/03/20 19:33:39 thorpej Exp $ ");
+__KERNEL_RCSID(0, "$NetBSD: amdsmn.c,v 1.10.4.2 2021/03/21 19:06:19 thorpej Exp $ ");
 
 /*
  * Driver for the AMD Family 15h (model 60+) and 17h CPU
@@ -153,13 +153,14 @@
 }
 
 static int
-amdsmn_rescan(device_t self, const char *ifattr, const int *flags)
+amdsmn_rescan(device_t self, const char *ifattr, const int *locators)
 {
        struct amdsmn_softc *sc = device_private(self);
 
        config_search(self, &sc->pa,
            CFARG_SUBMATCH, amdsmn_misc_search,
            CFARG_IATTR, ifattr,
+           CFARG_LOCATORS, locators,
            CFARG_EOL);
 
        return 0;
diff -r e64ea1e1dc0a -r f64d10d57935 sys/dev/audio/audio.c
--- a/sys/dev/audio/audio.c     Sun Mar 21 18:03:32 2021 +0000
+++ b/sys/dev/audio/audio.c     Sun Mar 21 19:06:19 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: audio.c,v 1.91.2.1 2021/03/20 19:33:40 thorpej Exp $   */
+/*     $NetBSD: audio.c,v 1.91.2.2 2021/03/21 19:06:19 thorpej Exp $   */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -138,7 +138,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.91.2.1 2021/03/20 19:33:40 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.91.2.2 2021/03/21 19:06:19 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -1410,16 +1410,14 @@
 }
 
 static int
-audiorescan(device_t self, const char *ifattr, const int *flags)
+audiorescan(device_t self, const char *ifattr, const int *locators)
 {
        struct audio_softc *sc = device_private(self);
 
-       if (!ifattr_match(ifattr, "audio"))
-               return 0;
-
        config_search(sc->sc_dev, NULL,
            CFARG_SUBMATCH, audiosearch,
-           CFARG_IATTR, "audio",
+           CFARG_IATTR, ifattr,
+           CFARG_LOCATORS, locators,
            CFARG_EOL);
 
        return 0;
diff -r e64ea1e1dc0a -r f64d10d57935 sys/dev/i2c/i2c.c
--- a/sys/dev/i2c/i2c.c Sun Mar 21 18:03:32 2021 +0000
+++ b/sys/dev/i2c/i2c.c Sun Mar 21 19:06:19 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: i2c.c,v 1.77.2.1 2021/03/20 19:33:40 thorpej Exp $     */
+/*     $NetBSD: i2c.c,v 1.77.2.2 2021/03/21 19:06:19 thorpej Exp $     */
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i2c.c,v 1.77.2.1 2021/03/20 19:33:40 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i2c.c,v 1.77.2.2 2021/03/21 19:06:19 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -383,6 +383,7 @@
        config_search(self, NULL,
            CFARG_SUBMATCH, iic_search,
            CFARG_IATTR, ifattr,
+           CFARG_LOCATORS, locators,
            CFARG_EOL);
        return 0;
 }
diff -r e64ea1e1dc0a -r f64d10d57935 sys/dev/isa/pcppi.c
--- a/sys/dev/isa/pcppi.c       Sun Mar 21 18:03:32 2021 +0000
+++ b/sys/dev/isa/pcppi.c       Sun Mar 21 19:06:19 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pcppi.c,v 1.45.22.1 2021/03/20 19:33:40 thorpej Exp $ */
+/* $NetBSD: pcppi.c,v 1.45.22.2 2021/03/21 19:06:19 thorpej Exp $ */
 
 /*
  * Copyright (c) 1996 Carnegie-Mellon University.
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pcppi.c,v 1.45.22.1 2021/03/20 19:33:40 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pcppi.c,v 1.45.22.2 2021/03/21 19:06:19 thorpej Exp $");
 
 #include "attimer.h"
 
@@ -233,23 +233,22 @@
        if (!pmf_device_register(self, NULL, NULL))
                aprint_error_dev(self, "couldn't establish power handler\n");
 
-       pcppi_rescan(self, "pcppi", NULL);
+       pcppi_rescan(self, NULL, NULL);
 }
 
 int
-pcppi_rescan(device_t self, const char *ifattr, const int *flags)
+pcppi_rescan(device_t self, const char *ifattr, const int *locators)
 {
        struct pcppi_softc *sc = device_private(self);
         struct pcppi_attach_args pa;
 
-       if (!ifattr_match(ifattr, "pcppi"))
-               return 0;
-
        pa.pa_cookie = sc;
        pa.pa_bell_func = pcppi_bell;
+
        config_search(sc->sc_dv, &pa,
            CFARG_SUBMATCH, pcppisearch,
-           CFARG_IATTR, "pcppi",
+           CFARG_IATTR, ifattr,
+           CFARG_LOCATORS, locators,
            CFARG_EOL);
 
        return 0;



Home | Main Index | Thread Index | Old Index