diff options
author | Paul Irofti <pirofti@cvs.openbsd.org> | 2010-07-02 01:07:21 +0000 |
---|---|---|
committer | Paul Irofti <pirofti@cvs.openbsd.org> | 2010-07-02 01:07:21 +0000 |
commit | 2e7ca0c732bb65a442c5b740eeba702daf45c2a6 (patch) | |
tree | aba4267eeb8ef2ec67477ff5defd3a88dca5e97d /sys/dev/pci/puc.c | |
parent | 3af3fca013144ea87b0c90a775ed88ceeb27e805 (diff) |
Abstraction clean-up. `I like it' deraadt@.
Diffstat (limited to 'sys/dev/pci/puc.c')
-rw-r--r-- | sys/dev/pci/puc.c | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/sys/dev/pci/puc.c b/sys/dev/pci/puc.c index ad37194ceb8..b117a4e4f50 100644 --- a/sys/dev/pci/puc.c +++ b/sys/dev/pci/puc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: puc.c,v 1.14 2009/03/03 16:52:25 deraadt Exp $ */ +/* $OpenBSD: puc.c,v 1.15 2010/07/02 01:07:20 pirofti Exp $ */ /* $NetBSD: puc.c,v 1.3 1999/02/06 06:29:54 cgd Exp $ */ /* @@ -349,22 +349,13 @@ puc_find_description(u_int16_t vend, u_int16_t prod, { int i; -#define checkreg(val, index) \ - (((val) & puc_devices[i].rmask[(index)]) == puc_devices[i].rval[(index)]) -#define pucdevdone(idx) \ - (puc_devices[idx].rval[0] == 0 && puc_devices[idx].rval[1] == 0 \ - && puc_devices[idx].rval[2] == 0 && puc_devices[idx].rval[3] == 0) - - for (i = 0; !pucdevdone(i); i++) { - if (checkreg(vend, PUC_REG_VEND) && - checkreg(prod, PUC_REG_PROD) && - checkreg(svend, PUC_REG_SVEND) && - checkreg(sprod, PUC_REG_SPROD)) - return (&puc_devices[i]); - } - -#undef devdone -#undef checkreg + for (i = 0; puc_devs[i].rval[0] && puc_devs[i].rval[1] && + puc_devs[i].rval[2] && puc_devs[i].rval[3]; i++) + if ((vend & puc_devs[i].rmask[0]) == puc_devs[i].rval[0] && + (prod & puc_devs[i].rmask[1]) == puc_devs[i].rval[1] && + (svend & puc_devs[i].rmask[2]) == puc_devs[i].rval[2] && + (sprod & puc_devs[i].rmask[3]) == puc_devs[i].rval[3]) + return (&puc_devs[i]); return (NULL); } |