ide: pass IDEBus to the restart_cb
Pass the containing IDEBus to the restart_cb instead of the more specific BMDMAState child. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1424708286-16483-6-git-send-email-jsnow@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
		
							parent
							
								
									2745df813d
								
							
						
					
					
						commit
						d34fceda8f
					
				@ -2332,7 +2332,7 @@ static const IDEDMAOps ide_dma_nop_ops = {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void ide_register_restart_cb(IDEBus *bus)
 | 
					void ide_register_restart_cb(IDEBus *bus)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    qemu_add_vm_change_state_handler(bus->dma->ops->restart_cb, bus->dma);
 | 
					    qemu_add_vm_change_state_handler(bus->dma->ops->restart_cb, bus);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static IDEDMA ide_dma_nop = {
 | 
					static IDEDMA ide_dma_nop = {
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										10
									
								
								hw/ide/pci.c
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								hw/ide/pci.c
									
									
									
									
									
								
							@ -208,8 +208,8 @@ static void ide_restart_dma(IDEState *s, enum ide_dma_cmd dma_cmd)
 | 
				
			|||||||
/* TODO This should be common IDE code */
 | 
					/* TODO This should be common IDE code */
 | 
				
			||||||
static void bmdma_restart_bh(void *opaque)
 | 
					static void bmdma_restart_bh(void *opaque)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    BMDMAState *bm = opaque;
 | 
					    IDEBus *bus = opaque;
 | 
				
			||||||
    IDEBus *bus = bm->bus;
 | 
					    BMDMAState *bm = DO_UPCAST(BMDMAState, dma, bus->dma);
 | 
				
			||||||
    IDEState *s;
 | 
					    IDEState *s;
 | 
				
			||||||
    bool is_read;
 | 
					    bool is_read;
 | 
				
			||||||
    int error_status;
 | 
					    int error_status;
 | 
				
			||||||
@ -260,14 +260,14 @@ static void bmdma_restart_bh(void *opaque)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
static void bmdma_restart_cb(void *opaque, int running, RunState state)
 | 
					static void bmdma_restart_cb(void *opaque, int running, RunState state)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    IDEDMA *dma = opaque;
 | 
					    IDEBus *bus = opaque;
 | 
				
			||||||
    BMDMAState *bm = DO_UPCAST(BMDMAState, dma, dma);
 | 
					    BMDMAState *bm = DO_UPCAST(BMDMAState, dma, bus->dma);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!running)
 | 
					    if (!running)
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!bm->bh) {
 | 
					    if (!bm->bh) {
 | 
				
			||||||
        bm->bh = qemu_bh_new(bmdma_restart_bh, &bm->dma);
 | 
					        bm->bh = qemu_bh_new(bmdma_restart_bh, bus);
 | 
				
			||||||
        qemu_bh_schedule(bm->bh);
 | 
					        qemu_bh_schedule(bm->bh);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user