From 489fe0909a13eea7d2cc5811cc82deff775521c8 Mon Sep 17 00:00:00 2001 From: Sascha Wildner Date: Mon, 7 Jan 2013 21:54:01 +0100 Subject: [PATCH] kernel: Remove some unused variables in RAID and disk drivers. --- sys/dev/disk/aic7xxx/aic79xx.c | 4 ---- sys/dev/disk/aic7xxx/aic_osm_lib.c | 4 ---- sys/dev/disk/amd/amd.c | 9 +-------- sys/dev/disk/isp/isp.c | 5 +---- sys/dev/disk/ncr/ncr.c | 2 -- sys/dev/raid/amr/amr.c | 8 ++------ sys/dev/raid/ciss/ciss.c | 12 +----------- sys/dev/raid/mfi/mfi.c | 5 ----- sys/dev/raid/mfi/mfi_tbolt.c | 6 +----- sys/dev/raid/tws/tws.c | 2 -- sys/dev/raid/vinum/vinumconfig.c | 3 --- sys/dev/raid/vinum/vinumio.c | 9 +-------- sys/dev/raid/vinum/vinumrequest.c | 7 ------- sys/dev/raid/vinum/vinumrevive.c | 11 ----------- 14 files changed, 7 insertions(+), 80 deletions(-) diff --git a/sys/dev/disk/aic7xxx/aic79xx.c b/sys/dev/disk/aic7xxx/aic79xx.c index 7fc6c97599..51390ff69f 100644 --- a/sys/dev/disk/aic7xxx/aic79xx.c +++ b/sys/dev/disk/aic7xxx/aic79xx.c @@ -1045,7 +1045,6 @@ ahd_handle_seqint(struct ahd_softc *ahd, u_int intstat) struct scb *scb; struct ahd_initiator_tinfo *targ_info; struct ahd_tmode_tstate *tstate; - struct ahd_transinfo *tinfo; u_int scbid; /* @@ -1078,7 +1077,6 @@ ahd_handle_seqint(struct ahd_softc *ahd, u_int intstat) devinfo.our_scsiid, devinfo.target, &tstate); - tinfo = &targ_info->curr; ahd_set_width(ahd, &devinfo, MSG_EXT_WDTR_BUS_8_BIT, AHD_TRANS_ACTIVE, /*paused*/TRUE); ahd_set_syncrate(ahd, &devinfo, /*period*/0, @@ -2735,10 +2733,8 @@ ahd_dump_sglist(struct scb *scb) sg_list = (struct ahd_dma64_seg*)scb->sg_list; for (i = 0; i < scb->sg_count; i++) { uint64_t addr; - uint32_t len; addr = aic_le64toh(sg_list[i].addr); - len = aic_le32toh(sg_list[i].len); kprintf("sg[%d] - Addr 0x%x%x : Length %d%s\n", i, (uint32_t)((addr >> 32) & 0xFFFFFFFF), diff --git a/sys/dev/disk/aic7xxx/aic_osm_lib.c b/sys/dev/disk/aic7xxx/aic_osm_lib.c index e32a3138ed..a999967480 100644 --- a/sys/dev/disk/aic7xxx/aic_osm_lib.c +++ b/sys/dev/disk/aic7xxx/aic_osm_lib.c @@ -32,7 +32,6 @@ * $Id: //depot/aic7xxx/freebsd/dev/aic7xxx/aic_osm_lib.c#5 $ * * $FreeBSD: src/sys/dev/aic7xxx/aic_osm_lib.c,v 1.3 2004/08/17 00:14:31 gibbs Exp $ - * $DragonFly: src/sys/dev/disk/aic7xxx/aic_osm_lib.c,v 1.3 2008/02/09 18:13:13 pavalos Exp $ */ static void aic_recovery_thread(void *arg); @@ -54,9 +53,6 @@ aic_set_recoveryscb(struct aic_softc *aic, struct scb *scb) * them after we've successfully fixed this problem. */ LIST_FOREACH(list_scb, &aic->pending_scbs, pending_links) { - union ccb *ccb; - - ccb = list_scb->io_ctx; callout_stop(&scb->io_timer); } } diff --git a/sys/dev/disk/amd/amd.c b/sys/dev/disk/amd/amd.c index 495666c738..15f4895698 100644 --- a/sys/dev/disk/amd/amd.c +++ b/sys/dev/disk/amd/amd.c @@ -366,13 +366,12 @@ static void amd_action(struct cam_sim * psim, union ccb * pccb) { struct amd_softc * amd; - u_int target_id, target_lun; + u_int target_id; CAM_DEBUG(pccb->ccb_h.path, CAM_DEBUG_TRACE, ("amd_action\n")); amd = (struct amd_softc *) cam_sim_softc(psim); target_id = pccb->ccb_h.target_id; - target_lun = pccb->ccb_h.target_lun; switch (pccb->ccb_h.func_code) { case XPT_SCSI_IO: @@ -1199,7 +1198,6 @@ amd_MsgInPhase0(struct amd_softc *amd, struct amd_srb *pSRB, u_int scsistat) static int amdparsemsg(struct amd_softc *amd) { - struct amd_target_info *targ_info; int reject; int done; int response; @@ -1208,8 +1206,6 @@ amdparsemsg(struct amd_softc *amd) response = FALSE; reject = FALSE; - targ_info = &amd->tinfo[amd->cur_target]; - /* * Parse as much of the message as is availible, * rejecting it if we don't support it. When @@ -1863,12 +1859,9 @@ SRBdone(struct amd_softc *amd, struct amd_srb *pSRB) struct ccb_scsiio *pcsio; struct amd_sg *ptr2; u_int32_t swlval; - u_int target_id, target_lun; pccb = pSRB->pccb; pcsio = &pccb->csio; - target_id = pSRB->pccb->ccb_h.target_id; - target_lun = pSRB->pccb->ccb_h.target_lun; CAM_DEBUG(pccb->ccb_h.path, CAM_DEBUG_TRACE, ("SRBdone - TagNumber %d\n", pSRB->TagNumber)); diff --git a/sys/dev/disk/isp/isp.c b/sys/dev/disk/isp/isp.c index 301df07f1e..2c3ae50cc3 100644 --- a/sys/dev/disk/isp/isp.c +++ b/sys/dev/disk/isp/isp.c @@ -2090,7 +2090,7 @@ isp_plogx(ispsoftc_t *isp, int chan, uint16_t handle, uint32_t portid, int flags fcparam *fcp; uint8_t *scp; uint32_t sst, parm1; - int rval, lev; + int rval; const char *msg; char buf[64]; @@ -2164,7 +2164,6 @@ isp_plogx(ispsoftc_t *isp, int chan, uint16_t handle, uint32_t portid, int flags parm1 = plp->plogx_ioparm[1].lo16 | (plp->plogx_ioparm[1].hi16 << 16); rval = -1; - lev = ISP_LOGERR; msg = NULL; switch (sst) { @@ -2204,13 +2203,11 @@ isp_plogx(ispsoftc_t *isp, int chan, uint16_t handle, uint32_t portid, int flags msg = buf; break; case PLOGX_IOCBERR_PORTUSED: - lev = ISP_LOGSANCFG|ISP_LOGDEBUG0; ISP_SNPRINTF(buf, sizeof (buf), "already logged in with N-Port handle 0x%x", parm1); msg = buf; rval = MBOX_PORT_ID_USED | (parm1 << 16); break; case PLOGX_IOCBERR_HNDLUSED: - lev = ISP_LOGSANCFG|ISP_LOGDEBUG0; ISP_SNPRINTF(buf, sizeof (buf), "handle already used for PortID 0x%06x", parm1); msg = buf; rval = MBOX_LOOP_ID_USED; diff --git a/sys/dev/disk/ncr/ncr.c b/sys/dev/disk/ncr/ncr.c index a7ed724f2c..338bbc414a 100644 --- a/sys/dev/disk/ncr/ncr.c +++ b/sys/dev/disk/ncr/ncr.c @@ -4427,7 +4427,6 @@ ncr_complete (ncb_p np, nccb_p cp) { union ccb *ccb; tcb_p tp; - lcb_p lp; /* ** Sanity check @@ -4459,7 +4458,6 @@ ncr_complete (ncb_p np, nccb_p cp) ccb = cp->ccb; cp->ccb = NULL; tp = &np->target[ccb->ccb_h.target_id]; - lp = tp->lp[ccb->ccb_h.target_lun]; /* ** We do not queue more than 1 nccb per target diff --git a/sys/dev/raid/amr/amr.c b/sys/dev/raid/amr/amr.c index 7781158cbf..83b7340ab3 100644 --- a/sys/dev/raid/amr/amr.c +++ b/sys/dev/raid/amr/amr.c @@ -534,7 +534,7 @@ amr_linux_ioctl_int(struct cdev *dev, u_long cmd, caddr_t addr, int32_t flag, struct amr_linux_ioctl ali; void *dp, *temp; int error; - int adapter, len, ac_flags = 0; + int len, ac_flags = 0; int logical_drives_changed = 0; u_int32_t linux_version = 0x02100000; u_int8_t status; @@ -577,8 +577,6 @@ amr_linux_ioctl_int(struct cdev *dev, u_long cmd, caddr_t addr, int32_t flag, else len = ali.ui.fcs.length; - adapter = (ali.ui.fcs.adapno) ^ 'm' << 8; - mb = (void *)&ali.mbox[0]; if ((ali.mbox[0] == FC_DEL_LOGDRV && ali.mbox[2] == OP_DEL_LOGDRV) || /* delete */ @@ -735,7 +733,7 @@ amr_ioctl(struct dev_ioctl_args *ap) void *dp, *au_buffer; unsigned long au_length, real_length; unsigned char *au_cmd; - int *au_statusp, au_direction; + int *au_statusp; int error; struct amr_passthrough *_ap; /* 60 bytes */ int logical_drives_changed = 0; @@ -767,7 +765,6 @@ amr_ioctl(struct dev_ioctl_args *ap) au_cmd = arg.au32->au_cmd; au_buffer = (void *)(u_int64_t)arg.au32->au_buffer; au_length = arg.au32->au_length; - au_direction = arg.au32->au_direction; au_statusp = &arg.au32->au_status; break; #endif @@ -777,7 +774,6 @@ amr_ioctl(struct dev_ioctl_args *ap) au_cmd = arg.au->au_cmd; au_buffer = (void *)arg.au->au_buffer; au_length = arg.au->au_length; - au_direction = arg.au->au_direction; au_statusp = &arg.au->au_status; break; diff --git a/sys/dev/raid/ciss/ciss.c b/sys/dev/raid/ciss/ciss.c index a45d063405..33b129a7ec 100644 --- a/sys/dev/raid/ciss/ciss.c +++ b/sys/dev/raid/ciss/ciss.c @@ -1426,12 +1426,11 @@ ciss_init_physical(struct ciss_softc *sc) struct ciss_lun_report *cll; int error = 0, i; int nphys; - int bus, target; + int bus; debug_called(1); bus = 0; - target = 0; cll = ciss_report_luns(sc, CISS_OPCODE_REPORT_PHYSICAL_LUNS, CISS_MAX_PHYSICAL); @@ -2460,12 +2459,8 @@ ciss_preen_command(struct ciss_request *cr) static void ciss_release_request(struct ciss_request *cr) { - struct ciss_softc *sc; - debug_called(2); - sc = cr->cr_sc; - /* release the request to the free queue */ ciss_requeue_free(cr); } @@ -3149,12 +3144,9 @@ static int ciss_cam_emulate(struct ciss_softc *sc, struct ccb_scsiio *csio) { int bus, target; - u_int8_t opcode; target = csio->ccb_h.target_id; bus = cam_sim_bus(xpt_path_sim(csio->ccb_h.path)); - opcode = (csio->ccb_h.flags & CAM_CDB_POINTER) ? - *(u_int8_t *)csio->cdb_io.cdb_ptr : csio->cdb_io.cdb_bytes[0]; if (CISS_IS_PHYSICAL(bus)) { if (sc->ciss_physical[CISS_CAM_TO_PBUS(bus)][target].cp_online != 1) { @@ -3612,14 +3604,12 @@ ciss_notify_event(struct ciss_softc *sc) static void ciss_notify_complete(struct ciss_request *cr) { - struct ciss_command *cc; struct ciss_notify *cn; struct ciss_softc *sc; int scsi_status; int command_status; debug_called(1); - cc = cr->cr_cc; cn = (struct ciss_notify *)cr->cr_data; sc = cr->cr_sc; diff --git a/sys/dev/raid/mfi/mfi.c b/sys/dev/raid/mfi/mfi.c index 9b859e95c2..d38fe2ff52 100644 --- a/sys/dev/raid/mfi/mfi.c +++ b/sys/dev/raid/mfi/mfi.c @@ -2192,7 +2192,6 @@ mfi_data_cb(void *arg, bus_dma_segment_t *segs, int nsegs, int error) union mfi_sgl *sgl; struct mfi_softc *sc; int i, j, first, dir; - int sge_size; cm = (struct mfi_command *)arg; sc = cm->cm_sc; @@ -2222,7 +2221,6 @@ mfi_data_cb(void *arg, bus_dma_segment_t *segs, int nsegs, int error) sgl->sg_skinny[i].flag = 0; } hdr->flags |= MFI_FRAME_IEEE_SGL | MFI_FRAME_SGL64; - sge_size = sizeof(struct mfi_sg_skinny); hdr->sg_count = nsegs; } else { j = 0; @@ -2252,7 +2250,6 @@ mfi_data_cb(void *arg, bus_dma_segment_t *segs, int nsegs, int error) hdr->flags |= MFI_FRAME_SGL64; } hdr->sg_count = j; - sge_size = sc->mfi_sge_size; } dir = 0; @@ -2905,7 +2902,6 @@ mfi_ioctl(struct dev_ioctl_args *ap) int i, res; struct mfi_ioc_passthru *iop = (struct mfi_ioc_passthru *)arg; int error, locked; - union mfi_sgl *sgl; sc = dev->si_drv1; error = 0; @@ -2995,7 +2991,6 @@ mfi_ioctl(struct dev_ioctl_args *ap) cm->cm_sg = (union mfi_sgl *)&cm->cm_frame->bytes[ioc->mfi_sgl_off]; } - sgl = cm->cm_sg; cm->cm_flags = 0; if (cm->cm_frame->header.flags & MFI_FRAME_DATAIN) cm->cm_flags |= MFI_CMD_DATAIN; diff --git a/sys/dev/raid/mfi/mfi_tbolt.c b/sys/dev/raid/mfi/mfi_tbolt.c index 534ca926fd..f396623fd6 100644 --- a/sys/dev/raid/mfi/mfi_tbolt.c +++ b/sys/dev/raid/mfi/mfi_tbolt.c @@ -891,15 +891,12 @@ int mfi_tbolt_is_ldio(struct mfi_command *mfi_cmd) int mfi_tbolt_build_io(struct mfi_softc *sc, struct mfi_command *mfi_cmd, struct mfi_cmd_tbolt *cmd) { - uint32_t device_id; uint32_t sge_count; uint8_t cdb[32], cdb_len; memset(cdb, 0, 32); struct mfi_mpi2_request_raid_scsi_io *io_request = cmd->io_request; - device_id = mfi_cmd->cm_frame->header.target_id; - /* Have to build CDB here for TB as BSD don't have a scsi layer */ if ((cdb_len = mfi_tbolt_build_cdb(sc, mfi_cmd, cdb)) == 1) return 1; @@ -1018,7 +1015,7 @@ static int mfi_tbolt_make_sgl(struct mfi_softc *sc, struct mfi_command *mfi_cmd, pMpi25IeeeSgeChain64_t sgl_ptr, struct mfi_cmd_tbolt *cmd) { - uint8_t i, sg_processed, sg_to_process; + uint8_t i, sg_processed; uint8_t sge_count, sge_idx; union mfi_sgl *os_sgl; @@ -1066,7 +1063,6 @@ mfi_tbolt_make_sgl(struct mfi_softc *sc, struct mfi_command *mfi_cmd, if (sg_processed < sge_count) { pMpi25IeeeSgeChain64_t sg_chain; - sg_to_process = sge_count - sg_processed; cmd->io_request->ChainOffset = sc->chain_offset_value_for_main_message; sg_chain = sgl_ptr; diff --git a/sys/dev/raid/tws/tws.c b/sys/dev/raid/tws/tws.c index b7b04a5c31..9243d1c296 100644 --- a/sys/dev/raid/tws/tws.c +++ b/sys/dev/raid/tws/tws.c @@ -456,7 +456,6 @@ tws_setup_intr(struct tws_softc *sc, int irqs) static int tws_setup_irq(struct tws_softc *sc) { - int messages; u_int16_t cmd; cmd = pci_read_config(sc->tws_dev, PCIR_COMMAND, 2); @@ -494,7 +493,6 @@ tws_setup_irq(struct tws_softc *sc) return(FAILURE); device_printf(sc->tws_dev, "Using MSI\n"); #else - messages = 0; panic("%s: Using MSI", device_get_nameunit(sc->tws_dev)); #endif break; diff --git a/sys/dev/raid/vinum/vinumconfig.c b/sys/dev/raid/vinum/vinumconfig.c index a71a167c34..21bb1caa8e 100644 --- a/sys/dev/raid/vinum/vinumconfig.c +++ b/sys/dev/raid/vinum/vinumconfig.c @@ -1105,7 +1105,6 @@ config_subdisk(int update) enum sdstate state = sd_unallocated; /* state to set, if specified */ int autosize = 0; /* set if we autosize in give_sd_to_drive */ int namedsdno; /* index of another with this name */ - char partition = 0; /* partition of external subdisk */ sdno = get_empty_sd(); /* allocate an SD to initialize */ sd = &SD[sdno]; /* and get a pointer */ @@ -1231,8 +1230,6 @@ config_subdisk(int update) "%s: invalid partition %c", sd->name, token[parameter][0]); - else - partition = token[parameter][0]; break; case kw_retryerrors: diff --git a/sys/dev/raid/vinum/vinumio.c b/sys/dev/raid/vinum/vinumio.c index 356afaa8d6..b06550319f 100644 --- a/sys/dev/raid/vinum/vinumio.c +++ b/sys/dev/raid/vinum/vinumio.c @@ -54,14 +54,12 @@ open_drive(struct drive *drive, struct proc *p, int verbose) { struct nlookupdata nd; int error; - const char *dname; /* * Fail if already open */ if (drive->flags & VF_OPEN) return EBUSY; - dname = drive->devicename; if (rootdev) { /* @@ -569,7 +567,6 @@ void daemon_save_config(void) { int error; - int written_config; /* set when we first write the config to disk */ int driveno; struct drive *drive; /* point to current drive info */ struct vinum_hdr *vhdr; /* and as header */ @@ -579,7 +576,6 @@ daemon_save_config(void) /* don't save the configuration while we're still working on it */ if (vinum_conf.flags & VF_CONFIGURING) return; - written_config = 0; /* no config written yet */ /* Build a volume header */ vhdr = (struct vinum_hdr *) Malloc(VINUMHEADERLEN); /* get space for the config data */ CHECKALLOC(vhdr, "Can't allocate config data"); @@ -652,8 +648,7 @@ daemon_save_config(void) drive->devicename, error); set_drive_state(drive->driveno, drive_down, setstate_force); - } else - written_config = 1; /* we've written it on at least one drive */ + } } } else /* not worth looking at, */ unlockdrive(drive); /* just unlock it again */ @@ -669,7 +664,6 @@ vinum_scandisk(char *devicename[], int drives) { struct drive *volatile drive; volatile int driveno; - int firstdrive; /* first drive in this list */ volatile int gooddrives; /* number of usable drives found */ int firsttime; /* set if we have never configured before */ int error; @@ -687,7 +681,6 @@ vinum_scandisk(char *devicename[], int drives) vinum_conf.flags |= VF_READING_CONFIG; /* reading config from disk */ gooddrives = 0; /* number of usable drives found */ - firstdrive = vinum_conf.drives_used; /* the first drive */ firsttime = vinum_conf.drives_used == 0; /* are we a virgin? */ /* allocate a drive pointer list */ diff --git a/sys/dev/raid/vinum/vinumrequest.c b/sys/dev/raid/vinum/vinumrequest.c index 4928f802dc..83231d699d 100644 --- a/sys/dev/raid/vinum/vinumrequest.c +++ b/sys/dev/raid/vinum/vinumrequest.c @@ -192,7 +192,6 @@ vinumstart(cdev_t dev, struct bio *bio, int reviveok) { struct buf *bp = bio->bio_buf; int plexno; - int maxplex; /* maximum number of plexes to handle */ struct volume *vol; struct request *rq; /* build up our request here */ enum requeststatus status; @@ -230,12 +229,10 @@ vinumstart(cdev_t dev, struct bio *bio, int reviveok) rq->volplex.volno = Volno(dev); /* get the volume number */ vol = &VOL[rq->volplex.volno]; /* and point to it */ vol->active++; /* one more active request */ - maxplex = vol->plexes; /* consider all its plexes */ } else { vol = NULL; /* no volume */ rq->volplex.plexno = Plexno(dev); /* point to the plex */ rq->isplex = 1; /* note that it's a plex */ - maxplex = 1; /* just the one plex */ } if (bp->b_cmd == BUF_CMD_READ) { @@ -693,7 +690,6 @@ build_read_request(struct request *rq, /* request */ vinum_off_t diskaddr; /* offset of current part of transfer */ vinum_off_t diskend; /* and end offset of transfer */ int plexno; /* plex index in vinum_conf */ - struct rqgroup *rqg; /* point to the request we're working on */ struct volume *vol; /* volume in question */ int recovered = 0; /* set if we recover a read */ enum requeststatus status = REQUEST_OK; @@ -703,7 +699,6 @@ build_read_request(struct request *rq, /* request */ bp = bio->bio_buf; diskaddr = bio->bio_offset >> DEV_BSHIFT; /* start offset of transfer */ diskend = diskaddr + (bp->b_bcount / DEV_BSIZE); /* and end offset of transfer */ - rqg = &rq->rqg[plexindex]; /* plex request */ vol = &VOL[rq->volplex.volno]; /* point to volume */ while (diskaddr < diskend) { /* build up request components */ @@ -798,12 +793,10 @@ enum requeststatus build_rq_buffer(struct rqelement *rqe, struct plex *plex) { struct sd *sd; /* point to subdisk */ - struct volume *vol; struct buf *bp; struct buf *ubp; /* user (high level) buffer header */ struct bio *ubio; - vol = &VOL[rqe->rqg->rq->volplex.volno]; sd = &SD[rqe->sdno]; /* point to subdisk */ bp = &rqe->b; ubio = rqe->rqg->rq->bio; /* pointer to user buffer header */ diff --git a/sys/dev/raid/vinum/vinumrevive.c b/sys/dev/raid/vinum/vinumrevive.c index ce5f783927..a2ab8cfb49 100644 --- a/sys/dev/raid/vinum/vinumrevive.c +++ b/sys/dev/raid/vinum/vinumrevive.c @@ -250,8 +250,6 @@ parityops(struct vinum_ioctl_msg *data) int plexno; struct plex *plex; int size; /* I/O transfer size, bytes */ - vinum_off_t stripe; /* stripe number in plex */ - int psd; /* parity subdisk number */ struct rangelock *lock; /* lock on stripe */ struct _ioctl_reply *reply; off_t pstripe; /* pointer to our stripe counter */ @@ -274,8 +272,6 @@ parityops(struct vinum_ioctl_msg *data) return; } pstripe = data->offset; - stripe = pstripe / plex->stripesize; /* stripe number */ - psd = plex->subdisks - 1 - stripe % plex->subdisks; /* parity subdisk for this stripe */ size = imin(DEFAULT_REVIVE_BLOCKSIZE, /* one block at a time */ plex->stripesize << DEV_BSHIFT); @@ -501,23 +497,16 @@ initsd(int sdno, int verify) { struct sd *sd; struct plex *plex; - struct volume *vol; struct buf *bp; int error; int size; /* size of init block, bytes */ - vinum_off_t plexblkno; /* lblkno in plex */ int verified; /* set when we're happy with what we wrote */ error = 0; - plexblkno = 0; /* to keep the compiler happy */ sd = &SD[sdno]; if (sd->plexno < 0) /* no plex? */ return EINVAL; plex = &PLEX[sd->plexno]; /* point to plex */ - if (plex->volno >= 0) - vol = &VOL[plex->volno]; - else - vol = NULL; if (sd->init_blocksize == 0) { if (plex->stripesize != 0) /* we're striped, don't init more than */ -- 2.41.0