diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2013-12-17 18:15:46 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2013-12-27 12:40:30 -0500 |
commit | b7558a36203aaf08cbe698e6495bf6db096433ec (patch) | |
tree | 6b75ab1348d05d237cbdbc8e242e7a1d2ec7a240 | |
parent | 518955f8eec5ccde9cb1d4ea3a2e633fa556dc39 (diff) | |
download | seabios-b7558a36203aaf08cbe698e6495bf6db096433ec.tar.gz |
Remove unnecesary updates of the disk op->count field.
Now that the op->count field is cleared in a global location on simple
errors, remove various local clears done in individual drivers.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r-- | src/block.c | 1 | ||||
-rw-r--r-- | src/cdrom.c | 1 | ||||
-rw-r--r-- | src/hw/ahci.c | 1 | ||||
-rw-r--r-- | src/hw/ata.c | 2 | ||||
-rw-r--r-- | src/hw/blockcmd.c | 1 | ||||
-rw-r--r-- | src/hw/floppy.c | 44 | ||||
-rw-r--r-- | src/hw/ramdisk.c | 1 | ||||
-rw-r--r-- | src/hw/usb-msc.c | 1 | ||||
-rw-r--r-- | src/hw/virtio-blk.c | 1 |
9 files changed, 14 insertions, 39 deletions
diff --git a/src/block.c b/src/block.c index 4fbf0587..ac2a830f 100644 --- a/src/block.c +++ b/src/block.c @@ -328,7 +328,6 @@ process_scsi_op(struct disk_op_s *op) case CMD_SEEK: return DISK_RET_SUCCESS; default: - op->count = 0; return DISK_RET_EPARAM; } } diff --git a/src/cdrom.c b/src/cdrom.c index 811bef5b..ff419c0f 100644 --- a/src/cdrom.c +++ b/src/cdrom.c @@ -104,7 +104,6 @@ process_cdemu_op(struct disk_op_s *op) case CMD_ISREADY: return DISK_RET_SUCCESS; default: - op->count = 0; return DISK_RET_EPARAM; } } diff --git a/src/hw/ahci.c b/src/hw/ahci.c index 687cc7d8..ff5d5f9e 100644 --- a/src/hw/ahci.c +++ b/src/hw/ahci.c @@ -314,7 +314,6 @@ process_ahci_op(struct disk_op_s *op) return DISK_RET_SUCCESS; default: dprintf(1, "AHCI: unknown disk command %d\n", op->command); - op->count = 0; return DISK_RET_EPARAM; } } diff --git a/src/hw/ata.c b/src/hw/ata.c index de2a9192..d805706d 100644 --- a/src/hw/ata.c +++ b/src/hw/ata.c @@ -452,7 +452,6 @@ ata_dma_transfer(struct disk_op_s *op) dprintf(6, "IDE DMA error (dma=%x ide=%x/%x/%x)\n", status, idestatus , inb(iobase2 + ATA_CB_ASTAT), inb(iobase1 + ATA_CB_ERR)); - op->count = 0; return -1; } @@ -575,7 +574,6 @@ process_ata_op(struct disk_op_s *op) case CMD_SEEK: return DISK_RET_SUCCESS; default: - op->count = 0; return DISK_RET_EPARAM; } } diff --git a/src/hw/blockcmd.c b/src/hw/blockcmd.c index 96950f2d..97c6675b 100644 --- a/src/hw/blockcmd.c +++ b/src/hw/blockcmd.c @@ -49,7 +49,6 @@ cdb_cmd_data(struct disk_op_s *op, void *cdbcmd, u16 blocksize) if (!MODESEGMENT) return ahci_cmd_data(op, cdbcmd, blocksize); default: - op->count = 0; return DISK_RET_EPARAM; } } diff --git a/src/hw/floppy.c b/src/hw/floppy.c index b8482031..f4d7c01f 100644 --- a/src/hw/floppy.c +++ b/src/hw/floppy.c @@ -538,9 +538,9 @@ static int floppy_read(struct disk_op_s *op) { struct chs_s chs = lba2chs(op); - int res = floppy_prep(op->drive_gf, chs.cylinder); - if (res) - goto fail; + int ret = floppy_prep(op->drive_gf, chs.cylinder); + if (ret) + return ret; // send read-normal-data command to controller u8 floppyid = GET_GLOBALFLAT(op->drive_gf->cntl_id); @@ -553,13 +553,7 @@ floppy_read(struct disk_op_s *op) param[5] = chs.sector + op->count - 1; // last sector to read on track param[6] = FLOPPY_GAPLEN; param[7] = FLOPPY_DATALEN; - res = floppy_dma_cmd(op, op->count * DISK_SECTOR_SIZE, FC_READ, param); - if (res) - goto fail; - return DISK_RET_SUCCESS; -fail: - op->count = 0; // no sectors read - return res; + return floppy_dma_cmd(op, op->count * DISK_SECTOR_SIZE, FC_READ, param); } // Write Diskette Sectors @@ -567,9 +561,9 @@ static int floppy_write(struct disk_op_s *op) { struct chs_s chs = lba2chs(op); - int res = floppy_prep(op->drive_gf, chs.cylinder); - if (res) - goto fail; + int ret = floppy_prep(op->drive_gf, chs.cylinder); + if (ret) + return ret; // send write-normal-data command to controller u8 floppyid = GET_GLOBALFLAT(op->drive_gf->cntl_id); @@ -582,13 +576,7 @@ floppy_write(struct disk_op_s *op) param[5] = chs.sector + op->count - 1; // last sector to write on track param[6] = FLOPPY_GAPLEN; param[7] = FLOPPY_DATALEN; - res = floppy_dma_cmd(op, op->count * DISK_SECTOR_SIZE, FC_WRITE, param); - if (res) - goto fail; - return DISK_RET_SUCCESS; -fail: - op->count = 0; // no sectors read - return res; + return floppy_dma_cmd(op, op->count * DISK_SECTOR_SIZE, FC_WRITE, param); } // Verify Diskette Sectors @@ -596,15 +584,12 @@ static int floppy_verify(struct disk_op_s *op) { struct chs_s chs = lba2chs(op); - int res = floppy_prep(op->drive_gf, chs.cylinder); - if (res) - goto fail; + int ret = floppy_prep(op->drive_gf, chs.cylinder); + if (ret) + return ret; // This command isn't implemented - just return success. return DISK_RET_SUCCESS; -fail: - op->count = 0; // no sectors read - return res; } // format diskette track @@ -612,9 +597,9 @@ static int floppy_format(struct disk_op_s *op) { struct chs_s chs = lba2chs(op); - int res = floppy_prep(op->drive_gf, chs.cylinder); - if (res) - return res; + int ret = floppy_prep(op->drive_gf, chs.cylinder); + if (ret) + return ret; // send format-track command to controller u8 floppyid = GET_GLOBALFLAT(op->drive_gf->cntl_id); @@ -645,7 +630,6 @@ process_floppy_op(struct disk_op_s *op) case CMD_FORMAT: return floppy_format(op); default: - op->count = 0; return DISK_RET_EPARAM; } } diff --git a/src/hw/ramdisk.c b/src/hw/ramdisk.c index 81aed50c..1177bc00 100644 --- a/src/hw/ramdisk.c +++ b/src/hw/ramdisk.c @@ -106,7 +106,6 @@ process_ramdisk_op(struct disk_op_s *op) case CMD_RESET: return DISK_RET_SUCCESS; default: - op->count = 0; return DISK_RET_EPARAM; } } diff --git a/src/hw/usb-msc.c b/src/hw/usb-msc.c index 7e2e440a..2cf97254 100644 --- a/src/hw/usb-msc.c +++ b/src/hw/usb-msc.c @@ -117,7 +117,6 @@ usb_cmd_data(struct disk_op_s *op, void *cdbcmd, u16 blocksize) fail: // XXX - reset connection dprintf(1, "USB transmission failed\n"); - op->count = 0; return DISK_RET_EBADTRACK; } diff --git a/src/hw/virtio-blk.c b/src/hw/virtio-blk.c index 0290d671..7b22bf5b 100644 --- a/src/hw/virtio-blk.c +++ b/src/hw/virtio-blk.c @@ -94,7 +94,6 @@ process_virtio_blk_op(struct disk_op_s *op) case CMD_SEEK: return DISK_RET_SUCCESS; default: - op->count = 0; return DISK_RET_EPARAM; } } |