ide: simplify set_inactive callbacks
Drop the unused return value and make the callback optional. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: John Snow <jsnow@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
parent
1374bec063
commit
829b933b70
|
@ -1116,11 +1116,6 @@ static int ahci_dma_add_status(IDEDMA *dma, int status)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ahci_dma_set_inactive(IDEDMA *dma)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int ahci_async_cmd_done(IDEDMA *dma)
|
static int ahci_async_cmd_done(IDEDMA *dma)
|
||||||
{
|
{
|
||||||
AHCIDevice *ad = DO_UPCAST(AHCIDevice, dma, dma);
|
AHCIDevice *ad = DO_UPCAST(AHCIDevice, dma, dma);
|
||||||
|
@ -1154,7 +1149,6 @@ static const IDEDMAOps ahci_dma_ops = {
|
||||||
.rw_buf = ahci_dma_rw_buf,
|
.rw_buf = ahci_dma_rw_buf,
|
||||||
.set_unit = ahci_dma_set_unit,
|
.set_unit = ahci_dma_set_unit,
|
||||||
.add_status = ahci_dma_add_status,
|
.add_status = ahci_dma_add_status,
|
||||||
.set_inactive = ahci_dma_set_inactive,
|
|
||||||
.async_cmd_done = ahci_async_cmd_done,
|
.async_cmd_done = ahci_async_cmd_done,
|
||||||
.restart_cb = ahci_dma_restart_cb,
|
.restart_cb = ahci_dma_restart_cb,
|
||||||
};
|
};
|
||||||
|
|
|
@ -595,7 +595,9 @@ static void ide_async_cmd_done(IDEState *s)
|
||||||
void ide_set_inactive(IDEState *s)
|
void ide_set_inactive(IDEState *s)
|
||||||
{
|
{
|
||||||
s->bus->dma->aiocb = NULL;
|
s->bus->dma->aiocb = NULL;
|
||||||
s->bus->dma->ops->set_inactive(s->bus->dma);
|
if (s->bus->dma->ops->set_inactive) {
|
||||||
|
s->bus->dma->ops->set_inactive(s->bus->dma);
|
||||||
|
}
|
||||||
ide_async_cmd_done(s);
|
ide_async_cmd_done(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2226,7 +2228,6 @@ static const IDEDMAOps ide_dma_nop_ops = {
|
||||||
.rw_buf = ide_nop_int,
|
.rw_buf = ide_nop_int,
|
||||||
.set_unit = ide_nop_int,
|
.set_unit = ide_nop_int,
|
||||||
.add_status = ide_nop_int,
|
.add_status = ide_nop_int,
|
||||||
.set_inactive = ide_nop,
|
|
||||||
.restart_cb = ide_nop_restart,
|
.restart_cb = ide_nop_restart,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -433,7 +433,7 @@ struct IDEDMAOps {
|
||||||
DMAIntFunc *rw_buf;
|
DMAIntFunc *rw_buf;
|
||||||
DMAIntFunc *set_unit;
|
DMAIntFunc *set_unit;
|
||||||
DMAIntFunc *add_status;
|
DMAIntFunc *add_status;
|
||||||
DMAFunc *set_inactive;
|
DMAVoidFunc *set_inactive;
|
||||||
DMAFunc *async_cmd_done;
|
DMAFunc *async_cmd_done;
|
||||||
DMARestartFunc *restart_cb;
|
DMARestartFunc *restart_cb;
|
||||||
DMAVoidFunc *reset;
|
DMAVoidFunc *reset;
|
||||||
|
|
|
@ -576,7 +576,6 @@ static const IDEDMAOps dbdma_ops = {
|
||||||
.rw_buf = ide_nop_int,
|
.rw_buf = ide_nop_int,
|
||||||
.set_unit = ide_nop_int,
|
.set_unit = ide_nop_int,
|
||||||
.add_status = ide_nop_int,
|
.add_status = ide_nop_int,
|
||||||
.set_inactive = ide_nop,
|
|
||||||
.restart_cb = ide_nop_restart,
|
.restart_cb = ide_nop_restart,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -160,15 +160,13 @@ static int bmdma_add_status(IDEDMA *dma, int status)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int bmdma_set_inactive(IDEDMA *dma)
|
static void bmdma_set_inactive(IDEDMA *dma)
|
||||||
{
|
{
|
||||||
BMDMAState *bm = DO_UPCAST(BMDMAState, dma, dma);
|
BMDMAState *bm = DO_UPCAST(BMDMAState, dma, dma);
|
||||||
|
|
||||||
bm->status &= ~BM_STATUS_DMAING;
|
bm->status &= ~BM_STATUS_DMAING;
|
||||||
bm->dma_cb = NULL;
|
bm->dma_cb = NULL;
|
||||||
bm->unit = -1;
|
bm->unit = -1;
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bmdma_restart_dma(BMDMAState *bm, enum ide_dma_cmd dma_cmd)
|
static void bmdma_restart_dma(BMDMAState *bm, enum ide_dma_cmd dma_cmd)
|
||||||
|
|
Loading…
Reference in a new issue