Message ID | 20240517071445.149364-1-hburaylee@gmail.com |
---|---|
State | New |
Headers | show |
Series | [1/1] scsi-bus: Remove unused parameter state from scsi_dma_restart_cb | expand |
Hi Ray, On 17/5/24 09:14, Ray Lee wrote: > Signed-off-by: Ray Lee <hburaylee@gmail.com> > --- > hw/scsi/scsi-bus.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c > index 9e40b0c920..7c3df9b31a 100644 > --- a/hw/scsi/scsi-bus.c > +++ b/hw/scsi/scsi-bus.c > @@ -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.
diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c index 9e40b0c920..7c3df9b31a 100644 --- a/hw/scsi/scsi-bus.c +++ b/hw/scsi/scsi-bus.c @@ -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;
Signed-off-by: Ray Lee <hburaylee@gmail.com> --- hw/scsi/scsi-bus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)