git: 98470f0e0bc7 - main - Fix "set but not used" in mrsas. This includes removing unnecessary cdevsw methods.

From: Scott Long <scottl_at_FreeBSD.org>
Date: Sat, 04 Dec 2021 07:09:08 UTC
The branch main has been updated by scottl:

URL: https://cgit.FreeBSD.org/src/commit/?id=98470f0e0bc72d5e6a9aaeff42ed72f92972365d

commit 98470f0e0bc72d5e6a9aaeff42ed72f92972365d
Author:     Scott Long <scottl@FreeBSD.org>
AuthorDate: 2021-12-04 07:08:27 +0000
Commit:     Scott Long <scottl@FreeBSD.org>
CommitDate: 2021-12-04 07:08:27 +0000

    Fix "set but not used" in mrsas.  This includes removing unnecessary cdevsw
    methods.
    
    Sponsored by: Rubicon Communications, LLC ("Netgate")
---
 sys/dev/mrsas/mrsas.c     | 43 +++++--------------------------------------
 sys/dev/mrsas/mrsas_cam.c |  6 ------
 2 files changed, 5 insertions(+), 44 deletions(-)

diff --git a/sys/dev/mrsas/mrsas.c b/sys/dev/mrsas/mrsas.c
index 8814642fccd0..c032959fcc86 100644
--- a/sys/dev/mrsas/mrsas.c
+++ b/sys/dev/mrsas/mrsas.c
@@ -59,8 +59,6 @@ __FBSDID("$FreeBSD$");
  */
 static d_open_t mrsas_open;
 static d_close_t mrsas_close;
-static d_read_t mrsas_read;
-static d_write_t mrsas_write;
 static d_ioctl_t mrsas_ioctl;
 static d_poll_t mrsas_poll;
 
@@ -225,8 +223,6 @@ static struct cdevsw mrsas_cdevsw = {
 	.d_version = D_VERSION,
 	.d_open = mrsas_open,
 	.d_close = mrsas_close,
-	.d_read = mrsas_read,
-	.d_write = mrsas_write,
 	.d_ioctl = mrsas_ioctl,
 	.d_poll = mrsas_poll,
 	.d_name = "mrsas",
@@ -234,43 +230,17 @@ static struct cdevsw mrsas_cdevsw = {
 
 MALLOC_DEFINE(M_MRSAS, "mrsasbuf", "Buffers for the MRSAS driver");
 
-/*
- * In the cdevsw routines, we find our softc by using the si_drv1 member of
- * struct cdev.  We set this variable to point to our softc in our attach
- * routine when we create the /dev entry.
- */
 int
 mrsas_open(struct cdev *dev, int oflags, int devtype, struct thread *td)
 {
-	struct mrsas_softc *sc;
 
-	sc = dev->si_drv1;
 	return (0);
 }
 
 int
 mrsas_close(struct cdev *dev, int fflag, int devtype, struct thread *td)
 {
-	struct mrsas_softc *sc;
 
-	sc = dev->si_drv1;
-	return (0);
-}
-
-int
-mrsas_read(struct cdev *dev, struct uio *uio, int ioflag)
-{
-	struct mrsas_softc *sc;
-
-	sc = dev->si_drv1;
-	return (0);
-}
-int
-mrsas_write(struct cdev *dev, struct uio *uio, int ioflag)
-{
-	struct mrsas_softc *sc;
-
-	sc = dev->si_drv1;
 	return (0);
 }
 
@@ -321,26 +291,24 @@ void
 mrsas_disable_intr(struct mrsas_softc *sc)
 {
 	u_int32_t mask = 0xFFFFFFFF;
-	u_int32_t status;
 
 	sc->mask_interrupts = 1;
 	mrsas_write_reg(sc, offsetof(mrsas_reg_set, outbound_intr_mask), mask);
 	/* Dummy read to force pci flush */
-	status = mrsas_read_reg(sc, offsetof(mrsas_reg_set, outbound_intr_mask));
+	(void)mrsas_read_reg(sc, offsetof(mrsas_reg_set, outbound_intr_mask));
 }
 
 void
 mrsas_enable_intr(struct mrsas_softc *sc)
 {
 	u_int32_t mask = MFI_FUSION_ENABLE_INTERRUPT_MASK;
-	u_int32_t status;
 
 	sc->mask_interrupts = 0;
 	mrsas_write_reg(sc, offsetof(mrsas_reg_set, outbound_intr_status), ~0);
-	status = mrsas_read_reg(sc, offsetof(mrsas_reg_set, outbound_intr_status));
+	(void)mrsas_read_reg(sc, offsetof(mrsas_reg_set, outbound_intr_status));
 
 	mrsas_write_reg(sc, offsetof(mrsas_reg_set, outbound_intr_mask), ~mask);
-	status = mrsas_read_reg(sc, offsetof(mrsas_reg_set, outbound_intr_mask));
+	(void)mrsas_read_reg(sc, offsetof(mrsas_reg_set, outbound_intr_mask));
 }
 
 static int
@@ -2975,7 +2943,7 @@ mrsas_transition_to_ready(struct mrsas_softc *sc, int ocr)
 	int i;
 	u_int8_t max_wait;
 	u_int32_t val, fw_state;
-	u_int32_t cur_state;
+	u_int32_t cur_state __unused;
 	u_int32_t abs_state, curr_abs_state;
 
 	val = mrsas_read_reg_with_retries(sc, offsetof(mrsas_reg_set, outbound_scratch_pad));
@@ -4407,7 +4375,7 @@ mrsas_sync_map_info(struct mrsas_softc *sc)
 	int retcode = 0, i;
 	struct mrsas_mfi_cmd *cmd;
 	struct mrsas_dcmd_frame *dcmd;
-	uint32_t size_sync_info, num_lds;
+	uint32_t num_lds;
 	MR_LD_TARGET_SYNC *target_map = NULL;
 	MR_DRV_RAID_MAP_ALL *map;
 	MR_LD_RAID *raid;
@@ -4423,7 +4391,6 @@ mrsas_sync_map_info(struct mrsas_softc *sc)
 	num_lds = map->raidMap.ldCount;
 
 	dcmd = &cmd->frame->dcmd;
-	size_sync_info = sizeof(MR_LD_TARGET_SYNC) * num_lds;
 	memset(dcmd->mbox.b, 0, MFI_MBOX_SIZE);
 
 	target_map = (MR_LD_TARGET_SYNC *) sc->raidmap_mem[(sc->map_id - 1) & 1];
diff --git a/sys/dev/mrsas/mrsas_cam.c b/sys/dev/mrsas/mrsas_cam.c
index 85dacdb9f306..2fc5049c7a0f 100644
--- a/sys/dev/mrsas/mrsas_cam.c
+++ b/sys/dev/mrsas/mrsas_cam.c
@@ -1188,7 +1188,6 @@ mrsas_build_ldio_nonrw(struct mrsas_softc *sc, struct mrsas_mpt_cmd *cmd,
 	u_int32_t device_id, ld;
 	MR_DRV_RAID_MAP_ALL *map_ptr;
 	MR_LD_RAID *raid;
-	RAID_CONTEXT *pRAID_Context;
 	MRSAS_RAID_SCSI_IO_REQUEST *io_request;
 
 	io_request = cmd->io_request;
@@ -1197,8 +1196,6 @@ mrsas_build_ldio_nonrw(struct mrsas_softc *sc, struct mrsas_mpt_cmd *cmd,
 	map_ptr = sc->ld_drv_map[(sc->map_id & 1)];
 	ld = MR_TargetIdToLdGet(device_id, map_ptr);
 	raid = MR_LdRaidGet(ld, map_ptr);
-	/* get RAID_Context pointer */
-	pRAID_Context = &io_request->RaidContext.raid_context;
 	/* Store the TM capability value in cmd */
 	cmd->tmCapable = raid->capability.tmCapable;
 
@@ -1248,12 +1245,9 @@ mrsas_build_syspdio(struct mrsas_softc *sc, struct mrsas_mpt_cmd *cmd,
 	u_int32_t device_id;
 	MR_DRV_RAID_MAP_ALL *local_map_ptr;
 	MRSAS_RAID_SCSI_IO_REQUEST *io_request;
-	RAID_CONTEXT *pRAID_Context;
 	struct MR_PD_CFG_SEQ_NUM_SYNC *pd_sync;
 
 	io_request = cmd->io_request;
-	/* get RAID_Context pointer */
-	pRAID_Context = &io_request->RaidContext.raid_context;
 	device_id = ccb_h->target_id;
 	local_map_ptr = sc->ld_drv_map[(sc->map_id & 1)];
 	io_request->RaidContext.raid_context.RAIDFlags = MR_RAID_FLAGS_IO_SUB_TYPE_SYSTEM_PD