summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2020-02-12 14:08:57 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2020-02-12 14:08:57 +0000
commit758e0bf6ad9d426618ee8dc337d2e53666f59022 (patch)
treed26045b1a382c10440a3ba8a806d6348ddebfc22 /sys
parent963f0b29ee8551233ffd0eb3c2b5f460d570e5ed (diff)
Bring a few stragglers into line with the idiom used by the other 40+
scsi drivers. i.e. eliminate the struct scsi_adapter member in the softc and rely on the pointer to a static scsi_adapter in the struct scsi_link member.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pv/hvs.c10
-rw-r--r--sys/dev/pv/vioblk.c13
-rw-r--r--sys/dev/pv/xbf.c13
-rw-r--r--sys/dev/sdmmc/sdmmc_scsi.c12
4 files changed, 22 insertions, 26 deletions
diff --git a/sys/dev/pv/hvs.c b/sys/dev/pv/hvs.c
index 3c6b16feedb..b9b6bc5b5d7 100644
--- a/sys/dev/pv/hvs.c
+++ b/sys/dev/pv/hvs.c
@@ -215,7 +215,6 @@ struct hvs_softc {
int sc_initiator;
struct scsi_iopool sc_iopool;
- struct scsi_adapter sc_switch;
struct scsi_link sc_link;
struct device *sc_scsibus;
struct task sc_probetask;
@@ -249,6 +248,10 @@ const struct cfattach hvs_ca = {
sizeof(struct hvs_softc), hvs_match, hvs_attach
};
+struct scsi_adapter hvs_switch = {
+ hvs_scsi_cmd, NULL, NULL, NULL, NULL
+};
+
int
hvs_match(struct device *parent, void *match, void *aux)
{
@@ -305,10 +308,7 @@ hvs_attach(struct device *parent, struct device *self, void *aux)
task_set(&sc->sc_probetask, hvs_scsi_probe, sc);
- sc->sc_switch.scsi_cmd = hvs_scsi_cmd;
- sc->sc_switch.dev_minphys = NULL;
-
- sc->sc_link.adapter = &sc->sc_switch;
+ sc->sc_link.adapter = &hvs_switch;
sc->sc_link.adapter_softc = self;
sc->sc_link.luns = sc->sc_flags & HVSF_SCSI ? 64 : 1;
sc->sc_link.adapter_buswidth = 2;
diff --git a/sys/dev/pv/vioblk.c b/sys/dev/pv/vioblk.c
index f2dcec31299..cda074a6ecb 100644
--- a/sys/dev/pv/vioblk.c
+++ b/sys/dev/pv/vioblk.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vioblk.c,v 1.15 2020/02/05 16:29:30 krw Exp $ */
+/* $OpenBSD: vioblk.c,v 1.16 2020/02/12 14:08:56 krw Exp $ */
/*
* Copyright (c) 2012 Stefan Fritsch.
@@ -109,7 +109,6 @@ struct vioblk_softc {
struct virtio_blk_req *sc_reqs;
bus_dma_segment_t sc_reqs_segs[1];
- struct scsi_adapter sc_switch;
struct scsi_link sc_link;
struct scsi_iopool sc_iopool;
struct mutex sc_vr_mtx;
@@ -153,6 +152,9 @@ struct cfdriver vioblk_cd = {
NULL, "vioblk", DV_DULL
};
+struct scsi_adapter vioblk_switch = {
+ vioblk_scsi_cmd, NULL, vioblk_dev_probe, vioblk_dev_free, NULL
+};
int vioblk_match(struct device *parent, void *match, void *aux)
{
@@ -226,11 +228,6 @@ vioblk_attach(struct device *parent, struct device *self, void *aux)
sc->sc_queued = 0;
- sc->sc_switch.scsi_cmd = vioblk_scsi_cmd;
- sc->sc_switch.dev_minphys = NULL;
- sc->sc_switch.dev_probe = vioblk_dev_probe;
- sc->sc_switch.dev_free = vioblk_dev_free;
-
SLIST_INIT(&sc->sc_freelist);
mtx_init(&sc->sc_vr_mtx, IPL_BIO);
scsi_iopool_init(&sc->sc_iopool, sc, vioblk_req_get, vioblk_req_put);
@@ -241,7 +238,7 @@ vioblk_attach(struct device *parent, struct device *self, void *aux)
goto err;
}
- sc->sc_link.adapter = &sc->sc_switch;
+ sc->sc_link.adapter = &vioblk_switch;
sc->sc_link.pool = &sc->sc_iopool;
sc->sc_link.adapter_softc = self;
sc->sc_link.adapter_buswidth = 2;
diff --git a/sys/dev/pv/xbf.c b/sys/dev/pv/xbf.c
index 0e737cde7a3..5ccf2023ca2 100644
--- a/sys/dev/pv/xbf.c
+++ b/sys/dev/pv/xbf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xbf.c,v 1.35 2020/02/05 16:29:30 krw Exp $ */
+/* $OpenBSD: xbf.c,v 1.36 2020/02/12 14:08:56 krw Exp $ */
/*
* Copyright (c) 2016, 2017 Mike Belopuhov
@@ -201,7 +201,6 @@ struct xbf_softc {
struct mutex sc_ccb_sqlck;
struct scsi_iopool sc_iopool;
- struct scsi_adapter sc_switch;
struct scsi_link sc_link;
struct device *sc_scsibus;
};
@@ -230,6 +229,10 @@ int xbf_poll_cmd(struct scsi_xfer *);
void xbf_complete_cmd(struct xbf_softc *, struct xbf_ccb_queue *, int);
int xbf_dev_probe(struct scsi_link *);
+struct scsi_adapter xbf_switch = {
+ xbf_scsi_cmd, NULL, xbf_dev_probe, NULL, NULL
+};
+
void xbf_scsi_inq(struct scsi_xfer *);
void xbf_scsi_inquiry(struct scsi_xfer *);
void xbf_scsi_capacity(struct scsi_xfer *);
@@ -298,11 +301,7 @@ xbf_attach(struct device *parent, struct device *self, void *aux)
goto error;
}
- sc->sc_switch.scsi_cmd = xbf_scsi_cmd;
- sc->sc_switch.dev_minphys = NULL;
- sc->sc_switch.dev_probe = xbf_dev_probe;
-
- sc->sc_link.adapter = &sc->sc_switch;
+ sc->sc_link.adapter = &xbf_switch;
sc->sc_link.adapter_softc = self;
sc->sc_link.adapter_buswidth = 2;
sc->sc_link.luns = 1;
diff --git a/sys/dev/sdmmc/sdmmc_scsi.c b/sys/dev/sdmmc/sdmmc_scsi.c
index 0ad8ec6ca08..702ae51cdae 100644
--- a/sys/dev/sdmmc/sdmmc_scsi.c
+++ b/sys/dev/sdmmc/sdmmc_scsi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sdmmc_scsi.c,v 1.44 2020/01/26 00:53:31 krw Exp $ */
+/* $OpenBSD: sdmmc_scsi.c,v 1.45 2020/02/12 14:08:56 krw Exp $ */
/*
* Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org>
@@ -68,7 +68,6 @@ struct sdmmc_ccb {
TAILQ_HEAD(sdmmc_ccb_list, sdmmc_ccb);
struct sdmmc_scsi_softc {
- struct scsi_adapter sc_adapter;
struct scsi_link sc_link;
struct device *sc_child;
struct sdmmc_scsi_target *sc_tgt;
@@ -94,6 +93,10 @@ void sdmmc_done_xs(struct sdmmc_ccb *);
void sdmmc_stimeout(void *);
void sdmmc_minphys(struct buf *, struct scsi_link *);
+struct scsi_adapter sdmmc_switch = {
+ sdmmc_scsi_cmd, sdmmc_minphys, NULL, NULL, NULL
+};
+
#ifdef SDMMC_DEBUG
#define DPRINTF(s) printf s
#else
@@ -134,15 +137,12 @@ sdmmc_scsi_attach(struct sdmmc_softc *sc)
sc->sc_scsibus = scbus;
- scbus->sc_adapter.scsi_cmd = sdmmc_scsi_cmd;
- scbus->sc_adapter.dev_minphys = sdmmc_minphys;
-
scbus->sc_link.adapter_target = SDMMC_SCSIID_HOST;
scbus->sc_link.adapter_buswidth = scbus->sc_ntargets;
scbus->sc_link.adapter_softc = sc;
scbus->sc_link.luns = 1;
scbus->sc_link.openings = 1;
- scbus->sc_link.adapter = &scbus->sc_adapter;
+ scbus->sc_link.adapter = &sdmmc_switch;
scbus->sc_link.pool = &scbus->sc_iopool;
bzero(&saa, sizeof(saa));