scsi-bus: Remove unused parameter state from scsi_dma_restart_cb
PATCH 1/1 scsi-bus: Remove unused parameter state from scsi_dma_restart_cb
--- hw/scsi/scsi-bus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/scsi/scsi-bus.c +1 -1
@@ -255,7 +255,7 @@ static void scsi_dma_restart_req(SCSIRequest *req, void *opaque)scsi_req_unref (req); } -static void scsi_dma_restart_cb (void *opaque,bool running,RunState state) +static void scsi_dma_restart_cb (void *opaque,bool running) {SCSIDevice *s = opaque;
Signature · 1 line
2.39.3
Hi Ray,
Quoted 10 lines · Ray Lee
Signed-off-by Ray Lee <[email protected]>--- hw/scsi/scsi-bus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/scsi/scsi-bus.c +0
-0
hw/scsi/scsi-bus.c static void scsi_dma_restart_req(SCSIRequest *req, void *opaque) · line 261
Quoted 8 lines
hw/scsi/scsi-bus.c +1
-1@@ -255,7 +255,7 @@ static void scsi_dma_restart_req(SCSIRequest *req, void *opaque)scsi_req_unref (req); } -static void scsi_dma_restart_cb (void *opaque,bool running,RunState state) +static void scsi_dma_restart_cb (void *opaque,bool running) {SCSIDevice *s = opaque;
scsi_dma_restart_cb() is registered as callback:
dev->vmsentry = qdev_add_vm_change_state_handler(DEVICE(dev),
scsi_dma_restart_cb,
dev);The function prototype is (see include/sysemu/runstate.h):
VMChangeStateEntry * qdev_add_vm_change_state_handler(DeviceState *dev,
VMChangeStateHandler *cb,
void *opaque);and VMChangeStateHandler is defined as:
typedef void VMChangeStateHandler(void *opaque,
bool running,
RunState state);So even if the callback argument is not used, its prototype must respect the VMChangeStateHandler definition. Thus your patch is not correct. Indeed when building QEMU with your patch I get:
[152/339] Compiling C object libcommon.fa.p/hw_scsi_scsi-bus.c.o../../hw/scsi/scsi-bus.c:359:13: error: incompatible function pointer types passing 'void (void *, bool)' to parameter of type 'VMChangeStateHandler *' (aka 'void (*)(void *, bool, enum RunState)') [-Wincompatible-function-pointer-types]
scsi_dma_restart_cb, dev);
^~~~~~~~~~~~~~~~~~~include/sysemu/runstate.h:24:76: note: passing argument to parameter 'cb' here
VMChangeStateHandler *cb,
^
1 error generated.
Please test your patch :)
Regards,
Phil.