diff mbox series

hw/usb: Use __attribute__((packed)) vs __packed

Message ID 20241101211720.3354111-1-roqueh@google.com (mailing list archive)
State New
Headers show
Series hw/usb: Use __attribute__((packed)) vs __packed | expand

Commit Message

Roque Arcudia Hernandez Nov. 1, 2024, 9:17 p.m. UTC
__packed is non standard and is not present in clang-cl.
__attribute__((packed)) has the same semantics.

Signed-off-by: Erwin Jansen <jansene@google.com>
Signed-off-by: Roque Arcudia Hernandez <roqueh@google.com>
---
 include/hw/usb/dwc2-regs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Pierrick Bouvier Nov. 1, 2024, 9:32 p.m. UTC | #1
On 11/1/24 14:17, Roque Arcudia Hernandez wrote:
> __packed is non standard and is not present in clang-cl.
> __attribute__((packed)) has the same semantics.
> 
> Signed-off-by: Erwin Jansen <jansene@google.com>
> Signed-off-by: Roque Arcudia Hernandez <roqueh@google.com>
> ---
>   include/hw/usb/dwc2-regs.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/hw/usb/dwc2-regs.h b/include/hw/usb/dwc2-regs.h
> index 523b112c5e..b8b4266543 100644
> --- a/include/hw/usb/dwc2-regs.h
> +++ b/include/hw/usb/dwc2-regs.h
> @@ -838,7 +838,7 @@
>   struct dwc2_dma_desc {
>           uint32_t status;
>           uint32_t buf;
> -} __packed;
> +} QEMU_PACKED;
>   
>   /* Host Mode DMA descriptor status quadlet */
>   

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Thomas Huth Nov. 4, 2024, 7:37 a.m. UTC | #2
On 01/11/2024 22.17, Roque Arcudia Hernandez wrote:
> __packed is non standard and is not present in clang-cl.
> __attribute__((packed)) has the same semantics.
> 
> Signed-off-by: Erwin Jansen <jansene@google.com>
> Signed-off-by: Roque Arcudia Hernandez <roqueh@google.com>
> ---
>   include/hw/usb/dwc2-regs.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/hw/usb/dwc2-regs.h b/include/hw/usb/dwc2-regs.h
> index 523b112c5e..b8b4266543 100644
> --- a/include/hw/usb/dwc2-regs.h
> +++ b/include/hw/usb/dwc2-regs.h
> @@ -838,7 +838,7 @@
>   struct dwc2_dma_desc {
>           uint32_t status;
>           uint32_t buf;
> -} __packed;
> +} QEMU_PACKED;

Reviewed-by: Thomas Huth <thuth@redhat.com>

Actually, the struct only consists of two 32-bit values, so I doubt that the 
"packed" is needed here at all. Maybe we could even simply remove it?

  Thomas
diff mbox series

Patch

diff --git a/include/hw/usb/dwc2-regs.h b/include/hw/usb/dwc2-regs.h
index 523b112c5e..b8b4266543 100644
--- a/include/hw/usb/dwc2-regs.h
+++ b/include/hw/usb/dwc2-regs.h
@@ -838,7 +838,7 @@ 
 struct dwc2_dma_desc {
         uint32_t status;
         uint32_t buf;
-} __packed;
+} QEMU_PACKED;
 
 /* Host Mode DMA descriptor status quadlet */