diff mbox series

[v2,4/7] hw/xen: Make XenDevOps structures const

Message ID 20240510104908.76908-5-philmd@linaro.org (mailing list archive)
State New, archived
Headers show
Series hw/xen: Simplify legacy backends handling | expand

Commit Message

Philippe Mathieu-Daudé May 10, 2024, 10:49 a.m. UTC
Keep XenDevOps structures in .rodata.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/xen/xen-legacy-backend.h | 8 ++++----
 hw/9pfs/xen-9p-backend.c            | 2 +-
 hw/display/xenfb.c                  | 4 ++--
 hw/usb/xen-usb.c                    | 4 ++--
 4 files changed, 9 insertions(+), 9 deletions(-)

Comments

Paul Durrant May 31, 2024, 9:52 a.m. UTC | #1
On 10/05/2024 11:49, Philippe Mathieu-Daudé wrote:
> Keep XenDevOps structures in .rodata.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   include/hw/xen/xen-legacy-backend.h | 8 ++++----
>   hw/9pfs/xen-9p-backend.c            | 2 +-
>   hw/display/xenfb.c                  | 4 ++--
>   hw/usb/xen-usb.c                    | 4 ++--
>   4 files changed, 9 insertions(+), 9 deletions(-)
> 

Reviewed-by: Paul Durrant <paul@xen.org>
diff mbox series

Patch

diff --git a/include/hw/xen/xen-legacy-backend.h b/include/hw/xen/xen-legacy-backend.h
index 2b2e43c7e7..cfa43a984a 100644
--- a/include/hw/xen/xen-legacy-backend.h
+++ b/include/hw/xen/xen-legacy-backend.h
@@ -67,13 +67,13 @@  static inline void xen_be_unmap_grant_ref(struct XenLegacyDevice *xendev,
 }
 
 /* actual backend drivers */
-extern struct XenDevOps xen_kbdmouse_ops;     /* xen_framebuffer.c */
-extern struct XenDevOps xen_framebuffer_ops;  /* xen_framebuffer.c */
+extern const struct XenDevOps xen_kbdmouse_ops;     /* xen_framebuffer.c */
+extern const struct XenDevOps xen_framebuffer_ops;  /* xen_framebuffer.c */
 #ifdef CONFIG_VIRTFS
-extern struct XenDevOps xen_9pfs_ops;       /* xen-9p-backend.c        */
+extern const struct XenDevOps xen_9pfs_ops;         /* xen-9p-backend.c  */
 #endif
 #ifdef CONFIG_USB_LIBUSB
-extern struct XenDevOps xen_usb_ops;          /* xen-usb.c         */
+extern const struct XenDevOps xen_usb_ops;          /* xen-usb.c         */
 #endif
 
 /* configuration (aka xenbus setup) */
diff --git a/hw/9pfs/xen-9p-backend.c b/hw/9pfs/xen-9p-backend.c
index 4aa9c8c736..b1780eb819 100644
--- a/hw/9pfs/xen-9p-backend.c
+++ b/hw/9pfs/xen-9p-backend.c
@@ -513,7 +513,7 @@  static void xen_9pfs_alloc(struct XenLegacyDevice *xendev)
     xenstore_write_be_int(xendev, "max-ring-page-order", MAX_RING_ORDER);
 }
 
-struct XenDevOps xen_9pfs_ops = {
+const struct XenDevOps xen_9pfs_ops = {
     .size       = sizeof(Xen9pfsDev),
     .flags      = DEVOPS_FLAG_NEED_GNTDEV,
     .alloc      = xen_9pfs_alloc,
diff --git a/hw/display/xenfb.c b/hw/display/xenfb.c
index b2130a0d70..dd83d0f5a5 100644
--- a/hw/display/xenfb.c
+++ b/hw/display/xenfb.c
@@ -972,7 +972,7 @@  static void fb_event(struct XenLegacyDevice *xendev)
 
 /* -------------------------------------------------------------------- */
 
-struct XenDevOps xen_kbdmouse_ops = {
+const struct XenDevOps xen_kbdmouse_ops = {
     .size       = sizeof(struct XenInput),
     .init       = input_init,
     .initialise = input_initialise,
@@ -981,7 +981,7 @@  struct XenDevOps xen_kbdmouse_ops = {
     .event      = input_event,
 };
 
-struct XenDevOps xen_framebuffer_ops = {
+const struct XenDevOps xen_framebuffer_ops = {
     .size       = sizeof(struct XenFB),
     .init       = fb_init,
     .initialise = fb_initialise,
diff --git a/hw/usb/xen-usb.c b/hw/usb/xen-usb.c
index 09ec326aea..95a901e81f 100644
--- a/hw/usb/xen-usb.c
+++ b/hw/usb/xen-usb.c
@@ -1083,7 +1083,7 @@  static void usbback_event(struct XenLegacyDevice *xendev)
     qemu_bh_schedule(usbif->bh);
 }
 
-struct XenDevOps xen_usb_ops = {
+const struct XenDevOps xen_usb_ops = {
     .size            = sizeof(struct usbback_info),
     .flags           = DEVOPS_FLAG_NEED_GNTDEV,
     .init            = usbback_init,
@@ -1102,7 +1102,7 @@  static int usbback_not_supported(void)
     return -EINVAL;
 }
 
-struct XenDevOps xen_usb_ops = {
+const struct XenDevOps xen_usb_ops = {
     .backend_register = usbback_not_supported,
 };