summaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2020-06-20 16:06:06 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2020-06-20 16:06:06 +0000
commit2cf621e6d906df3d9039b7fe9c1c60f108aa92d7 (patch)
treed720f190fd302b9c58e3a822e35a3944ac933b36 /sys/dev/pci
parentf274ed296e97101fcc26b22e9fa760b4143a444a (diff)
Make FUNCTION()/UNIT() return valid major/minor device numbers rather
than always returning 0. bktr0..bktr15 should now 'work'. COVERITY 1452865 COVERITY 1452956 COVERITY 1453025 COVERITY 1453186 COVERITY 1453231 ian@'s bktr still works as well as it did before.
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/bktr/bktr_os.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/dev/pci/bktr/bktr_os.c b/sys/dev/pci/bktr/bktr_os.c
index 5dd4f27efba..9fc2e08f820 100644
--- a/sys/dev/pci/bktr/bktr_os.c
+++ b/sys/dev/pci/bktr/bktr_os.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bktr_os.c,v 1.32 2015/03/14 03:38:49 jsg Exp $ */
+/* $OpenBSD: bktr_os.c,v 1.33 2020/06/20 16:06:05 krw Exp $ */
/* $FreeBSD: src/sys/dev/bktr/bktr_os.c,v 1.20 2000/10/20 08:16:53 roger Exp $ */
/*
@@ -337,8 +337,9 @@ free_bktr_mem(bktr, dmap, kva)
#define TUNER_DEV 0x01
#define VBI_DEV 0x02
-#define UNIT(x) (minor((x) & 0x0f))
-#define FUNCTION(x) (minor((x >> 4) & 0x0f))
+#define UNIT(x) ((minor((x)) < 16) ? minor((x)) : ((minor((x)) - 16) / 2))
+#define FUNCTION(x) ((minor((x)) < 16) ? VIDEO_DEV : ((minor((x)) & 0x1) ? \
+ VBI_DEV : TUNER_DEV))
/*
*