fix.diff sketch for DF-4411 — stop mutating the static model tables: apply look-alike quirks to a per-instance copy in the softc. Authored against the read-only sys/ tree; never applied there. fix_status: not_testable (no ATK0100/ASUS010 firmware on the audit guest; see env.txt). --- a/sys/dev/acpica/acpi_asus/acpi_asus.c +++ b/sys/dev/acpica/acpi_asus/acpi_asus.c @@ -116,6 +116,8 @@ struct acpi_asus_softc { device_t dev; ACPI_HANDLE handle; ACPI_HANDLE lcdd_handle; + struct acpi_asus_model model_copy; /* per-instance; quirks land + * here, not in the tables */ struct acpi_asus_model *model; /* == &sc->model_copy */ @@ -620,8 +622,11 @@ */ for (model = acpi_asus_models; model->name != NULL; model++) { if (strncmp(Obj->String.Pointer, model->name, 3) == 0) { + /* quirk the private copy, never the shared entry */ good: + sc->model_copy = *model; + sc->model = &sc->model_copy; + model = sc->model; sbuf_printf(sb, "Asus %s Laptop Extras", Obj->String.Pointer); @@ -679,9 +684,9 @@ /* L2B is like L3C but has no lcd_get method */ else if (strncmp(model->name, "L3C", 3) == 0 && strncmp(Obj->String.Pointer, "L2B", 3) == 0) { - model->lcd_get = NULL; + sc->model_copy.lcd_get = NULL; goto good; } /* A3G is like M6R but with a different lcd_get method */ else if (strncmp(model->name, "M6R", 3) == 0 && strncmp(Obj->String.Pointer, "A3G", 3) == 0) { - model->lcd_get = "\_SB.PCI0.P0P1.VGA.LCDG"; + sc->model_copy.lcd_get = "\_SB.PCI0.P0P1.VGA.LCDG"; goto good; } /* M2N and W1N are like xxN with added WLED */ else if (strncmp(model->name, "xxN", 3) == 0 && (strncmp(Obj->String.Pointer, "M2N", 3) == 0 || strncmp(Obj->String.Pointer, "W1N", 3) == 0)) { - model->wled_set = "WLED"; + sc->model_copy.wled_set = "WLED"; goto good; } /* M5N and S5N are like xxN without MLED */ else if (strncmp(model->name, "xxN", 3) == 0 && (strncmp(Obj->String.Pointer, "M5N", 3) == 0 || strncmp(Obj->String.Pointer, "S5N", 3) == 0)) { - model->mled_set = NULL; + sc->model_copy.mled_set = NULL; goto good; } @@ -805,9 +810,10 @@ /* Handle notifies */ - if (sc->model->n_func == NULL) - sc->model->n_func = acpi_asus_notify; + if (sc->model->n_func == NULL) + sc->model->n_func = acpi_asus_notify; /* now hits the copy */ AcpiInstallNotifyHandler(sc->handle, ACPI_SYSTEM_NOTIFY, sc->model->n_func, dev); (Combine with the DF-4409 fix so detach removes the handler recorded at install time; Samsung/EeePC paths already point sc->model at their table entries — switch those to sc->model_copy as well for uniformity, and make the static tables const.)