git: 721d3e7e9a7d - main - mrsas: purge EOL release compatibility

From: Warner Losh <imp_at_FreeBSD.org>
Date: Sat, 04 Feb 2023 16:20:12 UTC
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=721d3e7e9a7d6a099361d88e8d47697f07c4c2b6

commit 721d3e7e9a7d6a099361d88e8d47697f07c4c2b6
Author:     Elliott Mitchell <ehem+freebsd@m5p.com>
AuthorDate: 2022-06-23 00:53:47 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2023-02-04 16:10:36 +0000

    mrsas: purge EOL release compatibility
    
    Remove FreeBSD 7, 8, 9 and 10 compatibility code.
    
    Reviewed by: imp
    Pull Request: https://github.com/freebsd/freebsd-src/pull/603
    Differential Revision: https://reviews.freebsd.org/D35560
---
 sys/dev/mrsas/mrsas.h       | 12 ------------
 sys/dev/mrsas/mrsas_cam.c   | 48 +--------------------------------------------
 sys/dev/mrsas/mrsas_ioctl.h |  3 ---
 sys/dev/mrsas/mrsas_linux.c | 14 -------------
 4 files changed, 1 insertion(+), 76 deletions(-)

diff --git a/sys/dev/mrsas/mrsas.h b/sys/dev/mrsas/mrsas.h
index 069db02fadff..408018f2f5ce 100644
--- a/sys/dev/mrsas/mrsas.h
+++ b/sys/dev/mrsas/mrsas.h
@@ -138,12 +138,6 @@ __FBSDID("$FreeBSD$");
 /*
  * Boolean types
  */
-#if (__FreeBSD_version < 901000)
-typedef enum _boolean {
-	false, true
-}	boolean;
-
-#endif
 enum err {
 	SUCCESS, FAIL
 };
@@ -3632,15 +3626,9 @@ struct mrsas_softc {
 };
 
 /* Compatibility shims for different OS versions */
-#if __FreeBSD_version >= 800001
 #define	mrsas_kproc_create(func, farg, proc_ptr, flags, stackpgs, fmtstr, arg) \
     kproc_create(func, farg, proc_ptr, flags, stackpgs, fmtstr, arg)
 #define	mrsas_kproc_exit(arg)   kproc_exit(arg)
-#else
-#define	mrsas_kproc_create(func, farg, proc_ptr, flags, stackpgs, fmtstr, arg) \
-    kthread_create(func, farg, proc_ptr, flags, stackpgs, fmtstr, arg)
-#define	mrsas_kproc_exit(arg)   kthread_exit(arg)
-#endif
 
 static __inline void
 mrsas_clear_bit(int b, volatile void *p)
diff --git a/sys/dev/mrsas/mrsas_cam.c b/sys/dev/mrsas/mrsas_cam.c
index 3ac37bc13a3c..9ad97d2ce3e2 100644
--- a/sys/dev/mrsas/mrsas_cam.c
+++ b/sys/dev/mrsas/mrsas_cam.c
@@ -222,12 +222,6 @@ mrsas_cam_attach(struct mrsas_softc *sc)
 	}
 	mtx_unlock(&sc->sim_lock);
 
-#if (__FreeBSD_version <= 704000)
-	if (mrsas_bus_scan(sc)) {
-		device_printf(sc->mrsas_dev, "Error in bus scan.\n");
-		return (1);
-	}
-#endif
 	return (0);
 }
 
@@ -346,11 +340,7 @@ mrsas_action(struct cam_sim *sim, union ccb *ccb)
 			ccb->cpi.version_num = 1;
 			ccb->cpi.hba_inquiry = 0;
 			ccb->cpi.target_sprt = 0;
-#if (__FreeBSD_version >= 902001)
 			ccb->cpi.hba_misc = PIM_UNMAPPED;
-#else
-			ccb->cpi.hba_misc = 0;
-#endif
 			ccb->cpi.hba_eng_cnt = 0;
 			ccb->cpi.max_lun = MRSAS_SCSI_MAX_LUNS;
 			ccb->cpi.unit_number = cam_sim_unit(sim);
@@ -368,9 +358,7 @@ mrsas_action(struct cam_sim *sim, union ccb *ccb)
 				ccb->cpi.max_target = MRSAS_MAX_PD - 1;
 			else
 				ccb->cpi.max_target = MRSAS_MAX_LD_IDS - 1;
-#if (__FreeBSD_version > 704000)
 			ccb->cpi.maxio = sc->max_sectors_per_req * 512;
-#endif
 			ccb->ccb_h.status = CAM_REQ_CMP;
 			xpt_done(ccb);
 			break;
@@ -418,13 +406,8 @@ mrsas_scsiio_timeout(void *data)
 	 * on OCR enable/disable property of Controller from ocr_thread
 	 * context.
 	 */
-#if (__FreeBSD_version >= 1000510)
 	callout_reset_sbt(&cmd->cm_callout, SBT_1S * 180, 0,
 	    mrsas_scsiio_timeout, cmd, 0);
-#else
-	callout_reset(&cmd->cm_callout, (180000 * hz) / 1000,
-	    mrsas_scsiio_timeout, cmd);
-#endif
 
 	if (cmd->ccb_ptr->cpi.bus_id == 0)
 		target_id = cmd->ccb_ptr->ccb_h.target_id;
@@ -492,8 +475,6 @@ mrsas_startio(struct mrsas_softc *sc, struct cam_sim *sim,
 	} else
 		cmd->flags = MRSAS_DIR_NONE;	/* no data */
 
-/* For FreeBSD 9.2 and higher */
-#if (__FreeBSD_version >= 902001)
 	/*
 	 * XXX We don't yet support physical addresses here.
 	 */
@@ -526,24 +507,7 @@ mrsas_startio(struct mrsas_softc *sc, struct cam_sim *sim,
 		ccb->ccb_h.status = CAM_REQ_INVALID;
 		goto done;
 	}
-#else
-	if (!(ccb_h->flags & CAM_DATA_PHYS)) {	/* Virtual data address */
-		if (!(ccb_h->flags & CAM_SCATTER_VALID)) {
-			cmd->length = csio->dxfer_len;
-			if (cmd->length)
-				cmd->data = csio->data_ptr;
-		} else {
-			mrsas_release_mpt_cmd(cmd);
-			ccb_h->status = CAM_REQ_INVALID;
-			goto done;
-		}
-	} else {			/* Data addresses are physical. */
-		mrsas_release_mpt_cmd(cmd);
-		ccb_h->status = CAM_REQ_INVALID;
-		ccb_h->status &= ~CAM_SIM_QUEUED;
-		goto done;
-	}
-#endif
+
 	/* save ccb ptr */
 	cmd->ccb_ptr = ccb;
 
@@ -624,13 +588,8 @@ mrsas_startio(struct mrsas_softc *sc, struct cam_sim *sim,
 	 * Start timer for IO timeout. Default timeout value is 90 second.
 	 */
 	cmd->callout_owner = true;
-#if (__FreeBSD_version >= 1000510)
 	callout_reset_sbt(&cmd->cm_callout, SBT_1S * 180, 0,
 	    mrsas_scsiio_timeout, cmd, 0);
-#else
-	callout_reset(&cmd->cm_callout, (180000 * hz) / 1000,
-	    mrsas_scsiio_timeout, cmd);
-#endif
 
 	if (mrsas_atomic_read(&sc->fw_outstanding) > sc->io_cmds_highwater)
 		sc->io_cmds_highwater++;
@@ -1435,13 +1394,8 @@ mrsas_map_request(struct mrsas_softc *sc,
 	if (cmd->data != NULL) {
 		/* Map data buffer into bus space */
 		mtx_lock(&sc->io_lock);
-#if (__FreeBSD_version >= 902001)
 		retcode = bus_dmamap_load_ccb(sc->data_tag, cmd->data_dmamap, ccb,
 		    mrsas_data_load_cb, cmd, 0);
-#else
-		retcode = bus_dmamap_load(sc->data_tag, cmd->data_dmamap, cmd->data,
-		    cmd->length, mrsas_data_load_cb, cmd, BUS_DMA_NOWAIT);
-#endif
 		mtx_unlock(&sc->io_lock);
 		if (retcode)
 			device_printf(sc->mrsas_dev, "bus_dmamap_load(): retcode = %d\n", retcode);
diff --git a/sys/dev/mrsas/mrsas_ioctl.h b/sys/dev/mrsas/mrsas_ioctl.h
index adba0d52951a..07ee211714cc 100644
--- a/sys/dev/mrsas/mrsas_ioctl.h
+++ b/sys/dev/mrsas/mrsas_ioctl.h
@@ -49,9 +49,6 @@ __FBSDID("$FreeBSD$");
 
 #ifdef COMPAT_FREEBSD32
 /* Compilation error FIX */
-#if (__FreeBSD_version <= 900000)
-#include <sys/socket.h>
-#endif
 #include <sys/mount.h>
 #include <compat/freebsd32/freebsd32.h>
 #endif
diff --git a/sys/dev/mrsas/mrsas_linux.c b/sys/dev/mrsas/mrsas_linux.c
index 11ce3c3f8d54..1b5739652d5d 100644
--- a/sys/dev/mrsas/mrsas_linux.c
+++ b/sys/dev/mrsas/mrsas_linux.c
@@ -43,11 +43,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/param.h>
 #include <sys/systm.h>
 
-#if (__FreeBSD_version >= 1001511)
 #include <sys/capsicum.h>
-#elif (__FreeBSD_version > 900000)
-#include <sys/capability.h>
-#endif
 
 #include <sys/conf.h>
 #include <sys/kernel.h>
@@ -108,10 +104,7 @@ mrsas_linux_modevent(module_t mod __unused, int cmd __unused, void *data __unuse
 static int
 mrsas_linux_ioctl(struct thread *p, struct linux_ioctl_args *args)
 {
-#if (__FreeBSD_version >= 1000000)
 	cap_rights_t rights;
-
-#endif
 	struct file *fp;
 	int error;
 	u_long cmd = args->cmd;
@@ -120,14 +113,7 @@ mrsas_linux_ioctl(struct thread *p, struct linux_ioctl_args *args)
 		error = ENOTSUP;
 		goto END;
 	}
-#if (__FreeBSD_version >= 1000000)
 	error = fget(p, args->fd, cap_rights_init_one(&rights, CAP_IOCTL), &fp);
-#elif (__FreeBSD_version <= 900000)
-	error = fget(p, args->fd, &fp);
-#else					/* For FreeBSD version greater than
-					 * 9.0.0 but less than 10.0.0 */
-	error = fget(p, args->fd, CAP_IOCTL, &fp);
-#endif
 	if (error != 0)
 		goto END;