From c71c06d437d4cccf753cb41731e5a71f54317a01 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Mon, 23 Feb 2015 11:18:00 -0500 Subject: ide: commonize io_buffer_index initialization Resetting the io_buffer_index to 0 is commonized, with the exception of the case within ide_atapi_cmd_reply, where we need to reset this index to 0 prior to the ide_atapi_cmd_reply_end call. Note that not all calls to ide_atapi_cmd_reply_end expect the index to be 0, so setting it there is not appropriate. Signed-off-by: Paolo Bonzini Signed-off-by: John Snow Message-id: 1424708286-16483-12-git-send-email-jsnow@redhat.com Signed-off-by: Stefan Hajnoczi Signed-off-by: Kevin Wolf --- hw/ide/core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'hw/ide/core.c') diff --git a/hw/ide/core.c b/hw/ide/core.c index b62a94a..ff28db0 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -780,7 +780,6 @@ eot: static void ide_sector_start_dma(IDEState *s, enum ide_dma_cmd dma_cmd) { s->status = READY_STAT | SEEK_STAT | DRQ_STAT | BUSY_STAT; - s->io_buffer_index = 0; s->io_buffer_size = 0; s->dma_cmd = dma_cmd; @@ -802,6 +801,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; @@ -2341,7 +2341,6 @@ static void ide_restart_dma(IDEState *s, enum ide_dma_cmd dma_cmd) ide_set_sector(s, s->bus->retry_sector_num); s->nsector = s->bus->retry_nsector; s->bus->dma->ops->restart_dma(s->bus->dma); - s->io_buffer_index = 0; s->io_buffer_size = 0; s->dma_cmd = dma_cmd; ide_start_dma(s, ide_dma_cb); -- cgit v1.1