qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Ray Lee <hburaylee@gmail.com>, qemu-devel@nongnu.org
Cc: hbuxiaofei@gmail.com
Subject: Re: [PATCH 1/1] scsi-bus: Remove unused parameter state from scsi_dma_restart_cb
Date: Fri, 17 May 2024 16:23:49 +0200	[thread overview]
Message-ID: <3e9dba5c-638a-4b04-8e54-8dff87fe067f@linaro.org> (raw)
In-Reply-To: <20240517071445.149364-1-hburaylee@gmail.com>

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.


  reply	other threads:[~2024-05-17 14:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-17  7:14 [PATCH 1/1] scsi-bus: Remove unused parameter state from scsi_dma_restart_cb Ray Lee
2024-05-17 14:23 ` Philippe Mathieu-Daudé [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-05-20  1:08 Ray Lee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3e9dba5c-638a-4b04-8e54-8dff87fe067f@linaro.org \
    --to=philmd@linaro.org \
    --cc=hburaylee@gmail.com \
    --cc=hbuxiaofei@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).