qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Marc-André Lureau" <marcandre.lureau@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>
Cc: qemu-devel@nongnu.org, "Michael S. Tsirkin" <mst@redhat.com>,
	xen-devel@lists.xenproject.org,
	 Stefano Stabellini <sstabellini@kernel.org>,
	qemu-ppc@nongnu.org, Paul Durrant <paul@xen.org>,
	 Paolo Bonzini <pbonzini@redhat.com>,
	Song Gao <gaosong@loongson.cn>,
	 Gerd Hoffmann <kraxel@redhat.com>,
	Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>,
	 Anthony Perard <anthony.perard@citrix.com>
Subject: Re: [PATCH] ui/input: Constify QemuInputHandler structure
Date: Tue, 17 Oct 2023 17:32:27 +0400	[thread overview]
Message-ID: <CAMxuvazWSrZHMDqbJZ36CX1WsoWvZh+C0UeGrw=PvME5LUHtpQ@mail.gmail.com> (raw)
In-Reply-To: <20231017131251.43708-1-philmd@linaro.org>

On Tue, Oct 17, 2023 at 5:13 PM Philippe Mathieu-Daudé
<philmd@linaro.org> wrote:
>
> Access to QemuInputHandlerState::handler are read-only.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>

> ---
>  include/hw/virtio/virtio-input.h | 2 +-
>  include/ui/input.h               | 2 +-
>  chardev/msmouse.c                | 2 +-
>  chardev/wctablet.c               | 2 +-
>  hw/char/escc.c                   | 2 +-
>  hw/display/xenfb.c               | 6 +++---
>  hw/input/adb-kbd.c               | 2 +-
>  hw/input/hid.c                   | 6 +++---
>  hw/input/ps2.c                   | 4 ++--
>  hw/input/virtio-input-hid.c      | 8 ++++----
>  ui/input-legacy.c                | 2 +-
>  ui/input.c                       | 4 ++--
>  ui/vdagent.c                     | 2 +-
>  13 files changed, 22 insertions(+), 22 deletions(-)
>
> diff --git a/include/hw/virtio/virtio-input.h b/include/hw/virtio/virtio-input.h
> index 08f1591424..a6c9703644 100644
> --- a/include/hw/virtio/virtio-input.h
> +++ b/include/hw/virtio/virtio-input.h
> @@ -84,7 +84,7 @@ struct VirtIOInputHID {
>      VirtIOInput                       parent_obj;
>      char                              *display;
>      uint32_t                          head;
> -    QemuInputHandler                  *handler;
> +    const QemuInputHandler            *handler;
>      QemuInputHandlerState             *hs;
>      int                               ledstate;
>      bool                              wheel_axis;
> diff --git a/include/ui/input.h b/include/ui/input.h
> index 24d8e4579e..8f9aac562e 100644
> --- a/include/ui/input.h
> +++ b/include/ui/input.h
> @@ -30,7 +30,7 @@ struct QemuInputHandler {
>  };
>
>  QemuInputHandlerState *qemu_input_handler_register(DeviceState *dev,
> -                                                   QemuInputHandler *handler);
> +                                            const QemuInputHandler *handler);
>  void qemu_input_handler_activate(QemuInputHandlerState *s);
>  void qemu_input_handler_deactivate(QemuInputHandlerState *s);
>  void qemu_input_handler_unregister(QemuInputHandlerState *s);
> diff --git a/chardev/msmouse.c b/chardev/msmouse.c
> index ab8fe981d6..a774c397b4 100644
> --- a/chardev/msmouse.c
> +++ b/chardev/msmouse.c
> @@ -171,7 +171,7 @@ static int msmouse_chr_write(struct Chardev *s, const uint8_t *buf, int len)
>      return len;
>  }
>
> -static QemuInputHandler msmouse_handler = {
> +static const QemuInputHandler msmouse_handler = {
>      .name  = "QEMU Microsoft Mouse",
>      .mask  = INPUT_EVENT_MASK_BTN | INPUT_EVENT_MASK_REL,
>      .event = msmouse_input_event,
> diff --git a/chardev/wctablet.c b/chardev/wctablet.c
> index 43bdf6b608..f4008bf35b 100644
> --- a/chardev/wctablet.c
> +++ b/chardev/wctablet.c
> @@ -178,7 +178,7 @@ static void wctablet_input_sync(DeviceState *dev)
>      }
>  }
>
> -static QemuInputHandler wctablet_handler = {
> +static const QemuInputHandler wctablet_handler = {
>      .name  = "QEMU Wacom Pen Tablet",
>      .mask  = INPUT_EVENT_MASK_BTN | INPUT_EVENT_MASK_ABS,
>      .event = wctablet_input_event,
> diff --git a/hw/char/escc.c b/hw/char/escc.c
> index 4be66053c1..48b30ee760 100644
> --- a/hw/char/escc.c
> +++ b/hw/char/escc.c
> @@ -845,7 +845,7 @@ static void sunkbd_handle_event(DeviceState *dev, QemuConsole *src,
>      put_queue(s, keycode);
>  }
>
> -static QemuInputHandler sunkbd_handler = {
> +static const QemuInputHandler sunkbd_handler = {
>      .name  = "sun keyboard",
>      .mask  = INPUT_EVENT_MASK_KEY,
>      .event = sunkbd_handle_event,
> diff --git a/hw/display/xenfb.c b/hw/display/xenfb.c
> index 0074a9b6f8..b2130a0d70 100644
> --- a/hw/display/xenfb.c
> +++ b/hw/display/xenfb.c
> @@ -321,20 +321,20 @@ static void xenfb_mouse_sync(DeviceState *dev)
>      xenfb->wheel = 0;
>  }
>
> -static QemuInputHandler xenfb_keyboard = {
> +static const QemuInputHandler xenfb_keyboard = {
>      .name  = "Xen PV Keyboard",
>      .mask  = INPUT_EVENT_MASK_KEY,
>      .event = xenfb_key_event,
>  };
>
> -static QemuInputHandler xenfb_abs_mouse = {
> +static const QemuInputHandler xenfb_abs_mouse = {
>      .name  = "Xen PV Mouse",
>      .mask  = INPUT_EVENT_MASK_BTN | INPUT_EVENT_MASK_ABS,
>      .event = xenfb_mouse_event,
>      .sync  = xenfb_mouse_sync,
>  };
>
> -static QemuInputHandler xenfb_rel_mouse = {
> +static const QemuInputHandler xenfb_rel_mouse = {
>      .name  = "Xen PV Mouse",
>      .mask  = INPUT_EVENT_MASK_BTN | INPUT_EVENT_MASK_REL,
>      .event = xenfb_mouse_event,
> diff --git a/hw/input/adb-kbd.c b/hw/input/adb-kbd.c
> index a9088c910c..e21edf9acd 100644
> --- a/hw/input/adb-kbd.c
> +++ b/hw/input/adb-kbd.c
> @@ -355,7 +355,7 @@ static void adb_kbd_reset(DeviceState *dev)
>      s->count = 0;
>  }
>
> -static QemuInputHandler adb_keyboard_handler = {
> +static const QemuInputHandler adb_keyboard_handler = {
>      .name  = "QEMU ADB Keyboard",
>      .mask  = INPUT_EVENT_MASK_KEY,
>      .event = adb_keyboard_event,
> diff --git a/hw/input/hid.c b/hw/input/hid.c
> index a9c7dd1ce1..b8e85374ca 100644
> --- a/hw/input/hid.c
> +++ b/hw/input/hid.c
> @@ -510,20 +510,20 @@ void hid_free(HIDState *hs)
>      hid_del_idle_timer(hs);
>  }
>
> -static QemuInputHandler hid_keyboard_handler = {
> +static const QemuInputHandler hid_keyboard_handler = {
>      .name  = "QEMU HID Keyboard",
>      .mask  = INPUT_EVENT_MASK_KEY,
>      .event = hid_keyboard_event,
>  };
>
> -static QemuInputHandler hid_mouse_handler = {
> +static const QemuInputHandler hid_mouse_handler = {
>      .name  = "QEMU HID Mouse",
>      .mask  = INPUT_EVENT_MASK_BTN | INPUT_EVENT_MASK_REL,
>      .event = hid_pointer_event,
>      .sync  = hid_pointer_sync,
>  };
>
> -static QemuInputHandler hid_tablet_handler = {
> +static const QemuInputHandler hid_tablet_handler = {
>      .name  = "QEMU HID Tablet",
>      .mask  = INPUT_EVENT_MASK_BTN | INPUT_EVENT_MASK_ABS,
>      .event = hid_pointer_event,
> diff --git a/hw/input/ps2.c b/hw/input/ps2.c
> index 45af76a837..c8fd23cf36 100644
> --- a/hw/input/ps2.c
> +++ b/hw/input/ps2.c
> @@ -1231,7 +1231,7 @@ static const VMStateDescription vmstate_ps2_mouse = {
>      }
>  };
>
> -static QemuInputHandler ps2_keyboard_handler = {
> +static const QemuInputHandler ps2_keyboard_handler = {
>      .name  = "QEMU PS/2 Keyboard",
>      .mask  = INPUT_EVENT_MASK_KEY,
>      .event = ps2_keyboard_event,
> @@ -1242,7 +1242,7 @@ static void ps2_kbd_realize(DeviceState *dev, Error **errp)
>      qemu_input_handler_register(dev, &ps2_keyboard_handler);
>  }
>
> -static QemuInputHandler ps2_mouse_handler = {
> +static const QemuInputHandler ps2_mouse_handler = {
>      .name  = "QEMU PS/2 Mouse",
>      .mask  = INPUT_EVENT_MASK_BTN | INPUT_EVENT_MASK_REL,
>      .event = ps2_mouse_event,
> diff --git a/hw/input/virtio-input-hid.c b/hw/input/virtio-input-hid.c
> index 7053ad72d4..45e4d4c75d 100644
> --- a/hw/input/virtio-input-hid.c
> +++ b/hw/input/virtio-input-hid.c
> @@ -265,7 +265,7 @@ static const TypeInfo virtio_input_hid_info = {
>
>  /* ----------------------------------------------------------------- */
>
> -static QemuInputHandler virtio_keyboard_handler = {
> +static const QemuInputHandler virtio_keyboard_handler = {
>      .name  = VIRTIO_ID_NAME_KEYBOARD,
>      .mask  = INPUT_EVENT_MASK_KEY,
>      .event = virtio_input_handle_event,
> @@ -322,7 +322,7 @@ static const TypeInfo virtio_keyboard_info = {
>
>  /* ----------------------------------------------------------------- */
>
> -static QemuInputHandler virtio_mouse_handler = {
> +static const QemuInputHandler virtio_mouse_handler = {
>      .name  = VIRTIO_ID_NAME_MOUSE,
>      .mask  = INPUT_EVENT_MASK_BTN | INPUT_EVENT_MASK_REL,
>      .event = virtio_input_handle_event,
> @@ -416,7 +416,7 @@ static const TypeInfo virtio_mouse_info = {
>
>  /* ----------------------------------------------------------------- */
>
> -static QemuInputHandler virtio_tablet_handler = {
> +static const QemuInputHandler virtio_tablet_handler = {
>      .name  = VIRTIO_ID_NAME_TABLET,
>      .mask  = INPUT_EVENT_MASK_BTN | INPUT_EVENT_MASK_ABS,
>      .event = virtio_input_handle_event,
> @@ -541,7 +541,7 @@ static const TypeInfo virtio_tablet_info = {
>
>  /* ----------------------------------------------------------------- */
>
> -static QemuInputHandler virtio_multitouch_handler = {
> +static const QemuInputHandler virtio_multitouch_handler = {
>      .name  = VIRTIO_ID_NAME_MULTITOUCH,
>      .mask  = INPUT_EVENT_MASK_BTN | INPUT_EVENT_MASK_MTT,
>      .event = virtio_input_handle_event,
> diff --git a/ui/input-legacy.c b/ui/input-legacy.c
> index 46ea74e44d..210ae5eaca 100644
> --- a/ui/input-legacy.c
> +++ b/ui/input-legacy.c
> @@ -127,7 +127,7 @@ static void legacy_kbd_event(DeviceState *dev, QemuConsole *src,
>      }
>  }
>
> -static QemuInputHandler legacy_kbd_handler = {
> +static const QemuInputHandler legacy_kbd_handler = {
>      .name  = "legacy-kbd",
>      .mask  = INPUT_EVENT_MASK_KEY,
>      .event = legacy_kbd_event,
> diff --git a/ui/input.c b/ui/input.c
> index cbe8573c5c..dc745860f4 100644
> --- a/ui/input.c
> +++ b/ui/input.c
> @@ -10,7 +10,7 @@
>
>  struct QemuInputHandlerState {
>      DeviceState       *dev;
> -    QemuInputHandler  *handler;
> +    const QemuInputHandler *handler;
>      int               id;
>      int               events;
>      QemuConsole       *con;
> @@ -46,7 +46,7 @@ static uint32_t queue_count;
>  static uint32_t queue_limit = 1024;
>
>  QemuInputHandlerState *qemu_input_handler_register(DeviceState *dev,
> -                                                   QemuInputHandler *handler)
> +                                            const QemuInputHandler *handler)
>  {
>      QemuInputHandlerState *s = g_new0(QemuInputHandlerState, 1);
>      static int id = 1;
> diff --git a/ui/vdagent.c b/ui/vdagent.c
> index 00d36a8677..706d6d97bd 100644
> --- a/ui/vdagent.c
> +++ b/ui/vdagent.c
> @@ -297,7 +297,7 @@ static void vdagent_pointer_sync(DeviceState *dev)
>      }
>  }
>
> -static QemuInputHandler vdagent_mouse_handler = {
> +static const QemuInputHandler vdagent_mouse_handler = {
>      .name  = "vdagent mouse",
>      .mask  = INPUT_EVENT_MASK_BTN | INPUT_EVENT_MASK_ABS,
>      .event = vdagent_pointer_event,
> --
> 2.41.0
>



  reply	other threads:[~2023-10-17 13:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-17 13:12 [PATCH] ui/input: Constify QemuInputHandler structure Philippe Mathieu-Daudé
2023-10-17 13:32 ` Marc-André Lureau [this message]
2023-10-17 20:03 ` Mark Cave-Ayland
2023-10-19 21:41 ` Philippe Mathieu-Daudé

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='CAMxuvazWSrZHMDqbJZ36CX1WsoWvZh+C0UeGrw=PvME5LUHtpQ@mail.gmail.com' \
    --to=marcandre.lureau@redhat.com \
    --cc=anthony.perard@citrix.com \
    --cc=gaosong@loongson.cn \
    --cc=kraxel@redhat.com \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=mst@redhat.com \
    --cc=paul@xen.org \
    --cc=pbonzini@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.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).