summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkrw <krw@openbsd.org>2020-07-11 19:28:07 +0000
committerkrw <krw@openbsd.org>2020-07-11 19:28:07 +0000
commite2c68df5335b1df70893f8a092974f73388aa24d (patch)
tree349781458c89da85a03168a43d6259ea3e06c18d
parentSet the default ABI for OpenBSD to ELFv2 in the clang frontend as well. (diff)
downloadwireguard-openbsd-e2c68df5335b1df70893f8a092974f73388aa24d.tar.xz
wireguard-openbsd-e2c68df5335b1df70893f8a092974f73388aa24d.zip
Cache a pointer to the scsibus_softc rather than hoping the copy in
sc->sc_link is preserved by the nefarious forces outside of the adapter code.
-rw-r--r--sys/dev/ic/ami.c7
-rw-r--r--sys/dev/ic/amivar.h3
2 files changed, 6 insertions, 4 deletions
diff --git a/sys/dev/ic/ami.c b/sys/dev/ic/ami.c
index 23b2b5afe92..2572f21f2aa 100644
--- a/sys/dev/ic/ami.c
+++ b/sys/dev/ic/ami.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ami.c,v 1.246 2020/07/11 15:26:15 krw Exp $ */
+/* $OpenBSD: ami.c,v 1.247 2020/07/11 19:28:07 krw Exp $ */
/*
* Copyright (c) 2001 Michael Shalayeff
@@ -544,7 +544,8 @@ ami_attach(struct ami_softc *sc)
saa.saa_sc_link = &sc->sc_link;
- config_found(&sc->sc_dev, &saa, scsiprint);
+ sc->sc_scsibus = (struct scsibus_softc *)config_found(&sc->sc_dev, &saa,
+ scsiprint);
/* can't do bioctls, sensors, or pass-through on broken devices */
if (sc->sc_flags & AMI_BROKEN)
@@ -2390,7 +2391,7 @@ ami_create_sensors(struct ami_softc *sc)
/* check if this is the scsibus for the logical disks */
ssc = (struct scsibus_softc *)dev;
- if (ssc->adapter_link == &sc->sc_link)
+ if (ssc == sc->sc_scsibus)
break;
}
diff --git a/sys/dev/ic/amivar.h b/sys/dev/ic/amivar.h
index 21cafc33392..c2929967e59 100644
--- a/sys/dev/ic/amivar.h
+++ b/sys/dev/ic/amivar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: amivar.h,v 1.58 2010/06/23 04:53:53 dlg Exp $ */
+/* $OpenBSD: amivar.h,v 1.59 2020/07/11 19:28:07 krw Exp $ */
/*
* Copyright (c) 2001 Michael Shalayeff
@@ -87,6 +87,7 @@ struct ami_softc {
struct device sc_dev;
void *sc_ih;
struct scsi_link sc_link;
+ struct scsibus_softc *sc_scsibus;
int sc_flags;
#define AMI_CHECK_SIGN 0x0001