summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorkettenis <kettenis@openbsd.org>2010-07-26 17:46:29 +0000
committerkettenis <kettenis@openbsd.org>2010-07-26 17:46:29 +0000
commit43d0b534624ea591377a06fb9da9a1b79d01abcf (patch)
treeb3d3e4f9d028d3839458c91dfec30522baa82827 /sys
parentremove merge error which was commited (diff)
downloadwireguard-openbsd-43d0b534624ea591377a06fb9da9a1b79d01abcf.tar.xz
wireguard-openbsd-43d0b534624ea591377a06fb9da9a1b79d01abcf.zip
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@
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/acpi/acpivideo.c15
1 files changed, 14 insertions, 1 deletions
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 <fgsch@openbsd.org>
* Copyright (c) 2009 Paul Irofti <pirofti@openbsd.org>
@@ -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;
+}