ide: refactor retry_unit set and clear into separate function
Code to set and clear state associated with retry in moved into ide_set_retry and ide_clear_retry to make adding retry setups easier. Signed-off-by: Evgeny Yakovlev <eyakovlev@virtuozzo.com> Signed-off-by: Denis V. Lunev <den@openvz.org> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 1468870792-7411-2-git-send-email-den@openvz.org CC: Kevin Wolf <kwolf@redhat.com> CC: Max Reitz <mreitz@redhat.com> CC: Stefan Hajnoczi <stefanha@redhat.com> CC: Fam Zheng <famz@redhat.com> CC: John Snow <jsnow@redhat.com> Signed-off-by: John Snow <jsnow@redhat.com>
This commit is contained in:
parent
3913d3707e
commit
0eeee07e24
@ -466,6 +466,20 @@ void ide_abort_command(IDEState *s)
|
||||
s->error = ABRT_ERR;
|
||||
}
|
||||
|
||||
static void ide_set_retry(IDEState *s)
|
||||
{
|
||||
s->bus->retry_unit = s->unit;
|
||||
s->bus->retry_sector_num = ide_get_sector(s);
|
||||
s->bus->retry_nsector = s->nsector;
|
||||
}
|
||||
|
||||
static void ide_clear_retry(IDEState *s)
|
||||
{
|
||||
s->bus->retry_unit = -1;
|
||||
s->bus->retry_sector_num = 0;
|
||||
s->bus->retry_nsector = 0;
|
||||
}
|
||||
|
||||
/* prepare data transfer and tell what to do after */
|
||||
void ide_transfer_start(IDEState *s, uint8_t *buf, int size,
|
||||
EndTransferFunc *end_transfer_func)
|
||||
@ -756,9 +770,7 @@ void dma_buf_commit(IDEState *s, uint32_t tx_bytes)
|
||||
void ide_set_inactive(IDEState *s, bool more)
|
||||
{
|
||||
s->bus->dma->aiocb = NULL;
|
||||
s->bus->retry_unit = -1;
|
||||
s->bus->retry_sector_num = 0;
|
||||
s->bus->retry_nsector = 0;
|
||||
ide_clear_retry(s);
|
||||
if (s->bus->dma->ops->set_inactive) {
|
||||
s->bus->dma->ops->set_inactive(s->bus->dma, more);
|
||||
}
|
||||
@ -914,9 +926,7 @@ static void ide_sector_start_dma(IDEState *s, enum ide_dma_cmd dma_cmd)
|
||||
void ide_start_dma(IDEState *s, BlockCompletionFunc *cb)
|
||||
{
|
||||
s->io_buffer_index = 0;
|
||||
s->bus->retry_unit = s->unit;
|
||||
s->bus->retry_sector_num = ide_get_sector(s);
|
||||
s->bus->retry_nsector = s->nsector;
|
||||
ide_set_retry(s);
|
||||
if (s->bus->dma->ops->start_dma) {
|
||||
s->bus->dma->ops->start_dma(s->bus->dma, s, cb);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user