Skip to content

Commit

Permalink
nuttx: fix multiple 'FAR', 'CODE' and style issues
Browse files Browse the repository at this point in the history
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
  • Loading branch information
pkarashchenko committed Aug 25, 2024
1 parent 3229b58 commit e274b93
Show file tree
Hide file tree
Showing 275 changed files with 2,135 additions and 1,991 deletions.
10 changes: 5 additions & 5 deletions Documentation/reference/user/10_filesystem.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ Driver Operations
.. c:function:: int dup(int fd);
.. c:function:: int dup2(int fd1, int fd2);
.. c:function:: off_t lseek(int fd, off_t offset, int whence);
.. c:function:: ssize_t pread(int fd, void *buf, size_t nbytes, off_t offset);
.. c:function:: ssize_t pwrite(int fd, const void *buf, size_t nbytes, off_t offset);
.. c:function:: ssize_t pread(int fd, FAR void *buf, size_t nbytes, off_t offset);
.. c:function:: ssize_t pwrite(int fd, FAR const void *buf, size_t nbytes, off_t offset);
.. c:function:: ssize_t read(int fd, void *buf, size_t nbytes);
.. c:function:: int unlink(const char *path);
.. c:function:: ssize_t write(int fd, const void *buf, size_t nbytes);
.. c:function:: int unlink(FAR const char *path);
.. c:function:: ssize_t write(int fd, FAR const void *buf, size_t nbytes);
``sys/ioctl.h``
---------------
Expand All @@ -81,7 +81,7 @@ Driver Operations
``poll.h``
----------
.. c:function:: int poll(struct pollfd *fds, nfds_t nfds, int timeout)
.. c:function:: int poll(FAR struct pollfd *fds, nfds_t nfds, int timeout)
Waits for one of a set of file descriptors
to become ready to perform I/O. If none of the events requested (and no
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/include/spinlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ typedef uint8_t spinlock_t;
&& !defined(CONFIG_ARCH_CHIP_LC823450) \
&& !defined(CONFIG_ARCH_CHIP_CXD56XX) \
&& !defined(CONFIG_ARCH_CHIP_RP2040)
static inline_function spinlock_t up_testset(FAR volatile spinlock_t *lock)
static inline_function spinlock_t up_testset(volatile spinlock_t *lock)
{
spinlock_t ret = SP_UNLOCKED;

Expand Down
4 changes: 2 additions & 2 deletions arch/arm/src/stm32/stm32_eth.c
Original file line number Diff line number Diff line change
Expand Up @@ -4304,7 +4304,7 @@ int up_rtc_initialize(void)
*
****************************************************************************/

int up_rtc_gettime(FAR struct timespec *tp)
int up_rtc_gettime(struct timespec *tp)
{
uint64_t timestamp;
timestamp = stm32_eth_ptp_gettime();
Expand Down Expand Up @@ -4340,7 +4340,7 @@ int up_rtc_gettime(FAR struct timespec *tp)
*
****************************************************************************/

int up_rtc_settime(FAR const struct timespec *tp)
int up_rtc_settime(const struct timespec *tp)
{
struct timespec ptptime;
uint64_t timestamp;
Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/include/spinlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
typedef uint64_t spinlock_t;

#if defined(CONFIG_ARCH_HAVE_TESTSET)
static inline_function spinlock_t up_testset(FAR volatile spinlock_t *lock)
static inline_function spinlock_t up_testset(volatile spinlock_t *lock)
{
spinlock_t ret = SP_LOCKED;

Expand Down
4 changes: 2 additions & 2 deletions arch/arm64/src/imx9/imx9_dma_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,12 @@ void imx9_dma_free(void *memory, size_t size)
}

#ifdef CONFIG_FAT_DMAMEMORY
FAR void *fat_dma_alloc(size_t size)
void *fat_dma_alloc(size_t size)
{
return imx9_dma_alloc(size);
}

void fat_dma_free(FAR void *memory, size_t size)
void fat_dma_free(void *memory, size_t size)
{
imx9_dma_free(memory, size);
}
Expand Down
2 changes: 1 addition & 1 deletion arch/risc-v/include/spinlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ typedef uintptr_t spinlock_t;
****************************************************************************/

#if defined(CONFIG_ARCH_RV_ISA_A)
static inline_function spinlock_t up_testset(FAR volatile spinlock_t *lock)
static inline_function spinlock_t up_testset(volatile spinlock_t *lock)
{
spinlock_t ret = SP_UNLOCKED;

Expand Down
40 changes: 20 additions & 20 deletions arch/risc-v/src/bl808/bl808_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,18 @@ struct bl808_timer_ch_s
* Private Function Prototypes
****************************************************************************/

int bl808_timer_start(FAR struct timer_lowerhalf_s *lower);
int bl808_timer_stop(FAR struct timer_lowerhalf_s *lower);
int bl808_timer_getstatus(FAR struct timer_lowerhalf_s *lower,
FAR struct timer_status_s *status);
int bl808_timer_settimeout(FAR struct timer_lowerhalf_s *lower,
int bl808_timer_start(struct timer_lowerhalf_s *lower);
int bl808_timer_stop(struct timer_lowerhalf_s *lower);
int bl808_timer_getstatus(struct timer_lowerhalf_s *lower,
struct timer_status_s *status);
int bl808_timer_settimeout(struct timer_lowerhalf_s *lower,
uint32_t timeout);
void bl808_timer_setcallback(FAR struct timer_lowerhalf_s *lower,
CODE tccb_t callback, FAR void *arg);
int bl808_timer_ioctl(FAR struct timer_lowerhalf_s *lower,
void bl808_timer_setcallback(struct timer_lowerhalf_s *lower,
tccb_t callback, void *arg);
int bl808_timer_ioctl(struct timer_lowerhalf_s *lower,
int cmd, unsigned long arg);
int bl808_timer_maxtimeout(FAR struct timer_lowerhalf_s *lower,
FAR uint32_t *maxtimeout);
int bl808_timer_maxtimeout(struct timer_lowerhalf_s *lower,
uint32_t *maxtimeout);

/****************************************************************************
* Private Data
Expand Down Expand Up @@ -215,7 +215,7 @@ static int __timer_interrupt(int irq, void *context, void *arg)
*
****************************************************************************/

int bl808_timer_start(FAR struct timer_lowerhalf_s *lower)
int bl808_timer_start(struct timer_lowerhalf_s *lower)
{
struct bl808_timer_ch_s *priv = (struct bl808_timer_ch_s *)lower;
if (TIMER_GET_CH(priv->blk_ch) == 0)
Expand Down Expand Up @@ -269,7 +269,7 @@ int bl808_timer_start(FAR struct timer_lowerhalf_s *lower)
*
****************************************************************************/

int bl808_timer_stop(FAR struct timer_lowerhalf_s *lower)
int bl808_timer_stop(struct timer_lowerhalf_s *lower)
{
struct bl808_timer_ch_s *priv = (struct bl808_timer_ch_s *)lower;

Expand Down Expand Up @@ -304,8 +304,8 @@ int bl808_timer_stop(FAR struct timer_lowerhalf_s *lower)
*
****************************************************************************/

int bl808_timer_getstatus(FAR struct timer_lowerhalf_s *lower,
FAR struct timer_status_s *status)
int bl808_timer_getstatus(struct timer_lowerhalf_s *lower,
struct timer_status_s *status)
{
struct bl808_timer_ch_s *priv = (struct bl808_timer_ch_s *)lower;
uint32_t current_count;
Expand Down Expand Up @@ -338,7 +338,7 @@ int bl808_timer_getstatus(FAR struct timer_lowerhalf_s *lower,
*
****************************************************************************/

int bl808_timer_settimeout(FAR struct timer_lowerhalf_s *lower,
int bl808_timer_settimeout(struct timer_lowerhalf_s *lower,
uint32_t timeout)
{
struct bl808_timer_ch_s *priv = (struct bl808_timer_ch_s *)lower;
Expand Down Expand Up @@ -408,8 +408,8 @@ int bl808_timer_settimeout(FAR struct timer_lowerhalf_s *lower,
*
****************************************************************************/

void bl808_timer_setcallback(FAR struct timer_lowerhalf_s *lower,
CODE tccb_t callback, FAR void *arg)
void bl808_timer_setcallback(struct timer_lowerhalf_s *lower,
tccb_t callback, void *arg)
{
struct bl808_timer_ch_s *priv = (struct bl808_timer_ch_s *)lower;
priv->callback = callback;
Expand All @@ -424,7 +424,7 @@ void bl808_timer_setcallback(FAR struct timer_lowerhalf_s *lower,
*
****************************************************************************/

int bl808_timer_ioctl(FAR struct timer_lowerhalf_s *lower,
int bl808_timer_ioctl(struct timer_lowerhalf_s *lower,
int cmd, unsigned long arg)
{
/* No additional ioctl commands implemented */
Expand All @@ -441,8 +441,8 @@ int bl808_timer_ioctl(FAR struct timer_lowerhalf_s *lower,
*
****************************************************************************/

int bl808_timer_maxtimeout(FAR struct timer_lowerhalf_s *lower,
FAR uint32_t *maxtimeout)
int bl808_timer_maxtimeout(struct timer_lowerhalf_s *lower,
uint32_t *maxtimeout)
{
/* Timer comparators are 32-bit */

Expand Down
44 changes: 22 additions & 22 deletions arch/risc-v/src/bl808/bl808_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,17 @@ struct bl808_wdt_s
* Private Function Prototypes
****************************************************************************/

int bl808_wdt_start(FAR struct watchdog_lowerhalf_s *lower);
int bl808_wdt_stop(FAR struct watchdog_lowerhalf_s *lower);
int bl808_wdt_keepalive(FAR struct watchdog_lowerhalf_s *lower);
int bl808_wdt_getstatus(FAR struct watchdog_lowerhalf_s *lower,
FAR struct watchdog_status_s *status);
int bl808_wdt_settimeout(FAR struct watchdog_lowerhalf_s *lower,
uint32_t timeout);
xcpt_t bl808_wdt_capture(FAR struct watchdog_lowerhalf_s *lower,
CODE xcpt_t callback);
int bl808_wdt_ioctl(FAR struct watchdog_lowerhalf_s *lower,
int cmd, unsigned long arg);
int bl808_wdt_start(struct watchdog_lowerhalf_s *lower);
int bl808_wdt_stop(struct watchdog_lowerhalf_s *lower);
int bl808_wdt_keepalive(struct watchdog_lowerhalf_s *lower);
int bl808_wdt_getstatus(struct watchdog_lowerhalf_s *lower,
struct watchdog_status_s *status);
int bl808_wdt_settimeout(struct watchdog_lowerhalf_s *lower,
uint32_t timeout);
xcpt_t bl808_wdt_capture(struct watchdog_lowerhalf_s *lower,
xcpt_t callback);
int bl808_wdt_ioctl(struct watchdog_lowerhalf_s *lower,
int cmd, unsigned long arg);

/****************************************************************************
* Private Data
Expand Down Expand Up @@ -161,7 +161,7 @@ static int __wdt_interrupt(int irq, void *context, void *arg)
*
****************************************************************************/

int bl808_wdt_start(FAR struct watchdog_lowerhalf_s *lower)
int bl808_wdt_start(struct watchdog_lowerhalf_s *lower)
{
struct bl808_wdt_s *priv = (struct bl808_wdt_s *)lower;

Expand Down Expand Up @@ -196,7 +196,7 @@ int bl808_wdt_start(FAR struct watchdog_lowerhalf_s *lower)
*
****************************************************************************/

int bl808_wdt_stop(FAR struct watchdog_lowerhalf_s *lower)
int bl808_wdt_stop(struct watchdog_lowerhalf_s *lower)
{
struct bl808_wdt_s *priv = (struct bl808_wdt_s *)lower;

Expand Down Expand Up @@ -228,7 +228,7 @@ int bl808_wdt_stop(FAR struct watchdog_lowerhalf_s *lower)
*
****************************************************************************/

int bl808_wdt_keepalive(FAR struct watchdog_lowerhalf_s *lower)
int bl808_wdt_keepalive(struct watchdog_lowerhalf_s *lower)
{
struct bl808_wdt_s *priv = (struct bl808_wdt_s *)lower;

Expand Down Expand Up @@ -263,8 +263,8 @@ int bl808_wdt_keepalive(FAR struct watchdog_lowerhalf_s *lower)
*
****************************************************************************/

int bl808_wdt_getstatus(FAR struct watchdog_lowerhalf_s *lower,
FAR struct watchdog_status_s *status)
int bl808_wdt_getstatus(struct watchdog_lowerhalf_s *lower,
struct watchdog_status_s *status)
{
struct bl808_wdt_s *priv = (struct bl808_wdt_s *)lower;

Expand Down Expand Up @@ -295,8 +295,8 @@ int bl808_wdt_getstatus(FAR struct watchdog_lowerhalf_s *lower,
*
****************************************************************************/

int bl808_wdt_settimeout(FAR struct watchdog_lowerhalf_s *lower,
uint32_t timeout)
int bl808_wdt_settimeout(struct watchdog_lowerhalf_s *lower,
uint32_t timeout)
{
struct bl808_wdt_s *priv = (struct bl808_wdt_s *)lower;

Expand Down Expand Up @@ -342,8 +342,8 @@ int bl808_wdt_settimeout(FAR struct watchdog_lowerhalf_s *lower,
*
****************************************************************************/

xcpt_t bl808_wdt_capture(FAR struct watchdog_lowerhalf_s *lower,
CODE xcpt_t callback)
xcpt_t bl808_wdt_capture(struct watchdog_lowerhalf_s *lower,
xcpt_t callback)
{
struct bl808_wdt_s *priv = (struct bl808_wdt_s *)lower;
xcpt_t prev_callback = priv->callback;
Expand Down Expand Up @@ -396,8 +396,8 @@ xcpt_t bl808_wdt_capture(FAR struct watchdog_lowerhalf_s *lower,
*
****************************************************************************/

int bl808_wdt_ioctl(FAR struct watchdog_lowerhalf_s *lower,
int cmd, unsigned long arg)
int bl808_wdt_ioctl(struct watchdog_lowerhalf_s *lower,
int cmd, unsigned long arg)
{
/* No additional ioctl commands implemented */

Expand Down
14 changes: 7 additions & 7 deletions arch/risc-v/src/common/espressif/esp_mcpwm.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,13 @@ struct mcpwm_motor_lowerhalf_s
{
/* The following block is part of the upper-half device struct */

FAR const struct motor_ops_s *ops; /* Arch-specific operations */
uint8_t opmode; /* Motor operation mode */
uint8_t opflags; /* Motor operation flags */
struct motor_limits_s limits; /* Motor absolute limits */
struct motor_params_s param; /* Motor settings */
struct motor_state_s state; /* Motor state */
FAR void *priv; /* Private data */
const struct motor_ops_s *ops; /* Arch-specific operations */
uint8_t opmode; /* Motor operation mode */
uint8_t opflags; /* Motor operation flags */
struct motor_limits_s limits; /* Motor absolute limits */
struct motor_params_s param; /* Motor settings */
struct motor_state_s state; /* Motor state */
void *priv; /* Private data */

/* The following is private to the ESP MCPWM driver */

Expand Down
12 changes: 6 additions & 6 deletions arch/risc-v/src/common/espressif/esp_rmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,10 @@ struct rmt_dev_lowerhalf_s
{
/* The following block is part of the upper-half device struct */

FAR const struct rmt_ops_s *ops;
FAR struct circbuf_s *circbuf;
sem_t *recvsem;
int minor;
const struct rmt_ops_s *ops;
struct circbuf_s *circbuf;
sem_t *recvsem;
int minor;

/* The following is private to the ESP32 RMT driver */

Expand Down Expand Up @@ -338,8 +338,8 @@ static int rmt_write_items(rmt_channel_t channel,
bool wait_tx_done);
static ssize_t esp_rmt_read(struct rmt_dev_s *dev, char *buffer,
size_t buflen);
static ssize_t esp_rmt_write(FAR struct rmt_dev_s *dev,
FAR const char *buffer,
static ssize_t esp_rmt_write(struct rmt_dev_s *dev,
const char *buffer,
size_t buflen);
static struct rmt_dev_s
*esp_rmtinitialize(struct rmt_channel_config_s config);
Expand Down
14 changes: 7 additions & 7 deletions arch/risc-v/src/common/espressif/esp_temperature_sensor.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ static void esp_temp_sensor_register(struct esp_temp_priv_s *priv);
static int esp_temperature_sensor_install(struct esp_temp_priv_s *priv,
struct esp_temp_sensor_config_t cfg);
static void esp_temperature_sensor_uninstall(struct esp_temp_priv_s *priv);
static int esp_temperature_sensor_get_celsius(FAR struct file *filep,
FAR char *buffer,
static int esp_temperature_sensor_get_celsius(struct file *filep,
char *buffer,
size_t buflen);

/****************************************************************************
Expand Down Expand Up @@ -444,14 +444,14 @@ static void esp_temperature_sensor_uninstall(struct esp_temp_priv_s *priv)
*
****************************************************************************/

static int esp_temperature_sensor_get_celsius(FAR struct file *filep,
FAR char *buffer,
static int esp_temperature_sensor_get_celsius(struct file *filep,
char *buffer,
size_t buflen)
{
uint32_t tsens_out;
FAR struct inode *inode = filep->f_inode;
FAR struct esp_temp_priv_s *priv = inode->i_private;
FAR int *out = (FAR int *) buffer;
struct inode *inode = filep->f_inode;
struct esp_temp_priv_s *priv = inode->i_private;
int *out = (int *)buffer;

nxmutex_lock(&priv->lock);
if (priv == NULL)
Expand Down
2 changes: 1 addition & 1 deletion arch/risc-v/src/common/riscv_exception.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ static const char *g_reasons_str[RISCV_MAX_EXCEPTION + 1] =
int riscv_exception(int mcause, void *regs, void *args)
{
#ifdef CONFIG_ARCH_KERNEL_STACK
FAR struct tcb_s *tcb = this_task();
struct tcb_s *tcb = this_task();
#endif
uintreg_t cause = mcause & RISCV_IRQ_MASK;

Expand Down
9 changes: 4 additions & 5 deletions arch/risc-v/src/esp32c3-legacy/esp32c3_ice40.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,10 @@ ice40_get_status(struct ice40_dev_s *dev)
*
****************************************************************************/

FAR struct ice40_dev_s *
esp32c3_ice40_initialize(const uint16_t cdone_gpio,
const uint16_t crst_gpio,
const uint16_t cs_gpio,
const uint16_t spi_port)
struct ice40_dev_s *esp32c3_ice40_initialize(const uint16_t cdone_gpio,
const uint16_t crst_gpio,
const uint16_t cs_gpio,
const uint16_t spi_port)
{
struct esp32c3_ice40_dev_s *ice40_ptr;

Expand Down
2 changes: 1 addition & 1 deletion arch/risc-v/src/qemu-rv/qemu_rv_irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
****************************************************************************/

#ifdef CONFIG_RPTUN
static int qemu_ipi_handler(int mcause, FAR void *regs, FAR void *args)
static int qemu_ipi_handler(int mcause, void *regs, void *args)
{
/* Clear IPI (Inter-Processor-Interrupt) */

Expand Down
Loading

0 comments on commit e274b93

Please sign in to comment.