kernel/bus: Remove some unused variables and put others in #ifdef...
authorSascha Wildner <saw@online.de>
Tue, 8 Jan 2013 15:48:15 +0000 (16:48 +0100)
committerSascha Wildner <saw@online.de>
Tue, 8 Jan 2013 16:14:06 +0000 (17:14 +0100)
12 files changed:
sys/bus/cam/cam_xpt.c
sys/bus/cam/scsi/scsi_ch.c
sys/bus/cam/scsi/scsi_da.c
sys/bus/cam/scsi/scsi_low.c
sys/bus/cam/scsi/scsi_pass.c
sys/bus/cam/scsi/scsi_ses.c
sys/bus/cam/scsi/scsi_sg.c
sys/bus/cam/scsi/scsi_target.c
sys/bus/firewire/firewire.c
sys/bus/firewire/fwdev.c
sys/bus/firewire/fwohci.c
sys/bus/pci/pci.c

index 1e935eb..26b1717 100644 (file)
@@ -3144,12 +3144,8 @@ xpt_action(union ccb *start_ccb)
                        start_ccb->ccb_h.status = CAM_DEV_NOT_THERE;
                } else {
                        struct ccb_getdev *cgd;
-                       struct cam_eb *bus;
-                       struct cam_et *tar;
 
                        cgd = &start_ccb->cgd;
-                       bus = cgd->ccb_h.path->bus;
-                       tar = cgd->ccb_h.path->target;
                        cgd->inq_data = dev->inq_data;
                        cgd->ccb_h.status = CAM_REQ_CMP;
                        cgd->serial_num_len = dev->serial_num_len;
@@ -7267,7 +7263,6 @@ camisr_runqueue(struct cam_sim *sim)
 
                if (ccb_h->flags & CAM_HIGH_POWER) {
                        struct highpowerlist    *hphead;
-                       struct cam_ed           *device;
                        union ccb               *send_ccb;
 
                        lockmgr(&xsoftc.xpt_lock, LK_EXCLUSIVE);
@@ -7284,8 +7279,6 @@ camisr_runqueue(struct cam_sim *sim)
                         * Any high powered commands queued up?
                         */
                        if (send_ccb != NULL) {
-                               device = send_ccb->ccb_h.path->device;
-
                                STAILQ_REMOVE_HEAD(hphead, xpt_links.stqe);
                                lockmgr(&xsoftc.xpt_lock, LK_RELEASE);
 
index 1f7a725..0aa3446 100644 (file)
@@ -436,9 +436,7 @@ chclose(struct dev_close_args *ap)
        cdev_t dev = ap->a_head.a_dev;
        struct  cam_periph *periph;
        struct  ch_softc *softc;
-       int     unit, error;
-
-       error = 0;
+       int     unit;
 
        unit = CHUNIT(dev);
        periph = cam_extend_get(chperiphs, unit);
index 8706d57..f5bcd90 100644 (file)
@@ -435,7 +435,6 @@ daioctl(struct dev_ioctl_args *ap)
        struct buf *bp;         
        struct cam_periph *periph;
        int byte_count;
-       struct da_softc * softc;
 
        off_t *del_num = (off_t*)ap->a_data;
        off_t bytes_left;
@@ -448,7 +447,6 @@ daioctl(struct dev_ioctl_args *ap)
        periph = cam_extend_get(daperiphs, unit);
        if (periph == NULL)
                return(ENXIO);
-       softc = (struct da_softc *)periph->softc;
        
        switch (ap->a_cmd) {
        case IOCTLTRIM:
@@ -698,10 +696,8 @@ dastrategy(struct dev_strategy_args *ap)
        struct cam_periph *periph;
        struct da_softc *softc;
        u_int  unit;
-       u_int  part;
        
        unit = dkunit(dev);
-       part = dkpart(dev);
        periph = cam_extend_get(daperiphs, unit);
        if (periph == NULL) {
                bp->b_error = ENXIO;
@@ -978,7 +974,6 @@ daasync(void *callback_arg, u_int32_t code,
        case AC_FOUND_DEVICE:
        {
                struct ccb_getdev *cgd;
-               struct cam_sim *sim;
                cam_status status;
  
                cgd = (struct ccb_getdev *)arg;
@@ -1002,7 +997,6 @@ daasync(void *callback_arg, u_int32_t code,
                 * this device and start the probe
                 * process.
                 */
-               sim = xpt_path_sim(cgd->ccb_h.path);
                status = cam_periph_alloc(daregister, daoninvalidate,
                                          dacleanup, dastart,
                                          "da", CAM_PERIPH_BIO,
index 0d20ef6..a4a0218 100644 (file)
@@ -1365,7 +1365,6 @@ static int
 scsi_low_abort_ccb(struct scsi_low_softc *slp, struct slccb *cb)
 {
        struct targ_info *ti;
-       struct lun_info *li;
        u_int msg;
 
        if (cb == NULL)
@@ -1375,7 +1374,6 @@ scsi_low_abort_ccb(struct scsi_low_softc *slp, struct slccb *cb)
                return EBUSY;
 
        ti = cb->ti;
-       li = cb->li;
        if (cb->ccb_tag == SCSI_LOW_UNKTAG)
                msg = SCSI_LOW_MSG_ABORT;
        else
index eee5c7e..f6c53e4 100644 (file)
@@ -189,7 +189,6 @@ passasync(void *callback_arg, u_int32_t code,
          struct cam_path *path, void *arg)
 {
        struct cam_periph *periph;
-       struct cam_sim *sim;
 
        periph = (struct cam_periph *)callback_arg;
 
@@ -215,7 +214,6 @@ passasync(void *callback_arg, u_int32_t code,
                 * this device and start the probe
                 * process.
                 */
-               sim = xpt_path_sim(cgd->ccb_h.path);
                status = cam_periph_alloc(passregister, passoninvalidate,
                                          passcleanup, passstart, "pass",
                                          CAM_PERIPH_BIO, cgd->ccb_h.path,
@@ -413,10 +411,8 @@ passstart(struct cam_periph *periph, union ccb *start_ccb)
 static void
 passdone(struct cam_periph *periph, union ccb *done_ccb)
 { 
-       struct pass_softc *softc;
        struct ccb_scsiio *csio;
 
-       softc = (struct pass_softc *)periph->softc;
        csio = &done_ccb->csio;
        switch (csio->ccb_h.ccb_type) {
        case PASS_CCB_WAITING:
@@ -433,7 +429,6 @@ passioctl(struct dev_ioctl_args *ap)
        cdev_t dev = ap->a_head.a_dev;
        caddr_t addr = ap->a_data;
        struct  cam_periph *periph;
-       struct  pass_softc *softc;
        u_int8_t unit;
        int      error;
 
@@ -448,7 +443,6 @@ passioctl(struct dev_ioctl_args *ap)
                return(ENXIO);
 
        cam_periph_lock(periph);
-       softc = (struct pass_softc *)periph->softc;
 
        error = 0;
 
index 34edf17..5485023 100644 (file)
@@ -441,9 +441,7 @@ sesclose(struct dev_close_args *ap)
        cdev_t dev = ap->a_head.a_dev;
        struct cam_periph *periph;
        struct ses_softc *softc;
-       int unit, error;
-
-       error = 0;
+       int unit;
 
        unit = SESUNIT(dev);
        periph = cam_extend_get(sesperiphs, unit);
index f3858e8..9cb96ed 100644 (file)
@@ -345,7 +345,6 @@ sgdone(struct cam_periph *periph, union ccb *done_ccb)
        case SG_CCB_RDWR_IO:
        {
                struct sg_rdwr *rdwr;
-               int state;
 
                devstat_end_transaction(
                        &softc->device_stats,
@@ -357,7 +356,6 @@ sgdone(struct cam_periph *periph, union ccb *done_ccb)
                             DEVSTAT_WRITE : DEVSTAT_READ));
 
                rdwr = done_ccb->ccb_h.ccb_rdwr;
-               state = rdwr->state;
                rdwr->state = SG_RDWR_DONE;
                wakeup(rdwr);
                break;
index eb6c301..71719a8 100644 (file)
@@ -805,13 +805,11 @@ static void
 targdone(struct cam_periph *periph, union ccb *done_ccb)
 {
        struct targ_softc *softc;
-       cam_status status;
 
        CAM_DEBUG(periph->path, CAM_DEBUG_PERIPH, ("targdone %p\n", done_ccb));
        softc = (struct targ_softc *)periph->softc;
        TAILQ_REMOVE(&softc->pending_ccb_queue, &done_ccb->ccb_h,
                     periph_links.tqe);
-       status = done_ccb->ccb_h.status & CAM_STATUS_MASK;
 
        /* If we're no longer enabled, throw away CCB */
        if ((softc->state & TARG_STATE_LUN_ENABLED) == 0) {
index 2dee46f..9c33a23 100644 (file)
@@ -394,7 +394,6 @@ firewire_watchdog(void *arg)
 static int
 firewire_attach(device_t dev)
 {
-       int unit;
        struct firewire_softc *sc = device_get_softc(dev);
        device_t pa = device_get_parent(dev);
        struct firewire_comm *fc;
@@ -403,7 +402,6 @@ firewire_attach(device_t dev)
        sc->fc = fc;
        fc->status = FWBUSNOTREADY;
 
-       unit = device_get_unit(dev);
        if( fc->nisodma > FWMAXNDMA) fc->nisodma = FWMAXNDMA;
 
        fwdev_makedev(sc);
index c607044..0f8cb03 100644 (file)
@@ -366,14 +366,12 @@ fw_write (struct dev_write_args *ap)
        int unit = DEV2UNIT(dev);
        int slept = 0;
        struct fw_pkt *fp;
-       struct firewire_comm *fc;
        struct fw_xferq *it;
 
        if (DEV_FWMEM(dev))
                return physwrite(ap);
 
        sc = devclass_get_softc(firewire_devclass, unit);
-       fc = sc->fc;
        it = ((struct fw_drv1 *)dev->si_drv1)->it;
        if (it == NULL || it->buf == NULL)
                return (EIO);
@@ -720,10 +718,8 @@ static int
 fw_kqfilter(struct dev_kqfilter_args *ap)
 {
        cdev_t dev = ap->a_head.a_dev;
-       struct firewire_softc *sc;
        struct fw_xferq *ir;
        struct knote *kn = ap->a_kn;
-       int unit = DEV2UNIT(dev);
        struct klist *klist;
 
        /*
@@ -734,7 +730,6 @@ fw_kqfilter(struct dev_kqfilter_args *ap)
                return (0);
        }
 
-       sc = devclass_get_softc(firewire_devclass, unit);
        ir = ((struct fw_drv1 *)dev->si_drv1)->ir;
 
        ap->a_result = 0;
@@ -791,12 +786,9 @@ static int
 fw_mmap (struct dev_mmap_args *ap)
 {  
        cdev_t dev = ap->a_head.a_dev;
-       struct firewire_softc *sc;
-       int unit = DEV2UNIT(dev);
 
        if (DEV_FWMEM(dev))
                return fwmem_mmap(ap);
-       sc = devclass_get_softc(firewire_devclass, unit);
 
        return EINVAL;
 }
@@ -822,9 +814,6 @@ fw_strategy(struct dev_strategy_args *ap)
 int
 fwdev_makedev(struct firewire_softc *sc)
 {
-       int unit;
-
-       unit = device_get_unit(sc->fc->bdev);
        /*HELPME dev_ops_add(&firewire_ops, FW_UNITMASK, FW_UNIT(unit));*/
        return(0);
 }
index 269e256..b875c24 100644 (file)
@@ -766,9 +766,6 @@ fwohci_init(struct fwohci_softc *sc, device_t dev)
 void
 fwohci_timeout(void *arg)
 {
-       struct fwohci_softc *sc;
-
-       sc = (struct fwohci_softc *)arg;
 }
 
 u_int32_t
@@ -1488,7 +1485,6 @@ fwohci_itxbuf_enable(struct firewire_comm *fc, int dmach)
 {
        struct fwohci_softc *sc = (struct fwohci_softc *)fc;
        int err = 0;
-       unsigned short tag, ich;
        struct fwohci_dbch *dbch;
        int cycle_match, cycle_now, ldesc;
        u_int32_t stat;
@@ -1498,8 +1494,6 @@ fwohci_itxbuf_enable(struct firewire_comm *fc, int dmach)
        dbch = &sc->it[dmach];
        it = &dbch->xferq;
 
-       tag = (it->flag >> 6) & 3;
-       ich = it->flag & 0x3f;
        if ((dbch->flags & FWOHCI_DBCH_INIT) == 0) {
                dbch->ndb = it->bnpacket * it->bnchunk;
                dbch->ndesc = 3;
@@ -2266,7 +2260,10 @@ dump_db(struct fwohci_softc *sc, u_int32_t ch)
 {
        struct fwohci_dbch *dbch;
        struct fwohcidb_tr *cp = NULL, *pp, *np = NULL;
-       struct fwohcidb *curr = NULL, *prev, *next = NULL;
+       struct fwohcidb *curr = NULL;
+#if 0
+       struct fwohcidb *prev, *next = NULL;
+#endif
        int idb, jdb;
        u_int32_t cmd, off;
        if(ch == 0){
@@ -2295,7 +2292,9 @@ dump_db(struct fwohci_softc *sc, u_int32_t ch)
                return;
        }
        pp = dbch->top;
+#if 0
        prev = pp->db;
+#endif
        for(idb = 0 ; idb < dbch->ndb ; idb ++ ){
                if(pp == NULL){
                        curr = NULL;
@@ -2310,16 +2309,20 @@ dump_db(struct fwohci_softc *sc, u_int32_t ch)
                for(jdb = 0 ; jdb < dbch->ndesc ; jdb ++ ){
                        if ((cmd  & 0xfffffff0) == cp->bus_addr) {
                                curr = cp->db;
+#if 0
                                if(np != NULL){
                                        next = np->db;
                                }else{
                                        next = NULL;
                                }
+#endif
                                goto outdb;
                        }
                }
                pp = STAILQ_NEXT(pp, link);
+#if 0
                prev = pp->db;
+#endif
        }
 outdb:
        if( curr != NULL){
@@ -2455,7 +2458,10 @@ fwohci_ibr(struct firewire_comm *fc)
 void
 fwohci_txbufdb(struct fwohci_softc *sc, int dmach, struct fw_bulkxfer *bulkxfer)
 {
-       struct fwohcidb_tr *db_tr, *fdb_tr;
+       struct fwohcidb_tr *db_tr;
+#if 0
+       struct fwohcidb_tr *fdb_tr;
+#endif
        struct fwohci_dbch *dbch;
        struct fwohcidb *db;
        struct fw_pkt *fp;
@@ -2467,10 +2473,11 @@ fwohci_txbufdb(struct fwohci_softc *sc, int dmach, struct fw_bulkxfer *bulkxfer)
        chtag = sc->it[dmach].xferq.flag & 0xff;
 
        db_tr = (struct fwohcidb_tr *)(bulkxfer->start);
+#if 0
        fdb_tr = (struct fwohcidb_tr *)(bulkxfer->end);
-/*
-device_printf(sc->fc.dev, "DB %08x %08x %08x\n", bulkxfer, db_tr->bus_addr, fdb_tr->bus_addr);
-*/
+       device_printf(sc->fc.dev, "DB %08x %08x %08x\n", bulkxfer,
+           db_tr->bus_addr, fdb_tr->bus_addr);
+#endif
        for (idb = 0; idb < dbch->xferq.bnpacket; idb ++) {
                db = db_tr->db;
                fp = (struct fw_pkt *)db_tr->buf;
@@ -2605,9 +2612,9 @@ fwohci_arcv_swap(struct fw_pkt *fp, int len)
 {
        struct fw_pkt *fp0;
        u_int32_t ld0;
-       int slen, hlen;
+       int hlen;
 #if BYTE_ORDER == BIG_ENDIAN
-       int i;
+       int slen, i;
 #endif
 
        ld0 = FWOHCI_DMA_READ(fp->mode.ld[0]);
@@ -2622,15 +2629,19 @@ fwohci_arcv_swap(struct fw_pkt *fp, int len)
        case FWTCODE_WREQQ:
        case FWTCODE_RRESQ:
        case FWOHCITCODE_PHY:
+#if BYTE_ORDER == BIG_ENDIAN
                slen = 12;
                break;
+#endif
        case FWTCODE_RREQB:
        case FWTCODE_WREQB:
        case FWTCODE_LREQ:
        case FWTCODE_RRESB:
        case FWTCODE_LRES:
+#if BYTE_ORDER == BIG_ENDIAN
                slen = 16;
                break;
+#endif
        default:
                kprintf("Unknown tcode %d\n", fp0->mode.common.tcode);
                return(0);
@@ -2693,19 +2704,14 @@ fwohci_arcv(struct fwohci_softc *sc, struct fwohci_dbch *dbch, int count)
        int nvec;
        struct fw_pkt *fp;
        u_int8_t *ld;
-       u_int32_t stat, off, status;
+       u_int32_t stat, status;
        u_int spd;
        int len, plen, hlen, pcnt, offset;
        caddr_t buf;
        int resCount;
 
-       if(&sc->arrq == dbch){
-               off = OHCI_ARQOFF;
-       }else if(&sc->arrs == dbch){
-               off = OHCI_ARSOFF;
-       }else{
+       if (&sc->arrq != dbch && &sc->arrs != dbch)
                return;
-       }
 
        crit_enter();
        db_tr = dbch->top;
index ad8b277..d3cd7aa 100644 (file)
@@ -2100,7 +2100,7 @@ pci_set_powerstate_method(device_t dev, device_t child, int state)
        struct pci_devinfo *dinfo = device_get_ivars(child);
        pcicfgregs *cfg = &dinfo->cfg;
        uint16_t status;
-       int result, oldstate, highest, delay;
+       int oldstate, highest, delay;
 
        if (cfg->pp.pp_cap == 0)
                return (EOPNOTSUPP);
@@ -2135,7 +2135,6 @@ pci_set_powerstate_method(device_t dev, device_t child, int state)
            delay = 0;
        status = PCI_READ_CONFIG(dev, child, cfg->pp.pp_status, 2)
            & ~PCIM_PSTAT_DMASK;
-       result = 0;
        switch (state) {
        case PCI_POWERSTATE_D0:
                status |= PCIM_PSTAT_D0;