From: kettenis Date: Mon, 26 Jul 2010 17:46:29 +0000 (+0000) Subject: Some machines include VID devices for hardware that doesn't exist. Avoid X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=43d0b534624ea591377a06fb9da9a1b79d01abcf;p=openbsd Some machines include VID devices for hardware that doesn't exist. Avoid attaching those devices by checking whether the PCI bus on which they are supposed to sit exists. Fixes issues with brightness controls on my Dell laptop. ok marco@, pirofti@ --- diff --git a/sys/dev/acpi/acpivideo.c b/sys/dev/acpi/acpivideo.c index a74ee0f85ff..b101a2eb272 100644 --- a/sys/dev/acpi/acpivideo.c +++ b/sys/dev/acpi/acpivideo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpivideo.c,v 1.5 2009/06/04 17:16:00 pirofti Exp $ */ +/* $OpenBSD: acpivideo.c,v 1.6 2010/07/26 17:46:29 kettenis Exp $ */ /* * Copyright (c) 2008 Federico G. Schwindt * Copyright (c) 2009 Paul Irofti @@ -58,6 +58,8 @@ void acpivideo_get_dod(struct acpivideo_softc *); int acpi_foundvout(struct aml_node *, void *); int acpivideo_print(void *, const char *); +int acpivideo_getpcibus(struct acpivideo_softc *, struct aml_node *); + struct cfattach acpivideo_ca = { sizeof(struct acpivideo_softc), acpivideo_match, acpivideo_attach }; @@ -90,6 +92,9 @@ acpivideo_attach(struct device *parent, struct device *self, void *aux) printf(": %s\n", sc->sc_devnode->name); + if (acpivideo_getpcibus(sc, sc->sc_devnode) == -1) + return; + aml_register_notify(sc->sc_devnode, aaa->aaa_dev, acpivideo_notify, sc, ACPIDEV_NOPOLL); @@ -230,3 +235,11 @@ acpivideo_get_dod(struct acpivideo_softc * sc) aml_freevalue(&res); } + +int +acpivideo_getpcibus(struct acpivideo_softc *sc, struct aml_node *node) +{ + /* Check if parent device has PCI mapping */ + return (node->parent && node->parent->pci) ? + node->parent->pci->sub : -1; +}