qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] scsi-bus: Remove unused parameter state from scsi_dma_restart_cb
@ 2024-05-17  7:14 Ray Lee
  2024-05-17 14:23 ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 3+ messages in thread
From: Ray Lee @ 2024-05-17  7:14 UTC (permalink / raw)
  To: qemu-devel; +Cc: hbuxiaofei, Ray Lee

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;
 
-- 
2.39.3



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] scsi-bus: Remove unused parameter state from scsi_dma_restart_cb
  2024-05-17  7:14 Ray Lee
@ 2024-05-17 14:23 ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-05-17 14:23 UTC (permalink / raw)
  To: Ray Lee, qemu-devel; +Cc: hbuxiaofei

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.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/1] scsi-bus: Remove unused parameter state from scsi_dma_restart_cb
@ 2024-05-20  1:08 Ray Lee
  0 siblings, 0 replies; 3+ messages in thread
From: Ray Lee @ 2024-05-20  1:08 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, fam, Ray Lee

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;
 
-- 
2.39.3



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-05-20  1:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-20  1:08 [PATCH 1/1] scsi-bus: Remove unused parameter state from scsi_dma_restart_cb Ray Lee
  -- strict thread matches above, loose matches on Subject: below --
2024-05-17  7:14 Ray Lee
2024-05-17 14:23 ` Philippe Mathieu-Daudé

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).