summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormatthew <matthew@openbsd.org>2011-06-20 01:09:25 +0000
committermatthew <matthew@openbsd.org>2011-06-20 01:09:25 +0000
commite5ad99e7d8bdc8c0147451426ba3f3b5a552e3d2 (patch)
tree1343cfb3c9246e58fe0549bed37e6820d187991c
parentUnbreak (diff)
downloadwireguard-openbsd-e5ad99e7d8bdc8c0147451426ba3f3b5a552e3d2.tar.xz
wireguard-openbsd-e5ad99e7d8bdc8c0147451426ba3f3b5a552e3d2.zip
isa(4) is an indirect bus, which means that drivers that attach to it
need to provide an xxxprobe() method instead of an xxxmatch() method. The critical difference is xxxprobe() is given a device softc for the second argument, whereas a xxxmatch() is given the cfdata as the second argument. This commit fixes the handful of ISA device drivers that incorrectly cast the second argument to a "struct cfdata *" instead of a "struct device *". (Minor complication: unlike isa(4), isapnp(4) is a direct bus, and if_we.c used the same probe/match code for both; now separate we_probe and we_match methods are used as appropriate.) "makes sense to me" krw@; ok miod@
-rw-r--r--sys/dev/isa/if_lc_isa.c4
-rw-r--r--sys/dev/isa/if_we.c13
-rw-r--r--sys/dev/isa/radiotrack2.c4
-rw-r--r--sys/dev/isa/sf16fmr2.c4
-rw-r--r--sys/dev/isa/wdc_isa.c4
5 files changed, 19 insertions, 10 deletions
diff --git a/sys/dev/isa/if_lc_isa.c b/sys/dev/isa/if_lc_isa.c
index 4d36e3006bd..b2bcb2922f1 100644
--- a/sys/dev/isa/if_lc_isa.c
+++ b/sys/dev/isa/if_lc_isa.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_lc_isa.c,v 1.8 2009/08/10 22:08:04 deraadt Exp $ */
+/* $OpenBSD: if_lc_isa.c,v 1.9 2011/06/20 01:09:25 matthew Exp $ */
/* $NetBSD: if_lc_isa.c,v 1.10 2001/06/13 10:46:03 wiz Exp $ */
/*-
@@ -182,7 +182,7 @@ lemac_isa_probe(parent, match, aux)
void *aux;
{
struct isa_attach_args *ia = aux;
- struct cfdata *cf = match;
+ struct cfdata *cf = ((struct device *)match)->dv_cfdata;
struct lemac_softc sc;
snprintf(sc.sc_dv.dv_xname, sizeof sc.sc_dv.dv_xname, "%s%d",
diff --git a/sys/dev/isa/if_we.c b/sys/dev/isa/if_we.c
index 9cbd884daeb..5f115520ca5 100644
--- a/sys/dev/isa/if_we.c
+++ b/sys/dev/isa/if_we.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_we.c,v 1.20 2008/06/26 05:42:16 ray Exp $ */
+/* $OpenBSD: if_we.c,v 1.21 2011/06/20 01:09:25 matthew Exp $ */
/* $NetBSD: if_we.c,v 1.11 1998/07/05 06:49:14 jonathan Exp $ */
/*-
@@ -110,6 +110,7 @@ struct we_softc {
};
int we_probe(struct device *, void *, void *);
+int we_match(struct device *, void *, void *);
void we_attach(struct device *, struct device *, void *);
struct cfattach we_isa_ca = {
@@ -118,7 +119,7 @@ struct cfattach we_isa_ca = {
#if NWE_ISAPNP
struct cfattach we_isapnp_ca = {
- sizeof(struct we_softc), we_probe, we_attach
+ sizeof(struct we_softc), we_match, we_attach
};
#endif /* NWE_ISAPNP */
@@ -186,6 +187,14 @@ do { \
int
we_probe(struct device *parent, void *match, void *aux)
{
+ struct cfdata *cf = ((struct device *)match)->dv_cfdata;
+
+ return (we_match(parent, cf, aux));
+}
+
+int
+we_match(struct device *parent, void *match, void *aux)
+{
struct isa_attach_args *ia = aux;
struct cfdata *cf = match;
bus_space_tag_t asict, memt;
diff --git a/sys/dev/isa/radiotrack2.c b/sys/dev/isa/radiotrack2.c
index 0a78c8ee6d6..a742d071770 100644
--- a/sys/dev/isa/radiotrack2.c
+++ b/sys/dev/isa/radiotrack2.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: radiotrack2.c,v 1.3 2002/01/07 18:32:19 mickey Exp $ */
+/* $OpenBSD: radiotrack2.c,v 1.4 2011/06/20 01:09:25 matthew Exp $ */
/* $RuOBSD: radiotrack2.c,v 1.2 2001/10/18 16:51:36 pva Exp $ */
/*
@@ -127,7 +127,7 @@ rtii_probe(struct device *parent, void *match, void *aux)
struct isa_attach_args *ia = aux;
bus_space_tag_t iot = ia->ia_iot;
bus_space_handle_t ioh;
- struct cfdata *cf = match;
+ struct cfdata *cf = ((struct device *)match)->dv_cfdata;
int iosize = 1, iobase = ia->ia_iobase;
if (!RTII_BASE_VALID(iobase)) {
diff --git a/sys/dev/isa/sf16fmr2.c b/sys/dev/isa/sf16fmr2.c
index fedf70efffa..8a6df20e888 100644
--- a/sys/dev/isa/sf16fmr2.c
+++ b/sys/dev/isa/sf16fmr2.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sf16fmr2.c,v 1.6 2002/10/15 15:00:11 mickey Exp $ */
+/* $OpenBSD: sf16fmr2.c,v 1.7 2011/06/20 01:09:25 matthew Exp $ */
/* $RuOBSD: sf16fmr2.c,v 1.12 2001/10/18 16:51:36 pva Exp $ */
/*
@@ -140,7 +140,7 @@ sf2r_probe(struct device *parent, void *match, void *aux)
struct isa_attach_args *ia = aux;
bus_space_tag_t iot = ia->ia_iot;
bus_space_handle_t ioh;
- struct cfdata *cf = match;
+ struct cfdata *cf = ((struct device *)match)->dv_cfdata;
int iosize = 1, iobase = ia->ia_iobase;
if (!SF16FMR2_BASE_VALID(iobase)) {
diff --git a/sys/dev/isa/wdc_isa.c b/sys/dev/isa/wdc_isa.c
index 5c683da88c1..1cf488a954a 100644
--- a/sys/dev/isa/wdc_isa.c
+++ b/sys/dev/isa/wdc_isa.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wdc_isa.c,v 1.14 2011/05/09 22:33:54 matthew Exp $ */
+/* $OpenBSD: wdc_isa.c,v 1.15 2011/06/20 01:09:25 matthew Exp $ */
/* $NetBSD: wdc_isa.c,v 1.15 1999/05/19 14:41:25 bouyer Exp $ */
/*-
@@ -83,7 +83,7 @@ wdc_isa_probe(struct device *parent, void *match, void *aux)
{
struct channel_softc ch;
struct isa_attach_args *ia = aux;
- struct cfdata *cf = match;
+ struct cfdata *cf = ((struct device *)match)->dv_cfdata;
int result = 0;
bzero(&ch, sizeof ch);