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

View File

@ -182,12 +182,12 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
/* Save the adjusted stack values in the struct tcb_s */
tcb->adj_stack_ptr = (uint32_t*)top_of_stack;
tcb->adj_stack_ptr = (uint32_t *)top_of_stack;
tcb->adj_stack_size = size_of_stack;
board_autoled_on(LED_STACKCREATED);
return OK;
}
return ERROR;
return ERROR;
}

View File

@ -210,5 +210,5 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
return OK;
}
return ERROR;
return ERROR;
}

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;
/* 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
* necessary top_of_stack must be rounded down to the next boundary to
* meet these alignment requirements.
* floating point use, the stack must be aligned to 8-byte addresses.
* If necessary top_of_stack must be rounded down to the next boundary
* to meet these alignment requirements.
*/
top_of_stack = STACK_ALIGN_DOWN(top_of_stack);

View File

@ -118,19 +118,19 @@
int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
{
#ifdef CONFIG_TLS
/* Add the size of the TLS information structure */
/* Add the size of the TLS information structure */
stack_size += sizeof(struct tls_info_s);
stack_size += sizeof(struct tls_info_s);
/* The allocated stack size must not exceed the maximum possible for the
* TLS feature.
*/
/* The allocated stack size must not exceed the maximum possible for the
* TLS feature.
*/
DEBUGASSERT(stack_size <= TLS_MAXSTACK);
if (stack_size >= TLS_MAXSTACK)
{
stack_size = TLS_MAXSTACK;
}
DEBUGASSERT(stack_size <= TLS_MAXSTACK);
if (stack_size >= TLS_MAXSTACK)
{
stack_size = TLS_MAXSTACK;
}
#endif
/* Is there already a stack allocated of a different size? Because of
@ -229,8 +229,10 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
* water marks.
*/
stack_base = (uintptr_t)tcb->stack_alloc_ptr + sizeof(struct tls_info_s);
stack_size = tcb->adj_stack_size - sizeof(struct tls_info_s);
stack_base = (uintptr_t)tcb->stack_alloc_ptr +
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);
#endif /* CONFIG_STACK_COLORATION */

View File

@ -182,12 +182,12 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
/* Save the adjusted stack values in the struct tcb_s */
tcb->adj_stack_ptr = (uint32_t*)top_of_stack;
tcb->adj_stack_ptr = (uint32_t *)top_of_stack;
tcb->adj_stack_size = size_of_stack;
board_autoled_on(LED_STACKCREATED);
return OK;
}
return ERROR;
return ERROR;
}

View File

@ -182,12 +182,12 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
/* Save the adjusted stack values in the struct tcb_s */
tcb->adj_stack_ptr = (uint32_t*)top_of_stack;
tcb->adj_stack_ptr = (uint32_t *)top_of_stack;
tcb->adj_stack_size = size_of_stack;
board_autoled_on(LED_STACKCREATED);
return OK;
}
return ERROR;
return ERROR;
}

View File

@ -57,7 +57,8 @@
* 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 void btn_enable(FAR const struct btn_lowerhalf_s *lower,
btn_buttonset_t press, btn_buttonset_t release,

View File

@ -55,7 +55,8 @@
* 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,
int led, bool ledon);
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);
return (userled_set_t)((1 << BOARD_NLEDS) - 1);

View File

@ -239,8 +239,8 @@ FAR struct file_struct *fs_fdopen(int fd, int oflags, FAR struct tcb_s *tcb)
/* Set up pointers */
stream->fs_bufend = &stream->fs_bufstart[CONFIG_STDIO_BUFFER_SIZE];
stream->fs_bufpos = stream->fs_bufstart;
stream->fs_bufend = &stream->fs_bufstart[CONFIG_STDIO_BUFFER_SIZE];
stream->fs_bufpos = stream->fs_bufstart;
stream->fs_bufread = stream->fs_bufstart;
#ifdef CONFIG_STDIO_LINEBUFFER

View File

@ -51,7 +51,9 @@
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Configuration ************************************************************/
/* These interfaces are not available to kernel code */
#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__)
@ -75,6 +77,7 @@
#endif
/* Standard Definitions *****************************************************/
/* aio_cancel return values
*
* AIO_ALLDONE - Indicates that none of the requested operations could

View File

@ -49,33 +49,35 @@
/* How can we access the errno variable? */
#ifdef CONFIG_BUILD_FLAT
/* Flat build */
/* Flat build */
# if defined(CONFIG_LIB_SYSCALL) && !defined(__KERNEL__)
/* We still might be using system calls in user code. If so, then
* user code will have no direct access to the errno variable.
*/
/* We still might be using system calls in user code. If so, then
* user code will have no direct access to the errno variable.
*/
# undef __DIRECT_ERRNO_ACCESS
# else
/* Flat build with no system calls OR internal kernel logic... There
* is direct access.
*/
/* Flat build with no system calls OR internal kernel logic... There
* is direct access.
*/
# define __DIRECT_ERRNO_ACCESS 1
# endif
#else
# 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
# else
/* User portion of protected/kernel build. Application code has only indirect
* access
*/
/* User portion of protected/kernel build. Application code has only
* indirect access
*/
# undef __DIRECT_ERRNO_ACCESS
# endif

View File

@ -436,7 +436,7 @@ int clock_systimespec(FAR struct timespec *ts);
* Return load measurement data for the select PID.
*
* 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
*
* Returned Value:

View File

@ -102,7 +102,7 @@ EXTERN const int g_builtin_count;
#endif
/****************************************************************************
* Public Functions
* Public Function Prototypes
****************************************************************************/
/****************************************************************************

View File

@ -63,7 +63,7 @@
# define HAVE_GROUP_MEMBERS 1
#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
# undef HAVE_GROUP_MEMBERS

View File

@ -54,7 +54,9 @@
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Configuration ************************************************************/
/* 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.
*/
@ -73,6 +75,7 @@
#endif
/* Helper Macros ************************************************************/
/* This macro is used to access the struct userpace_s header that can be
* found at the beginning of the user-space blob.
*/
@ -89,9 +92,9 @@
struct mm_heaps_s; /* Forward reference */
/* 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
* instance of this structure is expected to reside at CONFIG_NUTTX_USERSPACE.
/* 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
* instance of this is expected to reside at CONFIG_NUTTX_USERSPACE.
*/
struct userspace_s
@ -166,7 +169,8 @@ extern "C"
****************************************************************************/
#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
/****************************************************************************

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 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);
int printf(FAR const IPTR char *fmt, ...);

View File

@ -45,9 +45,11 @@
#include <sys/types.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <semaphore.h>
#include <nuttx/kmalloc.h>
#include <nuttx/streams.h>
/****************************************************************************
@ -82,9 +84,8 @@
*/
#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_zalloc(s) kmm_zalloc(s)
@ -92,7 +93,7 @@
# define lib_memalign(p,s) kmm_memalign(p,s)
# define lib_free(p) kmm_free(p)
/* User-accessible allocations */
/* User-accessible allocations */
# define lib_umalloc(s) kumm_malloc(s)
# define lib_uzalloc(s) kumm_zalloc(s)
@ -100,16 +101,15 @@
# define lib_ufree(p) kumm_free(p)
#else
# include <stdlib.h>
/* Domain-specific allocations */
/* Domain-specific allocations */
# define lib_malloc(s) malloc(s)
# define lib_zalloc(s) zalloc(s)
# define lib_realloc(p,s) realloc(p,s)
# define lib_free(p) free(p)
/* User-accessible allocations */
/* User-accessible allocations */
# define lib_umalloc(s) malloc(s)
# define lib_uzalloc(s) zalloc(s)

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.
*
@ -271,7 +271,9 @@ static void lib_dtoa(FAR struct lib_outstream_s *obj, int fmt, int prec,
{
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)
{

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, 2016 Gregory Nutt. All rights reserved.
@ -110,7 +110,7 @@ int sethostname(FAR const char *name, size_t size)
irqstate_t flags;
/* Save the new host name, truncating to HOST_NAME_MAX if necessary. This
* internal copy is always NUL terminated. The hostname is global resource.
* internal copy is always NUL terminated. The hostname is global resource.
* There is a microscopic possibility that it could be accessed while we
* are setting it.
*/

View File

@ -45,26 +45,26 @@
#include <sys/types.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <nuttx/kmalloc.h>
#include <nuttx/streams.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* The NuttX NX library an be build in two modes: (1) as a standard, C-library
* that can be used by normal, user-space applications, or (2) as a special,
* kernel-mode NX-library only used within the OS. If NuttX is not being
* built as separated kernel- and user-space modules, then only the first
* mode is supported.
/* The NuttX NX library can be build in two modes: (1) as a standard, C-
* library that can be used by normal, user-space applications, or (2) as
* a special, kernel-mode NX-library only used within the OS. If NuttX is
* not being built as separated kernel- and user-space modules, then only
* the first mode is supported.
*/
#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_zalloc(s) kmm_zalloc(s)
@ -72,7 +72,7 @@
# define lib_memalign(p,s) kmm_memalign(p,s)
# define lib_free(p) kmm_free(p)
/* User-accessible allocations */
/* User-accessible allocations */
# define lib_umalloc(s) kumm_malloc(s)
# define lib_uzalloc(s) kumm_zalloc(s)
@ -80,16 +80,15 @@
# define lib_ufree(p) kumm_free(p)
#else
# include <stdlib.h>
/* Domain-specific allocations */
/* Domain-specific allocations */
# define lib_malloc(s) malloc(s)
# define lib_zalloc(s) zalloc(s)
# define lib_realloc(p,s) realloc(p,s)
# define lib_free(p) free(p)
/* User-accessible allocations */
/* User-accessible allocations */
# define lib_umalloc(s) malloc(s)
# define lib_uzalloc(s) zalloc(s)

View File

@ -42,6 +42,8 @@
#include <nuttx/config.h>
#include <nuttx/addrenv.h>
#include <nuttx/userspace.h>
#include <nuttx/mm/mm.h>
/****************************************************************************
@ -56,7 +58,6 @@
* ARCH_DATA_RESERVE_SIZE
*/
# include <nuttx/addrenv.h>
# define USR_HEAP (&ARCH_DATA_RESERVE->ar_usrheap)
#elif defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__)
@ -65,7 +66,6 @@
* structure from the userspace interface.
*/
# include <nuttx/userspace.h>
# define USR_HEAP (USERSPACE->us_heap)
#else
@ -74,8 +74,4 @@
# define USR_HEAP &g_mmheap
#endif
/****************************************************************************
* Public Functions
****************************************************************************/
#endif /* __MM_UMM_HEAP_UMM_HEAP_H */

View File

@ -117,7 +117,7 @@ static void group_assign_grpid(FAR struct task_group_s *group)
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();
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
* allocated and zeroed, but otherwise uninitialized. The full creation
* 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 container, then (2) group_initialize() is called to set up the
* group structure early in the task creation sequence in order to provide
* a group container, then (2) group_initialize() is called to set up the
* group membership.
*
* 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 this group is being created for a privileged thread, then all elements
* of the group must be created for privileged access.
/* If this group is being created for a privileged thread, then all
* elements of the group must be created for privileged access.
*/
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
/* 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)
{
kmm_free(group);