Skip to contentSkip to conversation

hw/display: Guard new_blob to fix Wunused-function

PATCH In review Brian Cain 2 participants 3 messages Sep 11 – Sep 14

lore
Share & tools
lore

Brian Cain

author
#0 lore raw

PATCH 1/1 hw/display: Guard new_blob to fix Wunused-function

The call to virtio_gpu_virgl_resource_new_blob() should be guarded like the (sole) caller is, to avoid -Wunused-function.

../hw/display/virtio-gpu-virgl.c:328:1: error: ‘virtio_gpu_virgl_resource_new_blob’ defined but not used [-Werror=unused-function]
328 | virtio_gpu_virgl_resource_new_blob(uint32_t resource_id, uint64_t blob_size)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

---
 hw/display/virtio-gpu-virgl.c | 2 ++
 1 file changed, 2 insertions(+)
hw/display/virtio-gpu-virgl.c +2 -0
index 1c9380e2a6d..f45571060fe 100644
@@ -324,6 +324,7 @@ virtio_gpu_virgl_resource_new(uint32_t resource_id, uint32_t width,
     return res;
 }
 
+#if VIRGL_VERSION_MAJOR >= 1
 static struct virtio_gpu_virgl_resource *
 virtio_gpu_virgl_resource_new_blob(uint32_t resource_id, uint64_t blob_size)
 {
@@ -335,6 +336,7 @@ virtio_gpu_virgl_resource_new_blob(uint32_t resource_id, uint64_t blob_size)
 
     return res;
 }
+#endif
 
 static void virgl_cmd_create_resource_2d(VirtIOGPU *g,
                                          struct virtio_gpu_ctrl_command *cmd)
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 1 line · Brian Cain

The call to virtio_gpu_virgl_resource_new_blob() should be guarded like

s/call to/definition of/

Quoted 7 lines

the (sole) caller is, to avoid -Wunused-function.

../hw/display/virtio-gpu-virgl.c:328:1: error: ‘virtio_gpu_virgl_resource_new_blob’ defined but not used [-Werror=unused-function]
328 | virtio_gpu_virgl_resource_new_blob(uint32_t resource_id, uint64_t blob_size)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

May also have:

Fixes d814b44636d0 ("hw/display/virtio-gpu: introduce virtio_gpu_{simple,virgl}_resource_new()")

Nevertheless, everything other than these nits looks good, so:

Regards,
Akihiko Odaki

Quoted 24 lines
---
  hw/display/virtio-gpu-virgl.c | 2 ++
  1 file changed, 2 insertions(+)
hw/display/virtio-gpu-virgl.c +2 -0
index 1c9380e2a6d..f45571060fe 100644
@@ -324,6 +324,7 @@ virtio_gpu_virgl_resource_new(uint32_t resource_id, uint32_t width,
      return res;
  }
 
+#if VIRGL_VERSION_MAJOR >= 1
  static struct virtio_gpu_virgl_resource *
  virtio_gpu_virgl_resource_new_blob(uint32_t resource_id, uint64_t blob_size)
  {
@@ -335,6 +336,7 @@ virtio_gpu_virgl_resource_new_blob(uint32_t resource_id, uint64_t blob_size)
 
      return res;
  }
+#endif
 
  static void virgl_cmd_create_resource_2d(VirtIOGPU *g,
                                           struct virtio_gpu_ctrl_command *cmd)
author
#2 lore raw
Quoted 4 lines · Akihiko Odaki
Quoted 1 line · Brian Cain

The call to virtio_gpu_virgl_resource_new_blob() should be guarded like

s/call to/definition of/

yeah - I was going to send a v2 when I noticed this but realized that Marc-Andre had sent their fix prior to mine.  So I figured this one was obsolete.

Quoted 44 lines
Quoted 8 lines

the (sole) caller is, to avoid -Wunused-function.

         ../hw/display/virtio-gpu-virgl.c:328:1: error: ‘virtio_gpu_virgl_resource_new_blob’ defined but not used [-Werror=unused-function] 328 | virtio_gpu_virgl_resource_new_blob(uint32_t resource_id, uint64_t blob_size)
           | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

May also have:

Fixes d814b44636d0 ("hw/display/virtio-gpu: introduce virtio_gpu_{simple,virgl}_resource_new()")

Nevertheless, everything other than these nits looks good, so:

Regards,
Akihiko Odaki

Quoted 23 lines

---
  hw/display/virtio-gpu-virgl.c | 2 ++

  1 file changed, 2 insertions(+)
hw/display/virtio-gpu-virgl.c +0 -0
index 1c9380e2a6d..f45571060fe 100644
@@ -324,6 +324,7 @@ virtio_gpu_virgl_resource_new(uint32_t 
 resource_id, uint32_t width,
       return res;
   }

  +#if VIRGL_VERSION_MAJOR >= 1
  static struct virtio_gpu_virgl_resource * virtio_gpu_virgl_resource_new_blob(uint32_t resource_id, uint64_t blob_size) {

hw/display/virtio-gpu-virgl.c +1 -0
@@ -335,6 +336,7 @@ virtio_gpu_virgl_resource_new_blob(uint32_t 
 resource_id, uint64_t blob_size)
         return res;
   }
+#endif
     static void virgl_cmd_create_resource_2d(VirtIOGPU *g,
                                            struct virtio_gpu_ctrl_command *cmd)