diff --git a/arch/README.txt b/arch/README.txt index 85175c6a07..ff0fd4f004 100644 --- a/arch/README.txt +++ b/arch/README.txt @@ -149,17 +149,15 @@ include/types.h include/irq.h This file needs to define some architecture specific functions (usually - inline) and structure. These include: + inline if the compiler supports inlining) and structure. These include: - struct xcptcontext. This structures represents the saved context of a thread. - - static inline uint32 irqsave(void) -- Used to disable - all interrupts. + - uint32 irqsave(void) -- Used to disable all interrupts. - - static inline void irqrestore(uint32 flags) -- Used to - restore interrupts enables to the same state as before irqsave - was called. + - void irqrestore(uint32 flags) -- Used to restore interrupt + enables to the same state as before irqsave was called. This file must also define NR_IRQS, the total number of IRQs supported by the board. diff --git a/arch/c5471/src/up_serial.c b/arch/c5471/src/up_serial.c index 25746da3f6..df4927660a 100644 --- a/arch/c5471/src/up_serial.c +++ b/arch/c5471/src/up_serial.c @@ -123,7 +123,6 @@ static int up_close(struct file *filep); static ssize_t up_read(struct file *filep, char *buffer, size_t buflen); static ssize_t up_write(struct file *filep, const char *buffer, size_t buflen); static int up_ioctl(struct file *filep, int cmd, unsigned long arg); -static void up_consoleinit(up_dev_t *dev); static void up_uartsetup(up_dev_t *dev); static void up_delay(int milliseconds); @@ -590,7 +589,7 @@ static void up_xmitchars(up_dev_t *dev) * serial driver. */ -static int up_interrupt(int irq, struct xcptcontext *xcp) +static int up_interrupt(int irq, void *context) { up_dev_t *dev; volatile uint32 cause; diff --git a/fs/fs_dup.c b/fs/fs_dup.c index 02a62daf61..114f4b9519 100644 --- a/fs/fs_dup.c +++ b/fs/fs_dup.c @@ -55,23 +55,14 @@ * Definitions ************************************************************/ +#define DUP_ISOPEN(fd, list) \ + ((unsigned int)fd < CONFIG_NFILE_DESCRIPTORS && \ + list->fl_files[fd].f_inode != NULL) + /************************************************************ * Private Functions ************************************************************/ -static inline boolean dup_isopen(int fd, struct filelist *list) -{ - if ((unsigned int)fd >= CONFIG_NFILE_DESCRIPTORS || - list->fl_files[fd].f_inode == NULL) - { - return FALSE; - } - else - { - return TRUE; - } -} - /************************************************************ * Global Functions ************************************************************/ @@ -92,7 +83,7 @@ int dup(int fildes) /* Verify that fildes is a valid, open file descriptor */ - if (!dup_isopen(fildes, list)) + if (!DUP_ISOPEN(fildes, list)) { *get_errno_ptr() = EBADF; return ERROR; @@ -131,7 +122,7 @@ int dup2(int fildes1, int fildes2) /* Verify that fildes is a valid, open file descriptor */ - if (!dup_isopen(fildes1, list)) + if (!DUP_ISOPEN(fildes1, list)) { *get_errno_ptr() = EBADF; return ERROR; diff --git a/fs/fs_files.c b/fs/fs_files.c index 7ffede4605..a280f92101 100644 --- a/fs/fs_files.c +++ b/fs/fs_files.c @@ -86,10 +86,7 @@ static void _files_semtake(struct filelist *list) } } -static inline void _files_semgive(struct filelist *list) -{ - sem_post(&list->fl_sem); -} +#define _files_semgive(list) sem_post(&list->fl_sem) /************************************************************ * Pulblic Functions diff --git a/fs/fs_inode.c b/fs/fs_inode.c index b080a4e43f..db7451d309 100644 --- a/fs/fs_inode.c +++ b/fs/fs_inode.c @@ -53,9 +53,12 @@ #include "fs_internal.h" /************************************************************ - * Private types + * Definitions ************************************************************/ +#define INODE_SEMGIVE() \ + sem_post(&tree_sem) + /************************************************************ * Private Variables ************************************************************/ @@ -86,10 +89,7 @@ static void _inode_semtake(void) } } -static inline void _inode_semgive(void) -{ - sem_post(&tree_sem); -} +#define _inode_semgive(void) sem_post(&tree_sem) static int _inode_compare(const char *fname, struct inode *node) @@ -152,20 +152,20 @@ static int _inode_compare(const char *fname, } } -static inline int _inode_namelen(const char *name) +static int _inode_namelen(const char *name) { const char *tmp = name; while(*tmp && *tmp != '/') tmp++; return tmp - name; } -static inline void _inode_namecpy(char *dest, const char *src) +static void _inode_namecpy(char *dest, const char *src) { while(*src && *src != '/') *dest++ = *src++; *dest='\0'; } -static inline const char *_inode_nextname(const char *name) +static const char *_inode_nextname(const char *name) { while (*name && *name != '/') name++; if (*name) name++; diff --git a/fs/fs_internal.h b/fs/fs_internal.h index 14265895f7..e8e8a33c97 100644 --- a/fs/fs_internal.h +++ b/fs/fs_internal.h @@ -63,10 +63,6 @@ extern struct file files[CONFIG_NFILE_DESCRIPTORS]; #endif extern struct inode *root_inode; -/************************************************************ - * Inline Functions - ************************************************************/ - /************************************************************ * Pulblic Function Prototypes ************************************************************/ diff --git a/include/nuttx/arch.h b/include/nuttx/arch.h index 1299b53f0f..cc5ad35608 100644 --- a/include/nuttx/arch.h +++ b/include/nuttx/arch.h @@ -49,10 +49,6 @@ * Definitions ************************************************************/ -/************************************************************ - * Inline functions - ************************************************************/ - /************************************************************ * Public Types ************************************************************/ diff --git a/include/nuttx/irq.h b/include/nuttx/irq.h index 0e29e2476f..ce35434041 100644 --- a/include/nuttx/irq.h +++ b/include/nuttx/irq.h @@ -69,10 +69,6 @@ typedef int (*swint_t)(uint32 code, uint32 parm2, uint32 parm3, #include -/************************************************************ - * Inline functions - ************************************************************/ - /************************************************************ * Public Variables ************************************************************/ diff --git a/include/stdio.h b/include/stdio.h index 0cc8639b46..883e32fc48 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -99,9 +99,9 @@ /* The first three _iob entries are reserved for standard I/O */ -#define stdin (__stdfile(0)) -#define stdout (__stdfile(1)) -#define stderr (__stdfile(2)) +#define stdin (&sched_getstreams()->sl_streams[0]) +#define stdout (&sched_getstreams()->sl_streams[1]) +#define stderr (&sched_getstreams()->sl_streams[2]) /* These APIs are not implemented and/or can be synthesized from * supported APIs. @@ -194,29 +194,6 @@ typedef void DIR; * Public Variables ************************************************************/ -/************************************************************ - * Inline Functions - ************************************************************/ - -/* Used to reference stdin, stdout, and stderr */ - -#ifdef CONFIG_HAVE_INLINE -static inline FILE *__stdfile(int fd) -{ - if ((unsigned int)fd < CONFIG_NFILE_DESCRIPTORS) - { - struct streamlist *streams = sched_getstreams(); - if (streams) - { - return &streams->sl_streams[fd]; - } - } - return NULL; -} -#else -extern FILE *__stdfile(int fd); -#endif - /************************************************************ * Public Function Prototypes ************************************************************/ diff --git a/lib/lib_init.c b/lib/lib_init.c index 216f7b780a..a8195937fa 100644 --- a/lib/lib_init.c +++ b/lib/lib_init.c @@ -71,10 +71,7 @@ static void _lib_semtake(struct streamlist *list) } } -static inline void _lib_semgive(struct streamlist *list) -{ - sem_post(&list->sl_sem); -} +#define _lib_semgive(list) sem_post(&list->sl_sem) /************************************************************ * Public Functions diff --git a/lib/lib_internal.h b/lib/lib_internal.h index 41d40d4288..736aec54f6 100644 --- a/lib/lib_internal.h +++ b/lib/lib_internal.h @@ -98,10 +98,6 @@ struct lib_rawstream_s * Public Variables ************************************************************/ -/************************************************************ - * Inline Functions - ************************************************************/ - /************************************************************ * Pulblic Function Prototypes ************************************************************/ diff --git a/mm/mm_internal.h b/mm/mm_internal.h index e171f2b605..fe519ab2e4 100644 --- a/mm/mm_internal.h +++ b/mm/mm_internal.h @@ -152,10 +152,6 @@ extern struct mm_allocnode_s *g_heapend; extern struct mm_freenode_s g_nodelist[MM_NNODES]; -/************************************************************ - * Inline Functions - ************************************************************/ - /************************************************************ * Pulblic Function Prototypes ************************************************************/ diff --git a/sched/clock_internal.h b/sched/clock_internal.h index 18806d9521..e97c468b7e 100644 --- a/sched/clock_internal.h +++ b/sched/clock_internal.h @@ -85,10 +85,6 @@ extern volatile uint32 g_system_timer; extern struct timespec g_basetime; extern uint32 g_tickbias; -/************************************************************ - * Public Inline Functions - ************************************************************/ - /************************************************************ * Public Function Prototypes ************************************************************/ diff --git a/sched/mktime.c b/sched/mktime.c index a0ed379f1a..1c58edc373 100644 --- a/sched/mktime.c +++ b/sched/mktime.c @@ -81,7 +81,7 @@ * ************************************************************/ -static inline time_t clock_gregorian2utc(int year, int month, int day) +static time_t clock_gregorian2utc(int year, int month, int day) { int temp; @@ -95,7 +95,7 @@ static inline time_t clock_gregorian2utc(int year, int month, int day) } #ifdef CONFIG_JULIAN_TIME -static inline time_t clock_julian2utc(int year, int month, int day) +static time_t clock_julian2utc(int year, int month, int day) { return 367*year - (7*(year + 5001 + (month-9)/7))/4 diff --git a/sched/mq_close.c b/sched/mq_close.c index b1625de736..c9817f9947 100644 --- a/sched/mq_close.c +++ b/sched/mq_close.c @@ -67,19 +67,15 @@ * Function: mq_desfree * * Description: - * Deallocate a message queue descriptor + * Deallocate a message queue descriptor but returning it + * to the free liest * * Inputs: * mqdes - message queue descriptor to free * ************************************************************/ -static inline void mq_desfree(mqd_t mqdes) -{ - /* Just put it back on the free list */ - - sq_addlast((sq_entry_t*)mqdes, &g_desfree); -} +#define mq_desfree(mqdes) sq_addlast((sq_entry_t*)mqdes, &g_desfree) /************************************************************ * Public Functions diff --git a/sched/mq_descreate.c b/sched/mq_descreate.c index 5f68268d30..f631cfd2bf 100644 --- a/sched/mq_descreate.c +++ b/sched/mq_descreate.c @@ -88,7 +88,7 @@ * ************************************************************/ -static inline mqd_t mq_desalloc(void) +static mqd_t mq_desalloc(void) { mqd_t mqdes; diff --git a/sched/os_internal.h b/sched/os_internal.h index 0be0bb5ac9..4e4cdf7d67 100644 --- a/sched/os_internal.h +++ b/sched/os_internal.h @@ -228,10 +228,6 @@ extern pidhash_t g_pidhash[MAX_TASKS_ALLOWED]; extern const tasklist_t g_tasklisttable[NUM_TASK_STATES]; -/************************************************************ - * Public Inline Functions - ************************************************************/ - /************************************************************ * Public Function Prototypes ************************************************************/ diff --git a/sched/sched_processtimer.c b/sched/sched_processtimer.c index 2ab4c4bfaf..de066eb465 100644 --- a/sched/sched_processtimer.c +++ b/sched/sched_processtimer.c @@ -72,7 +72,7 @@ * Private Functions ************************************************************/ -static inline void sched_process_timeslice(void) +static void sched_process_timeslice(void) { #if CONFIG_RR_INTERVAL > 0 _TCB *rtcb; diff --git a/sched/sig_internal.h b/sched/sig_internal.h index 8f3bebe1ce..fd8390cfed 100644 --- a/sched/sig_internal.h +++ b/sched/sig_internal.h @@ -149,10 +149,6 @@ extern sq_queue_t g_sigpendingsignal; extern sq_queue_t g_sigpendingirqsignal; -/************************************************************ - * Public Inline Functions - ************************************************************/ - /************************************************************ * Public Function Prototypes ************************************************************/