diff mbox series

[XEN] xen/arm: smmu: move phys_addr_t definition to linux-compat.h

Message ID e525cd0a2770743e052819b2e14f7df50f801a23.1702303903.git.federico.serafini@bugseng.com (mailing list archive)
State New
Headers show
Series [XEN] xen/arm: smmu: move phys_addr_t definition to linux-compat.h | expand

Commit Message

Federico Serafini Dec. 11, 2023, 2:54 p.m. UTC
Both smmu and smmu-v3 (ported from Linux) define the typedef name
"phys_addr_t": move the type definition to the common header
linux-compat.h to address violations of MISRA C:2012 Rule 5.6
("A typedef name shall be a unique identifier").
No functional change.

Suggested-by: Jan Beulich <jbeulich@suse.com>
Suggested-by: Julien Grall <julien@xen.org>
Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
---
 xen/drivers/passthrough/arm/smmu-v3.h | 1 -
 xen/drivers/passthrough/arm/smmu.c    | 1 -
 xen/include/xen/linux-compat.h        | 1 +
 3 files changed, 1 insertion(+), 2 deletions(-)

Comments

Jan Beulich Dec. 11, 2023, 4:11 p.m. UTC | #1
On 11.12.2023 15:54, Federico Serafini wrote:
> --- a/xen/include/xen/linux-compat.h
> +++ b/xen/include/xen/linux-compat.h
> @@ -16,5 +16,6 @@ typedef uint8_t __u8;
>  typedef int16_t __s16;
>  typedef int32_t __s32;
>  typedef int64_t __s64;
> +typedef paddr_t phys_addr_t;

Nit: Wants a blank line above the addition. If no need for a v2 arises,
I'd be happy to adjust on commit.

>  
>  #endif /* __XEN_LINUX_COMPAT_H__ */

Acked-by: Jan Beulich <jbeulich@suse.com>

Jan
Julien Grall Dec. 12, 2023, 11:49 a.m. UTC | #2
On 11/12/2023 14:54, Federico Serafini wrote:
> Both smmu and smmu-v3 (ported from Linux) define the typedef name
> "phys_addr_t": move the type definition to the common header
> linux-compat.h to address violations of MISRA C:2012 Rule 5.6
> ("A typedef name shall be a unique identifier").
> No functional change.
> 
> Suggested-by: Jan Beulich <jbeulich@suse.com>
> Suggested-by: Julien Grall <julien@xen.org>
> Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>

Regardless of Jan's comment:

Reviewed-by: Julien Grall <jgrall@amazon.com>

Cheers,
diff mbox series

Patch

diff --git a/xen/drivers/passthrough/arm/smmu-v3.h b/xen/drivers/passthrough/arm/smmu-v3.h
index 05f6b1fb7e..f09048812c 100644
--- a/xen/drivers/passthrough/arm/smmu-v3.h
+++ b/xen/drivers/passthrough/arm/smmu-v3.h
@@ -377,7 +377,6 @@ 
 
 /* Linux compatibility functions. */
 typedef paddr_t		dma_addr_t;
-typedef paddr_t		phys_addr_t;
 typedef unsigned int		gfp_t;
 
 /* Alias to Xen lock functions */
diff --git a/xen/drivers/passthrough/arm/smmu.c b/xen/drivers/passthrough/arm/smmu.c
index 11fc1d22ef..32e2ff279b 100644
--- a/xen/drivers/passthrough/arm/smmu.c
+++ b/xen/drivers/passthrough/arm/smmu.c
@@ -199,7 +199,6 @@  static inline int pci_for_each_dma_alias(struct pci_dev *pdev,
 
 /* Xen: misc */
 #define PHYS_MASK_SHIFT		PADDR_BITS
-typedef paddr_t phys_addr_t;
 
 #define VA_BITS		0	/* Only used for configuring stage-1 input size */
 
diff --git a/xen/include/xen/linux-compat.h b/xen/include/xen/linux-compat.h
index 8d06bb6dc9..987ac7d8db 100644
--- a/xen/include/xen/linux-compat.h
+++ b/xen/include/xen/linux-compat.h
@@ -16,5 +16,6 @@  typedef uint8_t __u8;
 typedef int16_t __s16;
 typedef int32_t __s32;
 typedef int64_t __s64;
+typedef paddr_t phys_addr_t;
 
 #endif /* __XEN_LINUX_COMPAT_H__ */