Author: imp Date: Thu Mar 10 00:33:06 2016 New Revision: 296589 URL: https://svnweb.freebsd.org/changeset/base/296589
Log: Stop assuming that bio_cmd is a bit field. Differential Revision: https://reviews.freebsd.org/D5587 Modified: head/sys/dev/fdc/fdc.c Modified: head/sys/dev/fdc/fdc.c ============================================================================== --- head/sys/dev/fdc/fdc.c Thu Mar 10 00:27:10 2016 (r296588) +++ head/sys/dev/fdc/fdc.c Thu Mar 10 00:33:06 2016 (r296589) @@ -941,7 +941,7 @@ fdc_worker(struct fdc_data *fdc) /* Disable ISADMA if we bailed while it was active */ if (fd != NULL && (fd->flags & FD_ISADMA)) { isa_dmadone( - bp->bio_cmd & BIO_READ ? ISADMA_READ : ISADMA_WRITE, + bp->bio_cmd == BIO_READ ? ISADMA_READ : ISADMA_WRITE, fd->fd_ioptr, fd->fd_iosize, fdc->dmachan); mtx_lock(&fdc->fdc_mtx); fd->flags &= ~FD_ISADMA; @@ -983,7 +983,7 @@ fdc_worker(struct fdc_data *fdc) fd = fdc->fd = bp->bio_driver1; fdc->retry = 0; fd->fd_ioptr = bp->bio_data; - if (bp->bio_cmd & BIO_FMT) { + if (bp->bio_cmd == BIO_FMT) { i = offsetof(struct fd_formb, fd_formb_cylno(0)); fd->fd_ioptr += i; fd->fd_iosize = bp->bio_length - i; @@ -1021,7 +1021,7 @@ fdc_worker(struct fdc_data *fdc) fdctl_wr(fdc, fd->ft->trans); #endif - if (bp->bio_cmd & BIO_PROBE) { + if (bp->bio_cmd == BIO_PROBE) { if ((!(device_get_flags(fd->dev) & FD_NO_CHLINE) && #ifndef PC98 !(fdin_rd(fdc) & FDI_DCHG) && @@ -1059,7 +1059,7 @@ fdc_worker(struct fdc_data *fdc) #endif /* Check if the floppy is write-protected */ - if (bp->bio_cmd & (BIO_FMT | BIO_WRITE)) { + if (bp->bio_cmd == BIO_FMT || bp->bio_cmd == BIO_WRITE) { retry_line = __LINE__; if(fdc_sense_drive(fdc, &st3) != 0) return (1); @@ -1078,10 +1078,11 @@ fdc_worker(struct fdc_data *fdc) sec = sec % fd->ft->sectrac + 1; /* If everything is going swimmingly, use multisector xfer */ - if (fdc->retry == 0 && bp->bio_cmd & (BIO_READ|BIO_WRITE)) { + if (fdc->retry == 0 && + (bp->bio_cmd == BIO_READ || bp->bio_cmd == BIO_WRITE)) { fd->fd_iosize = imin(nsect * fd->sectorsize, bp->bio_resid); nsect = fd->fd_iosize / fd->sectorsize; - } else if (bp->bio_cmd & (BIO_READ|BIO_WRITE)) { + } else if (bp->bio_cmd == BIO_READ || bp->bio_cmd == BIO_WRITE) { fd->fd_iosize = fd->sectorsize; nsect = 1; } @@ -1141,10 +1142,12 @@ fdc_worker(struct fdc_data *fdc) fd->fd_ioptr, fdc->retry); /* Setup ISADMA if we need it and have it */ - if ((bp->bio_cmd & (BIO_READ|BIO_WRITE|BIO_FMT)) + if ((bp->bio_cmd == BIO_READ || + bp->bio_cmd == BIO_WRITE || + bp->bio_cmd == BIO_FMT) && !(fdc->flags & FDC_NODMA)) { isa_dmastart( - bp->bio_cmd & BIO_READ ? ISADMA_READ : ISADMA_WRITE, + bp->bio_cmd == BIO_READ ? ISADMA_READ : ISADMA_WRITE, fd->fd_ioptr, fd->fd_iosize, fdc->dmachan); mtx_lock(&fdc->fdc_mtx); fd->flags |= FD_ISADMA; @@ -1153,9 +1156,12 @@ fdc_worker(struct fdc_data *fdc) /* Do PIO if we have to */ if (fdc->flags & FDC_NODMA) { - if (bp->bio_cmd & (BIO_READ|BIO_WRITE|BIO_FMT)) + if (bp->bio_cmd == BIO_READ || + bp->bio_cmd == BIO_WRITE || + bp->bio_cmd == BIO_FMT) fdbcdr_wr(fdc, 1, fd->fd_iosize); - if (bp->bio_cmd & (BIO_WRITE|BIO_FMT)) + if (bp->bio_cmd == BIO_WRITE || + bp->bio_cmd == BIO_FMT) fdc_pio(fdc); } @@ -1218,13 +1224,13 @@ fdc_worker(struct fdc_data *fdc) i = tsleep(fdc, PRIBIO, "fddata", hz); /* PIO if the read looks good */ - if (i == 0 && (fdc->flags & FDC_NODMA) && (bp->bio_cmd & BIO_READ)) + if (i == 0 && (fdc->flags & FDC_NODMA) && (bp->bio_cmd == BIO_READ)) fdc_pio(fdc); /* Finish DMA */ if (fd->flags & FD_ISADMA) { isa_dmadone( - bp->bio_cmd & BIO_READ ? ISADMA_READ : ISADMA_WRITE, + bp->bio_cmd == BIO_READ ? ISADMA_READ : ISADMA_WRITE, fd->fd_ioptr, fd->fd_iosize, fdc->dmachan); mtx_lock(&fdc->fdc_mtx); fd->flags &= ~FD_ISADMA; @@ -1668,7 +1674,7 @@ fd_start(struct bio *bp) fd = bp->bio_to->geom->softc; fdc = fd->fdc; bp->bio_driver1 = fd; - if (bp->bio_cmd & BIO_GETATTR) { + if (bp->bio_cmd == BIO_GETATTR) { if (g_handleattr_int(bp, "GEOM::fwsectors", fd->ft->sectrac)) return; if (g_handleattr_int(bp, "GEOM::fwheads", fd->ft->heads)) @@ -1676,7 +1682,7 @@ fd_start(struct bio *bp) g_io_deliver(bp, ENOIOCTL); return; } - if (!(bp->bio_cmd & (BIO_READ|BIO_WRITE))) { + if (!(bp->bio_cmd == BIO_READ || bp->bio_cmd == BIO_WRITE)) { g_io_deliver(bp, EOPNOTSUPP); return; } _______________________________________________ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"