diff options
author | Paul Irofti <pirofti@cvs.openbsd.org> | 2010-07-22 17:16:11 +0000 |
---|---|---|
committer | Paul Irofti <pirofti@cvs.openbsd.org> | 2010-07-22 17:16:11 +0000 |
commit | 9da6bad0821527e4f60fa49f5ad878b38f42d98b (patch) | |
tree | a5c9fdeeaa9cf7aebc97f4ef00a015f06510c75f /sys | |
parent | fe06463b6b590b8ac4b2a3b91562a89600962875 (diff) |
Clean the macros from puc(4). Now with correct logic.
Tested and okay sthen@.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/pci/puc.c | 25 | ||||
-rw-r--r-- | sys/dev/pci/pucdata.c | 4 | ||||
-rw-r--r-- | sys/dev/pci/pucvar.h | 9 |
3 files changed, 12 insertions, 26 deletions
diff --git a/sys/dev/pci/puc.c b/sys/dev/pci/puc.c index 09da445c1b8..9ec1af4d59d 100644 --- a/sys/dev/pci/puc.c +++ b/sys/dev/pci/puc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: puc.c,v 1.16 2010/07/07 21:32:50 sthen Exp $ */ +/* $OpenBSD: puc.c,v 1.17 2010/07/22 17:16:10 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] == 0 && puc_devs[i].rval[1] == 0 && + puc_devs[i].rval[2] == 0 && puc_devs[i].rval[3] == 0); 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); } diff --git a/sys/dev/pci/pucdata.c b/sys/dev/pci/pucdata.c index 0d9a2b470c2..f2b79db5d04 100644 --- a/sys/dev/pci/pucdata.c +++ b/sys/dev/pci/pucdata.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pucdata.c,v 1.71 2010/07/07 21:32:50 sthen Exp $ */ +/* $OpenBSD: pucdata.c,v 1.72 2010/07/22 17:16:10 pirofti Exp $ */ /* $NetBSD: pucdata.c,v 1.6 1999/07/03 05:55:23 cgd Exp $ */ /* @@ -46,7 +46,7 @@ #include <dev/pci/pcidevs.h> #include <dev/ic/comreg.h> -const struct puc_device_description puc_devices[] = { +const struct puc_device_description puc_devs[] = { /* * XXX no entry because I have no data: * XXX Dolphin Peripherals 4006 (single parallel) diff --git a/sys/dev/pci/pucvar.h b/sys/dev/pci/pucvar.h index 857e1eaa897..b2a5fa4b2a7 100644 --- a/sys/dev/pci/pucvar.h +++ b/sys/dev/pci/pucvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pucvar.h,v 1.9 2010/07/07 21:32:50 sthen Exp $ */ +/* $OpenBSD: pucvar.h,v 1.10 2010/07/22 17:16:10 pirofti Exp $ */ /* $NetBSD: pucvar.h,v 1.2 1999/02/06 06:29:54 cgd Exp $ */ /* @@ -51,11 +51,6 @@ struct puc_device_description { } ports[PUC_MAX_PORTS]; }; -#define PUC_REG_VEND 0 -#define PUC_REG_PROD 1 -#define PUC_REG_SVEND 2 -#define PUC_REG_SPROD 3 - #define PUC_PORT_TYPE_NONE 0 #define PUC_PORT_TYPE_COM 1 #define PUC_PORT_TYPE_LPT 2 @@ -85,7 +80,7 @@ struct puc_attach_args { void (*intr_disestablish)(struct puc_attach_args *, void *); }; -extern const struct puc_device_description puc_devices[]; +extern const struct puc_device_description puc_devs[]; #define PUC_NBARS 6 struct puc_softc { |