[PATCH 3/5] types: replace remaining uses of s16

Jan Beulich posted 5 patches 2 months, 3 weeks ago
[PATCH 3/5] types: replace remaining uses of s16
Posted by Jan Beulich 2 months, 3 weeks ago
... and move the type itself to linux-compat.h.

While doing so switch an adjacent x86 struct page_info field to bool.

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

--- a/xen/arch/arm/arm32/livepatch.c
+++ b/xen/arch/arm/arm32/livepatch.c
@@ -135,7 +135,7 @@ static s32 get_addend(unsigned char type
         addend =  (*(u32 *)dest & 0x00000FFF);
         addend |= (*(u32 *)dest & 0x000F0000) >> 4;
         /* Addend is to sign-extend ([19:16],[11:0]). */
-        addend = (s16)addend;
+        addend = (int16_t)addend;
         break;
 
     case R_ARM_CALL:
--- a/xen/arch/arm/arm64/livepatch.c
+++ b/xen/arch/arm/arm64/livepatch.c
@@ -124,7 +124,7 @@ static int reloc_data(enum aarch64_reloc
     switch ( len )
     {
     case 16:
-        *(s16 *)place = sval;
+        *(int16_t *)place = sval;
         if ( sval < INT16_MIN || sval > UINT16_MAX )
 	        return -EOVERFLOW;
         break;
--- a/xen/arch/x86/include/asm/irq.h
+++ b/xen/arch/x86/include/asm/irq.h
@@ -67,8 +67,8 @@ struct irq_desc;
  * the old destinations.
  */
 struct arch_irq_desc {
-        s16 vector;                  /* vector itself is only 8 bits, */
-        s16 old_vector;              /* but we use -1 for unassigned  */
+        int16_t vector;                  /* vector itself is only 8 bits, */
+        int16_t old_vector;              /* but we use -1 for unassigned  */
         /*
          * Except for high priority interrupts @cpu_mask may have bits set for
          * offline CPUs.  Consumers need to be careful to mask this down to
--- a/xen/arch/x86/include/asm/mm.h
+++ b/xen/arch/x86/include/asm/mm.h
@@ -286,8 +286,8 @@ struct page_info
         struct {
             u16 nr_validated_ptes:PAGETABLE_ORDER + 1;
             u16 :16 - PAGETABLE_ORDER - 1 - 1;
-            u16 partial_flags:1;
-            s16 linear_pt_count;
+            bool partial_flags:1;
+            int16_t linear_pt_count;
         };
 
         /*
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -1390,7 +1390,7 @@ unmap_common(
     struct grant_table *lgt, *rgt;
     grant_ref_t ref;
     struct active_grant_entry *act;
-    s16              rc = 0;
+    int16_t          rc;
     struct grant_mapping *map;
     unsigned int flags;
     bool put_handle = false;
@@ -2580,7 +2580,7 @@ acquire_grant_for_copy(
     uint16_t trans_page_off;
     uint16_t trans_length;
     bool is_sub_page;
-    s16 rc = GNTST_okay;
+    int16_t rc = GNTST_okay;
     unsigned int pin_incr = readonly ? GNTPIN_hstr_inc : GNTPIN_hstw_inc;
 
     *page = NULL;
@@ -3416,14 +3416,14 @@ gnttab_get_version(XEN_GUEST_HANDLE_PARA
     return 0;
 }
 
-static s16
+static int16_t
 swap_grant_ref(grant_ref_t ref_a, grant_ref_t ref_b)
 {
     struct domain *d = rcu_lock_current_domain();
     struct grant_table *gt = d->grant_table;
     struct active_grant_entry *act_a = NULL;
     struct active_grant_entry *act_b = NULL;
-    s16 rc = GNTST_okay;
+    int16_t rc = GNTST_okay;
 
     grant_write_lock(gt);
 
--- a/xen/drivers/passthrough/arm/smmu.c
+++ b/xen/drivers/passthrough/arm/smmu.c
@@ -43,6 +43,7 @@
 #include <xen/err.h>
 #include <xen/irq.h>
 #include <xen/lib.h>
+#include <xen/linux-compat.h>
 #include <xen/list.h>
 #include <xen/mm.h>
 #include <xen/vmap.h>
--- a/xen/include/xen/linux-compat.h
+++ b/xen/include/xen/linux-compat.h
@@ -13,7 +13,7 @@
 
 typedef int8_t  s8, __s8;
 typedef uint8_t __u8;
-typedef int16_t __s16;
+typedef int16_t s16, __s16;
 typedef int32_t __s32;
 typedef int64_t __s64;
 
--- a/xen/include/xen/types.h
+++ b/xen/include/xen/types.h
@@ -6,7 +6,6 @@
 
 /* Linux inherited types which are being phased out */
 typedef uint8_t u8;
-typedef int16_t s16;
 typedef uint16_t u16, __u16;
 typedef int32_t s32;
 typedef uint32_t u32, __u32;
Re: [PATCH 3/5] types: replace remaining uses of s16
Posted by Roger Pau Monné 2 months, 1 week ago
On Thu, Aug 29, 2024 at 02:00:20PM +0200, Jan Beulich wrote:
> ... and move the type itself to linux-compat.h.
> 
> While doing so switch an adjacent x86 struct page_info field to bool.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>

Thanks, Roger.

Re: [PATCH 3/5] types: replace remaining uses of s16
Posted by Andrew Cooper 2 months, 3 weeks ago
On 29/08/2024 1:00 pm, Jan Beulich wrote:
> ... and move the type itself to linux-compat.h.
>
> While doing so switch an adjacent x86 struct page_info field to bool.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>