ide: push end_transfer_func out of start_transfer callback, rename callback

Now that end_transfer_func is a tail call in ahci_start_transfer,
formalize the fact that the callback (of which ahci_start_transfer is
the sole implementation) takes care of the transfer too: rename it to
pio_transfer and, if it is present, call the end_transfer_func as soon
as it returns.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-id: 20180606190955.20845-4-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
This commit is contained in:
Paolo Bonzini 2018-06-06 15:09:51 -04:00 committed by John Snow
parent 956556e131
commit bed9bcfa32
4 changed files with 13 additions and 12 deletions

View file

@ -526,16 +526,18 @@ static void ide_clear_retry(IDEState *s)
void ide_transfer_start(IDEState *s, uint8_t *buf, int size,
EndTransferFunc *end_transfer_func)
{
s->end_transfer_func = end_transfer_func;
s->data_ptr = buf;
s->data_end = buf + size;
ide_set_retry(s);
if (!(s->status & ERR_STAT)) {
s->status |= DRQ_STAT;
}
if (s->bus->dma->ops->start_transfer) {
s->bus->dma->ops->start_transfer(s->bus->dma);
if (!s->bus->dma->ops->pio_transfer) {
s->end_transfer_func = end_transfer_func;
return;
}
s->bus->dma->ops->pio_transfer(s->bus->dma);
end_transfer_func(s);
}
static void ide_cmd_done(IDEState *s)