git: 5dedd2517db3 - main - devmatch: Ignore the pnp fields tagged as ignore ('#')

Warner Losh imp at FreeBSD.org
Tue Aug 10 21:55:28 UTC 2021


The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=5dedd2517db3ac1fc48e07c7daba684e5497d250

commit 5dedd2517db3ac1fc48e07c7daba684e5497d250
Author:     Warner Losh <imp at FreeBSD.org>
AuthorDate: 2021-08-10 21:45:50 +0000
Commit:     Warner Losh <imp at FreeBSD.org>
CommitDate: 2021-08-10 21:47:55 +0000

    devmatch: Ignore the pnp fields tagged as ignore ('#')
    
    When matching entries, we should ignore those with a name of '#'. It's
    the standard way to skip elements and need to be present to have the
    proper offsets to the fields that are observed. No bus has a pnp
    attribute of '#' and that is now disallowed for future buses that are
    written.
    
    Sponsored by:           Netflix
    Reviewed by:            kbowling
    Differential Revision:  https://reviews.freebsd.org/D31482
---
 sbin/devmatch/devmatch.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/sbin/devmatch/devmatch.c b/sbin/devmatch/devmatch.c
index c1ed11f6e41f..fbb05222fa5e 100644
--- a/sbin/devmatch/devmatch.c
+++ b/sbin/devmatch/devmatch.c
@@ -313,6 +313,13 @@ search_hints(const char *bus, const char *dev, const char *pnpinfo)
 						}
 						if (bit >= 0 && ((1 << bit) & mask) == 0)
 							break;
+						if (strcmp(cp + 2, "#") == 0) {
+							if (verbose_flag) {
+								printf("Ignoring %s (%c) table=%#x tomatch=%#x\n",
+								    cp + 2, *cp, v, ival);
+							}
+							break;
+						}
 						v = pnpval_as_int(cp + 2, pnpinfo);
 						if (verbose_flag)
 							printf("Matching %s (%c) table=%#x tomatch=%#x\n",
@@ -351,6 +358,13 @@ search_hints(const char *bus, const char *dev, const char *pnpinfo)
 							break;
 						if (bit >= 0 && ((1 << bit) & mask) == 0)
 							break;
+						if (strcmp(cp + 2, "#") == 0) {
+							if (verbose_flag) {
+								printf("Ignoring %s (%c) table=%#x tomatch=%#x\n",
+								    cp + 2, *cp, v, ival);
+							}
+							break;
+						}
 						s = pnpval_as_str(cp + 2, pnpinfo);
 						if (verbose_flag)
 							printf("Matching %s (%c) table=%s tomatch=%s\n",


More information about the dev-commits-src-main mailing list