Skip to contentSkip to conversation

scsi-bus: Remove unused parameter state from scsi_dma_restart_cb

PATCH In review Ray Lee 2 participants 2 messages May 17, 2024

lore
Share & tools
lore

Ray Lee

author
#0 lore raw

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
index 9e40b0c920..7c3df9b31a 100644
@@ -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
#1 lore raw

Hi Ray,

Quoted 10 lines · Ray Lee
---
  hw/scsi/scsi-bus.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
hw/scsi/scsi-bus.c +0 -0
index 9e40b0c920..7c3df9b31a 100644

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.