arch: Compute the array size by nitems

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao
2023-07-26 09:33:38 +02:00
committed by Alin Jerpelea
parent 7ca4c916eb
commit 46b25b3849
14 changed files with 33 additions and 19 deletions
+2 -1
View File
@@ -26,6 +26,7 @@
#include <nuttx/sched.h>
#include <arch/irq.h>
#include <sys/param.h>
/****************************************************************************
* Private Data
@@ -66,7 +67,7 @@ const struct tcbinfo_s g_tcbinfo =
.stack_size_off = TCB_STACK_SIZE_OFF,
.regs_off = TCB_REGS_OFF,
.basic_num = 17,
.total_num = sizeof(g_reg_offs) / sizeof(g_reg_offs[0]),
.total_num = nitems(g_reg_offs),
{
.p = g_reg_offs,
},
+2 -1
View File
@@ -26,6 +26,7 @@
#include <nuttx/sched.h>
#include <arch/irq.h>
#include <sys/param.h>
/****************************************************************************
* Private Data
@@ -73,7 +74,7 @@ const struct tcbinfo_s g_tcbinfo =
.stack_size_off = TCB_STACK_SIZE_OFF,
.regs_off = TCB_REGS_OFF,
.basic_num = 17,
.total_num = sizeof(g_reg_offs) / sizeof(g_reg_offs[0]),
.total_num = nitems(g_reg_offs),
{
.p = g_reg_offs,
},
+2 -1
View File
@@ -26,6 +26,7 @@
#include <nuttx/sched.h>
#include <arch/irq.h>
#include <sys/param.h>
/****************************************************************************
* Private Data
@@ -108,7 +109,7 @@ const struct tcbinfo_s g_tcbinfo =
.stack_size_off = TCB_STACK_SIZE_OFF,
.regs_off = TCB_REGS_OFF,
.basic_num = 17,
.total_num = sizeof(g_reg_offs) / sizeof(g_reg_offs[0]),
.total_num = nitems(g_reg_offs),
{
.p = g_reg_offs,
},
+2 -1
View File
@@ -26,6 +26,7 @@
#include <nuttx/sched.h>
#include <arch/irq.h>
#include <sys/param.h>
/****************************************************************************
* Private Data
@@ -114,7 +115,7 @@ const struct tcbinfo_s g_tcbinfo =
.stack_size_off = TCB_STACK_SIZE_OFF,
.regs_off = TCB_REGS_OFF,
.basic_num = 17,
.total_num = sizeof(g_reg_offs) / sizeof(g_reg_offs[0]),
.total_num = nitems(g_reg_offs),
{
.p = g_reg_offs,
},
+2 -1
View File
@@ -26,6 +26,7 @@
#include <nuttx/sched.h>
#include <arch/irq.h>
#include <sys/param.h>
/****************************************************************************
* Private Data
@@ -108,7 +109,7 @@ const struct tcbinfo_s g_tcbinfo =
.stack_size_off = TCB_STACK_SIZE_OFF,
.regs_off = TCB_REGS_OFF,
.basic_num = 17,
.total_num = sizeof(g_reg_offs) / sizeof(g_reg_offs[0]),
.total_num = nitems(g_reg_offs),
{
.p = g_reg_offs,
},
+2 -1
View File
@@ -26,6 +26,7 @@
#include <nuttx/sched.h>
#include <arch/irq.h>
#include <sys/param.h>
/****************************************************************************
* Private Data
@@ -114,7 +115,7 @@ const struct tcbinfo_s g_tcbinfo =
.stack_size_off = TCB_STACK_SIZE_OFF,
.regs_off = TCB_REGS_OFF,
.basic_num = 17,
.total_num = sizeof(g_reg_offs) / sizeof(g_reg_offs[0]),
.total_num = nitems(g_reg_offs),
{
.p = g_reg_offs,
},
+2 -1
View File
@@ -26,6 +26,7 @@
#include <nuttx/sched.h>
#include <arch/irq.h>
#include <sys/param.h>
/****************************************************************************
* Private Data
@@ -106,7 +107,7 @@ const struct tcbinfo_s g_tcbinfo =
.name_off = TCB_NAME_OFF,
.regs_off = TCB_REGS_OFF,
.basic_num = 17,
.total_num = sizeof(g_reg_offs) / sizeof(g_reg_offs[0]),
.total_num = nitems(g_reg_offs),
{
.p = g_reg_offs,
},
+3 -2
View File
@@ -26,6 +26,7 @@
#include <nuttx/sched.h>
#include <arch/irq.h>
#include <sys/param.h>
/****************************************************************************
* Private Data
@@ -81,8 +82,8 @@ const struct tcbinfo_s g_tcbinfo =
.stack_off = TCB_STACK_OFF,
.stack_size_off = TCB_STACK_SIZE_OFF,
.regs_off = TCB_REGS_OFF,
.basic_num = sizeof(g_reg_offs) / sizeof(g_reg_offs[0]),
.total_num = sizeof(g_reg_offs) / sizeof(g_reg_offs[0]),
.basic_num = nitems(g_reg_offs),
.total_num = nitems(g_reg_offs),
{
.p = g_reg_offs,
},
+2 -1
View File
@@ -26,6 +26,7 @@
#include <nuttx/sched.h>
#include <arch/irq.h>
#include <sys/param.h>
/****************************************************************************
* Private Data
@@ -120,7 +121,7 @@ const struct tcbinfo_s g_tcbinfo =
.stack_size_off = TCB_STACK_SIZE_OFF,
.regs_off = TCB_REGS_OFF,
.basic_num = 33,
.total_num = sizeof(g_reg_offs) / sizeof(g_reg_offs[0]),
.total_num = nitems(g_reg_offs),
{
.p = g_reg_offs,
},
+3 -2
View File
@@ -26,6 +26,7 @@
#include <nuttx/sched.h>
#include <arch/irq.h>
#include <sys/param.h>
/****************************************************************************
* Private Data
@@ -92,8 +93,8 @@ const struct tcbinfo_s g_tcbinfo =
.stack_off = TCB_STACK_OFF,
.stack_size_off = TCB_STACK_SIZE_OFF,
.regs_off = TCB_REGS_OFF,
.basic_num = sizeof(g_reg_offs) / sizeof(g_reg_offs[0]),
.total_num = sizeof(g_reg_offs) / sizeof(g_reg_offs[0]),
.basic_num = nitems(g_reg_offs),
.total_num = nitems(g_reg_offs),
{
.p = g_reg_offs,
},
+3 -2
View File
@@ -26,6 +26,7 @@
#include <nuttx/sched.h>
#include <arch/irq.h>
#include <sys/param.h>
/****************************************************************************
* Private Data
@@ -80,8 +81,8 @@ const struct tcbinfo_s g_tcbinfo =
.stack_off = TCB_STACK_OFF,
.stack_size_off = TCB_STACK_SIZE_OFF,
.regs_off = TCB_REGS_OFF,
.basic_num = sizeof(g_reg_offs) / sizeof(g_reg_offs[0]),
.total_num = sizeof(g_reg_offs) / sizeof(g_reg_offs[0]),
.basic_num = nitems(g_reg_offs),
.total_num = nitems(g_reg_offs),
{
.p = g_reg_offs,
},
+3 -2
View File
@@ -26,6 +26,7 @@
#include <nuttx/sched.h>
#include <arch/irq.h>
#include <sys/param.h>
/****************************************************************************
* Private Data
@@ -63,8 +64,8 @@ const struct tcbinfo_s g_tcbinfo =
.stack_off = TCB_STACK_OFF,
.stack_size_off = TCB_STACK_SIZE_OFF,
.regs_off = TCB_REGS_OFF,
.basic_num = sizeof(g_reg_offs) / sizeof(g_reg_offs[0]),
.total_num = sizeof(g_reg_offs) / sizeof(g_reg_offs[0]),
.basic_num = nitems(g_reg_offs),
.total_num = nitems(g_reg_offs),
{
.p = g_reg_offs,
},
+3 -2
View File
@@ -26,6 +26,7 @@
#include <nuttx/sched.h>
#include <arch/irq.h>
#include <sys/param.h>
/****************************************************************************
* Private Data
@@ -71,8 +72,8 @@ const struct tcbinfo_s g_tcbinfo =
.stack_off = TCB_STACK_OFF,
.stack_size_off = TCB_STACK_SIZE_OFF,
.regs_off = TCB_REGS_OFF,
.basic_num = sizeof(g_reg_offs) / sizeof(g_reg_offs[0]),
.total_num = sizeof(g_reg_offs) / sizeof(g_reg_offs[0]),
.basic_num = nitems(g_reg_offs),
.total_num = nitems(g_reg_offs),
{
.p = g_reg_offs,
},
+2 -1
View File
@@ -26,6 +26,7 @@
#include <nuttx/sched.h>
#include <arch/irq.h>
#include <sys/param.h>
/****************************************************************************
* Private Data
@@ -67,7 +68,7 @@ const struct tcbinfo_s g_tcbinfo =
.stack_size_off = TCB_STACK_SIZE_OFF,
.regs_off = TCB_REGS_OFF,
.basic_num = COMMON_CTX_REGS,
.total_num = sizeof(g_reg_offs) / sizeof(g_reg_offs[0]),
.total_num = nitems(g_reg_offs),
{
.p = g_reg_offs,
},