Source-Changes-HG archive

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

[src/thorpej-cfargs]: src/sys/dev/pci Don't filter interface attributes in re...



details:   https://anonhg.NetBSD.org/src/rev/7fed21b1423f
branches:  thorpej-cfargs
changeset: 1019719:7fed21b1423f
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Wed Mar 24 14:21:08 2021 +0000

description:
Don't filter interface attributes in rescan functions for devices that
carry only a single interface attribute.  The autoconfiguration machinery
already considers interface attributes when searching for possible parents.

diffstat:

 sys/arch/arm/broadcom/bcm2835_vcaudio.c |   6 +++---
 sys/arch/arm/omap/tiotg.c               |   6 ++----
 sys/arch/x86/pci/pcib.c                 |  13 ++++++++++---
 sys/dev/acpi/wmi/wmi_acpi.c             |  11 ++++++-----
 sys/dev/hdaudio/hdaudio.c               |   7 ++-----
 sys/dev/pci/ichsmb.c                    |  17 ++++++-----------
 sys/dev/pci/ismt.c                      |  13 +++++--------
 sys/dev/pci/piixpm.c                    |  21 +++++++++------------
 8 files changed, 43 insertions(+), 51 deletions(-)

diffs (truncated from 339 to 300 lines):

diff -r 7d8e98eca19f -r 7fed21b1423f sys/arch/arm/broadcom/bcm2835_vcaudio.c
--- a/sys/arch/arm/broadcom/bcm2835_vcaudio.c   Tue Mar 23 07:14:41 2021 +0000
+++ b/sys/arch/arm/broadcom/bcm2835_vcaudio.c   Wed Mar 24 14:21:08 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bcm2835_vcaudio.c,v 1.17 2021/01/27 12:06:10 nia Exp $ */
+/* $NetBSD: bcm2835_vcaudio.c,v 1.17.2.1 2021/03/24 14:21:08 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2013 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_vcaudio.c,v 1.17 2021/01/27 12:06:10 nia Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_vcaudio.c,v 1.17.2.1 2021/03/24 14:21:08 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -237,7 +237,7 @@
        struct vcaudio_softc *sc = device_private(self);
        int error;
 
-       if (ifattr_match(ifattr, "audiobus") && sc->sc_audiodev == NULL) {
+       if (sc->sc_audiodev == NULL) {
                error = vcaudio_init(sc);
                if (error) {
                        return error;
diff -r 7d8e98eca19f -r 7fed21b1423f sys/arch/arm/omap/tiotg.c
--- a/sys/arch/arm/omap/tiotg.c Tue Mar 23 07:14:41 2021 +0000
+++ b/sys/arch/arm/omap/tiotg.c Wed Mar 24 14:21:08 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tiotg.c,v 1.7.18.1 2021/03/23 07:14:44 thorpej Exp $ */
+/* $NetBSD: tiotg.c,v 1.7.18.2 2021/03/24 14:21:08 thorpej Exp $ */
 /*
  * Copyright (c) 2013 Manuel Bouyer.  All rights reserved.
  *
@@ -24,7 +24,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tiotg.c,v 1.7.18.1 2021/03/23 07:14:44 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tiotg.c,v 1.7.18.2 2021/03/24 14:21:08 thorpej Exp $");
 
 #include "opt_omap.h"
 #include "locators.h"
@@ -196,8 +196,6 @@
        for (i = 0; i < TI_OTG_NPORTS; i++) {
                if (sc->sc_motgdev[i] != NULL)
                        continue;
-               if (!ifattr_match(ifattr, "tiotg_port"))
-                       continue;
                if (bus_space_subregion(sc->sc_iot, sc->sc_ioh,
                    USB_CTRL_OFFSET(i), USB_PORT_SIZE, &aa.aa_ioh) < 0) {
                        aprint_error_dev(self,
diff -r 7d8e98eca19f -r 7fed21b1423f sys/arch/x86/pci/pcib.c
--- a/sys/arch/x86/pci/pcib.c   Tue Mar 23 07:14:41 2021 +0000
+++ b/sys/arch/x86/pci/pcib.c   Wed Mar 24 14:21:08 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pcib.c,v 1.19 2019/10/04 12:23:37 mrg Exp $    */
+/*     $NetBSD: pcib.c,v 1.19.10.1 2021/03/24 14:21:08 thorpej Exp $   */
 
 /*-
  * Copyright (c) 1996, 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pcib.c,v 1.19 2019/10/04 12:23:37 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pcib.c,v 1.19.10.1 2021/03/24 14:21:08 thorpej Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -228,6 +228,11 @@
        struct pcib_softc *sc = device_private(self);
        struct isabus_attach_args iba;
 
+       /*
+        * Even though pcib only has a single "isabus" interface
+        * attribute, this function is referenced by other drivers
+        * that carry more, so we go ahead and filter.
+        */
        if (ifattr_match(ifattr, "isabus") && sc->sc_isabus == NULL) {
                /*
                 * Attach the ISA bus behind this bridge.
@@ -239,7 +244,9 @@
                iba.iba_dmat = &isa_bus_dma_tag;
 #endif
                sc->sc_isabus =
-                   config_found_ia(self, "isabus", &iba, isabusprint);
+                   config_found(self, &iba, isabusprint,
+                       CFARG_IATTR, "isabus",
+                       CFARG_EOL);
        }
        return 0;
 }
diff -r 7d8e98eca19f -r 7fed21b1423f sys/dev/acpi/wmi/wmi_acpi.c
--- a/sys/dev/acpi/wmi/wmi_acpi.c       Tue Mar 23 07:14:41 2021 +0000
+++ b/sys/dev/acpi/wmi/wmi_acpi.c       Wed Mar 24 14:21:08 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wmi_acpi.c,v 1.17 2021/01/29 15:49:55 thorpej Exp $    */
+/*     $NetBSD: wmi_acpi.c,v 1.17.2.1 2021/03/24 14:21:08 thorpej Exp $        */
 
 /*-
  * Copyright (c) 2009, 2010 Jukka Ruohonen <jruohonen%iki.fi@localhost>
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wmi_acpi.c,v 1.17 2021/01/29 15:49:55 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wmi_acpi.c,v 1.17.2.1 2021/03/24 14:21:08 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -149,9 +149,10 @@
 {
        struct acpi_wmi_softc *sc = device_private(self);
 
-       if (ifattr_match(ifattr, "acpiwmibus") && sc->sc_child == NULL)
-               sc->sc_child = config_found_ia(self, "acpiwmibus",
-                   NULL, acpi_wmi_print);
+       if (sc->sc_child == NULL) {
+               sc->sc_child =
+                   config_found(self, NULL, acpi_wmi_print, CFARG_EOL);
+       }
 
        return 0;
 }
diff -r 7d8e98eca19f -r 7fed21b1423f sys/dev/hdaudio/hdaudio.c
--- a/sys/dev/hdaudio/hdaudio.c Tue Mar 23 07:14:41 2021 +0000
+++ b/sys/dev/hdaudio/hdaudio.c Wed Mar 24 14:21:08 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: hdaudio.c,v 1.13.2.2 2021/03/22 16:23:44 thorpej Exp $ */
+/* $NetBSD: hdaudio.c,v 1.13.2.3 2021/03/24 14:21:08 thorpej Exp $ */
 
 /*
  * Copyright (c) 2009 Precedence Technologies Ltd <support%precedence.co.uk@localhost>
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.13.2.2 2021/03/22 16:23:44 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.13.2.3 2021/03/24 14:21:08 thorpej Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -948,9 +948,6 @@
        struct hdaudio_function_group *fg;
        unsigned int codec;
 
-       if (!ifattr_match(ifattr, "hdaudiobus"))
-               return 0;
-
        for (codec = 0; codec < HDAUDIO_MAX_CODECS; codec++) {
                co = &sc->sc_codec[codec];
                fg = co->co_fg;
diff -r 7d8e98eca19f -r 7fed21b1423f sys/dev/pci/ichsmb.c
--- a/sys/dev/pci/ichsmb.c      Tue Mar 23 07:14:41 2021 +0000
+++ b/sys/dev/pci/ichsmb.c      Wed Mar 24 14:21:08 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ichsmb.c,v 1.69 2021/01/15 14:07:15 thorpej Exp $      */
+/*     $NetBSD: ichsmb.c,v 1.69.2.1 2021/03/24 14:21:08 thorpej Exp $  */
 /*     $OpenBSD: ichiic.c,v 1.44 2020/10/07 11:23:05 jsg Exp $ */
 
 /*
@@ -22,7 +22,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ichsmb.c,v 1.69 2021/01/15 14:07:15 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ichsmb.c,v 1.69.2.1 2021/03/24 14:21:08 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -163,7 +163,6 @@
        pcireg_t conf;
        const char *intrstr = NULL;
        char intrbuf[PCI_INTRSTR_LEN];
-       int flags;
 
        sc->sc_dev = self;
        sc->sc_pc = pa->pa_pc;
@@ -218,23 +217,19 @@
        }
 
        sc->sc_i2c_device = NULL;
-       flags = 0;
-       ichsmb_rescan(self, "i2cbus", &flags);
+       ichsmb_rescan(self, NULL, NULL);
 
 out:   if (!pmf_device_register(self, NULL, NULL))
                aprint_error_dev(self, "couldn't establish power handler\n");
 }
 
 static int
-ichsmb_rescan(device_t self, const char *ifattr, const int *flags)
+ichsmb_rescan(device_t self, const char *ifattr, const int *locators)
 {
        struct ichsmb_softc *sc = device_private(self);
        struct i2cbus_attach_args iba;
 
-       if (!ifattr_match(ifattr, "i2cbus"))
-               return 0;
-
-       if (sc->sc_i2c_device)
+       if (sc->sc_i2c_device != NULL)
                return 0;
 
        /* Attach I2C bus */
@@ -244,7 +239,7 @@
 
        memset(&iba, 0, sizeof(iba));
        iba.iba_tag = &sc->sc_i2c_tag;
-       sc->sc_i2c_device = config_found_ia(self, ifattr, &iba, iicbus_print);
+       sc->sc_i2c_device = config_found(self, &iba, iicbus_print, CFARG_EOL);
 
        return 0;
 }
diff -r 7d8e98eca19f -r 7fed21b1423f sys/dev/pci/ismt.c
--- a/sys/dev/pci/ismt.c        Tue Mar 23 07:14:41 2021 +0000
+++ b/sys/dev/pci/ismt.c        Wed Mar 24 14:21:08 2021 +0000
@@ -60,7 +60,7 @@
 #if 0
 __FBSDID("$FreeBSD: head/sys/dev/ismt/ismt.c 266474 2014-05-20 19:55:06Z jimharris $");
 #endif
-__KERNEL_RCSID(0, "$NetBSD: ismt.c,v 1.7 2019/12/22 23:23:32 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ismt.c,v 1.7.10.1 2021/03/24 14:21:08 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -787,15 +787,12 @@
 }
 
 static int
-ismt_rescan(device_t self, const char *ifattr, const int *flags)
+ismt_rescan(device_t self, const char *ifattr, const int *locators)
 {
        struct ismt_softc *sc = device_private(self);
        struct i2cbus_attach_args iba;
 
-       if (!ifattr_match(ifattr, "i2cbus"))
-               return 0;
-
-       if (sc->smbdev)
+       if (sc->smbdev != NULL)
                return 0;
 
        /* Attach I2C bus */
@@ -805,7 +802,7 @@
 
        memset(&iba, 0, sizeof(iba));
        iba.iba_tag = &sc->sc_i2c_tag;
-       sc->smbdev = config_found_ia(self, ifattr, &iba, iicbus_print);
+       sc->smbdev = config_found(self, &iba, iicbus_print, CFARG_EOL);
 
        return 0;
 }
@@ -815,7 +812,7 @@
 {
        int flags = 0;
 
-       ismt_rescan(self, "i2cbus", &flags);
+       ismt_rescan(self, NULL, NULL);
 }
 
 static void
diff -r 7d8e98eca19f -r 7fed21b1423f sys/dev/pci/piixpm.c
--- a/sys/dev/pci/piixpm.c      Tue Mar 23 07:14:41 2021 +0000
+++ b/sys/dev/pci/piixpm.c      Wed Mar 24 14:21:08 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: piixpm.c,v 1.63 2020/01/14 15:42:03 msaitoh Exp $ */
+/* $NetBSD: piixpm.c,v 1.63.8.1 2021/03/24 14:21:08 thorpej Exp $ */
 /*     $OpenBSD: piixpm.c,v 1.39 2013/10/01 20:06:02 sf Exp $  */
 
 /*
@@ -22,7 +22,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: piixpm.c,v 1.63 2020/01/14 15:42:03 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: piixpm.c,v 1.63.8.1 2021/03/24 14:21:08 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -192,7 +192,7 @@
        pci_intr_handle_t ih;
        bool usesmi = false;
        const char *intrstr = NULL;
-       int i, flags;
+       int i;
        char intrbuf[PCI_INTRSTR_LEN];
 
        sc->sc_dev = self;
@@ -304,8 +304,7 @@
        for (i = 0; i < sc->sc_numbusses; i++)
                sc->sc_i2c_device[i] = NULL;
 
-       flags = 0;
-       piixpm_rescan(self, "i2cbus", &flags);
+       piixpm_rescan(self, NULL, NULL);
 }



Home | Main Index | Thread Index | Old Index