Fix nxstyle issue

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao
2020-05-01 02:43:08 +08:00
committed by Alan Carvalho de Assis
parent eca7059785
commit f8a809eb5b
22 changed files with 93 additions and 80 deletions
+3 -3
View File
@@ -185,9 +185,9 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
top_of_stack = (uint32_t) tcb->stack_alloc_ptr + stack_size - 4; top_of_stack = (uint32_t) tcb->stack_alloc_ptr + stack_size - 4;
/* The MINERVA stack must be aligned at word (4 byte) boundaries; for /* The MINERVA stack must be aligned at word (4 byte) boundaries; for
* floating point use, the stack must be aligned to 8-byte addresses. If * floating point use, the stack must be aligned to 8-byte addresses.
* necessary top_of_stack must be rounded down to the next boundary to * If necessary top_of_stack must be rounded down to the next boundary
* meet these alignment requirements. * to meet these alignment requirements.
*/ */
top_of_stack = STACK_ALIGN_DOWN(top_of_stack); top_of_stack = STACK_ALIGN_DOWN(top_of_stack);
+4 -2
View File
@@ -229,8 +229,10 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
* water marks. * water marks.
*/ */
stack_base = (uintptr_t)tcb->stack_alloc_ptr + sizeof(struct tls_info_s); stack_base = (uintptr_t)tcb->stack_alloc_ptr +
stack_size = tcb->adj_stack_size - sizeof(struct tls_info_s); sizeof(struct tls_info_s);
stack_size = tcb->adj_stack_size -
sizeof(struct tls_info_s);
up_stack_color((FAR void *)stack_base, stack_size); up_stack_color((FAR void *)stack_base, stack_size);
#endif /* CONFIG_STACK_COLORATION */ #endif /* CONFIG_STACK_COLORATION */
+2 -1
View File
@@ -57,7 +57,8 @@
* Private Function Prototypes * Private Function Prototypes
****************************************************************************/ ****************************************************************************/
static btn_buttonset_t btn_supported(FAR const struct btn_lowerhalf_s *lower); static btn_buttonset_t
btn_supported(FAR const struct btn_lowerhalf_s *lower);
static btn_buttonset_t btn_buttons(FAR const struct btn_lowerhalf_s *lower); static btn_buttonset_t btn_buttons(FAR const struct btn_lowerhalf_s *lower);
static void btn_enable(FAR const struct btn_lowerhalf_s *lower, static void btn_enable(FAR const struct btn_lowerhalf_s *lower,
btn_buttonset_t press, btn_buttonset_t release, btn_buttonset_t press, btn_buttonset_t release,
+4 -2
View File
@@ -55,7 +55,8 @@
* Private Function Prototypes * Private Function Prototypes
****************************************************************************/ ****************************************************************************/
static userled_set_t userled_supported(FAR const struct userled_lowerhalf_s *lower); static userled_set_t
userled_supported(FAR const struct userled_lowerhalf_s *lower);
static void userled_led(FAR const struct userled_lowerhalf_s *lower, static void userled_led(FAR const struct userled_lowerhalf_s *lower,
int led, bool ledon); int led, bool ledon);
static void userled_ledset(FAR const struct userled_lowerhalf_s *lower, static void userled_ledset(FAR const struct userled_lowerhalf_s *lower,
@@ -86,7 +87,8 @@ static const struct userled_lowerhalf_s g_userled_lower =
* *
****************************************************************************/ ****************************************************************************/
static userled_set_t userled_supported(FAR const struct userled_lowerhalf_s *lower) static userled_set_t
userled_supported(FAR const struct userled_lowerhalf_s *lower)
{ {
ledinfo("BOARD_NLEDS: %02x\n", BOARD_NLEDS); ledinfo("BOARD_NLEDS: %02x\n", BOARD_NLEDS);
return (userled_set_t)((1 << BOARD_NLEDS) - 1); return (userled_set_t)((1 << BOARD_NLEDS) - 1);
+3
View File
@@ -51,7 +51,9 @@
/**************************************************************************** /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
/* Configuration ************************************************************/ /* Configuration ************************************************************/
/* These interfaces are not available to kernel code */ /* These interfaces are not available to kernel code */
#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__) #if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__)
@@ -75,6 +77,7 @@
#endif #endif
/* Standard Definitions *****************************************************/ /* Standard Definitions *****************************************************/
/* aio_cancel return values /* aio_cancel return values
* *
* AIO_ALLDONE - Indicates that none of the requested operations could * AIO_ALLDONE - Indicates that none of the requested operations could
+5 -3
View File
@@ -68,13 +68,15 @@
#else #else
# if defined(__KERNEL__) # if defined(__KERNEL__)
/* Kernel portion of protected/kernel build. Kernel code has direct access */ /* Kernel portion of protected/kernel build. Kernel code has direct
* access
*/
# define __DIRECT_ERRNO_ACCESS 1 # define __DIRECT_ERRNO_ACCESS 1
# else # else
/* User portion of protected/kernel build. Application code has only indirect /* User portion of protected/kernel build. Application code has only
* access * indirect access
*/ */
# undef __DIRECT_ERRNO_ACCESS # undef __DIRECT_ERRNO_ACCESS
+1 -1
View File
@@ -436,7 +436,7 @@ int clock_systimespec(FAR struct timespec *ts);
* Return load measurement data for the select PID. * Return load measurement data for the select PID.
* *
* Input Parameters: * Input Parameters:
* pid - The task ID of the thread of interest. pid == 0 is the IDLE thread. * pid - The task ID of the thread of interest. pid == 0 is IDLE thread.
* cpuload - The location to return the CPU load * cpuload - The location to return the CPU load
* *
* Returned Value: * Returned Value:
+1 -1
View File
@@ -102,7 +102,7 @@ EXTERN const int g_builtin_count;
#endif #endif
/**************************************************************************** /****************************************************************************
* Public Functions * Public Function Prototypes
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
+1 -1
View File
@@ -63,7 +63,7 @@
# define HAVE_GROUP_MEMBERS 1 # define HAVE_GROUP_MEMBERS 1
#endif #endif
/* In any event, we don't need group members if support for pthreads is disabled */ /* We don't need group members if support for pthreads is disabled */
#ifdef CONFIG_DISABLE_PTHREAD #ifdef CONFIG_DISABLE_PTHREAD
# undef HAVE_GROUP_MEMBERS # undef HAVE_GROUP_MEMBERS
+6 -2
View File
@@ -54,7 +54,9 @@
/**************************************************************************** /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
/* Configuration ************************************************************/ /* Configuration ************************************************************/
/* If CONFIG_BUILD_PROTECTED, then CONFIG_NUTTX_USERSPACE must be defined to /* If CONFIG_BUILD_PROTECTED, then CONFIG_NUTTX_USERSPACE must be defined to
* provide the address where the user-space header can be found in memory. * provide the address where the user-space header can be found in memory.
*/ */
@@ -73,6 +75,7 @@
#endif #endif
/* Helper Macros ************************************************************/ /* Helper Macros ************************************************************/
/* This macro is used to access the struct userpace_s header that can be /* This macro is used to access the struct userpace_s header that can be
* found at the beginning of the user-space blob. * found at the beginning of the user-space blob.
*/ */
@@ -91,7 +94,7 @@ struct mm_heaps_s; /* Forward reference */
/* Every user-space blob starts with a header that provides information about /* Every user-space blob starts with a header that provides information about
* the blob. The form of that header is provided by struct userspace_s. An * the blob. The form of that header is provided by struct userspace_s. An
* instance of this structure is expected to reside at CONFIG_NUTTX_USERSPACE. * instance of this is expected to reside at CONFIG_NUTTX_USERSPACE.
*/ */
struct userspace_s struct userspace_s
@@ -166,7 +169,8 @@ extern "C"
****************************************************************************/ ****************************************************************************/
#ifndef __KERNEL__ #ifndef __KERNEL__
void task_startup(main_t entrypt, int argc, FAR char *argv[]) noreturn_function; void task_startup(main_t entrypt, int argc, FAR char *argv[])
noreturn_function;
#endif #endif
/**************************************************************************** /****************************************************************************
+3 -1
View File
@@ -172,7 +172,9 @@ void setbuf(FAR FILE *stream, FAR char *buf);
int setvbuf(FAR FILE *stream, FAR char *buffer, int mode, size_t size); int setvbuf(FAR FILE *stream, FAR char *buffer, int mode, size_t size);
int ungetc(int c, FAR FILE *stream); int ungetc(int c, FAR FILE *stream);
/* Operations on the stdout stream, buffers, paths, and the whole printf-family */ /* Operations on the stdout stream, buffers, paths,
* and the whole printf-family
*/
void perror(FAR const char *s); void perror(FAR const char *s);
int printf(FAR const IPTR char *fmt, ...); int printf(FAR const IPTR char *fmt, ...);
+2 -2
View File
@@ -45,9 +45,11 @@
#include <sys/types.h> #include <sys/types.h>
#include <stdbool.h> #include <stdbool.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <limits.h> #include <limits.h>
#include <semaphore.h> #include <semaphore.h>
#include <nuttx/kmalloc.h>
#include <nuttx/streams.h> #include <nuttx/streams.h>
/**************************************************************************** /****************************************************************************
@@ -82,7 +84,6 @@
*/ */
#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__) #if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__)
# include <nuttx/kmalloc.h>
/* Domain-specific allocations */ /* Domain-specific allocations */
@@ -100,7 +101,6 @@
# define lib_ufree(p) kumm_free(p) # define lib_ufree(p) kumm_free(p)
#else #else
# include <stdlib.h>
/* Domain-specific allocations */ /* Domain-specific allocations */
+4 -2
View File
@@ -1,5 +1,5 @@
/**************************************************************************** /****************************************************************************
* libs/libc/unistd/lib_libdtoa.c * libs/libc/stdio/lib_libdtoa.c
* *
* This file was ported to NuttX by Yolande Cates. * This file was ported to NuttX by Yolande Cates.
* *
@@ -271,7 +271,9 @@ static void lib_dtoa(FAR struct lib_outstream_s *obj, int fmt, int prec,
{ {
obj->put(obj, '.'); obj->put(obj, '.');
/* Always print at least one digit to the right of the decimal point. */ /* Always print at least one digit to the right of the decimal
* point.
*/
if (notrailing) if (notrailing)
{ {
+1 -1
View File
@@ -1,5 +1,5 @@
/**************************************************************************** /****************************************************************************
* libs/libc/unistd/lib_gethostname.c * libs/libc/unistd/lib_sethostname.c
* *
* Copyright (C) 2015 Stavros Polymenis. All rights reserved. * Copyright (C) 2015 Stavros Polymenis. All rights reserved.
* Copyright (C) 2015, 2016 Gregory Nutt. All rights reserved. * Copyright (C) 2015, 2016 Gregory Nutt. All rights reserved.
+7 -8
View File
@@ -45,25 +45,25 @@
#include <sys/types.h> #include <sys/types.h>
#include <stdbool.h> #include <stdbool.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <limits.h> #include <limits.h>
#include <nuttx/kmalloc.h>
#include <nuttx/streams.h> #include <nuttx/streams.h>
/**************************************************************************** /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
/* The NuttX NX library an be build in two modes: (1) as a standard, C-library /* The NuttX NX library can be build in two modes: (1) as a standard, C-
* that can be used by normal, user-space applications, or (2) as a special, * library that can be used by normal, user-space applications, or (2) as
* kernel-mode NX-library only used within the OS. If NuttX is not being * a special, kernel-mode NX-library only used within the OS. If NuttX is
* built as separated kernel- and user-space modules, then only the first * not being built as separated kernel- and user-space modules, then only
* mode is supported. * the first mode is supported.
*/ */
#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__) #if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__)
# include <nuttx/kmalloc.h>
/* Domain-specific allocations */ /* Domain-specific allocations */
# define lib_malloc(s) kmm_malloc(s) # define lib_malloc(s) kmm_malloc(s)
@@ -80,7 +80,6 @@
# define lib_ufree(p) kumm_free(p) # define lib_ufree(p) kumm_free(p)
#else #else
# include <stdlib.h>
/* Domain-specific allocations */ /* Domain-specific allocations */
+2 -6
View File
@@ -42,6 +42,8 @@
#include <nuttx/config.h> #include <nuttx/config.h>
#include <nuttx/addrenv.h>
#include <nuttx/userspace.h>
#include <nuttx/mm/mm.h> #include <nuttx/mm/mm.h>
/**************************************************************************** /****************************************************************************
@@ -56,7 +58,6 @@
* ARCH_DATA_RESERVE_SIZE * ARCH_DATA_RESERVE_SIZE
*/ */
# include <nuttx/addrenv.h>
# define USR_HEAP (&ARCH_DATA_RESERVE->ar_usrheap) # define USR_HEAP (&ARCH_DATA_RESERVE->ar_usrheap)
#elif defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__) #elif defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__)
@@ -65,7 +66,6 @@
* structure from the userspace interface. * structure from the userspace interface.
*/ */
# include <nuttx/userspace.h>
# define USR_HEAP (USERSPACE->us_heap) # define USR_HEAP (USERSPACE->us_heap)
#else #else
@@ -74,8 +74,4 @@
# define USR_HEAP &g_mmheap # define USR_HEAP &g_mmheap
#endif #endif
/****************************************************************************
* Public Functions
****************************************************************************/
#endif /* __MM_UMM_HEAP_UMM_HEAP_H */ #endif /* __MM_UMM_HEAP_UMM_HEAP_H */
+6 -6
View File
@@ -117,7 +117,7 @@ static void group_assign_grpid(FAR struct task_group_s *group)
for (; ; ) for (; ; )
{ {
/* Increment the ID counter. This is global data so be extra paranoid. */ /* Increment the ID counter. It is global data so be extra paranoid. */
flags = enter_critical_section(); flags = enter_critical_section();
grpid = ++g_grpid_counter; grpid = ++g_grpid_counter;
@@ -193,8 +193,8 @@ static inline void group_inherit_identity(FAR struct task_group_s *group)
* function is called as part of the task creation sequence. The structure * function is called as part of the task creation sequence. The structure
* allocated and zeroed, but otherwise uninitialized. The full creation * allocated and zeroed, but otherwise uninitialized. The full creation
* of the group of a two step process: (1) First, this function allocates * of the group of a two step process: (1) First, this function allocates
* group structure early in the task creation sequence in order to provide a * group structure early in the task creation sequence in order to provide
* group container, then (2) group_initialize() is called to set up the * a group container, then (2) group_initialize() is called to set up the
* group membership. * group membership.
* *
* Input Parameters: * Input Parameters:
@@ -226,8 +226,8 @@ int group_allocate(FAR struct task_tcb_s *tcb, uint8_t ttype)
} }
#if CONFIG_NFILE_STREAMS > 0 && defined(CONFIG_MM_KERNEL_HEAP) #if CONFIG_NFILE_STREAMS > 0 && defined(CONFIG_MM_KERNEL_HEAP)
/* If this group is being created for a privileged thread, then all elements /* If this group is being created for a privileged thread, then all
* of the group must be created for privileged access. * elements of the group must be created for privileged access.
*/ */
if ((ttype & TCB_FLAG_TTYPE_MASK) == TCB_FLAG_TTYPE_KERNEL) if ((ttype & TCB_FLAG_TTYPE_MASK) == TCB_FLAG_TTYPE_KERNEL)
@@ -337,7 +337,7 @@ int group_initialize(FAR struct task_tcb_s *tcb)
#ifdef HAVE_GROUP_MEMBERS #ifdef HAVE_GROUP_MEMBERS
/* Allocate space to hold GROUP_INITIAL_MEMBERS members of the group */ /* Allocate space to hold GROUP_INITIAL_MEMBERS members of the group */
group->tg_members = (FAR pid_t *)kmm_malloc(GROUP_INITIAL_MEMBERS * sizeof(pid_t)); group->tg_members = kmm_malloc(GROUP_INITIAL_MEMBERS * sizeof(pid_t));
if (!group->tg_members) if (!group->tg_members)
{ {
kmm_free(group); kmm_free(group);