diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2010-03-23 01:57:21 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2010-03-23 01:57:21 +0000 |
commit | cd948c1fd3a45bb8ee18483b4f8df6ce849f8140 (patch) | |
tree | 2748525ad92550d0ad2b46b5619c24e5bcda0e13 /sys/scsi | |
parent | e88d321d148e115dbbf6fea61f7c0dcb67021421 (diff) |
Change the scsi_cmd function member of scsi_adapter from int to
void. Use XS_NO_CCB error in the scsi command (xs) to report the
NO_CCB condition. Eliminates all SUCCESSFULLY_QUEUED and COMPLETE
confusion and untangles the midlayer from the adapter a bit more.
Eyes and some fixes by miod@
There may be some compile issues on little used (i.e. I don't have
any) drivers but the change is mechanical and thus easy to remedy.
ok dlg@
Diffstat (limited to 'sys/scsi')
-rw-r--r-- | sys/scsi/mpath.c | 12 | ||||
-rw-r--r-- | sys/scsi/scsi_base.c | 25 | ||||
-rw-r--r-- | sys/scsi/scsiconf.h | 11 |
3 files changed, 11 insertions, 37 deletions
diff --git a/sys/scsi/mpath.c b/sys/scsi/mpath.c index 25b796760dd..98c058cbf8b 100644 --- a/sys/scsi/mpath.c +++ b/sys/scsi/mpath.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mpath.c,v 1.12 2010/01/03 01:36:40 dlg Exp $ */ +/* $OpenBSD: mpath.c,v 1.13 2010/03/23 01:57:20 krw Exp $ */ /* * Copyright (c) 2009 David Gwynne <dlg@openbsd.org> @@ -74,7 +74,7 @@ struct cfdriver mpath_cd = { DV_DULL }; -int mpath_cmd(struct scsi_xfer *); +void mpath_cmd(struct scsi_xfer *); void mpath_minphys(struct buf *, struct scsi_link *); int mpath_probe(struct scsi_link *); @@ -147,7 +147,7 @@ mpath_probe(struct scsi_link *link) return (0); } -int +void mpath_cmd(struct scsi_xfer *xs) { struct scsi_link *link = xs->sc_link; @@ -157,13 +157,13 @@ mpath_cmd(struct scsi_xfer *xs) if (n == NULL || p == NULL) { mpath_xs_stuffup(xs); - return (COMPLETE); + return; } mxs = scsi_xs_get(p->path_link, xs->flags); if (mxs == NULL) { mpath_xs_stuffup(xs); - return (COMPLETE); + return; } memcpy(mxs->cmd, xs->cmd, xs->cmdlen); @@ -178,8 +178,6 @@ mpath_cmd(struct scsi_xfer *xs) mxs->done = mpath_done; scsi_xs_exec(mxs); - - return (COMPLETE); /* doesnt matter anymore */ } void diff --git a/sys/scsi/scsi_base.c b/sys/scsi/scsi_base.c index 75a9a07ce00..b42febf6b21 100644 --- a/sys/scsi/scsi_base.c +++ b/sys/scsi/scsi_base.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scsi_base.c,v 1.166 2010/01/15 06:27:12 krw Exp $ */ +/* $OpenBSD: scsi_base.c,v 1.167 2010/03/23 01:57:20 krw Exp $ */ /* $NetBSD: scsi_base.c,v 1.43 1997/04/02 02:29:36 mycroft Exp $ */ /* @@ -718,8 +718,6 @@ scsi_report_luns(struct scsi_link *sc_link, int selectreport, void scsi_xs_exec(struct scsi_xfer *xs) { - int s; - xs->error = XS_NOERROR; xs->resid = xs->datalen; xs->status = 0; @@ -730,25 +728,10 @@ scsi_xs_exec(struct scsi_xfer *xs) if (xs->datalen && (xs->flags & SCSI_DATA_OUT)) scsi_show_mem(xs->data, min(64, xs->datalen)); } -#endif /* SCSIDEBUG */ - - /* - * scsi_xs_exec() guarantees that scsi_done() will be called on the xs - * it was given. The adapter is responsible for calling scsi_done() - * except if its scsi_cmd() routine returns NO_CCB. - * In those cases we must call scsi_done() for it. - */ - - if (xs->sc_link->adapter->scsi_cmd(xs) == NO_CCB) { - /* - * Give the xs back to the device driver to retry on its own. - */ +#endif - xs->error = XS_NO_CCB; - s = splbio(); - scsi_done(xs); - splx(s); - } + /* The adapter's scsi_cmd() is responsible for callng scsi_done(). */ + xs->sc_link->adapter->scsi_cmd(xs); } /* diff --git a/sys/scsi/scsiconf.h b/sys/scsi/scsiconf.h index c53467c9818..7a9a9b05f1d 100644 --- a/sys/scsi/scsiconf.h +++ b/sys/scsi/scsiconf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: scsiconf.h,v 1.119 2010/01/15 05:50:31 krw Exp $ */ +/* $OpenBSD: scsiconf.h,v 1.120 2010/03/23 01:57:20 krw Exp $ */ /* $NetBSD: scsiconf.h,v 1.35 1997/04/02 02:29:38 mycroft Exp $ */ /* @@ -304,7 +304,7 @@ extern int scsi_autoconf; * of these statically allocated. */ struct scsi_adapter { - int (*scsi_cmd)(struct scsi_xfer *); + void (*scsi_cmd)(struct scsi_xfer *); void (*scsi_minphys)(struct buf *, struct scsi_link *); int (*dev_probe)(struct scsi_link *); void (*dev_free)(struct scsi_link *); @@ -313,13 +313,6 @@ struct scsi_adapter { }; /* - * return values for scsi_cmd() - */ -#define SUCCESSFULLY_QUEUED 0 -#define COMPLETE 2 -#define NO_CCB 4 - -/* * These entry points are called by the low-end drivers to get services from * whatever high-end drivers they are attached to. Each device type has one * of these statically allocated. |