Adding each and every new acpi device driver to acpi_foundhid() is
gettingabit of the burden.  And it really isn't how our autoconf
framework is supposed to work for busses that can be enumerated.  All
the drivers already check for a matching _HID in their attach
function.  So we can just drop the checks in acpi_foundhid() and let
the drivers sort themselves out.

The checks for acpithinkpad(4), acpitoshiba(4) and acpiasus(4) remain
for now as they set a variable that prevents acpivideo(3) from
attaching.  I have some ideas for a better mechanism there as well.

The diff also adds code that prints a "not configured" line for
devices for which we don't attach a driver.  That may be a bit much as
there are tons of devices for which we will not have a driver.  But
I'm somewhat curious to see the results.  So I'd like to commit it and
remove it in the future if it causes too much dmesg pollution.

ok?


Index: acpi.c
===================================================================
RCS file: /cvs/src/sys/dev/acpi/acpi.c,v
retrieving revision 1.305
diff -u -p -r1.305 acpi.c
--- acpi.c      17 Jan 2016 09:04:18 -0000      1.305
+++ acpi.c      28 Mar 2016 17:06:49 -0000
@@ -1155,6 +1155,8 @@ acpi_print(void *aux, const char *pnp)
        if (pnp) {
                if (aa->aaa_name)
                        printf("%s at %s", aa->aaa_name, pnp);
+               else if (aa->aaa_dev)
+                       printf("\"%s\" at %s", aa->aaa_dev, pnp);
                else
                        return (QUIET);
        }
@@ -2778,37 +2780,16 @@ acpi_foundhid(struct aml_node *node, voi
        aaa.aaa_node = node->parent;
        aaa.aaa_dev = dev;
 
-       if (!strcmp(dev, ACPI_DEV_AC)) {
-               aaa.aaa_name = "acpiac";
-       } else if (!strcmp(dev, ACPI_DEV_CMB)) {
-               aaa.aaa_name = "acpibat";
-       } else if (!strcmp(dev, ACPI_DEV_LD) ||
-           !strcmp(dev, ACPI_DEV_PBD) ||
-           !strcmp(dev, ACPI_DEV_SBD)) {
-               aaa.aaa_name = "acpibtn";
-       } else if (!strcmp(dev, ACPI_DEV_ASUS) ||
+       if (!strcmp(dev, ACPI_DEV_ASUS) ||
            !strcmp(dev, ACPI_DEV_ASUS1)) {
-               aaa.aaa_name = "acpiasus";
                acpi_asus_enabled = 1;
        } else if (!strcmp(dev, ACPI_DEV_IBM) ||
            !strcmp(dev, ACPI_DEV_LENOVO)) {
-               aaa.aaa_name = "acpithinkpad";
                acpi_thinkpad_enabled = 1;
-       } else if (!strcmp(dev, ACPI_DEV_ASUSAIBOOSTER)) {
-               aaa.aaa_name = "aibs";
        } else if (!strcmp(dev, ACPI_DEV_TOSHIBA_LIBRETTO) ||
            !strcmp(dev, ACPI_DEV_TOSHIBA_DYNABOOK) ||
            !strcmp(dev, ACPI_DEV_TOSHIBA_SPA40)) {
-               aaa.aaa_name = "acpitoshiba";
                acpi_toshiba_enabled = 1;
-       } else if (!strcmp(dev, "80860F14") || !strcmp(dev, "PNP0FFF")) {
-               aaa.aaa_name = "sdhc";
-       } else if (!strcmp(dev, ACPI_DEV_DWIIC1) ||
-           !strcmp(dev, ACPI_DEV_DWIIC2) ||
-           !strcmp(dev, ACPI_DEV_DWIIC3) ||
-           !strcmp(dev, ACPI_DEV_DWIIC4) ||
-           !strcmp(dev, ACPI_DEV_DWIIC5)) {
-               aaa.aaa_name = "dwiic";
        }
 
 #ifndef SMALL_KERNEL
@@ -2822,8 +2803,7 @@ acpi_foundhid(struct aml_node *node, voi
        }
 #endif
 
-       if (aaa.aaa_name)
-               config_found(self, &aaa, acpi_print);
+       config_found(self, &aaa, acpi_print);
 
        return (0);
 }

Reply via email to