diff --git a/Documentation/reference/user/10_filesystem.rst b/Documentation/reference/user/10_filesystem.rst index 65a736d2fd..256d8b46d2 100644 --- a/Documentation/reference/user/10_filesystem.rst +++ b/Documentation/reference/user/10_filesystem.rst @@ -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`` --------------- @@ -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 diff --git a/arch/arm/include/spinlock.h b/arch/arm/include/spinlock.h index a13865263b..61aa9d74e5 100644 --- a/arch/arm/include/spinlock.h +++ b/arch/arm/include/spinlock.h @@ -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; diff --git a/arch/arm/src/stm32/stm32_eth.c b/arch/arm/src/stm32/stm32_eth.c index be74c61376..3a320b4a2f 100644 --- a/arch/arm/src/stm32/stm32_eth.c +++ b/arch/arm/src/stm32/stm32_eth.c @@ -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(); @@ -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; diff --git a/arch/arm64/include/spinlock.h b/arch/arm64/include/spinlock.h index e70283344d..559901d5a6 100644 --- a/arch/arm64/include/spinlock.h +++ b/arch/arm64/include/spinlock.h @@ -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; diff --git a/arch/arm64/src/imx9/imx9_dma_alloc.c b/arch/arm64/src/imx9/imx9_dma_alloc.c index 1708e1ae69..419f8f3cda 100644 --- a/arch/arm64/src/imx9/imx9_dma_alloc.c +++ b/arch/arm64/src/imx9/imx9_dma_alloc.c @@ -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); } diff --git a/arch/risc-v/include/spinlock.h b/arch/risc-v/include/spinlock.h index 9ae5dd5a4c..f3140f261f 100644 --- a/arch/risc-v/include/spinlock.h +++ b/arch/risc-v/include/spinlock.h @@ -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; diff --git a/arch/risc-v/src/bl808/bl808_timer.c b/arch/risc-v/src/bl808/bl808_timer.c index 4f1bc84925..0eda8b0714 100644 --- a/arch/risc-v/src/bl808/bl808_timer.c +++ b/arch/risc-v/src/bl808/bl808_timer.c @@ -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 @@ -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) @@ -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; @@ -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; @@ -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; @@ -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; @@ -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 */ @@ -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 */ diff --git a/arch/risc-v/src/bl808/bl808_wdt.c b/arch/risc-v/src/bl808/bl808_wdt.c index 78a42b800a..1cb9e6b153 100644 --- a/arch/risc-v/src/bl808/bl808_wdt.c +++ b/arch/risc-v/src/bl808/bl808_wdt.c @@ -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 @@ -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; @@ -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; @@ -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; @@ -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; @@ -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; @@ -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; @@ -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 */ diff --git a/arch/risc-v/src/common/espressif/esp_mcpwm.c b/arch/risc-v/src/common/espressif/esp_mcpwm.c index e172490f45..dbec97e6f7 100644 --- a/arch/risc-v/src/common/espressif/esp_mcpwm.c +++ b/arch/risc-v/src/common/espressif/esp_mcpwm.c @@ -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 */ diff --git a/arch/risc-v/src/common/espressif/esp_rmt.c b/arch/risc-v/src/common/espressif/esp_rmt.c index 2502c5d9e8..1ecd3a8ca1 100644 --- a/arch/risc-v/src/common/espressif/esp_rmt.c +++ b/arch/risc-v/src/common/espressif/esp_rmt.c @@ -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 */ @@ -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); diff --git a/arch/risc-v/src/common/espressif/esp_temperature_sensor.c b/arch/risc-v/src/common/espressif/esp_temperature_sensor.c index c2ab3b3f5a..214c752c41 100644 --- a/arch/risc-v/src/common/espressif/esp_temperature_sensor.c +++ b/arch/risc-v/src/common/espressif/esp_temperature_sensor.c @@ -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); /**************************************************************************** @@ -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) diff --git a/arch/risc-v/src/common/riscv_exception.c b/arch/risc-v/src/common/riscv_exception.c index ffa0b370dc..1666d334ef 100644 --- a/arch/risc-v/src/common/riscv_exception.c +++ b/arch/risc-v/src/common/riscv_exception.c @@ -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; diff --git a/arch/risc-v/src/esp32c3-legacy/esp32c3_ice40.c b/arch/risc-v/src/esp32c3-legacy/esp32c3_ice40.c index 823c4e15d8..983ce50a49 100644 --- a/arch/risc-v/src/esp32c3-legacy/esp32c3_ice40.c +++ b/arch/risc-v/src/esp32c3-legacy/esp32c3_ice40.c @@ -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; diff --git a/arch/risc-v/src/qemu-rv/qemu_rv_irq.c b/arch/risc-v/src/qemu-rv/qemu_rv_irq.c index 71c4b05fac..6969c1bf3c 100644 --- a/arch/risc-v/src/qemu-rv/qemu_rv_irq.c +++ b/arch/risc-v/src/qemu-rv/qemu_rv_irq.c @@ -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) */ diff --git a/arch/sim/src/sim/sim_camera.c b/arch/sim/src/sim/sim_camera.c index eb81c8a284..28371f69f0 100644 --- a/arch/sim/src/sim/sim_camera.c +++ b/arch/sim/src/sim/sim_camera.c @@ -92,7 +92,7 @@ static int sim_camera_data_start_capture(struct imgdata_s *data, static int sim_camera_data_stop_capture(struct imgdata_s *data); static int sim_camera_data_set_buf(struct imgdata_s *data, uint8_t nr_datafmts, - FAR imgdata_format_t *datafmts, + imgdata_format_t *datafmts, uint8_t *addr, uint32_t size); /**************************************************************************** @@ -261,7 +261,7 @@ static int sim_camera_data_validate_buf(uint8_t *addr, uint32_t size) static int sim_camera_data_set_buf(struct imgdata_s *data, uint8_t nr_datafmts, - FAR imgdata_format_t *datafmts, + imgdata_format_t *datafmts, uint8_t *addr, uint32_t size) { sim_camera_priv_t *priv = (sim_camera_priv_t *)data; diff --git a/arch/sim/src/sim/sim_heap.c b/arch/sim/src/sim/sim_heap.c index f974660421..f37eb36183 100644 --- a/arch/sim/src/sim/sim_heap.c +++ b/arch/sim/src/sim/sim_heap.c @@ -301,7 +301,7 @@ void mm_free(struct mm_heap_s *heap, void *mem) * ****************************************************************************/ -void mm_free_delaylist(FAR struct mm_heap_s *heap) +void mm_free_delaylist(struct mm_heap_s *heap) { if (heap) { diff --git a/arch/sim/src/sim/sim_uart.c b/arch/sim/src/sim/sim_uart.c index 2d4b04bb3a..f5e51f8c27 100644 --- a/arch/sim/src/sim/sim_uart.c +++ b/arch/sim/src/sim/sim_uart.c @@ -669,10 +669,10 @@ static bool tty_txempty(struct uart_dev_s *dev) #endif #ifdef CONFIG_SIM_RAM_UART -static int sim_uartram_register(FAR const char *devname, bool slave) +static int sim_uartram_register(const char *devname, bool slave) { char name[NAME_MAX]; - FAR struct uart_rambuf_s *shmem; + struct uart_rambuf_s *shmem; strlcpy(name, strrchr(devname, '/') + 1, NAME_MAX); shmem = host_allocshmem(name, sizeof(struct uart_rambuf_s) * 2, !slave); diff --git a/arch/xtensa/src/common/espressif/esp_mcpwm.c b/arch/xtensa/src/common/espressif/esp_mcpwm.c index 1760c57390..72c67ec154 100644 --- a/arch/xtensa/src/common/espressif/esp_mcpwm.c +++ b/arch/xtensa/src/common/espressif/esp_mcpwm.c @@ -160,13 +160,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 */ @@ -199,7 +199,7 @@ struct mcpwm_cap_channel_lowerhalf_s { /* The following block is part of the upper-half device struct */ - FAR const struct cap_ops_s *ops; + const struct cap_ops_s *ops; /* The following is private to the ESP MCPWM driver */ diff --git a/arch/xtensa/src/common/espressif/esp_rmt.c b/arch/xtensa/src/common/espressif/esp_rmt.c index 2b15c313c2..d996f25a70 100644 --- a/arch/xtensa/src/common/espressif/esp_rmt.c +++ b/arch/xtensa/src/common/espressif/esp_rmt.c @@ -270,10 +270,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 */ @@ -384,8 +384,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); diff --git a/arch/xtensa/src/common/espressif/esp_temperature_sensor.c b/arch/xtensa/src/common/espressif/esp_temperature_sensor.c index ffbbd38c5b..2e05975f85 100644 --- a/arch/xtensa/src/common/espressif/esp_temperature_sensor.c +++ b/arch/xtensa/src/common/espressif/esp_temperature_sensor.c @@ -109,8 +109,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); /**************************************************************************** @@ -443,14 +443,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) diff --git a/arch/xtensa/src/esp32/esp32_openeth.c b/arch/xtensa/src/esp32/esp32_openeth.c index b4dad22cd9..a59a7d9af6 100644 --- a/arch/xtensa/src/esp32/esp32_openeth.c +++ b/arch/xtensa/src/esp32/esp32_openeth.c @@ -240,7 +240,7 @@ static inline void openeth_set_tx_desc_cnt(int tx_desc_cnt) static IRAM_ATTR int openeth_isr_handler(int irq, void *context, void *arg) { - FAR struct netdev_lowerhalf_s *dev = &g_openeth.dev; + struct netdev_lowerhalf_s *dev = &g_openeth.dev; uint32_t status = REG_READ(OPENETH_INT_SOURCE_REG); @@ -261,9 +261,9 @@ static IRAM_ATTR int openeth_isr_handler(int irq, void *context, void *arg) return 0; } -static FAR netpkt_t *openeth_receive(FAR struct netdev_lowerhalf_s *dev) +static netpkt_t *openeth_receive(struct netdev_lowerhalf_s *dev) { - FAR netpkt_t *pkt = netpkt_alloc(dev, NETPKT_RX); + netpkt_t *pkt = netpkt_alloc(dev, NETPKT_RX); struct openeth_priv_s *priv = &g_openeth; @@ -322,7 +322,7 @@ err: * ****************************************************************************/ -static int openeth_ifup(FAR struct netdev_lowerhalf_s *dev) +static int openeth_ifup(struct netdev_lowerhalf_s *dev) { irqstate_t flags; @@ -357,7 +357,7 @@ static int openeth_ifup(FAR struct netdev_lowerhalf_s *dev) * ****************************************************************************/ -static int openeth_ifdown(FAR struct netdev_lowerhalf_s *dev) +static int openeth_ifdown(struct netdev_lowerhalf_s *dev) { irqstate_t flags; @@ -376,10 +376,10 @@ static int openeth_ifdown(FAR struct netdev_lowerhalf_s *dev) return OK; } -static int openeth_transmit(FAR struct netdev_lowerhalf_s *dev, - FAR netpkt_t *pkt) +static int openeth_transmit(struct netdev_lowerhalf_s *dev, + netpkt_t *pkt) { - FAR struct openeth_priv_s *priv = (FAR struct openeth_priv_s *)dev; + struct openeth_priv_s *priv = (struct openeth_priv_s *)dev; unsigned int len = netpkt_getdatalen(dev, pkt); /* In QEMU, there never is a TX operation in progress */ @@ -455,8 +455,8 @@ err: int esp32_openeth_initialize(void) { int ret; - FAR struct openeth_priv_s *priv = &g_openeth; - FAR struct netdev_lowerhalf_s *dev = &priv->dev; + struct openeth_priv_s *priv = &g_openeth; + struct netdev_lowerhalf_s *dev = &priv->dev; /* Sanity check */ diff --git a/arch/xtensa/src/esp32s3/esp32s3_textheap.c b/arch/xtensa/src/esp32s3/esp32s3_textheap.c index d93717325b..3505188083 100644 --- a/arch/xtensa/src/esp32s3/esp32s3_textheap.c +++ b/arch/xtensa/src/esp32s3/esp32s3_textheap.c @@ -191,7 +191,7 @@ bool up_textheap_heapmember(void *p) * ****************************************************************************/ -FAR void *up_textheap_data_address(FAR void *p) +void *up_textheap_data_address(void *p) { uintptr_t addr = (uintptr_t)p; if (SOC_DIRAM_IRAM_LOW <= addr && addr < SOC_DIRAM_IRAM_HIGH) @@ -206,7 +206,7 @@ FAR void *up_textheap_data_address(FAR void *p) addr -= EXTRAM_D_I_BUS_OFFSET; } - return (FAR void *)addr; + return (void *)addr; } /**************************************************************************** @@ -251,7 +251,7 @@ IRAM_ATTR void up_textheap_data_sync(void) ****************************************************************************/ #if defined(CONFIG_ARCH_USE_COPY_SECTION) -int up_copy_section(FAR void *dest, FAR const void *src, size_t n) +int up_copy_section(void *dest, const void *src, size_t n) { memcpy(up_textheap_data_address(dest), src, n); diff --git a/binfmt/libelf/libelf_coredump.c b/binfmt/libelf/libelf_coredump.c index f5f5ccd2c4..018884bfa1 100644 --- a/binfmt/libelf/libelf_coredump.c +++ b/binfmt/libelf/libelf_coredump.c @@ -277,7 +277,7 @@ static void elf_emit_tcb_note(FAR struct elf_dumpinfo_s *cinfo, } else { - regs = (uintptr_t *)tcb->xcp.regs; + regs = (FAR uintptr_t *)tcb->xcp.regs; } if (regs != NULL) @@ -290,8 +290,8 @@ static void elf_emit_tcb_note(FAR struct elf_dumpinfo_s *cinfo, } else { - status.pr_regs[i] = - *(uintptr_t *)((uint8_t *)regs + g_tcbinfo.reg_off.p[i]); + status.pr_regs[i] = *(FAR uintptr_t *) + ((FAR uint8_t *)regs + g_tcbinfo.reg_off.p[i]); } } } diff --git a/binfmt/libelf/libelf_ctors.c b/binfmt/libelf/libelf_ctors.c index 63b2807f6b..d85f4df2de 100644 --- a/binfmt/libelf/libelf_ctors.c +++ b/binfmt/libelf/libelf_ctors.c @@ -164,7 +164,7 @@ int elf_loadctors(FAR struct elf_loadinfo_s *loadinfo) for (i = 0; i < loadinfo->nctors; i++) { - FAR uintptr_t *ptr = (uintptr_t *) + FAR uintptr_t *ptr = (FAR uintptr_t *) ((FAR void *)(&loadinfo->ctors)[i]); binfo("ctor %d: " diff --git a/binfmt/libelf/libelf_dtors.c b/binfmt/libelf/libelf_dtors.c index 2c382e36df..5f593385aa 100644 --- a/binfmt/libelf/libelf_dtors.c +++ b/binfmt/libelf/libelf_dtors.c @@ -165,7 +165,7 @@ int elf_loaddtors(FAR struct elf_loadinfo_s *loadinfo) for (i = 0; i < loadinfo->ndtors; i++) { - FAR uintptr_t *ptr = (uintptr_t *) + FAR uintptr_t *ptr = (FAR uintptr_t *) ((FAR void *)(&loadinfo->dtors)[i]); binfo("dtor %d: " diff --git a/binfmt/libelf/libelf_sections.c b/binfmt/libelf/libelf_sections.c index f47f6daa85..c839b81086 100644 --- a/binfmt/libelf/libelf_sections.c +++ b/binfmt/libelf/libelf_sections.c @@ -204,7 +204,7 @@ int elf_loadphdrs(FAR struct elf_loadinfo_s *loadinfo) /* Allocate memory to hold a working copy of the program header table */ - loadinfo->phdr = (FAR FAR Elf_Phdr *)kmm_malloc(phdrsize); + loadinfo->phdr = (FAR Elf_Phdr *)kmm_malloc(phdrsize); if (!loadinfo->phdr) { berr("Failed to allocate the program header table. Size: %ld\n", diff --git a/binfmt/libnxflat/libnxflat_read.c b/binfmt/libnxflat/libnxflat_read.c index 084e713ec0..0ac7bd994a 100644 --- a/binfmt/libnxflat/libnxflat_read.c +++ b/binfmt/libnxflat/libnxflat_read.c @@ -93,14 +93,14 @@ static inline void nxflat_dumpreaddata(FAR char *buffer, int buflen) * ****************************************************************************/ -int nxflat_read(struct nxflat_loadinfo_s *loadinfo, char *buffer, +int nxflat_read(FAR struct nxflat_loadinfo_s *loadinfo, FAR char *buffer, int readsize, int offset) { - ssize_t nbytes; /* Number of bytes read */ - off_t rpos; /* Position returned by lseek */ - char *bufptr; /* Next buffer location to read into */ - int bytesleft; /* Number of bytes of .data left to read */ - int bytesread; /* Total number of bytes read */ + ssize_t nbytes; /* Number of bytes read */ + off_t rpos; /* Position returned by lseek */ + FAR char *bufptr; /* Next buffer location to read into */ + int bytesleft; /* Number of bytes of .data left to read */ + int bytesread; /* Total number of bytes read */ binfo("Read %d bytes from offset %d\n", readsize, offset); diff --git a/boards/arm/gd32f4/gd32f450zk-aiotbox/src/gd32f4xx_i2c.c b/boards/arm/gd32f4/gd32f450zk-aiotbox/src/gd32f4xx_i2c.c index 259c3ac725..383fca2761 100644 --- a/boards/arm/gd32f4/gd32f450zk-aiotbox/src/gd32f4xx_i2c.c +++ b/boards/arm/gd32f4/gd32f450zk-aiotbox/src/gd32f4xx_i2c.c @@ -39,7 +39,7 @@ #ifdef CONFIG_I2C void gd32_i2c_initialize(void) { - FAR struct i2c_master_s *i2c; + struct i2c_master_s *i2c; int ret; i2cinfo("Initialize I2c\n"); @@ -92,4 +92,4 @@ void gd32_i2c_initialize(void) #endif } -#endif \ No newline at end of file +#endif diff --git a/boards/arm/gd32f4/gd32f470zk-aiotbox/src/gd32f4xx_i2c.c b/boards/arm/gd32f4/gd32f470zk-aiotbox/src/gd32f4xx_i2c.c index 26169f9f2f..646ed6388e 100644 --- a/boards/arm/gd32f4/gd32f470zk-aiotbox/src/gd32f4xx_i2c.c +++ b/boards/arm/gd32f4/gd32f470zk-aiotbox/src/gd32f4xx_i2c.c @@ -39,7 +39,7 @@ #ifdef CONFIG_I2C void gd32_i2c_initialize(void) { - FAR struct i2c_master_s *i2c; + struct i2c_master_s *i2c; int ret; i2cinfo("Initialize I2c\n"); @@ -92,4 +92,4 @@ void gd32_i2c_initialize(void) #endif } -#endif \ No newline at end of file +#endif diff --git a/boards/arm/rp2040/common/src/rp2040_uniqueid.c b/boards/arm/rp2040/common/src/rp2040_uniqueid.c index 653028c2bc..db60eda73d 100644 --- a/boards/arm/rp2040/common/src/rp2040_uniqueid.c +++ b/boards/arm/rp2040/common/src/rp2040_uniqueid.c @@ -334,7 +334,7 @@ void rp2040_uniqueid_initialize(void) * ****************************************************************************/ -int board_uniqueid(FAR uint8_t *uniqueid) +int board_uniqueid(uint8_t *uniqueid) { memcpy(uniqueid, g_uniqueid, CONFIG_BOARDCTL_UNIQUEID_SIZE); return OK; diff --git a/boards/arm/samv7/common/src/sam_reset.c b/boards/arm/samv7/common/src/sam_reset.c index 796e438f54..e808d79898 100644 --- a/boards/arm/samv7/common/src/sam_reset.c +++ b/boards/arm/samv7/common/src/sam_reset.c @@ -52,7 +52,7 @@ ****************************************************************************/ #ifdef CONFIG_BOARDCTL_RESET_CAUSE -int board_reset_cause(FAR struct boardioc_reset_cause_s *cause) +int board_reset_cause(struct boardioc_reset_cause_s *cause) { int rst_cause; diff --git a/boards/arm/stm32/stm32f103-minimum/src/stm32_bringup.c b/boards/arm/stm32/stm32f103-minimum/src/stm32_bringup.c index 16d4a8c9fc..f4940b4765 100644 --- a/boards/arm/stm32/stm32f103-minimum/src/stm32_bringup.c +++ b/boards/arm/stm32/stm32f103-minimum/src/stm32_bringup.c @@ -191,7 +191,7 @@ #ifdef CONFIG_I2C_DRIVER static void stm32_i2c_register(int bus) { - FAR struct i2c_master_s *i2c; + struct i2c_master_s *i2c; int ret; i2c = stm32_i2cbus_initialize(bus); diff --git a/boards/arm/stm32/stm32f401rc-rs485/src/stm32_at24.c b/boards/arm/stm32/stm32f401rc-rs485/src/stm32_at24.c index a5e5fad5d7..852058af31 100644 --- a/boards/arm/stm32/stm32f401rc-rs485/src/stm32_at24.c +++ b/boards/arm/stm32/stm32f401rc-rs485/src/stm32_at24.c @@ -56,7 +56,7 @@ int stm32_at24_init(char *path) { - FAR struct i2c_master_s *i2c; + struct i2c_master_s *i2c; static bool initialized = false; int ret; diff --git a/boards/arm/stm32h7/linum-stm32h753bi/src/stm32_at24.c b/boards/arm/stm32h7/linum-stm32h753bi/src/stm32_at24.c index 0558479a01..fc6e1dcaa6 100644 --- a/boards/arm/stm32h7/linum-stm32h753bi/src/stm32_at24.c +++ b/boards/arm/stm32h7/linum-stm32h753bi/src/stm32_at24.c @@ -57,7 +57,7 @@ int stm32_at24_init(char *path) { - FAR struct i2c_master_s *i2c; + struct i2c_master_s *i2c; static bool initialized = false; int ret; diff --git a/boards/risc-v/mpfs/common/src/mpfs_emmcsd.c b/boards/risc-v/mpfs/common/src/mpfs_emmcsd.c index 400f68f4c8..d414ab1402 100644 --- a/boards/risc-v/mpfs/common/src/mpfs_emmcsd.c +++ b/boards/risc-v/mpfs/common/src/mpfs_emmcsd.c @@ -42,7 +42,7 @@ static struct sdio_dev_s *g_sdio_dev; * Private Functions ****************************************************************************/ -static void partition_handler(FAR struct partition_s *part, FAR void *arg) +static void partition_handler(struct partition_s *part, void *arg) { unsigned partition = *(int *)arg; char devname[] = "/dev/mmcsd0p0"; diff --git a/boards/risc-v/qemu-rv/rv-virt/src/qemu_rv_appinit.c b/boards/risc-v/qemu-rv/rv-virt/src/qemu_rv_appinit.c index 1ce93fe515..b408e1d074 100644 --- a/boards/risc-v/qemu-rv/rv-virt/src/qemu_rv_appinit.c +++ b/boards/risc-v/qemu-rv/rv-virt/src/qemu_rv_appinit.c @@ -216,7 +216,7 @@ int board_power_off(int status) #if defined(CONFIG_BUILD_KERNEL) && ! defined(CONFIG_NUTTSBI) riscv_sbi_system_reset(SBI_SRST_TYPE_SHUTDOWN, SBI_SRST_REASON_NONE); #else - *(FAR volatile uint32_t *)QEMU_RV_RESET_BASE = QEMU_RV_RESET_DONE; + *(volatile uint32_t *)QEMU_RV_RESET_BASE = QEMU_RV_RESET_DONE; #endif UNUSED(status); diff --git a/boards/xtensa/esp32s3/common/src/esp32s3_board_adc.c b/boards/xtensa/esp32s3/common/src/esp32s3_board_adc.c index 3d940064bf..824e35d961 100644 --- a/boards/xtensa/esp32s3/common/src/esp32s3_board_adc.c +++ b/boards/xtensa/esp32s3/common/src/esp32s3_board_adc.c @@ -59,7 +59,7 @@ static int board_adc_register(int channel) { int ret; char devname[12]; - FAR struct adc_dev_s *adcdev; + struct adc_dev_s *adcdev; adcdev = kmm_malloc(sizeof(struct adc_dev_s)); if (adcdev == NULL) diff --git a/boards/xtensa/esp32s3/esp32s3-box/src/esp32s3_board_touchsceen_gt911.c b/boards/xtensa/esp32s3/esp32s3-box/src/esp32s3_board_touchsceen_gt911.c index 2fa60fb9fc..5c3451d3f4 100644 --- a/boards/xtensa/esp32s3/esp32s3-box/src/esp32s3_board_touchsceen_gt911.c +++ b/boards/xtensa/esp32s3/esp32s3-box/src/esp32s3_board_touchsceen_gt911.c @@ -344,7 +344,7 @@ static void gt911_event(struct gt911_dev_s *dev) * ****************************************************************************/ -static void gt911_worker(FAR void *arg) +static void gt911_worker(void *arg) { int ret; struct gt911_dev_s *dev = (struct gt911_dev_s *)arg; diff --git a/boards/xtensa/esp32s3/esp32s3-box/src/esp32s3_board_touchsceen_tt21100.c b/boards/xtensa/esp32s3/esp32s3-box/src/esp32s3_board_touchsceen_tt21100.c index 4ddd011cf2..4e5db84573 100644 --- a/boards/xtensa/esp32s3/esp32s3-box/src/esp32s3_board_touchsceen_tt21100.c +++ b/boards/xtensa/esp32s3/esp32s3-box/src/esp32s3_board_touchsceen_tt21100.c @@ -126,7 +126,7 @@ __attribute__((packed)); * Private Function Prototypes ****************************************************************************/ -static void tt21100_worker(FAR void *arg); +static void tt21100_worker(void *arg); /**************************************************************************** * Private Data @@ -244,7 +244,7 @@ static void tt21100_event(struct tt21100_dev_s *dev) * ****************************************************************************/ -static void tt21100_worker(FAR void *arg) +static void tt21100_worker(void *arg) { int ret; struct i2c_msg_s msg; diff --git a/crypto/cryptodev.c b/crypto/cryptodev.c index 61b907d001..a2dd8bfd05 100644 --- a/crypto/cryptodev.c +++ b/crypto/cryptodev.c @@ -110,7 +110,7 @@ static ssize_t cryptof_write(FAR struct file *filep, static int cryptof_ioctl(FAR struct file *filep, int cmd, unsigned long arg); static int cryptof_poll(FAR struct file *filep, - struct pollfd *fds, bool setup); + FAR struct pollfd *fds, bool setup); static int cryptof_open(FAR struct file *filep); static int cryptof_close(FAR struct file *filep); @@ -682,7 +682,7 @@ fail: /* ARGSUSED */ static int cryptof_poll(FAR struct file *filep, - struct pollfd *fds, bool setup) + FAR struct pollfd *fds, bool setup) { return 0; } diff --git a/drivers/1wire/ds28e17.c b/drivers/1wire/ds28e17.c index a3f603a5bc..83e022dfe1 100644 --- a/drivers/1wire/ds28e17.c +++ b/drivers/1wire/ds28e17.c @@ -919,7 +919,7 @@ FAR struct i2c_master_s * } nxrmutex_unlock(&master->devlock); - return (struct i2c_master_s *)inst; + return (FAR struct i2c_master_s *)inst; } /**************************************************************************** diff --git a/drivers/analog/adc.c b/drivers/analog/adc.c index 955ab7e886..78405fdc78 100644 --- a/drivers/analog/adc.c +++ b/drivers/analog/adc.c @@ -55,7 +55,7 @@ static int adc_reset(FAR struct adc_dev_s *dev); static int adc_receive(FAR struct adc_dev_s *dev, uint8_t ch, int32_t data); static void adc_notify(FAR struct adc_dev_s *dev); -static int adc_poll(FAR struct file *filep, struct pollfd *fds, +static int adc_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup); static int adc_reset_fifo(FAR struct adc_dev_s *dev); static int adc_samples_on_read(FAR struct adc_dev_s *dev); @@ -523,7 +523,8 @@ static void adc_notify(FAR struct adc_dev_s *dev) * Name: adc_poll ****************************************************************************/ -static int adc_poll(FAR struct file *filep, struct pollfd *fds, bool setup) +static int adc_poll(FAR struct file *filep, FAR struct pollfd *fds, + bool setup) { FAR struct inode *inode = filep->f_inode; FAR struct adc_dev_s *dev = inode->i_private; @@ -583,7 +584,7 @@ static int adc_poll(FAR struct file *filep, struct pollfd *fds, bool setup) { /* This is a request to tear down the poll. */ - struct pollfd **slot = (struct pollfd **)fds->priv; + FAR struct pollfd **slot = (FAR struct pollfd **)fds->priv; /* Remove all memory of the poll setup */ diff --git a/drivers/analog/ads1255.c b/drivers/analog/ads1255.c index 4b83737d1b..5038a7373c 100644 --- a/drivers/analog/ads1255.c +++ b/drivers/analog/ads1255.c @@ -457,7 +457,7 @@ static void adc_worker(FAR void *arg) /* Perform the data received callback */ DEBUGASSERT(priv->cb->au_receive != NULL); - priv->cb->au_receive(&g_adcdev, priv->channel, *(int32_t *)buf); + priv->cb->au_receive(&g_adcdev, priv->channel, *(FAR int32_t *)buf); } /* Re-enable ADC interrupts */ @@ -473,7 +473,7 @@ static void adc_worker(FAR void *arg) * ****************************************************************************/ -static int adc_interrupt(int irq, void *context, FAR void *arg) +static int adc_interrupt(int irq, FAR void *context, FAR void *arg) { FAR struct ads1255_dev_s *priv = (FAR struct ads1255_dev_s *)g_adcdev.ad_priv; diff --git a/drivers/analog/ads7828.c b/drivers/analog/ads7828.c index 873e8e6e39..b9bbf0dc4d 100644 --- a/drivers/analog/ads7828.c +++ b/drivers/analog/ads7828.c @@ -236,7 +236,7 @@ static int ads7828_readchannel(FAR struct ads7828_dev_s *priv, i2cmsg[1].flags = I2C_M_READ; uint16_t buf; - i2cmsg[1].buffer = (uint8_t *)(&buf); + i2cmsg[1].buffer = (FAR uint8_t *)(&buf); i2cmsg[1].length = sizeof(buf); ret = I2C_TRANSFER(priv->i2c, i2cmsg, 2); if (ret < 0) diff --git a/drivers/analog/hx711.c b/drivers/analog/hx711.c index 8fda40d568..578b9c9d7a 100644 --- a/drivers/analog/hx711.c +++ b/drivers/analog/hx711.c @@ -336,7 +336,7 @@ static int hx711_ioctl(FAR struct file *filep, int cmd, unsigned long arg) case HX711_GET_AVERAGE: { - unsigned *ptr = (unsigned *)((uintptr_t)arg); + FAR unsigned *ptr = (FAR unsigned *)((uintptr_t)arg); if (ptr == NULL) { ret = -EINVAL; @@ -349,7 +349,7 @@ static int hx711_ioctl(FAR struct file *filep, int cmd, unsigned long arg) case HX711_GET_CHANNEL: { - char *ptr = (char *)((uintptr_t)arg); + FAR char *ptr = (FAR char *)((uintptr_t)arg); if (ptr == NULL) { ret = -EINVAL; @@ -362,7 +362,7 @@ static int hx711_ioctl(FAR struct file *filep, int cmd, unsigned long arg) case HX711_GET_GAIN: { - unsigned char *ptr = (unsigned char *)((uintptr_t)arg); + FAR unsigned char *ptr = (FAR unsigned char *)((uintptr_t)arg); if (ptr == NULL) { ret = -EINVAL; @@ -375,7 +375,7 @@ static int hx711_ioctl(FAR struct file *filep, int cmd, unsigned long arg) case HX711_GET_VAL_PER_UNIT: { - unsigned *ptr = (unsigned *)((uintptr_t)arg); + FAR unsigned *ptr = (FAR unsigned *)((uintptr_t)arg); if (ptr == NULL) { ret = -EINVAL; @@ -388,7 +388,7 @@ static int hx711_ioctl(FAR struct file *filep, int cmd, unsigned long arg) case HX711_TARE: { - float *precision = (float *)((uintptr_t)arg); + FAR float *precision = (FAR float *)((uintptr_t)arg); if (precision == NULL) { ret = -EINVAL; @@ -401,7 +401,7 @@ static int hx711_ioctl(FAR struct file *filep, int cmd, unsigned long arg) case HX711_SET_SIGN: { - int *sign = (int *)((uintptr_t)arg); + FAR int *sign = (FAR int *)((uintptr_t)arg); if (sign == NULL || (*sign != 1 && *sign != -1)) { ret = EINVAL; diff --git a/drivers/analog/max1161x.c b/drivers/analog/max1161x.c index 7e26fceb53..7c29d9e1b3 100644 --- a/drivers/analog/max1161x.c +++ b/drivers/analog/max1161x.c @@ -267,7 +267,7 @@ static int max1161x_readchannel(FAR struct max1161x_dev_s *priv, i2cmsg[2].flags = I2C_M_READ; uint16_t buf; - i2cmsg[2].buffer = (uint8_t *)(&buf); + i2cmsg[2].buffer = (FAR uint8_t *)(&buf); i2cmsg[2].length = sizeof(buf); ret = I2C_TRANSFER(priv->i2c, i2cmsg, 3); if (ret < 0) diff --git a/drivers/audio/audio_dma.c b/drivers/audio/audio_dma.c index 10b5c753ec..4a03d83043 100644 --- a/drivers/audio/audio_dma.c +++ b/drivers/audio/audio_dma.c @@ -585,9 +585,9 @@ struct audio_lowerhalf_s *audio_dma_initialize(struct dma_dev_s *dma_dev, audio_dma->fifo_width = fifo_width; if (audio_dma->playback) - audio_dma->dst_addr = up_addrenv_va_to_pa((void *)fifo_addr); + audio_dma->dst_addr = up_addrenv_va_to_pa((FAR void *)fifo_addr); else - audio_dma->src_addr = up_addrenv_va_to_pa((void *)fifo_addr); + audio_dma->src_addr = up_addrenv_va_to_pa((FAR void *)fifo_addr); audio_dma->buffer_size = CONFIG_AUDIO_BUFFER_NUMBYTES; audio_dma->buffer_num = CONFIG_AUDIO_NUM_BUFFERS; diff --git a/drivers/audio/audio_i2s.c b/drivers/audio/audio_i2s.c index c427b6e5ed..33408a9fb1 100644 --- a/drivers/audio/audio_i2s.c +++ b/drivers/audio/audio_i2s.c @@ -38,7 +38,7 @@ struct audio_i2s_s { struct audio_lowerhalf_s dev; - struct i2s_dev_s *i2s; + FAR struct i2s_dev_s *i2s; bool playback; }; @@ -91,7 +91,7 @@ static int audio_i2s_enqueuebuffer(FAR struct audio_lowerhalf_s *dev, FAR struct ap_buffer_s *apb); static int audio_i2s_ioctl(FAR struct audio_lowerhalf_s *dev, int cmd, unsigned long arg); -static void audio_i2s_callback(struct i2s_dev_s *dev, +static void audio_i2s_callback(FAR struct i2s_dev_s *dev, FAR struct ap_buffer_s *apb, FAR void *arg, int result); @@ -130,7 +130,7 @@ static const struct audio_ops_s g_audio_i2s_ops = static int audio_i2s_getcaps(FAR struct audio_lowerhalf_s *dev, int type, FAR struct audio_caps_s *caps) { - FAR struct audio_i2s_s *audio_i2s = (struct audio_i2s_s *)dev; + FAR struct audio_i2s_s *audio_i2s = (FAR struct audio_i2s_s *)dev; FAR struct i2s_dev_s *i2s = audio_i2s->i2s; /* Validate the structure */ @@ -208,7 +208,7 @@ static int audio_i2s_configure(FAR struct audio_lowerhalf_s *dev, FAR const struct audio_caps_s *caps) #endif { - FAR struct audio_i2s_s *audio_i2s = (struct audio_i2s_s *)dev; + FAR struct audio_i2s_s *audio_i2s = (FAR struct audio_i2s_s *)dev; FAR struct i2s_dev_s *i2s; int samprate; int nchannels; @@ -257,7 +257,7 @@ static int audio_i2s_configure(FAR struct audio_lowerhalf_s *dev, static int audio_i2s_shutdown(FAR struct audio_lowerhalf_s *dev) { - FAR struct audio_i2s_s *audio_i2s = (struct audio_i2s_s *)dev; + FAR struct audio_i2s_s *audio_i2s = (FAR struct audio_i2s_s *)dev; FAR struct i2s_dev_s *i2s = audio_i2s->i2s; return I2S_IOCTL(i2s, AUDIOIOC_SHUTDOWN, audio_i2s->playback); @@ -270,7 +270,7 @@ static int audio_i2s_start(FAR struct audio_lowerhalf_s *dev, static int audio_i2s_start(FAR struct audio_lowerhalf_s *dev) #endif { - FAR struct audio_i2s_s *audio_i2s = (struct audio_i2s_s *)dev; + FAR struct audio_i2s_s *audio_i2s = (FAR struct audio_i2s_s *)dev; FAR struct i2s_dev_s *i2s = audio_i2s->i2s; return I2S_IOCTL(i2s, AUDIOIOC_START, audio_i2s->playback); @@ -284,7 +284,7 @@ static int audio_i2s_stop(FAR struct audio_lowerhalf_s *dev, static int audio_i2s_stop(FAR struct audio_lowerhalf_s *dev) #endif { - FAR struct audio_i2s_s *audio_i2s = (struct audio_i2s_s *)dev; + FAR struct audio_i2s_s *audio_i2s = (FAR struct audio_i2s_s *)dev; FAR struct i2s_dev_s *i2s = audio_i2s->i2s; return I2S_IOCTL(i2s, AUDIOIOC_STOP, audio_i2s->playback); @@ -299,7 +299,7 @@ static int audio_i2s_pause(FAR struct audio_lowerhalf_s *dev, static int audio_i2s_pause(FAR struct audio_lowerhalf_s *dev) #endif { - FAR struct audio_i2s_s *audio_i2s = (struct audio_i2s_s *)dev; + FAR struct audio_i2s_s *audio_i2s = (FAR struct audio_i2s_s *)dev; FAR struct i2s_dev_s *i2s = audio_i2s->i2s; return I2S_IOCTL(i2s, AUDIOIOC_PAUSE, audio_i2s->playback); @@ -312,7 +312,7 @@ static int audio_i2s_resume(FAR struct audio_lowerhalf_s *dev, static int audio_i2s_resume(FAR struct audio_lowerhalf_s *dev) #endif { - FAR struct audio_i2s_s *audio_i2s = (struct audio_i2s_s *)dev; + FAR struct audio_i2s_s *audio_i2s = (FAR struct audio_i2s_s *)dev; FAR struct i2s_dev_s *i2s = audio_i2s->i2s; return I2S_IOCTL(i2s, AUDIOIOC_RESUME, audio_i2s->playback); @@ -322,7 +322,7 @@ static int audio_i2s_resume(FAR struct audio_lowerhalf_s *dev) static int audio_i2s_allocbuffer(FAR struct audio_lowerhalf_s *dev, FAR struct audio_buf_desc_s *bufdesc) { - FAR struct audio_i2s_s *audio_i2s = (struct audio_i2s_s *)dev; + FAR struct audio_i2s_s *audio_i2s = (FAR struct audio_i2s_s *)dev; FAR struct i2s_dev_s *i2s = audio_i2s->i2s; return I2S_IOCTL(i2s, AUDIOIOC_ALLOCBUFFER, (unsigned long)bufdesc); @@ -331,7 +331,7 @@ static int audio_i2s_allocbuffer(FAR struct audio_lowerhalf_s *dev, static int audio_i2s_freebuffer(FAR struct audio_lowerhalf_s *dev, FAR struct audio_buf_desc_s *bufdesc) { - FAR struct audio_i2s_s *audio_i2s = (struct audio_i2s_s *)dev; + FAR struct audio_i2s_s *audio_i2s = (FAR struct audio_i2s_s *)dev; FAR struct i2s_dev_s *i2s = audio_i2s->i2s; return I2S_IOCTL(i2s, AUDIOIOC_FREEBUFFER, (unsigned long)bufdesc); @@ -340,7 +340,7 @@ static int audio_i2s_freebuffer(FAR struct audio_lowerhalf_s *dev, static int audio_i2s_enqueuebuffer(FAR struct audio_lowerhalf_s *dev, FAR struct ap_buffer_s *apb) { - FAR struct audio_i2s_s *audio_i2s = (struct audio_i2s_s *)dev; + FAR struct audio_i2s_s *audio_i2s = (FAR struct audio_i2s_s *)dev; FAR struct i2s_dev_s *i2s = audio_i2s->i2s; if (audio_i2s->playback) @@ -356,7 +356,7 @@ static int audio_i2s_enqueuebuffer(FAR struct audio_lowerhalf_s *dev, static int audio_i2s_ioctl(FAR struct audio_lowerhalf_s *dev, int cmd, unsigned long arg) { - FAR struct audio_i2s_s *audio_i2s = (struct audio_i2s_s *)dev; + FAR struct audio_i2s_s *audio_i2s = (FAR struct audio_i2s_s *)dev; FAR struct i2s_dev_s *i2s = audio_i2s->i2s; return I2S_IOCTL(i2s, cmd, arg); @@ -370,7 +370,7 @@ static int audio_i2s_reserve(FAR struct audio_lowerhalf_s *dev) #endif { #ifdef CONFIG_AUDIO_MULTI_SESSION - *session = (void *)audio_i2s->playback; + *session = (FAR void *)audio_i2s->playback; #endif return OK; } @@ -385,7 +385,7 @@ static int audio_i2s_release(FAR struct audio_lowerhalf_s *dev) return OK; } -static void audio_i2s_callback(struct i2s_dev_s *dev, +static void audio_i2s_callback(FAR struct i2s_dev_s *dev, FAR struct ap_buffer_s *apb, FAR void *arg, int result) { diff --git a/drivers/audio/audio_null.c b/drivers/audio/audio_null.c index f2fd2e6da6..0ec5317e24 100644 --- a/drivers/audio/audio_null.c +++ b/drivers/audio/audio_null.c @@ -275,7 +275,7 @@ static int null_getcaps(FAR struct audio_lowerhalf_s *dev, int type, /* Report the Sample rates we support */ - ptr = (uint16_t *)caps->ac_controls.b; + ptr = (FAR uint16_t *)caps->ac_controls.b; *ptr = AUDIO_SAMP_RATE_8K | AUDIO_SAMP_RATE_11K | AUDIO_SAMP_RATE_16K | diff --git a/drivers/audio/cs4344.c b/drivers/audio/cs4344.c index 990b38595b..e99669e600 100644 --- a/drivers/audio/cs4344.c +++ b/drivers/audio/cs4344.c @@ -418,7 +418,7 @@ static int cs4344_getcaps(FAR struct audio_lowerhalf_s *dev, int type, /* Report the Sample rates we support */ - ptr = (uint16_t *)caps->ac_controls.b; + ptr = (FAR uint16_t *)caps->ac_controls.b; *ptr = AUDIO_SAMP_RATE_16K | AUDIO_SAMP_RATE_22K | AUDIO_SAMP_RATE_32K | AUDIO_SAMP_RATE_44K | diff --git a/drivers/audio/cs43l22.c b/drivers/audio/cs43l22.c index f767c24ad4..ca8b3dc91c 100644 --- a/drivers/audio/cs43l22.c +++ b/drivers/audio/cs43l22.c @@ -582,7 +582,7 @@ static int cs43l22_getcaps(FAR struct audio_lowerhalf_s *dev, int type, /* Report the Sample rates we support */ - ptr = (uint16_t *)caps->ac_controls.b; + ptr = (FAR uint16_t *)caps->ac_controls.b; *ptr = AUDIO_SAMP_RATE_8K | AUDIO_SAMP_RATE_11K | AUDIO_SAMP_RATE_16K | AUDIO_SAMP_RATE_22K | diff --git a/drivers/audio/es8311.c b/drivers/audio/es8311.c index d9917069de..084520cf0a 100644 --- a/drivers/audio/es8311.c +++ b/drivers/audio/es8311.c @@ -847,7 +847,7 @@ static int es8311_getcaps(FAR struct audio_lowerhalf_s *dev, int type, /* 8kHz is hardware dependent */ - ptr = (uint16_t *)caps->ac_controls.b; + ptr = (FAR uint16_t *)caps->ac_controls.b; *ptr = AUDIO_SAMP_RATE_11K | AUDIO_SAMP_RATE_16K | AUDIO_SAMP_RATE_22K | AUDIO_SAMP_RATE_32K | @@ -865,7 +865,7 @@ static int es8311_getcaps(FAR struct audio_lowerhalf_s *dev, int type, { /* Report supported input sample rates */ - ptr = (uint16_t *)caps->ac_controls.b; + ptr = (FAR uint16_t *)caps->ac_controls.b; *ptr = AUDIO_SAMP_RATE_11K | AUDIO_SAMP_RATE_16K | AUDIO_SAMP_RATE_22K | AUDIO_SAMP_RATE_32K | diff --git a/drivers/audio/es8388.c b/drivers/audio/es8388.c index 1f40689036..47ad520d59 100644 --- a/drivers/audio/es8388.c +++ b/drivers/audio/es8388.c @@ -830,7 +830,7 @@ static int es8388_getcaps(FAR struct audio_lowerhalf_s *dev, int type, /* 8kHz is hardware dependent */ - ptr = (uint16_t *)caps->ac_controls.b; + ptr = (FAR uint16_t *)caps->ac_controls.b; *ptr = AUDIO_SAMP_RATE_11K | AUDIO_SAMP_RATE_16K | AUDIO_SAMP_RATE_22K | AUDIO_SAMP_RATE_32K | @@ -853,7 +853,7 @@ static int es8388_getcaps(FAR struct audio_lowerhalf_s *dev, int type, /* Report supported input sample rates */ - ptr = (uint16_t *)caps->ac_controls.b; + ptr = (FAR uint16_t *)caps->ac_controls.b; *ptr = AUDIO_SAMP_RATE_11K | AUDIO_SAMP_RATE_16K | AUDIO_SAMP_RATE_22K | AUDIO_SAMP_RATE_32K | diff --git a/drivers/audio/tone.c b/drivers/audio/tone.c index 5066f86414..68cc01c6c2 100644 --- a/drivers/audio/tone.c +++ b/drivers/audio/tone.c @@ -127,8 +127,8 @@ static const uint16_t g_notes_freq[84] = /* Global variable used by the tone generator */ -static const char *g_tune; -static const char *g_next; +static FAR const char *g_tune; +static FAR const char *g_next; static uint8_t g_tempo; static uint8_t g_note_mode; static uint32_t g_note_length; diff --git a/drivers/audio/vs1053.c b/drivers/audio/vs1053.c index 2b2b1c1b5f..fd8a5779e3 100644 --- a/drivers/audio/vs1053.c +++ b/drivers/audio/vs1053.c @@ -343,7 +343,8 @@ static void vs1053_writereg(FAR struct vs1053_struct_s *dev, * ****************************************************************************/ -static int vs1053_setfrequency(FAR struct vs1053_struct_s *dev, uint32_t freq) +static int vs1053_setfrequency(FAR struct vs1053_struct_s *dev, + uint32_t freq) { double factor; uint16_t reg; @@ -648,7 +649,7 @@ static int vs1053_getcaps(FAR struct audio_lowerhalf_s *lower, int type, /* Report the Sample rates we support */ - ptr = (uint16_t *)caps->ac_controls.b; + ptr = (FAR uint16_t *)caps->ac_controls.b; *ptr = AUDIO_SAMP_RATE_8K | AUDIO_SAMP_RATE_11K | AUDIO_SAMP_RATE_16K | @@ -826,6 +827,7 @@ static int vs1053_configure(FAR struct audio_lowerhalf_s *lower, { dev->bass = 100; } + vs1053_setbass(dev); break; @@ -840,6 +842,7 @@ static int vs1053_configure(FAR struct audio_lowerhalf_s *lower, { dev->treble = 100; } + vs1053_setbass(dev); break; diff --git a/drivers/audio/wm8904.c b/drivers/audio/wm8904.c index 37eb1a427d..b47446aeb7 100644 --- a/drivers/audio/wm8904.c +++ b/drivers/audio/wm8904.c @@ -1018,7 +1018,7 @@ static int wm8904_getcaps(FAR struct audio_lowerhalf_s *dev, int type, /* Report the Sample rates we support */ - ptr = (uint16_t *)caps->ac_controls.b; + ptr = (FAR uint16_t *)caps->ac_controls.b; *ptr = AUDIO_SAMP_RATE_8K | AUDIO_SAMP_RATE_11K | AUDIO_SAMP_RATE_16K | AUDIO_SAMP_RATE_22K | diff --git a/drivers/audio/wm8994.c b/drivers/audio/wm8994.c index 3d42419609..a33604c23a 100644 --- a/drivers/audio/wm8994.c +++ b/drivers/audio/wm8994.c @@ -242,7 +242,7 @@ uint16_t wm8994_readreg(FAR struct wm8994_dev_s *priv, uint16_t regaddr) msg[0].frequency = priv->lower->frequency; msg[0].addr = priv->lower->address; msg[0].flags = 0; - msg[0].buffer = (uint8_t *)&buffer; + msg[0].buffer = (FAR uint8_t *)&buffer; msg[0].length = 2; /* Followed by the read data */ @@ -716,7 +716,7 @@ static int wm8994_getcaps(FAR struct audio_lowerhalf_s *dev, int type, /* Report the Sample rates we support */ - ptr = (uint16_t *)caps->ac_controls.b; + ptr = (FAR uint16_t *)caps->ac_controls.b; *ptr = AUDIO_SAMP_RATE_8K | AUDIO_SAMP_RATE_11K | AUDIO_SAMP_RATE_16K | AUDIO_SAMP_RATE_22K | diff --git a/drivers/bch/bchlib_setup.c b/drivers/bch/bchlib_setup.c index f0454aedf2..dca08903ff 100644 --- a/drivers/bch/bchlib_setup.c +++ b/drivers/bch/bchlib_setup.c @@ -53,7 +53,7 @@ * ****************************************************************************/ -int bchlib_setup(const char *blkdev, bool readonly, FAR void **handle) +int bchlib_setup(FAR const char *blkdev, bool readonly, FAR void **handle) { FAR struct bchlib_s *bch; struct geometry geo; diff --git a/drivers/can/can.c b/drivers/can/can.c index ed804247c8..dea1d0fa67 100644 --- a/drivers/can/can.c +++ b/drivers/can/can.c @@ -897,7 +897,7 @@ static int can_ioctl(FAR struct file *filep, int cmd, unsigned long arg) case FIONWRITE: { - *(uint8_t *)arg = dev->cd_xmit.tx_tail; + *(FAR uint8_t *)arg = dev->cd_xmit.tx_tail; } break; @@ -905,7 +905,7 @@ static int can_ioctl(FAR struct file *filep, int cmd, unsigned long arg) case FIONREAD: { - *(uint8_t *)arg = reader->fifo.rx_tail; + *(FAR uint8_t *)arg = reader->fifo.rx_tail; } break; diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 6218f5a7ea..ae188166c9 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -80,8 +80,8 @@ static uint32_t __clk_round_rate(FAR struct clk_s *clk, uint32_t rate); static int __clk_enable(FAR struct clk_s *clk); static int __clk_disable(FAR struct clk_s *clk); -static struct clk_s *__clk_lookup(FAR const char *name, - FAR struct clk_s *clk); +static FAR struct clk_s *__clk_lookup(FAR const char *name, + FAR struct clk_s *clk); static int __clk_register(FAR struct clk_s *clk); static void clk_disable_unused_subtree(FAR struct clk_s *clk); @@ -98,7 +98,7 @@ static ssize_t clk_procfs_read(FAR struct file *filep, FAR char *buffer, size_t buflen); static int clk_procfs_dup(FAR const struct file *oldp, FAR struct file *newp); -static int clk_procfs_stat(const char *relpath, struct stat *buf); +static int clk_procfs_stat(FAR const char *relpath, FAR struct stat *buf); #endif /* !defined(CONFIG_FS_PROCFS_EXCLUDE_CLK) && defined(CONFIG_FS_PROCFS) */ @@ -164,7 +164,7 @@ static int clk_procfs_close(FAR struct file *filep) } static size_t clk_procfs_printf(FAR char *buffer, size_t buflen, - off_t *pos, FAR const char *fmt, + FAR off_t *pos, FAR const char *fmt, ...) { char tmp[CLK_PROCFS_LINELEN]; @@ -180,7 +180,7 @@ static size_t clk_procfs_printf(FAR char *buffer, size_t buflen, static size_t clk_procfs_show_subtree(FAR struct clk_s *clk, int level, FAR char *buffer, size_t buflen, - off_t *pos, FAR irqstate_t *flags) + FAR off_t *pos, FAR irqstate_t *flags) { FAR struct clk_s *child; size_t oldlen = buflen; @@ -223,7 +223,7 @@ static size_t clk_procfs_show_subtree(FAR struct clk_s *clk, int level, } static size_t clk_procfs_showtree(FAR char *buffer, - size_t buflen, off_t *pos) + size_t buflen, FAR off_t *pos) { FAR struct clk_s *clk; size_t oldlen = buflen; @@ -305,7 +305,7 @@ static int clk_procfs_dup(FAR const struct file *oldp, return OK; } -static int clk_procfs_stat(const char *relpath, struct stat *buf) +static int clk_procfs_stat(FAR const char *relpath, FAR struct stat *buf) { /* File/directory size, access block size */ @@ -426,7 +426,7 @@ static void clk_calc_subtree(FAR struct clk_s *clk, uint32_t new_rate, } static FAR struct clk_s *clk_calc_new_rates(FAR struct clk_s *clk, - uint32_t rate) + uint32_t rate) { FAR struct clk_s *top = clk; FAR struct clk_s *old_parent; @@ -561,8 +561,8 @@ static void clk_change_rate(FAR struct clk_s *clk, uint32_t best_parent_rate) } } -static struct clk_s *__clk_lookup(FAR const char *name, - FAR struct clk_s *clk) +static FAR struct clk_s *__clk_lookup(FAR const char *name, + FAR struct clk_s *clk) { FAR struct clk_s *child; FAR struct clk_s *ret; @@ -1198,7 +1198,7 @@ FAR struct clk_s *clk_register(FAR const char *name, size_t len; int i; - off = len = sizeof(struct clk_s) + num_parents * sizeof(char *); + off = len = sizeof(struct clk_s) + num_parents * sizeof(FAR char *); if (!(flags & CLK_PARENT_NAME_IS_STATIC)) { for (i = 0; i < num_parents; i++) @@ -1228,8 +1228,8 @@ FAR struct clk_s *clk_register(FAR const char *name, return NULL; } - clk->name = (char *)clk + len; - strlcpy((char *)clk->name, name, size); + clk->name = (FAR char *)clk + len; + strlcpy((FAR char *)clk->name, name, size); } clk->ops = ops; @@ -1238,7 +1238,7 @@ FAR struct clk_s *clk_register(FAR const char *name, if (private_data) { - clk->private_data = (char *)clk + off; + clk->private_data = (FAR char *)clk + off; memcpy(clk->private_data, private_data, private_size); off += private_size; } @@ -1251,8 +1251,9 @@ FAR struct clk_s *clk_register(FAR const char *name, } else { - clk->parent_names[i] = (char *)clk + off; - strlcpy((char *)clk->parent_names[i], parent_names[i], len - off); + clk->parent_names[i] = (FAR char *)clk + off; + strlcpy((FAR char *)clk->parent_names[i], parent_names[i], + len - off); off += strlen(parent_names[i]) + 1; } } diff --git a/drivers/contactless/mfrc522.c b/drivers/contactless/mfrc522.c index ae2614e309..a862ee70f9 100644 --- a/drivers/contactless/mfrc522.c +++ b/drivers/contactless/mfrc522.c @@ -98,7 +98,7 @@ int mfrc522_picc_select(FAR struct mfrc522_dev_s *dev, #if 0 /* TODO */ /* IRQ Handling */ -static int mfrc522_irqhandler(FAR int irq, FAR void *context, FAR void *dev); +static int mfrc522_irqhandler(int irq, FAR void *context, FAR void *dev); static inline int mfrc522_attachirq(FAR struct mfrc522_dev_s *dev, xcpt_t isr); #endif diff --git a/drivers/contactless/pn532.c b/drivers/contactless/pn532.c index 680fc895ad..4842e691f7 100644 --- a/drivers/contactless/pn532.c +++ b/drivers/contactless/pn532.c @@ -96,7 +96,7 @@ int pn532_read(FAR struct pn532_dev_s *dev, FAR uint8_t *buff, uint8_t n); #if 0 /* TODO */ /* IRQ Handling */ -static int pn532_irqhandler(FAR int irq, FAR void *context, FAR void *dev); +static int pn532_irqhandler(int irq, FAR void *context, FAR void *dev); static inline int pn532_attachirq(FAR struct pn532_dev_s *dev, xcpt_t isr); #endif @@ -346,7 +346,7 @@ static void pn532_writecommand(FAR struct pn532_dev_s *dev, uint8_t cmd) pn532_deselect(dev); pn532_unlock(dev->spi); - tracetx("command sent", (uint8_t *) f, FRAME_SIZE(f)); + tracetx("command sent", (FAR uint8_t *)f, FRAME_SIZE(f)); } #endif @@ -408,7 +408,7 @@ int pn532_read_ack(FAR struct pn532_dev_s *dev) int res = 0; uint8_t ack[6]; - pn532_read(dev, (uint8_t *) &ack, 6); + pn532_read(dev, (FAR uint8_t *) &ack, 6); if (memcmp(&ack, &pn532ack, 6) == 0x00) { @@ -453,7 +453,7 @@ int pn532_write_frame(FAR struct pn532_dev_s *dev, FAR struct pn532_frame *f) SPI_SNDBLOCK(dev->spi, f, FRAME_SIZE(f)); pn532_deselect(dev); pn532_unlock(dev->spi); - tracetx("WriteFrame", (uint8_t *) f, FRAME_SIZE(f)); + tracetx("WriteFrame", (FAR uint8_t *)f, FRAME_SIZE(f)); /* Wait ACK frame */ @@ -481,7 +481,7 @@ int pn532_read_frame(FAR struct pn532_dev_s *dev, FAR struct pn532_frame *f, { /* Read header */ - pn532_read(dev, (uint8_t *) f, sizeof(struct pn532_frame)); + pn532_read(dev, (FAR uint8_t *)f, sizeof(struct pn532_frame)); if (pn532_rx_frame_is_valid(f, false)) { if (max_size < f->len) @@ -521,7 +521,7 @@ bool pn532_set_config(FAR struct pn532_dev_s *dev, uint8_t flags) if (pn532_write_frame(dev, f) == OK) { - pn532_read(dev, (uint8_t *) &resp, 9); + pn532_read(dev, (FAR uint8_t *)&resp, 9); tracerx("set config response", resp, 9); res = true; } @@ -555,7 +555,7 @@ int pn532_sam_config(FAR struct pn532_dev_s *dev, { if (pn532_read_frame(dev, f, 4) == OK) { - tracerx("sam config response", (uint8_t *) f->data, 3); + tracerx("sam config response", (FAR uint8_t *)f->data, 3); if (f->data[0] == PN532_COMMAND_SAMCONFIGURATION + 1) { res = OK; @@ -798,8 +798,8 @@ bool pn532_set_rf_config(struct pn532_dev_s * dev, if (pn532_write_frame(dev, f) == OK) { - pn532_read(dev, (uint8_t *) f, 10); - tracerx("rf config response", (uint8_t *) f, 10); + pn532_read(dev, (FAR uint8_t *)f, 10); + tracerx("rf config response", (FAR uint8_t *)f, 10); if (pn532_rx_frame_is_valid(f, true)) { if (f->data[0] == PN532_COMMAND_RFCONFIGURATION + 1) @@ -990,7 +990,7 @@ static int _ioctl(FAR struct file *filep, int cmd, unsigned long arg) } ret = pn532_read_passive_data(dev, tag_data->address, - (uint8_t *) &tag_data->data, + (FAR uint8_t *)&tag_data->data, sizeof(tag_data->data)); dev->state = PN532_STATE_IDLE; diff --git a/drivers/crypto/dev_urandom.c b/drivers/crypto/dev_urandom.c index b6c6efda87..9ead0dd27a 100644 --- a/drivers/crypto/dev_urandom.c +++ b/drivers/crypto/dev_urandom.c @@ -182,7 +182,7 @@ static ssize_t devurand_read(FAR struct file *filep, FAR char *buffer, while (n >= 4) { - *(uint32_t *)buffer = PRNG(); + *(FAR uint32_t *)buffer = PRNG(); buffer += 4; n -= 4; } diff --git a/drivers/devicetree/fdt.c b/drivers/devicetree/fdt.c index 4bef5f6f06..f842e5dc71 100644 --- a/drivers/devicetree/fdt.c +++ b/drivers/devicetree/fdt.c @@ -80,7 +80,7 @@ int fdt_get_irq(FAR const void *fdt, int nodeoffset, } int fdt_get_irq_by_path(FAR const void *fdt, int offset, - const char *path, int irqbase) + FAR const char *path, int irqbase) { return fdt_get_irq(fdt, fdt_path_offset(fdt, path), offset, irqbase); } @@ -124,7 +124,7 @@ uintptr_t fdt_ld_by_cells(FAR const void *value, int cells) } uintptr_t fdt_get_reg_base_by_name(FAR const void *fdt, int offset, - const char *reg_name) + FAR const char *reg_name) { uintptr_t addr = 0; @@ -184,7 +184,7 @@ uintptr_t fdt_get_reg_base_by_path(FAR const void *fdt, FAR const char *path) bool fdt_device_is_available(FAR const void *fdt, int node) { - const char *status = fdt_getprop(fdt, node, "status", NULL); + FAR const char *status = fdt_getprop(fdt, node, "status", NULL); if (!status) { return true; @@ -198,7 +198,7 @@ bool fdt_device_is_available(FAR const void *fdt, int node) return false; } -const char *fdt_get_node_label(FAR const void *fdt, int node) +FAR const char *fdt_get_node_label(FAR const void *fdt, int node) { int symbols_offset; int property_offset; diff --git a/drivers/eeprom/i2c_xx24xx.c b/drivers/eeprom/i2c_xx24xx.c index 959545da86..6d2210a991 100644 --- a/drivers/eeprom/i2c_xx24xx.c +++ b/drivers/eeprom/i2c_xx24xx.c @@ -121,23 +121,23 @@ struct ee24xx_dev_s { /* Bus management */ - struct i2c_master_s *i2c; /* I2C device where the EEPROM is attached */ - uint32_t freq; /* I2C bus speed */ - uint8_t addr; /* 7-bit unshifted I2C device address */ + FAR struct i2c_master_s *i2c; /* I2C device where the EEPROM is attached */ + uint32_t freq; /* I2C bus speed */ + uint8_t addr; /* 7-bit unshifted I2C device address */ /* Driver management */ - mutex_t lock; /* file write access serialization */ - uint8_t refs; /* Nr of times the device has been opened */ - bool readonly; /* Flags */ + mutex_t lock; /* file write access serialization */ + uint8_t refs; /* Nr of times the device has been opened */ + bool readonly; /* Flags */ /* Expanded from geometry */ - uint32_t size; /* total bytes in device */ - uint16_t pgsize; /* write block size, in bytes */ - uint16_t addrlen; /* number of bytes in data addresses */ - uint16_t haddrbits; /* Number of bits in high address part */ - uint16_t haddrshift; /* bit-shift of high address part */ + uint32_t size; /* total bytes in device */ + uint16_t pgsize; /* write block size, in bytes */ + uint16_t addrlen; /* number of bytes in data addresses */ + uint16_t haddrbits; /* Number of bits in high address part */ + uint16_t haddrshift; /* bit-shift of high address part */ }; /**************************************************************************** @@ -322,7 +322,7 @@ static int ee24xx_writepage(FAR struct ee24xx_dev_s *eedev, uint32_t memaddr, msgs[1].frequency = msgs[0].frequency; msgs[1].addr = msgs[0].addr; msgs[1].flags = I2C_M_NOSTART; - msgs[1].buffer = (uint8_t *)buffer; + msgs[1].buffer = (FAR uint8_t *)buffer; msgs[1].length = len; return I2C_TRANSFER(eedev->i2c, msgs, 2); @@ -543,7 +543,7 @@ static ssize_t ee24xx_read(FAR struct file *filep, FAR char *buffer, msgs[1].frequency = msgs[0].frequency; msgs[1].addr = msgs[0].addr; msgs[1].flags = I2C_M_READ; - msgs[1].buffer = (uint8_t *)buffer; + msgs[1].buffer = (FAR uint8_t *)buffer; msgs[1].length = len; ret = I2C_TRANSFER(eedev->i2c, msgs, 2); @@ -618,7 +618,7 @@ static ssize_t at24cs_read_uuid(FAR struct file *filep, FAR char *buffer, msgs[1].frequency = msgs[0].frequency; msgs[1].addr = msgs[0].addr; msgs[1].flags = I2C_M_READ; - msgs[1].buffer = (uint8_t *)buffer; + msgs[1].buffer = (FAR uint8_t *)buffer; msgs[1].length = len; ret = I2C_TRANSFER(eedev->i2c, msgs, 2); diff --git a/drivers/eeprom/spi_xx25xx.c b/drivers/eeprom/spi_xx25xx.c index 71bd5927bc..dd3be40f4c 100644 --- a/drivers/eeprom/spi_xx25xx.c +++ b/drivers/eeprom/spi_xx25xx.c @@ -324,7 +324,7 @@ static inline void ee25xx_unlock(FAR struct spi_dev_s *dev) * Name: ee25xx_sendcmd * * Description: Send command and address as one transaction to take advantage - * of possible faster DMA transfers. Sending byte per byte is FAR FAR slower. + * of possible faster DMA transfers. Sending byte per byte is far far slower. * ****************************************************************************/ diff --git a/drivers/i2c/i2c_slave_driver.c b/drivers/i2c/i2c_slave_driver.c index b71c1266cc..9ec9792326 100644 --- a/drivers/i2c/i2c_slave_driver.c +++ b/drivers/i2c/i2c_slave_driver.c @@ -426,7 +426,7 @@ static int i2c_slave_poll(FAR struct file *filep, FAR struct pollfd *fds, } else if (fds->priv != NULL) { - struct pollfd **slot = fds->priv; + FAR struct pollfd **slot = fds->priv; *slot = NULL; fds->priv = NULL; } diff --git a/drivers/input/ads7843e.c b/drivers/input/ads7843e.c index 87d527d016..eee7c49acf 100644 --- a/drivers/input/ads7843e.c +++ b/drivers/input/ads7843e.c @@ -105,7 +105,7 @@ static ssize_t ads7843e_read(FAR struct file *filep, FAR char *buffer, size_t len); static int ads7843e_ioctl(FAR struct file *filep, int cmd, unsigned long arg); -static int ads7843e_poll(FAR struct file *filep, struct pollfd *fds, +static int ads7843e_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup); /**************************************************************************** @@ -1050,7 +1050,7 @@ static int ads7843e_poll(FAR struct file *filep, FAR struct pollfd *fds, { /* This is a request to tear down the poll. */ - struct pollfd **slot = (struct pollfd **)fds->priv; + FAR struct pollfd **slot = (FAR struct pollfd **)fds->priv; DEBUGASSERT(slot != NULL); /* Remove all memory of the poll setup */ diff --git a/drivers/input/ads7843e.h b/drivers/input/ads7843e.h index 6a79096628..bf2ce171f5 100644 --- a/drivers/input/ads7843e.h +++ b/drivers/input/ads7843e.h @@ -149,7 +149,7 @@ struct ads7843e_dev_s * retained in the f_priv field of the 'struct file'. */ - struct pollfd *fds[CONFIG_ADS7843E_NPOLLWAITERS]; + FAR struct pollfd *fds[CONFIG_ADS7843E_NPOLLWAITERS]; }; /**************************************************************************** diff --git a/drivers/input/cypress_mbr3108.c b/drivers/input/cypress_mbr3108.c index 710e85d6c9..2d4a2be2e4 100644 --- a/drivers/input/cypress_mbr3108.c +++ b/drivers/input/cypress_mbr3108.c @@ -184,19 +184,19 @@ struct mbr3108_dev_s { /* I2C bus and address for device. */ - struct i2c_master_s *i2c; + FAR struct i2c_master_s *i2c; uint8_t addr; /* Configuration for device. */ - struct mbr3108_board_s *board; - const struct mbr3108_sensor_conf_s *sensor_conf; + FAR struct mbr3108_board_s *board; + FAR const struct mbr3108_sensor_conf_s *sensor_conf; mutex_t devlock; uint8_t cref; struct mbr3108_debug_conf_s debug_conf; bool int_pending; - struct pollfd *fds[CONFIG_INPUT_CYPRESS_MBR3108_NPOLLWAITERS]; + FAR struct pollfd *fds[CONFIG_INPUT_CYPRESS_MBR3108_NPOLLWAITERS]; }; /**************************************************************************** @@ -234,7 +234,7 @@ static const struct file_operations g_mbr3108_fileops = ****************************************************************************/ static int mbr3108_i2c_write(FAR struct mbr3108_dev_s *dev, uint8_t reg, - const uint8_t *buf, size_t buflen) + FAR const uint8_t *buf, size_t buflen) { struct i2c_msg_s msgv[2] = { @@ -282,7 +282,7 @@ static int mbr3108_i2c_write(FAR struct mbr3108_dev_s *dev, uint8_t reg, } static int mbr3108_i2c_read(FAR struct mbr3108_dev_s *dev, uint8_t reg, - uint8_t *buf, size_t buflen) + FAR uint8_t *buf, size_t buflen) { struct i2c_msg_s msgv[2] = { @@ -1075,13 +1075,14 @@ static int mbr3108_isr_handler(int irq, FAR void *context, FAR void *arg) * Public Functions ****************************************************************************/ -int cypress_mbr3108_register(FAR const char *devpath, - FAR struct i2c_master_s *i2c_dev, - uint8_t i2c_devaddr, - struct mbr3108_board_s *board_config, - const struct mbr3108_sensor_conf_s *sensor_conf) +int +cypress_mbr3108_register(FAR const char *devpath, + FAR struct i2c_master_s *i2c_dev, + uint8_t i2c_devaddr, + FAR struct mbr3108_board_s *board_config, + FAR const struct mbr3108_sensor_conf_s *sensor_conf) { - struct mbr3108_dev_s *priv; + FAR struct mbr3108_dev_s *priv; int ret = 0; /* Allocate device private structure. */ diff --git a/drivers/input/ft5x06.c b/drivers/input/ft5x06.c index c5fcb9ebd2..fa2212e7e3 100644 --- a/drivers/input/ft5x06.c +++ b/drivers/input/ft5x06.c @@ -130,7 +130,7 @@ struct ft5x06_dev_s * retained in the f_priv field of the 'struct file'. */ - struct pollfd *fds[CONFIG_FT5X06_NPOLLWAITERS]; + FAR struct pollfd *fds[CONFIG_FT5X06_NPOLLWAITERS]; }; /**************************************************************************** @@ -159,7 +159,7 @@ static ssize_t ft5x06_read(FAR struct file *filep, FAR char *buffer, size_t len); static int ft5x06_ioctl(FAR struct file *filep, int cmd, unsigned long arg); -static int ft5x06_poll(FAR struct file *filep, struct pollfd *fds, +static int ft5x06_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup); /**************************************************************************** @@ -1029,7 +1029,7 @@ static int ft5x06_poll(FAR struct file *filep, FAR struct pollfd *fds, { /* This is a request to tear down the poll. */ - struct pollfd **slot = (struct pollfd **)fds->priv; + FAR struct pollfd **slot = (FAR struct pollfd **)fds->priv; DEBUGASSERT(slot != NULL); /* Remove all memory of the poll setup */ diff --git a/drivers/input/goldfish_events.c b/drivers/input/goldfish_events.c index 3c7bf1ce89..11a7a3fc5e 100644 --- a/drivers/input/goldfish_events.c +++ b/drivers/input/goldfish_events.c @@ -40,11 +40,11 @@ ****************************************************************************/ #ifndef putreg32 -#define putreg32(v, x) (*(volatile uint32_t *)(x) = (v)) +#define putreg32(v, x) (*(FAR volatile uint32_t *)(x) = (v)) #endif #ifndef getreg32 -#define getreg32(x) (*(uint32_t *)(x)) +#define getreg32(x) (*(FAR volatile uint32_t *)(x)) #endif /**************************************************************************** diff --git a/drivers/input/gt9xx.c b/drivers/input/gt9xx.c index 1b77893e71..42423cd24f 100644 --- a/drivers/input/gt9xx.c +++ b/drivers/input/gt9xx.c @@ -76,12 +76,12 @@ struct gt9xx_dev_s { /* I2C bus and address for device */ - struct i2c_master_s *i2c; + FAR struct i2c_master_s *i2c; uint8_t addr; /* Callback for Board-Specific Operations */ - const struct gt9xx_board_s *board; + FAR const struct gt9xx_board_s *board; /* Device State */ @@ -94,7 +94,7 @@ struct gt9xx_dev_s /* Poll Waiters for device */ - struct pollfd *fds[CONFIG_INPUT_GT9XX_NPOLLWAITERS]; + FAR struct pollfd *fds[CONFIG_INPUT_GT9XX_NPOLLWAITERS]; }; /**************************************************************************** diff --git a/drivers/input/max11802.c b/drivers/input/max11802.c index 1e37ff9254..1ad3956ddb 100644 --- a/drivers/input/max11802.c +++ b/drivers/input/max11802.c @@ -98,7 +98,7 @@ static ssize_t max11802_read(FAR struct file *filep, FAR char *buffer, size_t len); static int max11802_ioctl(FAR struct file *filep, int cmd, unsigned long arg); -static int max11802_poll(FAR struct file *filep, struct pollfd *fds, +static int max11802_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup); /**************************************************************************** @@ -1043,7 +1043,7 @@ static int max11802_poll(FAR struct file *filep, FAR struct pollfd *fds, { /* This is a request to tear down the poll. */ - struct pollfd **slot = (struct pollfd **)fds->priv; + FAR struct pollfd **slot = (FAR struct pollfd **)fds->priv; DEBUGASSERT(slot != NULL); /* Remove all memory of the poll setup */ diff --git a/drivers/input/max11802.h b/drivers/input/max11802.h index 48613c22df..ccf50b7f19 100644 --- a/drivers/input/max11802.h +++ b/drivers/input/max11802.h @@ -135,7 +135,7 @@ struct max11802_dev_s * retained in the f_priv field of the 'struct file'. */ - struct pollfd *fds[CONFIG_MAX11802_NPOLLWAITERS]; + FAR struct pollfd *fds[CONFIG_MAX11802_NPOLLWAITERS]; }; /**************************************************************************** diff --git a/drivers/input/mxt.c b/drivers/input/mxt.c index 34ab9553aa..62be9660d1 100644 --- a/drivers/input/mxt.c +++ b/drivers/input/mxt.c @@ -202,7 +202,7 @@ struct mxt_dev_s * retained in the f_priv field of the 'struct file'. */ - struct pollfd *fds[CONFIG_MXT_NPOLLWAITERS]; + FAR struct pollfd *fds[CONFIG_MXT_NPOLLWAITERS]; }; /**************************************************************************** @@ -226,7 +226,7 @@ static int mxt_putobject(FAR struct mxt_dev_s *priv, uint8_t type, uint8_t offset, uint8_t value); #if 0 /* Not used */ static int mxt_getobject(FAR struct mxt_dev_s *priv, uint8_t type, - uint8_t offset, FAR uint8_t *value); + uint8_t offset, FAR uint8_t *value); #endif static int mxt_flushmsgs(FAR struct mxt_dev_s *priv); @@ -258,11 +258,12 @@ static int mxt_close(FAR struct file *filep); static ssize_t mxt_read(FAR struct file *filep, FAR char *buffer, size_t len); static int mxt_ioctl(FAR struct file *filep, int cmd, unsigned long arg); -static int mxt_poll(FAR struct file *filep, struct pollfd *fds, bool setup); +static int mxt_poll(FAR struct file *filep, FAR struct pollfd *fds, + bool setup); /* Initialization */ -static int mxt_getinfo(struct mxt_dev_s *priv); +static int mxt_getinfo(FAR struct mxt_dev_s *priv); static int mxt_getobjtab(FAR struct mxt_dev_s *priv); static int mxt_hwinitialize(FAR struct mxt_dev_s *priv); @@ -1509,7 +1510,7 @@ static int mxt_ioctl(FAR struct file *filep, int cmd, unsigned long arg) ****************************************************************************/ static int mxt_poll(FAR struct file *filep, FAR struct pollfd *fds, - bool setup) + bool setup) { FAR struct inode *inode; FAR struct mxt_dev_s *priv; @@ -1580,7 +1581,7 @@ static int mxt_poll(FAR struct file *filep, FAR struct pollfd *fds, { /* This is a request to tear down the poll. */ - struct pollfd **slot = (struct pollfd **)fds->priv; + FAR struct pollfd **slot = (FAR struct pollfd **)fds->priv; DEBUGASSERT(slot != NULL); /* Remove all memory of the poll setup */ @@ -1598,7 +1599,7 @@ errout: * Name: mxt_getinfo ****************************************************************************/ -static int mxt_getinfo(struct mxt_dev_s *priv) +static int mxt_getinfo(FAR struct mxt_dev_s *priv) { int ret; diff --git a/drivers/input/spq10kbd.c b/drivers/input/spq10kbd.c index 19d16af5c3..afb33a7a29 100644 --- a/drivers/input/spq10kbd.c +++ b/drivers/input/spq10kbd.c @@ -192,7 +192,7 @@ struct spq10kbd_dev_s * retained in the f_priv field of the 'struct file'. */ - struct pollfd *fds[CONFIG_SPQ10KBD_NPOLLWAITERS]; + FAR struct pollfd *fds[CONFIG_SPQ10KBD_NPOLLWAITERS]; /* Buffer used to collect and buffer incoming keyboard characters */ @@ -658,7 +658,7 @@ static int spq10kbd_poll(FAR struct file *filep, FAR struct pollfd *fds, { /* This is a request to tear down the poll. */ - struct pollfd **slot = (struct pollfd **)fds->priv; + FAR struct pollfd **slot = (FAR struct pollfd **)fds->priv; DEBUGASSERT(slot); /* Remove all memory of the poll setup */ diff --git a/drivers/input/stmpe811.h b/drivers/input/stmpe811.h index 4cfa4ce884..f1c2b0c3ef 100644 --- a/drivers/input/stmpe811.h +++ b/drivers/input/stmpe811.h @@ -157,7 +157,7 @@ struct stmpe811_dev_s * retained in the f_priv field of the 'struct file'. */ - struct pollfd *fds[CONFIG_STMPE811_NPOLLWAITERS]; + FAR struct pollfd *fds[CONFIG_STMPE811_NPOLLWAITERS]; #endif /* Fields that may be disabled to save size of GPIO support is not used */ diff --git a/drivers/input/stmpe811_tsc.c b/drivers/input/stmpe811_tsc.c index d1bf150c04..f3e60c174f 100644 --- a/drivers/input/stmpe811_tsc.c +++ b/drivers/input/stmpe811_tsc.c @@ -103,7 +103,7 @@ static ssize_t stmpe811_read(FAR struct file *filep, FAR char *buffer, size_t len); static int stmpe811_ioctl(FAR struct file *filep, int cmd, unsigned long arg); -static int stmpe811_poll(FAR struct file *filep, struct pollfd *fds, +static int stmpe811_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup); /* Initialization logic */ @@ -693,7 +693,7 @@ static int stmpe811_poll(FAR struct file *filep, FAR struct pollfd *fds, { /* This is a request to tear down the poll. */ - struct pollfd **slot = (struct pollfd **)fds->priv; + FAR struct pollfd **slot = (FAR struct pollfd **)fds->priv; DEBUGASSERT(slot != NULL); /* Remove all memory of the poll setup */ diff --git a/drivers/input/touchscreen_upper.c b/drivers/input/touchscreen_upper.c index d71c2d5363..bce5711059 100644 --- a/drivers/input/touchscreen_upper.c +++ b/drivers/input/touchscreen_upper.c @@ -323,7 +323,8 @@ static int touch_ioctl(FAR struct file *filep, int cmd, unsigned long arg) * Name: touch_poll ****************************************************************************/ -static int touch_poll(FAR struct file *filep, struct pollfd *fds, bool setup) +static int touch_poll(FAR struct file *filep, FAR struct pollfd *fds, + bool setup) { FAR struct touch_openpriv_s *openpriv = filep->f_priv; pollevent_t eventset = 0; diff --git a/drivers/input/tsc2007.c b/drivers/input/tsc2007.c index 8092d6c7d2..019e98383e 100644 --- a/drivers/input/tsc2007.c +++ b/drivers/input/tsc2007.c @@ -166,7 +166,7 @@ struct tsc2007_dev_s * retained in the f_priv field of the 'struct file'. */ - struct pollfd *fds[CONFIG_TSC2007_NPOLLWAITERS]; + FAR struct pollfd *fds[CONFIG_TSC2007_NPOLLWAITERS]; }; /**************************************************************************** @@ -192,7 +192,7 @@ static int tsc2007_close(FAR struct file *filep); static ssize_t tsc2007_read(FAR struct file *filep, FAR char *buffer, size_t len); static int tsc2007_ioctl(FAR struct file *filep, int cmd, unsigned long arg); -static int tsc2007_poll(FAR struct file *filep, struct pollfd *fds, +static int tsc2007_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup); /**************************************************************************** @@ -1136,7 +1136,7 @@ static int tsc2007_poll(FAR struct file *filep, FAR struct pollfd *fds, { /* This is a request to tear down the poll. */ - struct pollfd **slot = (struct pollfd **)fds->priv; + FAR struct pollfd **slot = (FAR struct pollfd **)fds->priv; DEBUGASSERT(slot != NULL); /* Remove all memory of the poll setup */ diff --git a/drivers/ioexpander/icjx.c b/drivers/ioexpander/icjx.c index f79df627b1..7518db8440 100644 --- a/drivers/ioexpander/icjx.c +++ b/drivers/ioexpander/icjx.c @@ -996,7 +996,7 @@ static int icjx_interrupt(int irq, FAR void *context, FAR void *arg) DEBUGASSERT(work_available(&priv->work)); DEBUGVERIFY(work_queue(HPWORK, &priv->work, icjx_interrupt_worker, - (void *)priv, 0)); + (FAR void *)priv, 0)); return OK; } diff --git a/drivers/ioexpander/ioe_rpmsg.c b/drivers/ioexpander/ioe_rpmsg.c index 8020fced26..29a589bf65 100644 --- a/drivers/ioexpander/ioe_rpmsg.c +++ b/drivers/ioexpander/ioe_rpmsg.c @@ -402,7 +402,7 @@ static int ioe_rpmsg_option_handler(FAR struct rpmsg_endpoint *ept, FAR struct ioe_rpmsg_server_s *priv = priv_; msg->header.result = IOEXP_SETOPTION(priv->ioe, msg->pin, msg->opt, - (void *)(uintptr_t)msg->val); + (FAR void *)(uintptr_t)msg->val); return rpmsg_send(ept, msg, len); } diff --git a/drivers/lcd/apa102.c b/drivers/lcd/apa102.c index 0bc1b7ab6b..05155df3fb 100644 --- a/drivers/lcd/apa102.c +++ b/drivers/lcd/apa102.c @@ -372,11 +372,11 @@ static inline void apa102_refresh(FAR struct apa102_dev_s *priv) for (i = 0; i < (APA102_XRES * APA102_YRES); i++) { - uint32_t *led = (uint32_t *) &priv->fb[i]; + uint32_t *led = (FAR uint32_t *)&priv->fb[i]; /* Then transfer 4 bytes per LED */ - apa102_write32(priv, (uint32_t) (*led | APA102_HEADER_FRAME)); + apa102_write32(priv, (uint32_t)(*led | APA102_HEADER_FRAME)); } /* Send an end of frame */ @@ -438,7 +438,7 @@ static int apa102_putrun(FAR struct lcd_dev_s *dev, fb_coord_t row, for (i = 0; i < pixlen; i++) { - uint16_t *ptr = (uint16_t *)buffer; + FAR uint16_t *ptr = (FAR uint16_t *)buffer; if (row % 2 == 0) { @@ -568,7 +568,7 @@ static int apa102_getrun(FAR struct lcd_dev_s *dev, fb_coord_t row, for (i = 0; i < pixlen; i++) { - uint16_t *ptr = (uint16_t *) buffer; + FAR uint16_t *ptr = (FAR uint16_t *)buffer; *ptr++ = apa102_rgb565(priv->fb[(row * APA102_XRES) + col + i]); } diff --git a/drivers/lcd/jd9851.c b/drivers/lcd/jd9851.c index 2fdf2634e7..9815bfa848 100644 --- a/drivers/lcd/jd9851.c +++ b/drivers/lcd/jd9851.c @@ -263,7 +263,7 @@ static struct jd9851_dev_s g_lcddev; * ****************************************************************************/ -static void jd9851_select(FAR FAR struct spi_dev_s *spi, int bits) +static void jd9851_select(FAR struct spi_dev_s *spi, int bits) { /* Select JD9851 chip (locking the SPI bus in case there are multiple * devices competing for the SPI bus @@ -297,7 +297,7 @@ static void jd9851_select(FAR FAR struct spi_dev_s *spi, int bits) * ****************************************************************************/ -static void jd9851_deselect(FAR FAR struct spi_dev_s *spi) +static void jd9851_deselect(FAR struct spi_dev_s *spi) { /* De-select JD9851 chip and relinquish the SPI bus. */ @@ -886,7 +886,7 @@ static int jd9851_setcontrast(FAR struct lcd_dev_s *dev, * ****************************************************************************/ -FAR struct lcd_dev_s *jd9851_lcdinitialize(FAR FAR struct spi_dev_s *spi) +FAR struct lcd_dev_s *jd9851_lcdinitialize(FAR struct spi_dev_s *spi) { FAR struct jd9851_dev_s *priv = &g_lcddev; diff --git a/drivers/lcd/lcd_framebuffer.c b/drivers/lcd/lcd_framebuffer.c index 3fd21109fb..d7a2f88d4b 100644 --- a/drivers/lcd/lcd_framebuffer.c +++ b/drivers/lcd/lcd_framebuffer.c @@ -105,7 +105,7 @@ static int lcdfb_setcursor(FAR struct fb_vtable_s *vtable, FAR struct fb_setcursor_s *settings); #endif -static int lcdfb_setpower(FAR struct fb_vtable_s *vtable, FAR int power); +static int lcdfb_setpower(FAR struct fb_vtable_s *vtable, int power); /**************************************************************************** * Private Data @@ -467,7 +467,7 @@ static int lcdfb_setcursor(FAR struct fb_vtable_s *vtable, * Name: lcdfb_setpower ****************************************************************************/ -static int lcdfb_setpower(FAR struct fb_vtable_s *vtable, FAR int power) +static int lcdfb_setpower(FAR struct fb_vtable_s *vtable, int power) { int ret = -EINVAL; FAR struct lcdfb_dev_s *priv; diff --git a/drivers/lcd/lpm013m091a.c b/drivers/lcd/lpm013m091a.c index ef86f9a3b5..c1908fbb9c 100644 --- a/drivers/lcd/lpm013m091a.c +++ b/drivers/lcd/lpm013m091a.c @@ -132,7 +132,7 @@ static const struct lcd_planeinfo_s g_planeinfo = #ifndef CONFIG_LCD_NOGETRUN .getrun = lpm013m091a_getrun, /* Get a run from lcd memory */ #endif - .buffer = (uint8_t *) g_runbuffer, /* Run scratch buffer */ + .buffer = (FAR uint8_t *)g_runbuffer, /* Run scratch buffer */ .bpp = LPM013M091A_BPP, /* Bits-per-pixel */ }; diff --git a/drivers/lcd/max7219.c b/drivers/lcd/max7219.c index 3cc8e6f16b..1aecff8ecb 100644 --- a/drivers/lcd/max7219.c +++ b/drivers/lcd/max7219.c @@ -283,21 +283,21 @@ static struct max7219_dev_s g_max7219dev = * ****************************************************************************/ -static inline void __set_bit(int nr, uint8_t * addr) +static inline void __set_bit(int nr, uint8_t *addr) { uint8_t mask = BIT_BYTE_MASK(nr); - uint8_t *p = ((uint8_t *) addr) + BIT_BYTE(nr); + uint8_t *p = ((FAR uint8_t *)addr) + BIT_BYTE(nr); *p |= mask; } -static inline void __clear_bit(int nr, uint8_t * addr) +static inline void __clear_bit(int nr, uint8_t *addr) { uint8_t mask = BIT_BYTE_MASK(nr); - uint8_t *p = ((uint8_t *) addr) + BIT_BYTE(nr); + uint8_t *p = ((FAR uint8_t *)addr) + BIT_BYTE(nr); *p &= ~mask; } -static inline int __test_bit(int nr, const volatile uint8_t * addr) +static inline int __test_bit(int nr, const volatile uint8_t *addr) { return 1 & (addr[BIT_BYTE(nr)] >> (nr & (BITS_PER_BYTE - 1))); } diff --git a/drivers/lcd/memlcd.c b/drivers/lcd/memlcd.c index dd89227007..45e1667938 100644 --- a/drivers/lcd/memlcd.c +++ b/drivers/lcd/memlcd.c @@ -200,10 +200,10 @@ static const struct fb_videoinfo_s g_videoinfo = static const struct lcd_planeinfo_s g_planeinfo = { - .putrun = memlcd_putrun, /* Put a run into lcd memory */ - .getrun = memlcd_getrun, /* Get a run from lcd memory */ - .buffer = (uint8_t *) g_runbuffer, /* Run scratch buffer */ - .bpp = MEMLCD_BPP, /* Bits-per-pixel */ + .putrun = memlcd_putrun, /* Put a run into lcd memory */ + .getrun = memlcd_getrun, /* Get a run from lcd memory */ + .buffer = (FAR uint8_t *)g_runbuffer, /* Run scratch buffer */ + .bpp = MEMLCD_BPP, /* Bits-per-pixel */ }; /* This is the oled driver instance (only a single device is supported @@ -244,21 +244,21 @@ static struct memlcd_dev_s g_memlcddev = * ****************************************************************************/ -static inline void __set_bit(int nr, uint8_t * addr) +static inline void __set_bit(int nr, uint8_t *addr) { uint8_t mask = BIT_BYTE_MASK(nr); - uint8_t *p = ((uint8_t *) addr) + BIT_BYTE(nr); + uint8_t *p = ((FAR uint8_t *)addr) + BIT_BYTE(nr); *p |= mask; } -static inline void __clear_bit(int nr, uint8_t * addr) +static inline void __clear_bit(int nr, uint8_t *addr) { uint8_t mask = BIT_BYTE_MASK(nr); - uint8_t *p = ((uint8_t *) addr) + BIT_BYTE(nr); + uint8_t *p = ((FAR uint8_t *)addr) + BIT_BYTE(nr); *p &= ~mask; } -static inline int __test_bit(int nr, const volatile uint8_t * addr) +static inline int __test_bit(int nr, const volatile uint8_t *addr) { return 1 & (addr[BIT_BYTE(nr)] >> (nr & (BITS_PER_BYTE - 1))); } diff --git a/drivers/lcd/ssd1351.c b/drivers/lcd/ssd1351.c index c5e8f542dc..3a9aa0ce63 100644 --- a/drivers/lcd/ssd1351.c +++ b/drivers/lcd/ssd1351.c @@ -825,7 +825,7 @@ static int ssd1351_getplaneinfo(FAR struct lcd_dev_s *dev, pinfo->putrun = ssd1351_putrun; pinfo->getrun = ssd1351_getrun; - pinfo->buffer = (uint8_t *)priv->runbuffer; + pinfo->buffer = (FAR uint8_t *)priv->runbuffer; pinfo->bpp = SSD1351_BPP; pinfo->dev = dev; diff --git a/drivers/lcd/st7565.c b/drivers/lcd/st7565.c index 8fd4b68f8f..538d8c580a 100644 --- a/drivers/lcd/st7565.c +++ b/drivers/lcd/st7565.c @@ -262,10 +262,10 @@ static const struct fb_videoinfo_s g_videoinfo = static const struct lcd_planeinfo_s g_planeinfo = { - .putrun = st7565_putrun, /* Put a run into LCD memory */ - .getrun = st7565_getrun, /* Get a run from LCD memory */ - .buffer = (uint8_t *) g_runbuffer, /* Run scratch buffer */ - .bpp = ST7565_BPP, /* Bits-per-pixel */ + .putrun = st7565_putrun, /* Put a run into LCD memory */ + .getrun = st7565_getrun, /* Get a run from LCD memory */ + .buffer = (FAR uint8_t *)g_runbuffer, /* Run scratch buffer */ + .bpp = ST7565_BPP, /* Bits-per-pixel */ }; /* This is the standard, NuttX LCD driver object */ diff --git a/drivers/misc/rpmsgblk_server.c b/drivers/misc/rpmsgblk_server.c index b8c0f050a2..0cb7cbac48 100644 --- a/drivers/misc/rpmsgblk_server.c +++ b/drivers/misc/rpmsgblk_server.c @@ -220,7 +220,8 @@ static int rpmsgblk_read_handler(FAR struct rpmsg_endpoint *ept, nsectors = msg->nsectors - read; } - ret = server->bops->read(server->blknode, (unsigned char *)rsp->buf, + ret = server->bops->read(server->blknode, + (FAR unsigned char *)rsp->buf, msg->startsector, nsectors); rsp->header.result = ret; rpmsg_send_nocopy(ept, rsp, (ret < 0 ? 0 : ret * msg->sectorsize) + diff --git a/drivers/misc/rpmsgdev.c b/drivers/misc/rpmsgdev.c index f52b5c2094..45d249b402 100644 --- a/drivers/misc/rpmsgdev.c +++ b/drivers/misc/rpmsgdev.c @@ -693,7 +693,7 @@ static int rpmsgdev_ioctl(FAR struct file *filep, int cmd, unsigned long arg) msglen, arglen > 0 ? (FAR void *)arg : NULL); if (cmd == FIONBIO && ret >= 0) { - int *nonblock = (FAR int *)(uintptr_t)arg; + FAR int *nonblock = (FAR int *)(uintptr_t)arg; priv->nonblock = *nonblock; } diff --git a/drivers/mmcsd/mmcsd_sdio.c b/drivers/mmcsd/mmcsd_sdio.c index 0e851023b5..f8d8848f36 100644 --- a/drivers/mmcsd/mmcsd_sdio.c +++ b/drivers/mmcsd/mmcsd_sdio.c @@ -4102,21 +4102,21 @@ static void mmcsd_hwuninitialize(FAR struct mmcsd_state_s *priv) SDIO_RESET(priv->dev); } -static const char *mmc_get_mode_name(uint8_t mode) +static FAR const char *mmc_get_mode_name(uint8_t mode) { switch (mode) { case EXT_CSD_HS_TIMING_BC: - return "backwards compatibility"; + return "backwards compatibility"; case EXT_CSD_HS_TIMING_HS: - return "high speed"; + return "high speed"; case EXT_CSD_HS_TIMING_HS200: - return "HS200"; + return "HS200"; case EXT_CSD_HS_TIMING_HS400: - return "HS400"; + return "HS400"; default: - ferr("Unknown mode: %u\n", mode); - return "Unknown"; + ferr("Unknown mode: %u\n", mode); + return "Unknown"; } } diff --git a/drivers/mmcsd/mmcsd_spi.c b/drivers/mmcsd/mmcsd_spi.c index 8162c094b8..cc0e2edbe2 100644 --- a/drivers/mmcsd/mmcsd_spi.c +++ b/drivers/mmcsd/mmcsd_spi.c @@ -156,46 +156,52 @@ static void mmcsd_unlock(FAR struct mmcsd_slot_s *slot); static int mmcsd_waitready(FAR struct mmcsd_slot_s *slot); static uint32_t mmcsd_sendcmd(FAR struct mmcsd_slot_s *slot, - const struct mmcsd_cmdinfo_s *cmd, uint32_t arg); + FAR const struct mmcsd_cmdinfo_s *cmd, + uint32_t arg); static void mmcsd_setblklen(FAR struct mmcsd_slot_s *slot, - uint32_t length); -static uint32_t mmcsd_nsac(FAR struct mmcsd_slot_s *slot, uint8_t *csd, - uint32_t frequency); -static uint32_t mmcsd_taac(FAR struct mmcsd_slot_s *slot, uint8_t *csd); -static void mmcsd_decodecsd(FAR struct mmcsd_slot_s *slot, uint8_t *csd); + uint32_t length); +static uint32_t mmcsd_nsac(FAR struct mmcsd_slot_s *slot, FAR uint8_t *csd, + uint32_t frequency); +static uint32_t mmcsd_taac(FAR struct mmcsd_slot_s *slot, FAR uint8_t *csd); +static void mmcsd_decodecsd(FAR struct mmcsd_slot_s *slot, + FAR uint8_t *csd); static void mmcsd_checkwrprotect(FAR struct mmcsd_slot_s *slot, - uint8_t *csd); + FAR uint8_t *csd); static int mmcsd_getcardinfo(FAR struct mmcsd_slot_s *slot, - uint8_t *buffer, const struct mmcsd_cmdinfo_s *cmd); + FAR uint8_t *buffer, + FAR const struct mmcsd_cmdinfo_s *cmd); #define mmcsd_getcsd(slot, csd) mmcsd_getcardinfo(slot, csd, &g_cmd9); #define mmcsd_getcid(slot, cid) mmcsd_getcardinfo(slot, cid, &g_cmd10); static int mmcsd_recvblock(FAR struct mmcsd_slot_s *slot, - uint8_t *buffer, int nbytes); + FAR uint8_t *buffer, int nbytes); #if !defined(CONFIG_MMCSD_READONLY) static int mmcsd_xmitblock(FAR struct mmcsd_slot_s *slot, - const uint8_t *buffer, int nbytes, uint8_t token); + FAR const uint8_t *buffer, int nbytes, + uint8_t token); #endif /* Block driver interfaces **************************************************/ static int mmcsd_open(FAR struct inode *inode); static int mmcsd_close(FAR struct inode *inode); -static ssize_t mmcsd_read(FAR struct inode *inode, unsigned char *buffer, - blkcnt_t start_sector, unsigned int nsectors); +static ssize_t mmcsd_read(FAR struct inode *inode, + FAR unsigned char *buffer, + blkcnt_t start_sector, unsigned int nsectors); #if !defined(CONFIG_MMCSD_READONLY) static ssize_t mmcsd_write(FAR struct inode *inode, - const unsigned char *buffer, blkcnt_t start_sector, - unsigned int nsectors); + FAR const unsigned char *buffer, + blkcnt_t start_sector, + unsigned int nsectors); #endif static int mmcsd_geometry(FAR struct inode *inode, - struct geometry *geometry); + FAR struct geometry *geometry); /* Initialization ***********************************************************/ static int mmcsd_mediainitialize(FAR struct mmcsd_slot_s *slot); -static void mmcsd_mediachanged(void *arg); +static void mmcsd_mediachanged(FAR void *arg); /**************************************************************************** * Private Data @@ -659,7 +665,7 @@ static void mmcsd_setblklen(FAR struct mmcsd_slot_s *slot, uint32_t length) * ****************************************************************************/ -static uint32_t mmcsd_nsac(FAR struct mmcsd_slot_s *slot, uint8_t *csd, +static uint32_t mmcsd_nsac(FAR struct mmcsd_slot_s *slot, FAR uint8_t *csd, uint32_t frequency) { /* NSAC is 8-bits wide and is in units of 100 clock cycles. Therefore, @@ -678,7 +684,7 @@ static uint32_t mmcsd_nsac(FAR struct mmcsd_slot_s *slot, uint8_t *csd, * ****************************************************************************/ -static uint32_t mmcsd_taac(FAR struct mmcsd_slot_s *slot, uint8_t *csd) +static uint32_t mmcsd_taac(FAR struct mmcsd_slot_s *slot, FAR uint8_t *csd) { int tundx; @@ -718,7 +724,7 @@ static uint32_t mmcsd_taac(FAR struct mmcsd_slot_s *slot, uint8_t *csd) * ****************************************************************************/ -static void mmcsd_decodecsd(FAR struct mmcsd_slot_s *slot, uint8_t *csd) +static void mmcsd_decodecsd(FAR struct mmcsd_slot_s *slot, FAR uint8_t *csd) { FAR struct spi_dev_s *spi = slot->spi; uint32_t maxfrequency; @@ -879,7 +885,8 @@ static void mmcsd_decodecsd(FAR struct mmcsd_slot_s *slot, uint8_t *csd) * ****************************************************************************/ -static void mmcsd_checkwrprotect(FAR struct mmcsd_slot_s *slot, uint8_t *csd) +static void mmcsd_checkwrprotect(FAR struct mmcsd_slot_s *slot, + FAR uint8_t *csd) { FAR struct spi_dev_s *spi = slot->spi; @@ -911,8 +918,9 @@ static void mmcsd_checkwrprotect(FAR struct mmcsd_slot_s *slot, uint8_t *csd) * ****************************************************************************/ -static int mmcsd_getcardinfo(FAR struct mmcsd_slot_s *slot, uint8_t *buffer, - const struct mmcsd_cmdinfo_s *cmd) +static int mmcsd_getcardinfo(FAR struct mmcsd_slot_s *slot, + FAR uint8_t *buffer, + FAR const struct mmcsd_cmdinfo_s *cmd) { FAR struct spi_dev_s *spi = slot->spi; uint32_t result; @@ -973,8 +981,8 @@ static int mmcsd_getcardinfo(FAR struct mmcsd_slot_s *slot, uint8_t *buffer, * ****************************************************************************/ -static int mmcsd_recvblock(FAR struct mmcsd_slot_s *slot, uint8_t *buffer, - int nbytes) +static int mmcsd_recvblock(FAR struct mmcsd_slot_s *slot, + FAR uint8_t *buffer, int nbytes) { FAR struct spi_dev_s *spi = slot->spi; clock_t start; @@ -1157,7 +1165,7 @@ static int mmcsd_close(FAR struct inode *inode) * ****************************************************************************/ -static ssize_t mmcsd_read(FAR struct inode *inode, unsigned char *buffer, +static ssize_t mmcsd_read(FAR struct inode *inode, FAR unsigned char *buffer, blkcnt_t start_sector, unsigned int nsectors) { FAR struct mmcsd_slot_s *slot; @@ -1165,9 +1173,9 @@ static ssize_t mmcsd_read(FAR struct inode *inode, unsigned char *buffer, FAR unsigned char *restore = buffer; int retry_count = 0; size_t nbytes; - off_t offset; + off_t offset; uint8_t response; - int i; + int i; int ret; finfo("start_sector=%" PRIuOFF " nsectors=%u\n", start_sector, nsectors); @@ -1348,7 +1356,7 @@ static ssize_t mmcsd_write(FAR struct inode *inode, FAR const unsigned char *restore = buffer; int retry_count = 0; size_t nbytes; - off_t offset; + off_t offset; uint8_t response; int i; int ret; @@ -1552,7 +1560,8 @@ errout_with_lock: * ****************************************************************************/ -static int mmcsd_geometry(FAR struct inode *inode, struct geometry *geometry) +static int mmcsd_geometry(FAR struct inode *inode, + FAR struct geometry *geometry) { FAR struct mmcsd_slot_s *slot; FAR struct spi_dev_s *spi; @@ -1937,7 +1946,7 @@ static int mmcsd_mediainitialize(FAR struct mmcsd_slot_s *slot) * ****************************************************************************/ -static void mmcsd_mediachanged(void *arg) +static void mmcsd_mediachanged(FAR void *arg) { FAR struct mmcsd_slot_s *slot = (FAR struct mmcsd_slot_s *)arg; FAR struct spi_dev_s *spi; diff --git a/drivers/modem/alt1250/altcom_hdlr_firmware.c b/drivers/modem/alt1250/altcom_hdlr_firmware.c index d3a4d8dd6d..7a936cbcfc 100644 --- a/drivers/modem/alt1250/altcom_hdlr_firmware.c +++ b/drivers/modem/alt1250/altcom_hdlr_firmware.c @@ -82,7 +82,7 @@ int32_t altcom_injectimage_pkt_compose(FAR void **arg, size_t arglen, { int32_t size = 0; - FAR uint8_t *sending_data = (uint8_t *)arg[0]; + FAR uint8_t *sending_data = (FAR uint8_t *)arg[0]; int len = *(int *)arg[1]; bool mode = *(bool *)arg[2]; diff --git a/drivers/modem/alt1250/altcom_hdlr_net.c b/drivers/modem/alt1250/altcom_hdlr_net.c index 3bfb9b2822..b967ad5041 100644 --- a/drivers/modem/alt1250/altcom_hdlr_net.c +++ b/drivers/modem/alt1250/altcom_hdlr_net.c @@ -207,7 +207,7 @@ static void altcombs_set_cellinfo_v4( { m_err("cmd_cellinfo->mnc error\n"); } - else if (strlen((const char *)cmd_cellinfo->cgid) > + else if (strlen((FAR const char *)cmd_cellinfo->cgid) > APICMD_CELLINFO_GCID_MAX) { m_err("cmd_cellinfo->cgid error\n"); diff --git a/drivers/modem/alt1250/altcom_hdlr_other.c b/drivers/modem/alt1250/altcom_hdlr_other.c index 2fbf41ce21..e30ef7f153 100644 --- a/drivers/modem/alt1250/altcom_hdlr_other.c +++ b/drivers/modem/alt1250/altcom_hdlr_other.c @@ -169,7 +169,7 @@ int32_t altcom_sendatcmd_pkt_parse(FAR struct alt1250_dev_s *dev, size_t arglen, FAR uint64_t *bitmap) { FAR char *respbuff = (FAR char *)arg[0]; - FAR int respbufflen = (int)arg[1]; + int respbufflen = (int)arg[1]; FAR int *resplen = (FAR int *)arg[2]; if (respbufflen < pktsz) diff --git a/drivers/modem/alt1250/altcom_hdlr_pdn.c b/drivers/modem/alt1250/altcom_hdlr_pdn.c index a664ec0a61..90803cff15 100644 --- a/drivers/modem/alt1250/altcom_hdlr_pdn.c +++ b/drivers/modem/alt1250/altcom_hdlr_pdn.c @@ -578,7 +578,7 @@ int32_t altcom_repnet_pkt_parse(FAR struct alt1250_dev_s *dev, /* parse IPv4 DNS address */ - if (*(uint32_t *)in->dnsaddrv4 != 0) + if (*(FAR uint32_t *)in->dnsaddrv4 != 0) { FAR struct sockaddr_in *v4addr = (FAR struct sockaddr_in *)&dnsaddrs[0]; @@ -592,10 +592,10 @@ int32_t altcom_repnet_pkt_parse(FAR struct alt1250_dev_s *dev, /* parse IPv6 DNS address */ - if (!((*(uint32_t *)&in->dnsaddrv6[0] == 0) && - (*(uint32_t *)&in->dnsaddrv6[4] == 0) && - (*(uint32_t *)&in->dnsaddrv6[8] == 0) && - (*(uint32_t *)&in->dnsaddrv6[12] == 0))) + if (!((*(FAR uint32_t *)&in->dnsaddrv6[0] == 0) && + (*(FAR uint32_t *)&in->dnsaddrv6[4] == 0) && + (*(FAR uint32_t *)&in->dnsaddrv6[8] == 0) && + (*(FAR uint32_t *)&in->dnsaddrv6[12] == 0))) { FAR struct sockaddr_in6 *v6addr = (FAR struct sockaddr_in6 *)&dnsaddrs[*ndnsaddrs]; diff --git a/drivers/modem/alt1250/altcom_lwm2m_hdlr.c b/drivers/modem/alt1250/altcom_lwm2m_hdlr.c index eb7a8b1ddc..a4eb5ff956 100644 --- a/drivers/modem/alt1250/altcom_lwm2m_hdlr.c +++ b/drivers/modem/alt1250/altcom_lwm2m_hdlr.c @@ -43,19 +43,19 @@ ****************************************************************************/ static int32_t read_request_hndl(FAR uint8_t *pktbuf, size_t pktsz, - FAR void **cb_args, size_t arglen); + FAR void **cb_args, size_t arglen); static int32_t write_request_hndl(FAR uint8_t *pktbuf, size_t pktsz, - FAR void **cb_args, size_t arglen); + FAR void **cb_args, size_t arglen); static int32_t exec_request_hndl(FAR uint8_t *pktbuf, size_t pktsz, - FAR void **cb_args, size_t arglen); + FAR void **cb_args, size_t arglen); static int32_t start_ov_request_hndl(FAR uint8_t *pktbuf, size_t pktsz, - FAR void **cb_args, size_t arglen); + FAR void **cb_args, size_t arglen); static int32_t stop_ov_request_hndl(FAR uint8_t *pktbuf, size_t pktsz, - FAR void **cb_args, size_t arglen); + FAR void **cb_args, size_t arglen); static int32_t fwupdate_notice_hndl(FAR uint8_t *pktbuf, size_t pktsz, - FAR void **cb_args, size_t arglen); + FAR void **cb_args, size_t arglen); static int32_t server_op_notice_hndl(FAR uint8_t *pktbuf, size_t pktsz, - FAR void **cb_args, size_t arglen); + FAR void **cb_args, size_t arglen); /**************************************************************************** * Private Types @@ -78,12 +78,12 @@ struct lwm2mstub_instance_s struct lwm2mstub_ovcondition_s { - uint8_t valid_mask; - unsigned int min_period; - unsigned int max_period; - double gt_cond; - double lt_cond; - double step_val; + uint8_t valid_mask; + unsigned int min_period; + unsigned int max_period; + double gt_cond; + double lt_cond; + double step_val; }; /**************************************************************************** @@ -143,9 +143,10 @@ static FAR uint8_t *skip_until(FAR uint8_t *stream, FAR char *delim) * name: strcpy_until ****************************************************************************/ -static FAR char strcpy_until(char *dst, int n, char **src, char *delim) +static FAR char strcpy_until(FAR char *dst, int n, FAR char **src, + FAR char *delim) { - char *tmp = *src; + FAR char *tmp = *src; if (dst) { @@ -178,28 +179,29 @@ static FAR char strcpy_until(char *dst, int n, char **src, char *delim) * name: parse_instance ****************************************************************************/ -static FAR uint8_t *parse_instance(uint8_t *pktbuf, int *seq_no, int *srv_id, - struct lwm2mstub_instance_s *inst) +static FAR uint8_t *parse_instance(FAR uint8_t *pktbuf, FAR int *seq_no, + FAR int *srv_id, + FAR struct lwm2mstub_instance_s *inst) { - *seq_no = atoi((char *)pktbuf); /* for seq_no */ + *seq_no = atoi((FAR char *)pktbuf); /* for seq_no */ pktbuf = skip_until(pktbuf, ","); - *srv_id = atoi((char *)pktbuf); /* for srv_id */ + *srv_id = atoi((FAR char *)pktbuf); /* for srv_id */ pktbuf = skip_until(pktbuf, ","); /* Parse URI like /objid/objinst/resid */ pktbuf = skip_until(pktbuf, "/"); - inst->object_id = atoi((char *)pktbuf); + inst->object_id = atoi((FAR char *)pktbuf); pktbuf = skip_until(pktbuf, "/"); - inst->object_inst = atoi((char *)pktbuf); + inst->object_inst = atoi((FAR char *)pktbuf); pktbuf = skip_until(pktbuf, "/"); - inst->res_id = atoi((char *)pktbuf); + inst->res_id = atoi((FAR char *)pktbuf); inst->res_inst = -1; if (skip_until(pktbuf, "/") != NULL) { pktbuf = skip_until(pktbuf, "/"); - inst->res_inst = atoi((char *)pktbuf); + inst->res_inst = atoi((FAR char *)pktbuf); } pktbuf = skip_until(pktbuf, ",/\r\n"); @@ -212,10 +214,10 @@ static FAR uint8_t *parse_instance(uint8_t *pktbuf, int *seq_no, int *srv_id, ****************************************************************************/ static int32_t read_request_hndl(FAR uint8_t *pktbuf, size_t pktsz, - FAR void **cb_args, size_t arglen) + FAR void **cb_args, size_t arglen) { - parse_instance(pktbuf, (int *)&cb_args[0], (int *)&cb_args[1], - (struct lwm2mstub_instance_s *)(cb_args[2])); + parse_instance(pktbuf, (FAR int *)&cb_args[0], (FAR int *)&cb_args[1], + (FAR struct lwm2mstub_instance_s *)(cb_args[2])); return 0; } @@ -225,25 +227,26 @@ static int32_t read_request_hndl(FAR uint8_t *pktbuf, size_t pktsz, ****************************************************************************/ static int32_t write_request_hndl(FAR uint8_t *pktbuf, size_t pktsz, - FAR void **cb_args, size_t arglen) + FAR void **cb_args, size_t arglen) { if (!cb_args[3] && ((int)cb_args[5]) <= 0) { return -1; } - pktbuf = parse_instance(pktbuf, (int *)&cb_args[0], (int *)&cb_args[1], - (struct lwm2mstub_instance_s *)(cb_args[2])); + pktbuf = parse_instance(pktbuf, (FAR int *)&cb_args[0], + (FAR int *)&cb_args[1], + (FAR struct lwm2mstub_instance_s *)(cb_args[2])); if (*pktbuf == '\"') { pktbuf++; } - strcpy_until((char *)cb_args[3], (int)cb_args[5], (char **)&pktbuf, + strcpy_until((FAR char *)cb_args[3], (int)cb_args[5], (FAR char **)&pktbuf, "\",\r\n"); - cb_args[4] = (void *)strlen((char *)cb_args[3]); + cb_args[4] = (FAR void *)strlen((FAR char *)cb_args[3]); return 0; } @@ -253,10 +256,10 @@ static int32_t write_request_hndl(FAR uint8_t *pktbuf, size_t pktsz, ****************************************************************************/ static int32_t exec_request_hndl(FAR uint8_t *pktbuf, size_t pktsz, - FAR void **cb_args, size_t arglen) + FAR void **cb_args, size_t arglen) { - parse_instance(pktbuf, (int *)&cb_args[0], (int *)&cb_args[1], - (struct lwm2mstub_instance_s *)(cb_args[2])); + parse_instance(pktbuf, (FAR int *)&cb_args[0], (FAR int *)&cb_args[1], + (FAR struct lwm2mstub_instance_s *)(cb_args[2])); return 0; } @@ -265,15 +268,16 @@ static int32_t exec_request_hndl(FAR uint8_t *pktbuf, size_t pktsz, * name: parse_observe ****************************************************************************/ -static uint8_t *parse_observe(uint8_t *pktbuf, int *seq_no, int *srv_id, - int tksize, char *token, - struct lwm2mstub_instance_s *inst) +FAR static uint8_t *parse_observe(FAR uint8_t *pktbuf, FAR int *seq_no, + FAR int *srv_id, int tksize, + FAR char *token, + FAR struct lwm2mstub_instance_s *inst) { - *seq_no = atoi((char *)pktbuf); /* for seq_no */ + *seq_no = atoi((FAR char *)pktbuf); /* for seq_no */ pktbuf = skip_until(pktbuf, ","); - *srv_id = atoi((char *)pktbuf); /* for server id */ + *srv_id = atoi((FAR char *)pktbuf); /* for server id */ pktbuf = skip_until(pktbuf, "\""); - strcpy_until(token, tksize, (char **)&pktbuf, "\""); + strcpy_until(token, tksize, (FAR char **)&pktbuf, "\""); pktbuf = skip_until(pktbuf, ","); pktbuf = skip_until(pktbuf, "/"); @@ -282,16 +286,16 @@ static uint8_t *parse_observe(uint8_t *pktbuf, int *seq_no, int *srv_id, inst->res_id = -1; inst->res_inst = -1; - inst->object_id = atoi((char *)pktbuf); - if (strcpy_until(NULL, 0, (char **)&pktbuf, "/\",") == '/') + inst->object_id = atoi((FAR char *)pktbuf); + if (strcpy_until(NULL, 0, (FAR char **)&pktbuf, "/\",") == '/') { - inst->object_inst = atoi((char *)pktbuf); - if (strcpy_until(NULL, 0, (char **)&pktbuf, "/\",") == '/') + inst->object_inst = atoi((FAR char *)pktbuf); + if (strcpy_until(NULL, 0, (FAR char **)&pktbuf, "/\",") == '/') { - inst->res_id = atoi((char *)pktbuf); - if (strcpy_until(NULL, 0, (char **)&pktbuf, "/\",") == '/') + inst->res_id = atoi((FAR char *)pktbuf); + if (strcpy_until(NULL, 0, (FAR char **)&pktbuf, "/\",") == '/') { - inst->res_inst = atoi((char *)pktbuf); + inst->res_inst = atoi((FAR char *)pktbuf); } } } @@ -304,15 +308,14 @@ static uint8_t *parse_observe(uint8_t *pktbuf, int *seq_no, int *srv_id, ****************************************************************************/ static int32_t start_ov_request_hndl(FAR uint8_t *pktbuf, size_t pktsz, - FAR void **cb_args, size_t arglen) + FAR void **cb_args, size_t arglen) { - struct lwm2mstub_ovcondition_s *cond - = (struct lwm2mstub_ovcondition_s *)cb_args[5]; + FAR struct lwm2mstub_ovcondition_s *cond + = (FAR struct lwm2mstub_ovcondition_s *)cb_args[5]; - parse_observe(pktbuf, - (int *)&cb_args[0], (int *)&cb_args[1], - (int)cb_args[4], (char *)cb_args[3], - (struct lwm2mstub_instance_s *)cb_args[2]); + parse_observe(pktbuf, (FAR int *)&cb_args[0], (FAR int *)&cb_args[1], + (int)cb_args[4], (FAR char *)cb_args[3], + (FAR struct lwm2mstub_instance_s *)cb_args[2]); cond->valid_mask = 0; @@ -324,12 +327,11 @@ static int32_t start_ov_request_hndl(FAR uint8_t *pktbuf, size_t pktsz, ****************************************************************************/ static int32_t stop_ov_request_hndl(FAR uint8_t *pktbuf, size_t pktsz, - FAR void **cb_args, size_t arglen) + FAR void **cb_args, size_t arglen) { - parse_observe(pktbuf, - (int *)&cb_args[0], (int *)&cb_args[1], - (int)cb_args[4], (char *)cb_args[3], - (struct lwm2mstub_instance_s *)cb_args[2]); + parse_observe(pktbuf, (FAR int *)&cb_args[0], (FAR int *)&cb_args[1], + (int)cb_args[4], (FAR char *)cb_args[3], + (FAR struct lwm2mstub_instance_s *)cb_args[2]); return 0; } @@ -339,16 +341,16 @@ static int32_t stop_ov_request_hndl(FAR uint8_t *pktbuf, size_t pktsz, ****************************************************************************/ static int32_t fwupdate_notice_hndl(FAR uint8_t *pktbuf, size_t pktsz, - FAR void **cb_args, size_t arglen) + FAR void **cb_args, size_t arglen) { - uint8_t *ep; + FAR uint8_t *ep; FAR int *event = (FAR int *)&cb_args[0]; /* Expected unsolicited event * %LWM2MEV: [,.... */ - *event = strtol((const char *)pktbuf, (char **)&ep, 10); + *event = strtol((FAR const char *)pktbuf, (FAR char **)&ep, 10); if ((*event == 0) && (pktbuf == ep)) { return -1; @@ -451,11 +453,12 @@ static int32_t server_op_notice_hndl(FAR uint8_t *pktbuf, size_t pktsz, * name: lwm2mstub_get_handler ****************************************************************************/ -lwm2mstub_hndl_t lwm2mstub_get_handler(FAR uint8_t **pktbuf, size_t *pktsz, - uint32_t *lcmdid) +lwm2mstub_hndl_t lwm2mstub_get_handler(FAR uint8_t **pktbuf, + FAR size_t *pktsz, + FAR uint32_t *lcmdid) { - char *head_pos; - struct urc_hdltbl_s *tbl; + FAR char *head_pos; + FAR struct urc_hdltbl_s *tbl; size_t shift_size = 0; *lcmdid = 0; @@ -463,10 +466,10 @@ lwm2mstub_hndl_t lwm2mstub_get_handler(FAR uint8_t **pktbuf, size_t *pktsz, while (tbl->head) { - head_pos = strstr((char *)*pktbuf, tbl->head); + head_pos = strstr((FAR char *)*pktbuf, tbl->head); if (head_pos) { - shift_size = head_pos - (char *)*pktbuf + strlen(tbl->head); + shift_size = head_pos - (FAR char *)*pktbuf + strlen(tbl->head); /* Follow shift_size to advance them */ diff --git a/drivers/modem/alt1250/altcom_pkt.c b/drivers/modem/alt1250/altcom_pkt.c index 38ae6367da..fda716689c 100644 --- a/drivers/modem/alt1250/altcom_pkt.c +++ b/drivers/modem/alt1250/altcom_pkt.c @@ -60,7 +60,7 @@ static uint16_t calc_checksum_v1(FAR uint8_t *ptr, uint16_t len) for (i = 0; i < (len & 0xfffe); i += sizeof(uint16_t)) { - calctmp = *((uint16_t *)(ptr + i)); + calctmp = *((FAR uint16_t *)(ptr + i)); ret += ntohs(calctmp); } @@ -221,7 +221,7 @@ static bool is_header_ok(FAR struct altcom_cmdhdr_s *hdr) if (hdr->ver == ALTCOM_VER1) { - checksum = calc_checksum_v1((uint8_t *)hdr, + checksum = calc_checksum_v1((FAR uint8_t *)hdr, sizeof(struct altcom_cmdhdr_s) - sizeof(hdr->v1_checksum)); if (ntohs(hdr->v1_checksum) == checksum) { @@ -246,7 +246,7 @@ static bool is_header_ok(FAR struct altcom_cmdhdr_s *hdr) } else if (hdr->ver == ALTCOM_VER4) { - checksum = calc_checksum_v4((uint8_t *)hdr, + checksum = calc_checksum_v4((FAR uint8_t *)hdr, sizeof(struct altcom_cmdhdr_s) - sizeof(hdr->v4_hdr_cksum) - sizeof(hdr->v4_data_cksum)); if (ntohs(hdr->v4_hdr_cksum) == checksum) @@ -315,7 +315,7 @@ FAR void *altcom_make_poweron_cmd_v1(int *sz) set_header_top(hdr, ALTCOM_VER1, ALTCOM_CMDID_POWER_ON_V1); hdr->v1_options = htons(ALTCOM_CMDOPT_CHECKSUM_EN); hdr->v1_checksum = - htons(calc_checksum_v1((uint8_t *)hdr, + htons(calc_checksum_v1((FAR uint8_t *)hdr, sizeof(struct altcom_cmdhdr_s) - 2)); footer->reserve = 0; @@ -337,7 +337,7 @@ FAR void *altcom_make_poweron_cmd_v4(int *sz) struct altcom_cmdhdr_s *hdr = (struct altcom_cmdhdr_s *)g_poweron_cmd; set_header_top(hdr, ALTCOM_VER4, ALTCOM_CMDID_POWER_ON_V4); - hdr->v4_hdr_cksum = htons(calc_checksum_v4((uint8_t *)hdr, + hdr->v4_hdr_cksum = htons(calc_checksum_v4((FAR uint8_t *)hdr, sizeof(struct altcom_cmdhdr_s)-4)); hdr->v4_data_cksum = htons(calc_checksum_v4(&hdr->payload[0], 0)); @@ -410,7 +410,7 @@ uint16_t altcom_make_header(FAR struct altcom_cmdhdr_s *hdr, hdr->v1_options = htons(ALTCOM_CMDOPT_CHECKSUM_EN); hdr->v1_checksum = - htons(calc_checksum_v1((uint8_t *)hdr, + htons(calc_checksum_v1((FAR uint8_t *)hdr, sizeof(struct altcom_cmdhdr_s) - 2)); footer->reserve = 0; @@ -420,7 +420,7 @@ uint16_t altcom_make_header(FAR struct altcom_cmdhdr_s *hdr, } else if (ver == ALTCOM_VER4) { - hdr->v4_hdr_cksum = htons(calc_checksum_v4((uint8_t *)hdr, + hdr->v4_hdr_cksum = htons(calc_checksum_v4((FAR uint8_t *)hdr, sizeof(struct altcom_cmdhdr_s)-4)); hdr->v4_data_cksum = htons(calc_checksum_v4(&hdr->payload[0], sz)); } diff --git a/drivers/modem/alt1250/altmdm.c b/drivers/modem/alt1250/altmdm.c index 589a93e12a..f45e87edd7 100644 --- a/drivers/modem/alt1250/altmdm.c +++ b/drivers/modem/alt1250/altmdm.c @@ -109,11 +109,11 @@ typedef enum version_phase_e struct state_func_s { - int (*goto_next)(altmdm_state_t); - uint32_t (*wait_event)(void); - altmdm_state_t (*process_state)(uint32_t, altmdm_state_t); + CODE int (*goto_next)(altmdm_state_t); + CODE uint32_t (*wait_event)(void); + CODE altmdm_state_t (*process_state)(uint32_t, altmdm_state_t); #ifdef CONFIG_MODEM_ALT1250_DEBUG - const char *name; + FAR const char *name; #endif }; @@ -126,7 +126,7 @@ typedef struct altmdm_dev_s sem_t lock_counter; int wcounter; FAR struct spi_dev_s *spidev; - const struct alt1250_lower_s *lower; + FAR const struct alt1250_lower_s *lower; timer_t txsus_timer; altmdm_state_t current_state; altmdm_spipkt_t tx_pkt; @@ -134,7 +134,7 @@ typedef struct altmdm_dev_s int rx_retcode; struct altmdm_event_s txdone_event; sem_t lock_txreq; - void *txreq_buff; + FAR void *txreq_buff; int txreq_size; int is_destroy; uint32_t reset_reason; @@ -269,8 +269,8 @@ static struct altmdm_dev_s g_altmdm_dev; ****************************************************************************/ #ifdef CONFIG_MODEM_ALT1250_DEBUG -static void dump_current_all_status(altmdm_dev_t *dev, uint32_t evt, - altmdm_state_t next, int is_exit) +static void dump_current_all_status(FAR altmdm_dev_t *dev, uint32_t evt, + altmdm_state_t next, int is_exit) { m_info("state[%s => %s], vp[%s], event out[%08lx]:cur[%08lx], " "wcount=%2d, txreq_buf=%s, txreq_sz=%4d, " @@ -292,7 +292,7 @@ static int sready_isr(int irq, FAR void *context, FAR void *arg) } static void txsustimer_handler(int signo, FAR siginfo_t *info, - FAR void *uctx) + FAR void *uctx) { FAR struct altmdm_dev_s *priv = (FAR struct altmdm_dev_s *)(info->si_value.sival_ptr); @@ -450,7 +450,7 @@ static uint32_t waitevt_state_common(void) } static altmdm_state_t process_state_common(uint32_t event, - altmdm_state_t state) + altmdm_state_t state) { return state; } @@ -474,7 +474,7 @@ static uint32_t waitevt_state_poweroff(void) } static altmdm_state_t process_state_poweroff(uint32_t event, - altmdm_state_t state) + altmdm_state_t state) { struct timespec interval; @@ -535,7 +535,7 @@ static uint32_t waitevt_state_sleep(void) } static altmdm_state_t process_state_sleep(uint32_t event, - altmdm_state_t state) + altmdm_state_t state) { /* The order of checking the events is related to processing * priority, so be careful when making changes. @@ -603,7 +603,7 @@ static uint32_t waitevt_state_sleepwotx(void) } static altmdm_state_t process_state_sleepwotx(uint32_t event, - altmdm_state_t state) + altmdm_state_t state) { if (event & EVENT_DESTROY) { @@ -675,7 +675,7 @@ static uint32_t waitevt_state_idle4rst(void) } static altmdm_state_t process_state_idle4rst(uint32_t event, - altmdm_state_t state) + altmdm_state_t state) { enum version_phase_e vp; vp = get_vp(); @@ -735,7 +735,7 @@ static uint32_t waitevt_state_idlewto(void) } static altmdm_state_t process_state_idlewto(uint32_t event, - altmdm_state_t state) + altmdm_state_t state) { /* The order of checking the events is related to processing * priority, so be careful when making changes. @@ -807,7 +807,7 @@ static uint32_t waitevt_state_idlewoto(void) } static altmdm_state_t process_state_idlewoto(uint32_t event, - altmdm_state_t state) + altmdm_state_t state) { if (event & EVENT_DESTROY) { @@ -867,7 +867,7 @@ static uint32_t waitevt_state_idlewotx(void) } static altmdm_state_t process_state_idlewotx(uint32_t event, - altmdm_state_t state) + altmdm_state_t state) { if (event & EVENT_DESTROY) { @@ -914,7 +914,7 @@ static altmdm_state_t process_state_idlewotx(uint32_t event, ****************************************************************************/ static altmdm_state_t process_state_v1set(uint32_t event, - altmdm_state_t state) + altmdm_state_t state) { int len; void *pkt; @@ -931,7 +931,7 @@ static altmdm_state_t process_state_v1set(uint32_t event, ****************************************************************************/ static altmdm_state_t process_state_v4set(uint32_t event, - altmdm_state_t state) + altmdm_state_t state) { int len; void *pkt; @@ -948,7 +948,7 @@ static altmdm_state_t process_state_v4set(uint32_t event, ****************************************************************************/ static altmdm_state_t process_state_sleepset(uint32_t event, - altmdm_state_t state) + altmdm_state_t state) { altmdm_set_sleeppkt(&g_altmdm_dev.tx_pkt); @@ -960,7 +960,7 @@ static altmdm_state_t process_state_sleepset(uint32_t event, ****************************************************************************/ static altmdm_state_t process_state_txprepare(uint32_t event, - altmdm_state_t state) + altmdm_state_t state) { void *buff; int len; @@ -980,7 +980,7 @@ static altmdm_state_t process_state_txprepare(uint32_t event, ****************************************************************************/ static altmdm_state_t process_state_txreq(uint32_t event, - altmdm_state_t state) + altmdm_state_t state) { g_altmdm_dev.lower->set_mready(true); @@ -1019,7 +1019,7 @@ static uint32_t waitevt_state_hdrsreq(void) } static altmdm_state_t process_state_hdrsreq(uint32_t event, - altmdm_state_t state) + altmdm_state_t state) { if (event & EVENT_DESTROY) { @@ -1057,7 +1057,7 @@ static altmdm_state_t process_state_hdrsreq(uint32_t event, ****************************************************************************/ static altmdm_state_t process_state_hdrtrx(uint32_t event, - altmdm_state_t state) + altmdm_state_t state) { altmdm_do_hdr_transaction(g_altmdm_dev.spidev, g_altmdm_dev.lower, &g_altmdm_dev.tx_pkt, &g_altmdm_dev.rx_pkt); @@ -1107,7 +1107,7 @@ static altmdm_state_t process_state_hdrtrx(uint32_t event, ****************************************************************************/ static altmdm_state_t process_state_sleeppkt(uint32_t event, - altmdm_state_t state) + altmdm_state_t state) { altmdm_overwrite_body_size(&g_altmdm_dev.rx_pkt, 4); @@ -1126,7 +1126,7 @@ static uint32_t waitevt_state_bodysreq(void) } static altmdm_state_t process_state_bodysreq(uint32_t event, - altmdm_state_t state) + altmdm_state_t state) { if (event & EVENT_DESTROY) { @@ -1164,7 +1164,7 @@ static altmdm_state_t process_state_bodysreq(uint32_t event, ****************************************************************************/ static altmdm_state_t process_state_bodytrx(uint32_t event, - altmdm_state_t state) + altmdm_state_t state) { altmdm_do_body_transaction(g_altmdm_dev.spidev, g_altmdm_dev.lower, &g_altmdm_dev.tx_pkt, &g_altmdm_dev.rx_pkt); @@ -1214,7 +1214,7 @@ static altmdm_state_t process_state_bodytrx(uint32_t event, ****************************************************************************/ static altmdm_state_t process_state_gotrx(uint32_t event, - altmdm_state_t state) + altmdm_state_t state) { enum version_phase_e vp; void *rcv_data; @@ -1260,7 +1260,7 @@ static altmdm_state_t process_state_gotrx(uint32_t event, ****************************************************************************/ static altmdm_state_t process_state_gotrst(uint32_t event, - altmdm_state_t state) + altmdm_state_t state) { if (is_vp_noreset()) { @@ -1298,7 +1298,7 @@ static uint32_t waitevt_state_gotsleep(void) } static altmdm_state_t process_state_gotsleep(uint32_t event, - altmdm_state_t state) + altmdm_state_t state) { if (event & EVENT_SUSPEND) { @@ -1324,7 +1324,7 @@ static altmdm_state_t process_state_gotsleep(uint32_t event, ****************************************************************************/ static altmdm_state_t process_state_backtoidle(uint32_t event, - altmdm_state_t state) + altmdm_state_t state) { if (is_buffer_full(&g_altmdm_dev.rx_pkt)) { @@ -1358,7 +1358,7 @@ static altmdm_state_t process_state_backtoidle(uint32_t event, ****************************************************************************/ static altmdm_state_t process_state_retrecv(uint32_t event, - altmdm_state_t state) + altmdm_state_t state) { return ALTMDM_STATE_DECIDEDELAY; } @@ -1368,7 +1368,7 @@ static altmdm_state_t process_state_retrecv(uint32_t event, ****************************************************************************/ static altmdm_state_t process_state_forcerst(uint32_t event, - altmdm_state_t state) + altmdm_state_t state) { force_reset(); @@ -1387,7 +1387,7 @@ static uint32_t waitevt_state_sleeping(void) } static altmdm_state_t process_state_sleeping(uint32_t event, - altmdm_state_t state) + altmdm_state_t state) { if (is_buffer_full(&g_altmdm_dev.rx_pkt)) { @@ -1418,7 +1418,7 @@ static int next_state_decidedelay(altmdm_state_t state) } static altmdm_state_t process_state_decidedelay(uint32_t event, - altmdm_state_t state) + altmdm_state_t state) { if (has_sendrequest(&g_altmdm_dev.tx_pkt) || is_sleep_pkt(&g_altmdm_dev.tx_pkt)) @@ -1445,7 +1445,7 @@ static uint32_t waitevt_state_delaynext(void) } static altmdm_state_t process_state_delaynext(uint32_t event, - altmdm_state_t state) + altmdm_state_t state) { state = ALTMDM_STATE_BACKTOIDLE; @@ -1457,7 +1457,7 @@ static altmdm_state_t process_state_delaynext(uint32_t event, ****************************************************************************/ static altmdm_state_t process_state_setsustimer(uint32_t event, - altmdm_state_t state) + altmdm_state_t state) { altmdm_timer_restart(g_altmdm_dev.txsus_timer, TXSUS_TIMEOUT, 0); @@ -1470,7 +1470,7 @@ static altmdm_state_t process_state_setsustimer(uint32_t event, ****************************************************************************/ static altmdm_state_t process_state_setsustimersleep(uint32_t event, - altmdm_state_t state) + altmdm_state_t state) { altmdm_timer_restart(g_altmdm_dev.txsus_timer, TXSUS_TIMEOUT, 0); @@ -1497,7 +1497,7 @@ static int next_state_destroy(altmdm_state_t state) ****************************************************************************/ int altmdm_init(FAR struct spi_dev_s *spidev, - FAR const struct alt1250_lower_s *lower) + FAR const struct alt1250_lower_s *lower) { altmdm_event_init(&g_altmdm_dev.event); altmdm_event_init(&g_altmdm_dev.txdone_event); @@ -1514,7 +1514,7 @@ int altmdm_init(FAR struct spi_dev_s *spidev, g_altmdm_dev.lower = lower; g_altmdm_dev.txsus_timer = altmdm_timer_start(0, 0, txsustimer_handler, - &g_altmdm_dev); + &g_altmdm_dev); g_altmdm_dev.wcounter = 0; g_altmdm_dev.rx_retcode = 0; g_altmdm_dev.txreq_buff = NULL; @@ -1747,7 +1747,7 @@ int altmdm_write(FAR uint8_t *buff, int sz) if (should_wait) { ret = altmdm_event_wait(&g_altmdm_dev.txdone_event, - TX_DONE | TX_CANCEL, true, 0); + TX_DONE | TX_CANCEL, true, 0); if (ret & TX_CANCEL) { return ALTMDM_RETURN_CANCELED; @@ -1757,7 +1757,7 @@ int altmdm_write(FAR uint8_t *buff, int sz) while (should_wait); ret = altmdm_event_wait(&g_altmdm_dev.txdone_event, - TX_DONE | TX_CANCEL, true, 0); + TX_DONE | TX_CANCEL, true, 0); if (ret & TX_DONE) { diff --git a/drivers/mtd/gd25.c b/drivers/mtd/gd25.c index 7259953942..c19646fb2f 100644 --- a/drivers/mtd/gd25.c +++ b/drivers/mtd/gd25.c @@ -497,7 +497,7 @@ static bool gd25_is_erased(FAR struct gd25_dev_s *priv, off_t address, { /* Check if all bytes of page is in erased state. */ - gd25_byteread(priv, (uint8_t *)buf, address, GD25_PAGE_SIZE); + gd25_byteread(priv, (FAR uint8_t *)buf, address, GD25_PAGE_SIZE); for (i = 0; i < GD25_PAGE_SIZE / sizeof(uint32_t); i++) { diff --git a/drivers/mtd/gd5f.c b/drivers/mtd/gd5f.c index 478dc75213..fa8ed7ab71 100644 --- a/drivers/mtd/gd5f.c +++ b/drivers/mtd/gd5f.c @@ -793,7 +793,7 @@ static int gd5f_ioctl(FAR struct mtd_dev_s *dev, int cmd, unsigned long arg) case MTDIOC_ECCSTATUS: { - uint8_t *result = (uint8_t *)arg; + uint8_t *result = (FAR uint8_t *)arg; *result = (priv->eccstatus & GD5F_FEATURE_ECC_MASK) >> GD5F_FEATURE_ECC_OFFSET; diff --git a/drivers/mtd/mtd_nandram.c b/drivers/mtd/mtd_nandram.c index 1f4f4f2a8f..8e22ee01b7 100644 --- a/drivers/mtd/mtd_nandram.c +++ b/drivers/mtd/mtd_nandram.c @@ -436,15 +436,15 @@ int nand_ram_rawwrite(FAR struct nand_raw_s *raw, off_t block, nand_ram_flash_spare[write_page].n_write++; nand_ram_flash_spare[write_page].free = NAND_RAM_PAGE_WRITTEN; - memset((void *)write_page_data->page, 0, NAND_RAM_PAGE_SIZE); + memset((FAR void *)write_page_data->page, 0, NAND_RAM_PAGE_SIZE); if (data != NULL) { - memcpy((void *)write_page_data->page, data, NAND_RAM_PAGE_SIZE); + memcpy((FAR void *)write_page_data->page, data, NAND_RAM_PAGE_SIZE); } if (spare != NULL) { - memcpy((void *)write_page_spare, data, NAND_RAM_SPARE_SIZE); + memcpy((FAR void *)write_page_spare, data, NAND_RAM_SPARE_SIZE); } NAND_RAM_LOG("[LOWER %lu | %s] Done\n", nand_ram_ins_i, "rawwrite"); diff --git a/drivers/mtd/mx25rxx.c b/drivers/mtd/mx25rxx.c index 1dbd7b8b17..7a1f9cdb14 100644 --- a/drivers/mtd/mx25rxx.c +++ b/drivers/mtd/mx25rxx.c @@ -225,7 +225,7 @@ static int mx25rxx_command(FAR struct qspi_dev_s *qspi, uint8_t cmd); static int mx25rxx_command_address(FAR struct qspi_dev_s *qspi, uint8_t cmd, off_t addr, uint8_t addrlen); -static int mx25rxx_readid(struct mx25rxx_dev_s *dev); +static int mx25rxx_readid(FAR struct mx25rxx_dev_s *dev); static int mx25rxx_read_byte(FAR struct mx25rxx_dev_s *dev, FAR uint8_t *buffer, off_t address, size_t buflen); @@ -235,23 +235,26 @@ static void mx25rxx_write_status_config(FAR struct mx25rxx_dev_s *dev, uint8_t status, uint16_t config); static void mx25rxx_write_enable(FAR struct mx25rxx_dev_s *dev, bool enable); -static int mx25rxx_write_page(struct mx25rxx_dev_s *priv, +static int mx25rxx_write_page(FAR struct mx25rxx_dev_s *priv, FAR const uint8_t *buffer, off_t address, size_t buflen); -static int mx25rxx_erase_sector(struct mx25rxx_dev_s *priv, off_t sector); +static int mx25rxx_erase_sector(FAR struct mx25rxx_dev_s *priv, + off_t sector); #if 0 /* FIXME: Not used */ -static int mx25rxx_erase_block(struct mx25rxx_dev_s *priv, off_t block); +static int mx25rxx_erase_block(FAR struct mx25rxx_dev_s *priv, off_t block); #endif -static int mx25rxx_erase_chip(struct mx25rxx_dev_s *priv); +static int mx25rxx_erase_chip(FAR struct mx25rxx_dev_s *priv); #ifdef CONFIG_MX25RXX_SECTOR512 -static int mx25rxx_flush_cache(struct mx25rxx_dev_s *priv); -static FAR uint8_t *mx25rxx_read_cache(struct mx25rxx_dev_s *priv, +static int mx25rxx_flush_cache(FAR struct mx25rxx_dev_s *priv); +static FAR uint8_t *mx25rxx_read_cache(FAR struct mx25rxx_dev_s *priv, off_t sector); -static void mx25rxx_erase_cache(struct mx25rxx_dev_s *priv, off_t sector); +static void mx25rxx_erase_cache(FAR struct mx25rxx_dev_s *priv, + off_t sector); static int mx25rxx_write_cache(FAR struct mx25rxx_dev_s *priv, - FAR const uint8_t *buffer, off_t sector, size_t nsectors); + FAR const uint8_t *buffer, off_t sector, + size_t nsectors); #endif /**************************************************************************** @@ -379,7 +382,8 @@ int mx25rxx_read_byte(FAR struct mx25rxx_dev_s *dev, FAR uint8_t *buffer, return QSPI_MEMORY(dev->qspi, &meminfo); } -int mx25rxx_write_page(struct mx25rxx_dev_s *priv, FAR const uint8_t *buffer, +int mx25rxx_write_page(FAR struct mx25rxx_dev_s *priv, + FAR const uint8_t *buffer, off_t address, size_t buflen) { struct qspi_meminfo_s meminfo; @@ -409,7 +413,7 @@ int mx25rxx_write_page(struct mx25rxx_dev_s *priv, FAR const uint8_t *buffer, /* Set up varying parts of the transfer description */ meminfo.addr = address; - meminfo.buffer = (void *)buffer; + meminfo.buffer = (FAR void *)buffer; /* Write one page */ @@ -442,7 +446,7 @@ int mx25rxx_write_page(struct mx25rxx_dev_s *priv, FAR const uint8_t *buffer, return OK; } -int mx25rxx_erase_sector(struct mx25rxx_dev_s *priv, off_t sector) +int mx25rxx_erase_sector(FAR struct mx25rxx_dev_s *priv, off_t sector) { off_t address; uint8_t status; @@ -472,7 +476,7 @@ int mx25rxx_erase_sector(struct mx25rxx_dev_s *priv, off_t sector) } #if 0 /* FIXME: Not used */ -int mx25rxx_erase_block(struct mx25rxx_dev_s *priv, off_t block) +int mx25rxx_erase_block(FAR struct mx25rxx_dev_s *priv, off_t block) { uint8_t status; @@ -497,7 +501,7 @@ int mx25rxx_erase_block(struct mx25rxx_dev_s *priv, off_t block) } #endif -int mx25rxx_erase_chip(struct mx25rxx_dev_s *priv) +int mx25rxx_erase_chip(FAR struct mx25rxx_dev_s *priv) { uint8_t status; @@ -828,7 +832,7 @@ int mx25rxx_ioctl(FAR struct mtd_dev_s *dev, int cmd, unsigned long arg) return ret; } -int mx25rxx_readid(struct mx25rxx_dev_s *dev) +int mx25rxx_readid(FAR struct mx25rxx_dev_s *dev) { /* Lock the QuadSPI bus and configure the bus. */ @@ -884,7 +888,7 @@ int mx25rxx_readid(struct mx25rxx_dev_s *dev) ****************************************************************************/ #ifdef CONFIG_MX25RXX_SECTOR512 -static int mx25rxx_flush_cache(struct mx25rxx_dev_s *priv) +static int mx25rxx_flush_cache(FAR struct mx25rxx_dev_s *priv) { int ret = OK; @@ -927,7 +931,7 @@ static int mx25rxx_flush_cache(struct mx25rxx_dev_s *priv) ****************************************************************************/ #ifdef CONFIG_MX25RXX_SECTOR512 -static FAR uint8_t *mx25rxx_read_cache(struct mx25rxx_dev_s *priv, +static FAR uint8_t *mx25rxx_read_cache(FAR struct mx25rxx_dev_s *priv, off_t sector) { off_t esectno; @@ -996,7 +1000,7 @@ static FAR uint8_t *mx25rxx_read_cache(struct mx25rxx_dev_s *priv, ****************************************************************************/ #ifdef CONFIG_MX25RXX_SECTOR512 -static void mx25rxx_erase_cache(struct mx25rxx_dev_s *priv, off_t sector) +static void mx25rxx_erase_cache(FAR struct mx25rxx_dev_s *priv, off_t sector) { FAR uint8_t *dest; @@ -1038,8 +1042,8 @@ static void mx25rxx_erase_cache(struct mx25rxx_dev_s *priv, off_t sector) #ifdef CONFIG_MX25RXX_SECTOR512 static int mx25rxx_write_cache(FAR struct mx25rxx_dev_s *priv, - FAR const uint8_t *buffer, off_t sector, - size_t nsectors) + FAR const uint8_t *buffer, off_t sector, + size_t nsectors) { FAR uint8_t *dest; int ret; diff --git a/drivers/mtd/mx35.c b/drivers/mtd/mx35.c index c1155b1d32..5e2c7a9658 100644 --- a/drivers/mtd/mx35.c +++ b/drivers/mtd/mx35.c @@ -839,7 +839,7 @@ static int mx35_ioctl(FAR struct mtd_dev_s *dev, int cmd, unsigned long arg) case MTDIOC_ECCSTATUS: { - uint8_t *result = (uint8_t *)arg; + uint8_t *result = (FAR uint8_t *)arg; *result = (priv->eccstatus & MX35_FEATURE_ECC_MASK) >> MX35_FEATURE_ECC_OFFSET; diff --git a/drivers/mtd/n25qxxx.c b/drivers/mtd/n25qxxx.c index 09cfeec753..c43a4d8278 100644 --- a/drivers/mtd/n25qxxx.c +++ b/drivers/mtd/n25qxxx.c @@ -337,10 +337,10 @@ static int n25qxxx_write_page(FAR struct n25qxxx_dev_s *priv, off_t address, size_t nbytes); #ifdef CONFIG_N25QXXX_SECTOR512 -static int n25qxxx_flush_cache(struct n25qxxx_dev_s *priv); -static FAR uint8_t *n25qxxx_read_cache(struct n25qxxx_dev_s *priv, +static int n25qxxx_flush_cache(FAR struct n25qxxx_dev_s *priv); +static FAR uint8_t *n25qxxx_read_cache(FAR struct n25qxxx_dev_s *priv, off_t sector); -static void n25qxxx_erase_cache(struct n25qxxx_dev_s *priv, +static void n25qxxx_erase_cache(FAR struct n25qxxx_dev_s *priv, off_t sector); static int n25qxxx_write_cache(FAR struct n25qxxx_dev_s *priv, FAR const uint8_t *buffer, @@ -503,7 +503,7 @@ static int n25qxxx_command_write(FAR struct qspi_dev_s *qspi, uint8_t cmd, static uint8_t n25qxxx_read_status(FAR struct n25qxxx_dev_s *priv) { DEBUGVERIFY(n25qxxx_command_read(priv->qspi, N25QXXX_READ_STATUS, - (FAR void *)&priv->readbuf[0], 1)); + (FAR void *)&priv->readbuf[0], 1)); return priv->readbuf[0]; } @@ -520,7 +520,7 @@ static void n25qxxx_write_status(FAR struct n25qxxx_dev_s *priv) priv->cmdbuf[0] &= ~STATUS_SRP0_MASK; n25qxxx_command_write(priv->qspi, N25QXXX_WRITE_STATUS, - (FAR const void *)priv->cmdbuf, 1); + (FAR const void *)priv->cmdbuf, 1); n25qxxx_write_disable(priv); } @@ -531,7 +531,7 @@ static void n25qxxx_write_status(FAR struct n25qxxx_dev_s *priv) static uint8_t n25qxxx_read_volcfg(FAR struct n25qxxx_dev_s *priv) { DEBUGVERIFY(n25qxxx_command_read(priv->qspi, N25QXXX_READ_VOLCFG, - (FAR void *)&priv->readbuf[0], 1)); + (FAR void *)&priv->readbuf[0], 1)); return priv->readbuf[0]; } @@ -543,7 +543,7 @@ static void n25qxxx_write_volcfg(FAR struct n25qxxx_dev_s *priv) { n25qxxx_write_enable(priv); n25qxxx_command_write(priv->qspi, N25QXXX_WRITE_VOLCFG, - (FAR const void *)priv->cmdbuf, 1); + (FAR const void *)priv->cmdbuf, 1); n25qxxx_write_disable(priv); } @@ -670,7 +670,7 @@ static inline int n25qxxx_readid(struct n25qxxx_dev_s *priv) ****************************************************************************/ static int n25qxxx_protect(FAR struct n25qxxx_dev_s *priv, - off_t startblock, size_t nblocks) + off_t startblock, size_t nblocks) { /* Get the status register value to check the current protection */ @@ -718,7 +718,7 @@ static int n25qxxx_protect(FAR struct n25qxxx_dev_s *priv, ****************************************************************************/ static int n25qxxx_unprotect(FAR struct n25qxxx_dev_s *priv, - off_t startblock, size_t nblocks) + off_t startblock, size_t nblocks) { /* Get the status register value to check the current protection */ @@ -823,7 +823,7 @@ static bool n25qxxx_isprotected(FAR struct n25qxxx_dev_s *priv, * Name: n25qxxx_erase_sector ****************************************************************************/ -static int n25qxxx_erase_sector(struct n25qxxx_dev_s *priv, off_t sector) +static int n25qxxx_erase_sector(FAR struct n25qxxx_dev_s *priv, off_t sector) { off_t address; uint8_t status; @@ -866,7 +866,7 @@ static int n25qxxx_erase_sector(struct n25qxxx_dev_s *priv, off_t sector) * Name: n25qxxx_erase_chip ****************************************************************************/ -static int n25qxxx_erase_chip(struct n25qxxx_dev_s *priv) +static int n25qxxx_erase_chip(FAR struct n25qxxx_dev_s *priv) { uint8_t status; @@ -924,7 +924,7 @@ static int n25qxxx_read_byte(FAR struct n25qxxx_dev_s *priv, * Name: n25qxxx_write_page ****************************************************************************/ -static int n25qxxx_write_page(struct n25qxxx_dev_s *priv, +static int n25qxxx_write_page(FAR struct n25qxxx_dev_s *priv, FAR const uint8_t *buffer, off_t address, size_t buflen) @@ -957,7 +957,7 @@ static int n25qxxx_write_page(struct n25qxxx_dev_s *priv, /* Set up varying parts of the transfer description */ meminfo.addr = address; - meminfo.buffer = (void *)buffer; + meminfo.buffer = (FAR void *)buffer; /* Write one page */ @@ -993,7 +993,7 @@ static int n25qxxx_write_page(struct n25qxxx_dev_s *priv, ****************************************************************************/ #ifdef CONFIG_N25QXXX_SECTOR512 -static int n25qxxx_flush_cache(struct n25qxxx_dev_s *priv) +static int n25qxxx_flush_cache(FAR struct n25qxxx_dev_s *priv) { int ret = OK; @@ -1034,7 +1034,7 @@ static int n25qxxx_flush_cache(struct n25qxxx_dev_s *priv) ****************************************************************************/ #ifdef CONFIG_N25QXXX_SECTOR512 -static FAR uint8_t *n25qxxx_read_cache(struct n25qxxx_dev_s *priv, +static FAR uint8_t *n25qxxx_read_cache(FAR struct n25qxxx_dev_s *priv, off_t sector) { off_t esectno; @@ -1103,7 +1103,7 @@ static FAR uint8_t *n25qxxx_read_cache(struct n25qxxx_dev_s *priv, ****************************************************************************/ #ifdef CONFIG_N25QXXX_SECTOR512 -static void n25qxxx_erase_cache(struct n25qxxx_dev_s *priv, off_t sector) +static void n25qxxx_erase_cache(FAR struct n25qxxx_dev_s *priv, off_t sector) { FAR uint8_t *dest; @@ -1145,8 +1145,8 @@ static void n25qxxx_erase_cache(struct n25qxxx_dev_s *priv, off_t sector) #ifdef CONFIG_N25QXXX_SECTOR512 static int n25qxxx_write_cache(FAR struct n25qxxx_dev_s *priv, - FAR const uint8_t *buffer, off_t sector, - size_t nsectors) + FAR const uint8_t *buffer, off_t sector, + size_t nsectors) { FAR uint8_t *dest; int ret; @@ -1250,7 +1250,7 @@ static int n25qxxx_erase(FAR struct mtd_dev_s *dev, ****************************************************************************/ static ssize_t n25qxxx_bread(FAR struct mtd_dev_s *dev, off_t startblock, - size_t nblocks, FAR uint8_t *buffer) + size_t nblocks, FAR uint8_t *buffer) { #ifndef CONFIG_N25QXXX_SECTOR512 FAR struct n25qxxx_dev_s *priv = (FAR struct n25qxxx_dev_s *)dev; @@ -1287,7 +1287,7 @@ static ssize_t n25qxxx_bread(FAR struct mtd_dev_s *dev, off_t startblock, ****************************************************************************/ static ssize_t n25qxxx_bwrite(FAR struct mtd_dev_s *dev, off_t startblock, - size_t nblocks, FAR const uint8_t *buffer) + size_t nblocks, FAR const uint8_t *buffer) { FAR struct n25qxxx_dev_s *priv = (FAR struct n25qxxx_dev_s *)dev; int ret = (int)nblocks; diff --git a/drivers/mtd/s25fl1.c b/drivers/mtd/s25fl1.c index 7c0e04f520..414d9c9877 100644 --- a/drivers/mtd/s25fl1.c +++ b/drivers/mtd/s25fl1.c @@ -392,10 +392,10 @@ static int s25fl1_write_page(FAR struct s25fl1_dev_s *priv, off_t address, size_t nbytes); #ifdef CONFIG_S25FL1_SECTOR512 -static int s25fl1_flush_cache(struct s25fl1_dev_s *priv); -static FAR uint8_t *s25fl1_read_cache(struct s25fl1_dev_s *priv, +static int s25fl1_flush_cache(FAR struct s25fl1_dev_s *priv); +static FAR uint8_t *s25fl1_read_cache(FAR struct s25fl1_dev_s *priv, off_t sector); -static void s25fl1_erase_cache(struct s25fl1_dev_s *priv, +static void s25fl1_erase_cache(FAR struct s25fl1_dev_s *priv, off_t sector); static int s25fl1_write_cache(FAR struct s25fl1_dev_s *priv, FAR const uint8_t *buffer, @@ -637,7 +637,7 @@ static void s25fl1_write_status(FAR struct s25fl1_dev_s *priv) * Name: s25fl1_readid ****************************************************************************/ -static inline int s25fl1_readid(struct s25fl1_dev_s *priv) +static inline int s25fl1_readid(FAR struct s25fl1_dev_s *priv) { /* Lock the QuadSPI bus and configure the bus. */ @@ -863,7 +863,7 @@ static bool s25fl1_isprotected(FAR struct s25fl1_dev_s *priv, uint8_t status, * Name: s25fl1_erase_sector ****************************************************************************/ -static int s25fl1_erase_sector(struct s25fl1_dev_s *priv, off_t sector) +static int s25fl1_erase_sector(FAR struct s25fl1_dev_s *priv, off_t sector) { off_t address; uint8_t status; @@ -905,7 +905,7 @@ static int s25fl1_erase_sector(struct s25fl1_dev_s *priv, off_t sector) * Name: s25fl1_erase_chip ****************************************************************************/ -static int s25fl1_erase_chip(struct s25fl1_dev_s *priv) +static int s25fl1_erase_chip(FAR struct s25fl1_dev_s *priv) { uint8_t status; @@ -970,7 +970,7 @@ static int s25fl1_read_byte(FAR struct s25fl1_dev_s *priv, * Name: s25fl1_write_page ****************************************************************************/ -static int s25fl1_write_page(struct s25fl1_dev_s *priv, +static int s25fl1_write_page(FAR struct s25fl1_dev_s *priv, FAR const uint8_t *buffer, off_t address, size_t buflen) @@ -1009,7 +1009,7 @@ static int s25fl1_write_page(struct s25fl1_dev_s *priv, /* Set up varying parts of the transfer description */ meminfo.addr = address; - meminfo.buffer = (void *)buffer; + meminfo.buffer = (FAR void *)buffer; /* Write one page */ @@ -1044,7 +1044,7 @@ static int s25fl1_write_page(struct s25fl1_dev_s *priv, ****************************************************************************/ #ifdef CONFIG_S25FL1_SECTOR512 -static int s25fl1_flush_cache(struct s25fl1_dev_s *priv) +static int s25fl1_flush_cache(FAR struct s25fl1_dev_s *priv) { int ret = OK; @@ -1087,7 +1087,7 @@ static int s25fl1_flush_cache(struct s25fl1_dev_s *priv) ****************************************************************************/ #ifdef CONFIG_S25FL1_SECTOR512 -static FAR uint8_t *s25fl1_read_cache(struct s25fl1_dev_s *priv, +static FAR uint8_t *s25fl1_read_cache(FAR struct s25fl1_dev_s *priv, off_t sector) { off_t esectno; @@ -1155,7 +1155,7 @@ static FAR uint8_t *s25fl1_read_cache(struct s25fl1_dev_s *priv, ****************************************************************************/ #ifdef CONFIG_S25FL1_SECTOR512 -static void s25fl1_erase_cache(struct s25fl1_dev_s *priv, off_t sector) +static void s25fl1_erase_cache(FAR struct s25fl1_dev_s *priv, off_t sector) { FAR uint8_t *dest; diff --git a/drivers/mtd/smart.c b/drivers/mtd/smart.c index 97d0dc8cc0..b3747d4c59 100644 --- a/drivers/mtd/smart.c +++ b/drivers/mtd/smart.c @@ -413,26 +413,26 @@ struct smart_entry_header_s static int smart_open(FAR struct inode *inode); static int smart_close(FAR struct inode *inode); static ssize_t smart_reload(struct smart_struct_s *dev, FAR uint8_t *buffer, - off_t startblock, size_t nblocks); -static ssize_t smart_read(FAR struct inode *inode, unsigned char *buffer, - blkcnt_t start_sector, unsigned int nsectors); + off_t startblock, size_t nblocks); +static ssize_t smart_read(FAR struct inode *inode, FAR unsigned char *buffer, + blkcnt_t start_sector, unsigned int nsectors); static ssize_t smart_write(FAR struct inode *inode, - FAR const unsigned char *buffer, blkcnt_t start_sector, - unsigned int nsectors); + FAR const unsigned char *buffer, + blkcnt_t start_sector, unsigned int nsectors); static int smart_geometry(FAR struct inode *inode, - FAR struct geometry *geometry); + FAR struct geometry *geometry); static int smart_ioctl(FAR struct inode *inode, int cmd, - unsigned long arg); + unsigned long arg); static int smart_findfreephyssector(FAR struct smart_struct_s *dev, - uint8_t canrelocate); + bool canrelocate); static int smart_writesector(FAR struct smart_struct_s *dev, - unsigned long arg); + unsigned long arg); static inline int smart_allocsector(FAR struct smart_struct_s *dev, - unsigned long requested); + unsigned long requested); static int smart_readsector(FAR struct smart_struct_s *dev, - unsigned long arg); + unsigned long arg); #ifdef CONFIG_MTD_SMART_ENABLE_CRC static int smart_validate_crc(FAR struct smart_struct_s *dev); @@ -440,11 +440,11 @@ static int smart_validate_crc(FAR struct smart_struct_s *dev); #ifdef CONFIG_MTD_SMART_WEAR_LEVEL static int smart_read_wearstatus(FAR struct smart_struct_s *dev); static int smart_relocate_static_data(FAR struct smart_struct_s *dev, - uint16_t block); + uint16_t block); #endif static int smart_relocate_sector(FAR struct smart_struct_s *dev, - uint16_t oldsector, uint16_t newsector); + uint16_t oldsector, uint16_t newsector); #ifdef CONFIG_MTD_SMART_FSCK static int smart_fsck(FAR struct smart_struct_s *dev); @@ -452,11 +452,11 @@ static int smart_fsck(FAR struct smart_struct_s *dev); #ifdef CONFIG_SMART_DEV_LOOP static ssize_t smart_loop_read(FAR struct file *filep, FAR char *buffer, - size_t buflen); + size_t buflen); static ssize_t smart_loop_write(FAR struct file *filep, - FAR const char *buffer, size_t buflen); + FAR const char *buffer, size_t buflen); static int smart_loop_ioctl(FAR struct file *filep, int cmd, - unsigned long arg); + unsigned long arg); #endif /* CONFIG_SMART_DEV_LOOP */ /**************************************************************************** @@ -525,7 +525,7 @@ static int smart_close(FAR struct inode *inode) #ifdef CONFIG_MTD_SMART_ALLOC_DEBUG FAR static void *smart_malloc(FAR struct smart_struct_s *dev, - size_t bytes, const char *name) + size_t bytes, FAR const char *name) { FAR void *ret = kmm_malloc(bytes); uint8_t x; @@ -577,9 +577,9 @@ FAR static void *smart_malloc(FAR struct smart_struct_s *dev, #ifdef CONFIG_MTD_SMART_ALLOC_DEBUG FAR static void *smart_zalloc(FAR struct smart_struct_s *dev, - size_t bytes, const char *name) + size_t bytes, FAR const char *name) { - void *mem; + FAR void *mem; mem = smart_malloc(dev, bytes, name); if (mem != NULL) @@ -679,7 +679,7 @@ static void smart_set_count(FAR struct smart_struct_s *dev, #ifdef CONFIG_MTD_SMART_PACK_COUNTS static uint8_t smart_get_count(FAR struct smart_struct_s *dev, - FAR uint8_t *pcount, uint16_t block) + FAR uint8_t *pcount, uint16_t block) { uint8_t count; @@ -726,10 +726,11 @@ static uint8_t smart_get_count(FAR struct smart_struct_s *dev, ****************************************************************************/ #ifdef CONFIG_MTD_SMART_PACK_COUNTS -static void smart_add_count(struct smart_struct_s *dev, uint8_t *pcount, +static void smart_add_count(FAR struct smart_struct_s *dev, + FAR uint8_t *pcount, uint16_t block, int adder) { - int16_t value; + int16_t value; value = smart_get_count(dev, pcount, block) + adder; smart_set_count(dev, pcount, block, value); @@ -895,7 +896,7 @@ static ssize_t smart_reload(struct smart_struct_s *dev, FAR uint8_t *buffer, * ****************************************************************************/ -static ssize_t smart_read(FAR struct inode *inode, unsigned char *buffer, +static ssize_t smart_read(FAR struct inode *inode, FAR unsigned char *buffer, blkcnt_t start_sector, unsigned int nsectors) { FAR struct smart_struct_s *dev; @@ -1042,7 +1043,8 @@ static ssize_t smart_write(FAR struct inode *inode, * ****************************************************************************/ -static int smart_geometry(FAR struct inode *inode, struct geometry *geometry) +static int smart_geometry(FAR struct inode *inode, + FAR struct geometry *geometry) { FAR struct smart_struct_s *dev; uint32_t erasesize; @@ -1089,9 +1091,9 @@ static int smart_geometry(FAR struct inode *inode, struct geometry *geometry) static int smart_setsectorsize(FAR struct smart_struct_s *dev, uint16_t size) { - uint32_t erasesize; - uint32_t totalsectors; - uint32_t allocsize; + uint32_t erasesize; + uint32_t totalsectors; + uint32_t allocsize; /* Validate the size isn't zero so we don't divide by zero below */ @@ -1208,7 +1210,7 @@ static int smart_setsectorsize(FAR struct smart_struct_s *dev, uint16_t size) totalsectors -= 2; } - dev->totalsectors = (uint16_t) totalsectors; + dev->totalsectors = (uint16_t)totalsectors; #ifndef CONFIG_MTD_SMART_MINIMIZE_RAM allocsize = dev->neraseblocks << 1; @@ -1221,7 +1223,7 @@ static int smart_setsectorsize(FAR struct smart_struct_s *dev, uint16_t size) goto errexit; } - dev->releasecount = (FAR uint8_t *) dev->smap + + dev->releasecount = (FAR uint8_t *)dev->smap + (totalsectors * sizeof(uint16_t)); dev->freecount = dev->releasecount + dev->neraseblocks; #else @@ -1257,7 +1259,7 @@ static int smart_setsectorsize(FAR struct smart_struct_s *dev, uint16_t size) if (dev->scache == NULL) { - dev->scache = (FAR struct smart_cache_s *) smart_malloc(dev, + dev->scache = (FAR struct smart_cache_s *)smart_malloc(dev, CONFIG_MTD_SMART_SECTOR_CACHE_SIZE * sizeof(struct smart_cache_s) + allocsize, "Sector Cache"); } @@ -1313,7 +1315,7 @@ static int smart_setsectorsize(FAR struct smart_struct_s *dev, uint16_t size) #ifdef CONFIG_MTD_SMART_WEAR_LEVEL /* Allocate the wear leveling status array */ - dev->wearstatus = (FAR uint8_t *) smart_malloc(dev, dev->neraseblocks >> + dev->wearstatus = (FAR uint8_t *)smart_malloc(dev, dev->neraseblocks >> SMART_WEAR_BIT_DIVIDE, "Wear status"); if (!dev->wearstatus) { @@ -1329,7 +1331,7 @@ static int smart_setsectorsize(FAR struct smart_struct_s *dev, uint16_t size) /* Allocate a read/write buffer */ - dev->rwbuffer = (FAR char *) smart_malloc(dev, size, "RW Buffer"); + dev->rwbuffer = (FAR char *)smart_malloc(dev, size, "RW Buffer"); if (!dev->rwbuffer) { ferr("ERROR: Error allocating SMART read/write buffer\n"); @@ -1395,9 +1397,9 @@ errexit: ****************************************************************************/ static ssize_t smart_bytewrite(FAR struct smart_struct_s *dev, size_t offset, - int nbytes, FAR const uint8_t *buffer) + int nbytes, FAR const uint8_t *buffer) { - ssize_t ret; + ssize_t ret; #ifdef CONFIG_MTD_BYTE_WRITE /* Check if the underlying MTD device supports write */ @@ -1442,7 +1444,7 @@ static ssize_t smart_bytewrite(FAR struct smart_struct_s *dev, size_t offset, /* Write the data back to the device */ ret = MTD_BWRITE(dev->mtd, startblock, nblocks, - (FAR uint8_t *) dev->rwbuffer); + (FAR uint8_t *)dev->rwbuffer); if (ret < 0) { ferr("ERROR: Error %zd writing to device\n", -ret); @@ -1471,7 +1473,8 @@ errout: #ifdef CONFIG_MTD_SMART_MINIMIZE_RAM static int smart_add_sector_to_cache(FAR struct smart_struct_s *dev, - uint16_t logical, uint16_t physical, int line) + uint16_t logical, uint16_t physical, + int line) { uint16_t index; uint16_t x; @@ -1497,7 +1500,9 @@ static int smart_add_sector_to_cache(FAR struct smart_struct_s *dev, /* Never replace cache entries for system sectors */ if (dev->scache[x].logical < SMART_FIRST_ALLOC_SECTOR) - continue; + { + continue; + } /* If the hit count is zero, then choose this entry */ @@ -1520,7 +1525,7 @@ static int smart_add_sector_to_cache(FAR struct smart_struct_s *dev, if (dev->debuglevel > 1) { _err("Add Cache sector: Log=%d, Phys=%d at index %d from line %d\n", - logical, physical, index, line); + logical, physical, index, line); } /* Test if the birthdays need to be adjusted */ @@ -1555,14 +1560,14 @@ static int smart_add_sector_to_cache(FAR struct smart_struct_s *dev, static uint16_t smart_cache_lookup(FAR struct smart_struct_s *dev, uint16_t logical) { - int ret; - uint16_t block; - uint16_t sector; - uint16_t x; - uint16_t physical; - uint16_t logicalsector; - struct smart_sect_header_s header; - size_t readaddress; + int ret; + uint16_t block; + uint16_t sector; + uint16_t x; + uint16_t physical; + uint16_t logicalsector; + struct smart_sect_header_s header; + size_t readaddress; physical = 0xffff; @@ -1616,7 +1621,7 @@ static uint16_t smart_cache_lookup(FAR struct smart_struct_s *dev, ret = MTD_READ(dev->mtd, readaddress, sizeof(struct smart_sect_header_s), - (FAR uint8_t *) &header); + (FAR uint8_t *)&header); if (ret != sizeof(struct smart_sect_header_s)) { goto err_out; @@ -1624,7 +1629,7 @@ static uint16_t smart_cache_lookup(FAR struct smart_struct_s *dev, /* Get the logical sector number for this physical sector */ - logicalsector = *((FAR uint16_t *) header.logicalsector); + logicalsector = *((FAR uint16_t *)header.logicalsector); #if CONFIG_SMARTFS_ERASEDSTATE == 0x00 if (logicalsector == 0) { @@ -1691,10 +1696,10 @@ err_out: ****************************************************************************/ #ifdef CONFIG_MTD_SMART_MINIMIZE_RAM -static void smart_update_cache(FAR struct smart_struct_s *dev, uint16_t - logical, uint16_t physical) +static void smart_update_cache(FAR struct smart_struct_s *dev, + uint16_t logical, uint16_t physical) { - uint16_t x; + uint16_t x; /* Scan through all cache entries and find the logical sector entry */ @@ -1785,7 +1790,7 @@ static uint8_t smart_get_wear_level(FAR struct smart_struct_s *dev, #ifdef CONFIG_MTD_SMART_WEAR_LEVEL static void smart_find_wear_minmax(FAR struct smart_struct_s *dev) { - uint16_t x; + uint16_t x; unsigned char level; dev->minwearlevel = 15; @@ -1917,7 +1922,9 @@ static int smart_set_wear_level(FAR struct smart_struct_s *dev, smart_find_wear_minmax(dev); if (oldlevel != dev->minwearlevel) + { finfo("##### New min wear level = %d\n", dev->minwearlevel); + } } } @@ -1988,7 +1995,7 @@ static int smart_scan(FAR struct smart_struct_s *dev) ret = MTD_READ(dev->mtd, readaddress, sizeof(struct smart_sect_header_s), - (FAR uint8_t *) &header); + (FAR uint8_t *)&header); if (ret != sizeof(struct smart_sect_header_s)) { goto err_out; @@ -2099,7 +2106,7 @@ static int smart_scan(FAR struct smart_struct_s *dev) /* Get the logical sector number for this physical sector */ - logicalsector = *((FAR uint16_t *) header.logicalsector); + logicalsector = *((FAR uint16_t *)header.logicalsector); #if CONFIG_SMARTFS_ERASEDSTATE == 0x00 if (logicalsector == 0) { @@ -2223,7 +2230,7 @@ static int smart_scan(FAR struct smart_struct_s *dev) * the SMART device structure and the root directory number. */ - rootdirdev = (struct smart_multiroot_device_s *) + rootdirdev = (FAR struct smart_multiroot_device_s *) smart_malloc(dev, sizeof(*rootdirdev), "Root Dir"); if (rootdirdev == NULL) { @@ -2294,7 +2301,7 @@ static int smart_scan(FAR struct smart_struct_s *dev) ret = MTD_READ(dev->mtd, readaddress, sizeof(struct smart_sect_header_s), - (FAR uint8_t *) &header); + (FAR uint8_t *)&header); if (ret != sizeof(struct smart_sect_header_s)) { goto err_out; @@ -2302,7 +2309,7 @@ static int smart_scan(FAR struct smart_struct_s *dev) /* Get the logical sector number for this physical sector */ - duplogsector = *((FAR uint16_t *) header.logicalsector); + duplogsector = *((FAR uint16_t *)header.logicalsector); #if CONFIG_SMARTFS_ERASEDSTATE == 0x00 if (duplogsector == 0) @@ -2346,7 +2353,7 @@ static int smart_scan(FAR struct smart_struct_s *dev) ret = MTD_READ(dev->mtd, readaddress, sizeof(struct smart_sect_header_s), - (FAR uint8_t *) &header); + (FAR uint8_t *)&header); if (ret != sizeof(struct smart_sect_header_s)) { goto err_out; @@ -2361,7 +2368,7 @@ static int smart_scan(FAR struct smart_struct_s *dev) } else { - seq1 = *((FAR uint16_t *) &header.seq); + seq1 = *((FAR uint16_t *)&header.seq); seqwrap = 0xfff0; } #else @@ -2401,7 +2408,7 @@ static int smart_scan(FAR struct smart_struct_s *dev) ret = MTD_BREAD(dev->mtd, winner * dev->mtdblkspersector, dev->mtdblkspersector, - (FAR uint8_t *) dev->rwbuffer); + (FAR uint8_t *)dev->rwbuffer); if (ret == dev->mtdblkspersector) { /* Validate the CRC of the read-back data */ @@ -2444,7 +2451,7 @@ static int smart_scan(FAR struct smart_struct_s *dev) readaddress = loser * dev->mtdblkspersector * dev->geo.blocksize; ret = MTD_READ(dev->mtd, readaddress, sizeof(struct smart_sect_header_s), - (FAR uint8_t *)&header); + (FAR uint8_t *)&header); if (ret != sizeof(struct smart_sect_header_s)) { goto err_out; @@ -2510,7 +2517,7 @@ static int smart_scan(FAR struct smart_struct_s *dev) /* Read the sector data */ ret = MTD_BREAD(dev->mtd, sector * dev->mtdblkspersector, - dev->mtdblkspersector, (uint8_t *) dev->rwbuffer); + dev->mtdblkspersector, (FAR uint8_t *)dev->rwbuffer); if (ret != dev->mtdblkspersector) { ferr("ERROR: Error reading physical sector %d.\n", sector); @@ -2525,7 +2532,7 @@ static int smart_scan(FAR struct smart_struct_s *dev) * in with 0xff. */ - uint16_t newsector = smart_findfreephyssector(dev, FALSE); + uint16_t newsector = smart_findfreephyssector(dev, false); if (newsector == 0xffff) { /* Unable to find a free sector!!! */ @@ -2692,7 +2699,7 @@ err_out: ****************************************************************************/ static void smart_erase_block_if_empty(FAR struct smart_struct_s *dev, - uint16_t block, uint8_t forceerase) + uint16_t block, bool forceerase) { uint16_t freecount; uint16_t releasecount; @@ -2811,7 +2818,7 @@ static int smart_relocate_static_data(FAR struct smart_struct_s *dev, */ ret = OK; - header = (FAR struct smart_sect_header_s *) dev->rwbuffer; + header = (FAR struct smart_sect_header_s *)dev->rwbuffer; #ifdef CONFIG_SMART_LOCAL_CHECKFREE if (smart_checkfree(dev, __LINE__) != OK) @@ -2903,7 +2910,8 @@ static int smart_relocate_static_data(FAR struct smart_struct_s *dev, /* Read the next sector from this erase block */ ret = MTD_BREAD(dev->mtd, sector * dev->mtdblkspersector, - dev->mtdblkspersector, (FAR uint8_t *) dev->rwbuffer); + dev->mtdblkspersector, + (FAR uint8_t *)dev->rwbuffer); if (ret != dev->mtdblkspersector) { ferr("ERROR: Error reading sector %d\n", sector); @@ -2950,7 +2958,7 @@ static int smart_relocate_static_data(FAR struct smart_struct_s *dev, /* Update the temporary allocation's physical sector */ allocsector->physical = newsector; - *((FAR uint16_t *) header->logicalsector) = + *((FAR uint16_t *)header->logicalsector) = allocsector->logical; } else @@ -2985,7 +2993,7 @@ static int smart_relocate_static_data(FAR struct smart_struct_s *dev, dev->freesectors--; #ifndef CONFIG_MTD_SMART_MINIMIZE_RAM - dev->smap[*((FAR uint16_t *) header->logicalsector)] = newsector; + dev->smap[*((FAR uint16_t *)header->logicalsector)] = newsector; #else smart_update_cache(dev, *((FAR uint16_t *)header->logicalsector), newsector); @@ -3007,7 +3015,7 @@ static int smart_relocate_static_data(FAR struct smart_struct_s *dev, /* Now erase the block we just relocated, force erasing it */ - smart_erase_block_if_empty(dev, x, TRUE); + smart_erase_block_if_empty(dev, x, true); } #ifdef CONFIG_SMART_LOCAL_CHECKFREE @@ -3067,7 +3075,7 @@ static crc_t smart_calc_sector_crc(FAR struct smart_struct_s *dev) /* Add status and seq to the CRC calculation */ - crc = crc16part((uint8_t *) + crc = crc16part((FAR uint8_t *) &dev->rwbuffer[offsetof(struct smart_sect_header_s, status)], 2, crc); #elif defined(CONFIG_SMART_CRC_32) @@ -3080,7 +3088,7 @@ static crc_t smart_calc_sector_crc(FAR struct smart_struct_s *dev) /* Add logical sector number, status and seq to the CRC calculation */ - crc = crc32part((FAR uint8_t *) dev->rwbuffer, 6, crc); + crc = crc32part((FAR uint8_t *)dev->rwbuffer, 6, crc); #else #error "Unknown CRC size!" #endif @@ -3160,7 +3168,7 @@ static inline int smart_llformat(FAR struct smart_struct_s *dev, /* Now construct a logical sector zero header to write to the device. */ - sectorheader = (FAR struct smart_sect_header_s *) dev->rwbuffer; + sectorheader = (FAR struct smart_sect_header_s *)dev->rwbuffer; memset(dev->rwbuffer, CONFIG_SMARTFS_ERASEDSTATE, dev->sectorsize); #if SMART_STATUS_VERSION == 1 @@ -3171,7 +3179,7 @@ static inline int smart_llformat(FAR struct smart_struct_s *dev, #else /* CRC not enabled. Using a 16-bit sequence number */ - *((FAR uint16_t *) §orheader->seq) = 0; + *((FAR uint16_t *)§orheader->seq) = 0; #endif #else /* SMART_STATUS_VERSION == 1 */ sectorheader->seq = 0; @@ -3218,20 +3226,20 @@ static inline int smart_llformat(FAR struct smart_struct_s *dev, /* Record the number of root directory entries we have */ - dev->rwbuffer[SMART_FMT_ROOTDIRS_POS] = (uint8_t) (arg & 0xff); + dev->rwbuffer[SMART_FMT_ROOTDIRS_POS] = (uint8_t)(arg & 0xff); #ifdef CONFIG_SMART_CRC_8 sectorheader->crc8 = smart_calc_sector_crc(dev); #elif defined(CONFIG_SMART_CRC_16) - *((uint16_t *) sectorheader->crc16) = smart_calc_sector_crc(dev); + *((uint16_t *)sectorheader->crc16) = smart_calc_sector_crc(dev); #elif defined(CONFIG_SMART_CRC_32) - *((uint32_t *) sectorheader->crc32) = smart_calc_sector_crc(dev); + *((FAR uint32_t *)sectorheader->crc32) = smart_calc_sector_crc(dev); #endif /* Write the sector to the flash */ wrcount = MTD_BWRITE(dev->mtd, 0, dev->mtdblkspersector, - (FAR uint8_t *) dev->rwbuffer); + (FAR uint8_t *)dev->rwbuffer); if (wrcount != dev->mtdblkspersector) { /* The block is not empty!! What to do? */ @@ -3335,7 +3343,7 @@ static int smart_relocate_sector(FAR struct smart_struct_s *dev, uint8_t newstatus; int ret; - header = (FAR struct smart_sect_header_s *) dev->rwbuffer; + header = (FAR struct smart_sect_header_s *)dev->rwbuffer; /* Increment the sequence number and clear the "commit" flag */ @@ -3357,10 +3365,10 @@ static int smart_relocate_sector(FAR struct smart_struct_s *dev, { /* Using 16-bit sequence and no CRC */ - (*((FAR uint16_t *) &header->seq))++; - if (*((FAR uint16_t *) &header->seq) == 0xffff) + (*((FAR uint16_t *)&header->seq))++; + if (*((FAR uint16_t *)&header->seq) == 0xffff) { - *((FAR uint16_t *) &header->seq) = 1; + *((FAR uint16_t *)&header->seq) = 1; } } #endif @@ -3385,15 +3393,15 @@ static int smart_relocate_sector(FAR struct smart_struct_s *dev, #ifdef CONFIG_SMART_CRC_8 header->crc8 = smart_calc_sector_crc(dev); #elif defined(CONFIG_SMART_CRC_16) - *((uint16_t *) header->crc16) = smart_calc_sector_crc(dev); + *((uint16_t *)header->crc16) = smart_calc_sector_crc(dev); #elif defined(CONFIG_SMART_CRC_32) - *((uint32_t *) header->crc32) = smart_calc_sector_crc(dev); + *((FAR uint32_t *)header->crc32) = smart_calc_sector_crc(dev); #endif /* Write the data to the new physical sector location */ ret = MTD_BWRITE(dev->mtd, newsector * dev->mtdblkspersector, - dev->mtdblkspersector, (FAR uint8_t *) dev->rwbuffer); + dev->mtdblkspersector, (FAR uint8_t *)dev->rwbuffer); if (ret != dev->mtdblkspersector) { ferr("Error writing to new sector %d\n", newsector); @@ -3411,7 +3419,7 @@ static int smart_relocate_sector(FAR struct smart_struct_s *dev, /* Write the data to the new physical sector location */ ret = MTD_BWRITE(dev->mtd, newsector * dev->mtdblkspersector, - dev->mtdblkspersector, (FAR uint8_t *) dev->rwbuffer); + dev->mtdblkspersector, (FAR uint8_t *)dev->rwbuffer); if (ret != dev->mtdblkspersector) { ferr("Error writing to new sector %d\n", newsector); @@ -3487,7 +3495,7 @@ static int smart_relocate_block(FAR struct smart_struct_s *dev, * try to move sectors into the block we are trying to erase. */ - header = (FAR struct smart_sect_header_s *) dev->rwbuffer; + header = (FAR struct smart_sect_header_s *)dev->rwbuffer; #ifdef CONFIG_SMART_LOCAL_CHECKFREE if (smart_checkfree(dev, __LINE__) != OK) @@ -3538,7 +3546,7 @@ static int smart_relocate_block(FAR struct smart_struct_s *dev, /* Read the next sector from this erase block */ ret = MTD_BREAD(dev->mtd, x * dev->mtdblkspersector, - dev->mtdblkspersector, (FAR uint8_t *) dev->rwbuffer); + dev->mtdblkspersector, (FAR uint8_t *)dev->rwbuffer); if (ret != dev->mtdblkspersector) { ferr("ERROR: Error reading sector %d\n", x); @@ -3556,7 +3564,10 @@ static int smart_relocate_block(FAR struct smart_struct_s *dev, while (allocsector) { if (allocsector->physical == x) - break; + { + break; + } + allocsector = allocsector->next; } @@ -3567,7 +3578,7 @@ static int smart_relocate_block(FAR struct smart_struct_s *dev, if (allocsector) { - newsector = smart_findfreephyssector(dev, FALSE); + newsector = smart_findfreephyssector(dev, false); if (newsector == 0xffff) { /* Unable to find a free sector!!! */ @@ -3580,7 +3591,7 @@ static int smart_relocate_block(FAR struct smart_struct_s *dev, /* Update the temporary allocation's physical sector */ allocsector->physical = newsector; - *((FAR uint16_t *) header->logicalsector) = allocsector->logical; + *((FAR uint16_t *)header->logicalsector) = allocsector->logical; } else #endif @@ -3599,7 +3610,7 @@ static int smart_relocate_block(FAR struct smart_struct_s *dev, /* Find a new sector where it can live, NOT in this erase block */ - newsector = smart_findfreephyssector(dev, FALSE); + newsector = smart_findfreephyssector(dev, false); if (newsector == 0xffff) { /* Unable to find a free sector!!! */ @@ -3620,9 +3631,9 @@ static int smart_relocate_block(FAR struct smart_struct_s *dev, /* Update the variables */ #ifndef CONFIG_MTD_SMART_MINIMIZE_RAM - dev->smap[*((FAR uint16_t *) header->logicalsector)] = newsector; + dev->smap[*((FAR uint16_t *)header->logicalsector)] = newsector; #else - smart_update_cache(dev, *((FAR uint16_t *) header->logicalsector), + smart_update_cache(dev, *((FAR uint16_t *)header->logicalsector), newsector); #endif @@ -3726,7 +3737,7 @@ errout: ****************************************************************************/ static int smart_findfreephyssector(FAR struct smart_struct_s *dev, - uint8_t canrelocate) + bool canrelocate) { uint16_t count; uint16_t allocfreecount; @@ -3863,7 +3874,7 @@ retry: { /* Disable relocate for retry */ - canrelocate = FALSE; + canrelocate = false; goto retry; } } @@ -3950,7 +3961,7 @@ retry: readaddr = i * dev->mtdblkspersector * dev->geo.blocksize; ret = MTD_READ(dev->mtd, readaddr, sizeof(struct smart_sect_header_s), - (FAR uint8_t *) &header); + (FAR uint8_t *)&header); if (ret != sizeof(struct smart_sect_header_s)) { ferr("ERROR: Error reading phys sector %d\n", physicalsector); @@ -4014,7 +4025,7 @@ static int smart_garbagecollect(FAR struct smart_struct_s *dev) { uint16_t collectblock; uint16_t releasemax; - bool collect = TRUE; + bool collect = true; int x; int ret; #ifdef CONFIG_MTD_SMART_PACK_COUNTS @@ -4023,23 +4034,23 @@ static int smart_garbagecollect(FAR struct smart_struct_s *dev) while (collect) { - collect = FALSE; + collect = false; /* Test if the released sectors count is greater than the * free sectors. If it is, then we will do garbage collection. */ - if (dev->releasesectors > dev->freesectors && dev->freesectors < - (dev->totalsectors >> 5)) + if (dev->releasesectors > dev->freesectors && + dev->freesectors < (dev->totalsectors >> 5)) { - collect = TRUE; + collect = true; } /* Test if we have more reached our reserved free sector limit */ if (dev->freesectors <= (dev->sectorsperblk << 0) + 4) { - collect = TRUE; + collect = true; } /* Test if we need to garbage collect */ @@ -4160,7 +4171,7 @@ static int smart_write_wearstatus(struct smart_struct_s *dev) #if defined(CONFIG_FS_PROCFS) && !defined(CONFIG_FS_PROCFS_EXCLUDE_SMARTFS) if (dev->blockerases > 0) { - *((uint32_t *) buffer) = dev->blockerases; + *((FAR uint32_t *)buffer) = dev->blockerases; write_buffer = 1; } #endif @@ -4169,7 +4180,7 @@ static int smart_write_wearstatus(struct smart_struct_s *dev) if (dev->uneven_wearcount != 0) { - *((uint32_t *) &buffer[4]) = dev->uneven_wearcount; + *((FAR uint32_t *)&buffer[4]) = dev->uneven_wearcount; write_buffer = 1; } @@ -4184,7 +4195,7 @@ static int smart_write_wearstatus(struct smart_struct_s *dev) req.count = sizeof(buffer); req.buffer = buffer; - ret = smart_writesector(dev, (unsigned long) &req); + ret = smart_writesector(dev, (unsigned long)&req); if (ret != OK) { goto errout; @@ -4218,7 +4229,7 @@ static int smart_write_wearstatus(struct smart_struct_s *dev) /* Write the sector */ - ret = smart_writesector(dev, (unsigned long) &req); + ret = smart_writesector(dev, (unsigned long)&req); if (ret != OK) { goto errout; @@ -4282,7 +4293,7 @@ static inline int smart_read_wearstatus(FAR struct smart_struct_s *dev) req.count = sizeof(buffer); req.buffer = buffer; - ret = smart_readsector(dev, (unsigned long) &req); + ret = smart_readsector(dev, (unsigned long)&req); if (ret != sizeof(buffer)) { goto errout; @@ -4290,7 +4301,7 @@ static inline int smart_read_wearstatus(FAR struct smart_struct_s *dev) /* Get the uneven wearcount value */ - dev->uneven_wearcount = *((uint32_t *) &buffer[4]); + dev->uneven_wearcount = *((FAR uint32_t *)&buffer[4]); /* Check for erased state */ @@ -4304,7 +4315,7 @@ static inline int smart_read_wearstatus(FAR struct smart_struct_s *dev) #if defined(CONFIG_FS_PROCFS) && !defined(CONFIG_FS_PROCFS_EXCLUDE_SMARTFS) /* Get the block erases count */ - dev->blockerases = *((uint32_t *) buffer); + dev->blockerases = *((FAR uint32_t *)buffer); #if ( CONFIG_SMARTFS_ERASEDSTATE == 0xff ) if (dev->blockerases == 0xffffffff) { @@ -4361,7 +4372,7 @@ static inline int smart_read_wearstatus(FAR struct smart_struct_s *dev) /* Read the sector */ - ret = smart_readsector(dev, (unsigned long) &req); + ret = smart_readsector(dev, (unsigned long)&req); if (ret != toread) { goto errout; @@ -4417,14 +4428,14 @@ errout: ****************************************************************************/ static int smart_write_alloc_sector(FAR struct smart_struct_s *dev, - uint16_t logical, uint16_t physical) + uint16_t logical, uint16_t physical) { int ret = 1; uint8_t sectsize; FAR struct smart_sect_header_s *header; memset(dev->rwbuffer, CONFIG_SMARTFS_ERASEDSTATE, dev->sectorsize); - header = (FAR struct smart_sect_header_s *) dev->rwbuffer; + header = (FAR struct smart_sect_header_s *)dev->rwbuffer; *((FAR uint16_t *) header->logicalsector) = logical; #if SMART_STATUS_VERSION == 1 #ifdef CONFIG_MTD_SMART_ENABLE_CRC @@ -4469,7 +4480,7 @@ static int smart_write_alloc_sector(FAR struct smart_struct_s *dev, #ifndef CONFIG_MTD_SMART_ENABLE_CRC finfo("Write MTD block %d\n", physical * dev->mtdblkspersector); ret = MTD_BWRITE(dev->mtd, physical * dev->mtdblkspersector, 1, - (FAR uint8_t *) dev->rwbuffer); + (FAR uint8_t *) dev->rwbuffer); if (ret != 1) { /* The block is not empty!! What to do? */ @@ -4504,7 +4515,7 @@ static int smart_validate_crc(FAR struct smart_struct_s *dev) /* Calculate CRC on data region of the sector */ crc = smart_calc_sector_crc(dev); - header = (FAR struct smart_sect_header_s *) dev->rwbuffer; + header = (FAR struct smart_sect_header_s *)dev->rwbuffer; #ifdef CONFIG_SMART_CRC_8 @@ -4519,14 +4530,14 @@ static int smart_validate_crc(FAR struct smart_struct_s *dev) /* Test 16-bit CRC */ - if (crc != *((uint16_t *) header->crc16)) + if (crc != *((uint16_t *)header->crc16)) { return -EIO; } #elif defined(CONFIG_SMART_CRC_32) - if (crc != *((uint32_t *) header->crc32)) + if (crc != *((FAR uint32_t *)header->crc32)) { return -EIO; } @@ -4551,10 +4562,10 @@ static int smart_validate_crc(FAR struct smart_struct_s *dev) ****************************************************************************/ static int smart_writesector(FAR struct smart_struct_s *dev, - unsigned long arg) + unsigned long arg) { int ret; - bool needsrelocate = FALSE; + bool needsrelocate = false; uint32_t mtdblock; uint16_t physsector; uint16_t oldphyssector; @@ -4571,7 +4582,7 @@ static int smart_writesector(FAR struct smart_struct_s *dev, #endif finfo("Entry\n"); - req = (FAR struct smart_read_write_s *) arg; + req = (FAR struct smart_read_write_s *)arg; DEBUGASSERT(req->offset <= dev->sectorsize); DEBUGASSERT(req->offset + req->count <= dev->sectorsize); @@ -4630,8 +4641,8 @@ static int smart_writesector(FAR struct smart_struct_s *dev, /* Read the sector data into our buffer */ mtdblock = physsector * dev->mtdblkspersector; - ret = MTD_BREAD(dev->mtd, mtdblock, dev->mtdblkspersector, (FAR uint8_t *) - dev->rwbuffer); + ret = MTD_BREAD(dev->mtd, mtdblock, dev->mtdblkspersector, + (FAR uint8_t *)dev->rwbuffer); if (ret != dev->mtdblkspersector) { ferr("ERROR: Error reading phys sector %d\n", physsector); @@ -4662,7 +4673,7 @@ static int smart_writesector(FAR struct smart_struct_s *dev, if (!allocsector) { - needsrelocate = TRUE; + needsrelocate = true; } #else @@ -4680,13 +4691,13 @@ static int smart_writesector(FAR struct smart_struct_s *dev, #if CONFIG_SMARTFS_ERASEDSTATE == 0xff if (((byte ^ req->buffer[x]) | byte) != byte) { - needsrelocate = TRUE; + needsrelocate = true; break; } #else if (((byte ^ req->buffer[x]) | req->buffer[x]) != req->buffer[x]) { - needsrelocate = TRUE; + needsrelocate = true; break; } #endif @@ -4704,7 +4715,7 @@ static int smart_writesector(FAR struct smart_struct_s *dev, /* Find a new physical sector to save data to */ oldphyssector = physsector; - physsector = smart_findfreephyssector(dev, FALSE); + physsector = smart_findfreephyssector(dev, false); if (physsector == 0xffff) { ferr("ERROR: Error relocating sector %d\n", req->logsector); @@ -4728,9 +4739,11 @@ static int smart_writesector(FAR struct smart_struct_s *dev, } else { - (*((FAR uint16_t *) &header->seq))++; - if (*((FAR uint16_t *) &header->seq) == 0xffff) - *((FAR uint16_t *) &header->seq) = 1; + (*((FAR uint16_t *)&header->seq))++; + if (*((FAR uint16_t *)&header->seq) == 0xffff) + { + *((FAR uint16_t *)&header->seq) = 1; + } } #else header->seq++; @@ -4790,7 +4803,7 @@ static int smart_writesector(FAR struct smart_struct_s *dev, /* Now copy the data to the sector buffer. */ memcpy(&dev->rwbuffer[sizeof(struct smart_sect_header_s) + req->offset], - req->buffer, req->count); + req->buffer, req->count); /* Commit the sector ahead of time. The CRC will protect us */ @@ -4805,9 +4818,9 @@ static int smart_writesector(FAR struct smart_struct_s *dev, #ifdef CONFIG_SMART_CRC_8 header->crc8 = smart_calc_sector_crc(dev); #elif defined(CONFIG_SMART_CRC_16) - *((uint16_t *) header->crc16) = smart_calc_sector_crc(dev); + *((uint16_t *)header->crc16) = smart_calc_sector_crc(dev); #elif defined(CONFIG_SMART_CRC_32) - *((uint32_t *) header->crc32) = smart_calc_sector_crc(dev); + *((FAR uint32_t *)header->crc32) = smart_calc_sector_crc(dev); #endif #else /* CONFIG_MTD_SMART_ENABLE_CRC */ @@ -4826,7 +4839,7 @@ static int smart_writesector(FAR struct smart_struct_s *dev, /* Write the entire sector to the new physical location, uncommitted. */ ret = MTD_BWRITE(dev->mtd, physsector * dev->mtdblkspersector, - dev->mtdblkspersector, (FAR uint8_t *) dev->rwbuffer); + dev->mtdblkspersector, (FAR uint8_t *)dev->rwbuffer); if (ret != dev->mtdblkspersector) { ferr("ERROR: Error writing to physical sector %d\n", physsector); @@ -4899,7 +4912,7 @@ static int smart_writesector(FAR struct smart_struct_s *dev, /* Test if releasing the sector created an empty erase block */ - smart_erase_block_if_empty(dev, block, FALSE); + smart_erase_block_if_empty(dev, block, false); /* Since we performed a relocation, do garbage collection to * ensure we don't fill up our flash with released blocks. @@ -4913,7 +4926,7 @@ static int smart_writesector(FAR struct smart_struct_s *dev, /* Write the entire sector to FLASH when CRC enabled */ ret = MTD_BWRITE(dev->mtd, physsector * dev->mtdblkspersector, - dev->mtdblkspersector, (FAR uint8_t *) dev->rwbuffer); + dev->mtdblkspersector, (FAR uint8_t *)dev->rwbuffer); if (ret != dev->mtdblkspersector) { ferr("ERROR: Error writing to physical sector %d\n", physsector); @@ -4924,7 +4937,7 @@ static int smart_writesector(FAR struct smart_struct_s *dev, /* Read the sector back and validate the CRC. */ ret = MTD_BREAD(dev->mtd, physsector * dev->mtdblkspersector, - dev->mtdblkspersector, (FAR uint8_t *) dev->rwbuffer); + dev->mtdblkspersector, (FAR uint8_t *)dev->rwbuffer); if (ret == dev->mtdblkspersector) { /* Validate the CRC of the read-back data */ @@ -4966,7 +4979,7 @@ errout: ****************************************************************************/ static int smart_readsector(FAR struct smart_struct_s *dev, - unsigned long arg) + unsigned long arg) { int ret; uint16_t physsector; @@ -4982,7 +4995,7 @@ static int smart_readsector(FAR struct smart_struct_s *dev, finfo("Entry\n"); - req = (FAR struct smart_read_write_s *) arg; + req = (FAR struct smart_read_write_s *)arg; DEBUGASSERT(req->offset < dev->sectorsize); DEBUGASSERT(req->offset + req->count + sizeof(struct smart_sect_header_s) <= dev->sectorsize); @@ -5014,7 +5027,7 @@ static int smart_readsector(FAR struct smart_struct_s *dev, */ ret = MTD_BREAD(dev->mtd, physsector * dev->mtdblkspersector, - dev->mtdblkspersector, (FAR uint8_t *) dev->rwbuffer); + dev->mtdblkspersector, (FAR uint8_t *)dev->rwbuffer); if (ret != dev->mtdblkspersector) { /* TODO: Mark the block bad */ @@ -5026,7 +5039,7 @@ static int smart_readsector(FAR struct smart_struct_s *dev, #if SMART_STATUS_VERSION == 1 /* Test if this sector has CRC enabled or not */ - header = (FAR struct smart_sect_header_s *) dev->rwbuffer; + header = (FAR struct smart_sect_header_s *)dev->rwbuffer; if ((header->status & SMART_STATUS_CRC) == (CONFIG_SMARTFS_ERASEDSTATE & SMART_STATUS_CRC)) { @@ -5052,7 +5065,7 @@ static int smart_readsector(FAR struct smart_struct_s *dev, /* Copy data to the output buffer */ - memmove((FAR char *) req->buffer, &dev->rwbuffer[req->offset + + memmove((FAR char *)req->buffer, &dev->rwbuffer[req->offset + sizeof(struct smart_sect_header_s)], req->count); ret = req->count; @@ -5071,7 +5084,7 @@ static int smart_readsector(FAR struct smart_struct_s *dev, /* Do a sanity check on the header data */ - if (((*(FAR uint16_t *) header.logicalsector) != req->logsector) || + if (((*(FAR uint16_t *)header.logicalsector) != req->logsector) || ((header.status & SMART_STATUS_COMMITTED) == (CONFIG_SMARTFS_ERASEDSTATE & SMART_STATUS_COMMITTED))) { @@ -5088,8 +5101,8 @@ static int smart_readsector(FAR struct smart_struct_s *dev, dev->geo.blocksize + req->offset + sizeof(struct smart_sect_header_s); - ret = MTD_READ(dev->mtd, readaddr, req->count, (FAR uint8_t *) - req->buffer); + ret = MTD_READ(dev->mtd, readaddr, req->count, + (FAR uint8_t *)req->buffer); if (ret != req->count) { ferr("ERROR: Error reading phys sector %d\n", physsector); @@ -5109,7 +5122,7 @@ static int smart_readsector(FAR struct smart_struct_s *dev, ****************************************************************************/ static inline int smart_allocsector(FAR struct smart_struct_s *dev, - unsigned long requested) + unsigned long requested) { uint16_t logsector = 0xffff; /* Logical sector number selected */ uint16_t physicalsector; /* The selected physical sector */ @@ -5257,7 +5270,7 @@ static inline int smart_allocsector(FAR struct smart_struct_s *dev, */ ferr("ERROR: No free logical sector numbers! Free sectors = %d\n", - dev->freesectors); + dev->freesectors); return -EIO; } @@ -5273,10 +5286,10 @@ static inline int smart_allocsector(FAR struct smart_struct_s *dev, /* Find a free physical sector */ - physicalsector = smart_findfreephyssector(dev, FALSE); + physicalsector = smart_findfreephyssector(dev, false); finfo("Alloc: log=%d, phys=%d, erase block=%d, free=%d, released=%d\n", - logsector, physicalsector, physicalsector / - dev->sectorsperblk, dev->freesectors, dev->releasesectors); + logsector, physicalsector, physicalsector / + dev->sectorsperblk, dev->freesectors, dev->releasesectors); if (physicalsector == 0xffff) { @@ -5358,7 +5371,7 @@ static inline int smart_allocsector(FAR struct smart_struct_s *dev, ****************************************************************************/ static inline int smart_freesector(FAR struct smart_struct_s *dev, - unsigned long logicalsector) + unsigned long logicalsector) { int ret; int readaddr; @@ -5396,7 +5409,7 @@ static inline int smart_freesector(FAR struct smart_struct_s *dev, #endif readaddr = physsector * dev->mtdblkspersector * dev->geo.blocksize; ret = MTD_READ(dev->mtd, readaddr, sizeof(struct smart_sect_header_s), - (FAR uint8_t *) &header); + (FAR uint8_t *)&header); if (ret != sizeof(struct smart_sect_header_s)) { goto errout; @@ -5404,7 +5417,7 @@ static inline int smart_freesector(FAR struct smart_struct_s *dev, /* Do a sanity check on the logical sector number */ - if (*((FAR uint16_t *) header.logicalsector) != (uint16_t) logicalsector) + if (*((FAR uint16_t *)header.logicalsector) != (uint16_t)logicalsector) { /* Hmmm... something is wrong. This should always match! Bug in our * code? @@ -5447,7 +5460,7 @@ static inline int smart_freesector(FAR struct smart_struct_s *dev, /* Unmap this logical sector */ #ifndef CONFIG_MTD_SMART_MINIMIZE_RAM - dev->smap[logicalsector] = (uint16_t) -1; + dev->smap[logicalsector] = (uint16_t)-1; #else dev->sbitmap[logicalsector >> 3] &= ~(1 << (logicalsector & 0x07)); smart_update_cache(dev, logicalsector, 0xffff); @@ -5455,7 +5468,7 @@ static inline int smart_freesector(FAR struct smart_struct_s *dev, /* If this block has only released blocks, then erase it */ - smart_erase_block_if_empty(dev, block, FALSE); + smart_erase_block_if_empty(dev, block, false); ret = OK; errout: @@ -5498,11 +5511,11 @@ static int smart_ioctl(FAR struct inode *inode, int cmd, unsigned long arg) /* Return the format information for the device */ #ifdef CONFIG_SMARTFS_MULTI_ROOT_DIRS - ret = smart_getformat(dev, (FAR struct smart_format_s *) arg, + ret = smart_getformat(dev, (FAR struct smart_format_s *)arg, ((FAR struct smart_multiroot_device_s *) inode->i_private)->rootdirnum); #else - ret = smart_getformat(dev, (FAR struct smart_format_s *) arg); + ret = smart_getformat(dev, (FAR struct smart_format_s *)arg); #endif goto ok_out; @@ -5526,7 +5539,7 @@ static int smart_ioctl(FAR struct inode *inode, int cmd, unsigned long arg) if (arg < 3) { - arg = (unsigned long) -1; + arg = (unsigned long)-1; } /* Allocate a logical sector for the upper layer file system */ @@ -5599,7 +5612,7 @@ static int smart_ioctl(FAR struct inode *inode, int cmd, unsigned long arg) case BIOC_DEBUGCMD: #if defined(CONFIG_FS_PROCFS) && !defined(CONFIG_FS_PROCFS_EXCLUDE_SMARTFS) - debug_data = (FAR struct mtd_smart_debug_data_s *) arg; + debug_data = (FAR struct mtd_smart_debug_data_s *)arg; switch (debug_data->debugcmd) { case SMART_DEBUG_CMD_SET_DEBUG_LEVEL: @@ -5729,7 +5742,7 @@ static int smart_fsck_file(FAR struct smart_struct_s *dev, size = MTD_READ(dev->mtd, readaddress, sizeof(struct smart_sect_header_s) + sizeof(struct smart_chain_header_s), - (uint8_t *)dev->rwbuffer); + (FAR uint8_t *)dev->rwbuffer); if (size != (sizeof(struct smart_sect_header_s) + sizeof(struct smart_chain_header_s))) { @@ -5738,9 +5751,9 @@ static int smart_fsck_file(FAR struct smart_struct_s *dev, break; } - header = (struct smart_sect_header_s *) & dev->rwbuffer[0]; - chain = (struct smart_chain_header_s *) & - dev->rwbuffer[sizeof(struct smart_sect_header_s)]; + header = (FAR struct smart_sect_header_s *)&dev->rwbuffer[0]; + chain = (FAR struct smart_chain_header_s *) + &dev->rwbuffer[sizeof(struct smart_sect_header_s)]; /* Test if the sector has live data (not free or not released) */ @@ -5854,12 +5867,12 @@ static int smart_fsck_directory(FAR struct smart_struct_s *dev, goto errout; } - header = (struct smart_sect_header_s *) & rwbuffer[0]; - chain = (struct smart_chain_header_s *) & - rwbuffer[sizeof(struct smart_sect_header_s)]; - entry = (struct smart_entry_header_s *) & - rwbuffer[sizeof(struct smart_sect_header_s) + - sizeof(struct smart_chain_header_s)]; + header = (FAR struct smart_sect_header_s *)&rwbuffer[0]; + chain = (FAR struct smart_chain_header_s *) + &rwbuffer[sizeof(struct smart_sect_header_s)]; + entry = (FAR struct smart_entry_header_s *) + &rwbuffer[sizeof(struct smart_sect_header_s) + + sizeof(struct smart_chain_header_s)]; #ifdef CONFIG_MTD_SMART_FSCK_ENABLE_CRC /* Check CRC */ @@ -5926,7 +5939,7 @@ static int smart_fsck_directory(FAR struct smart_struct_s *dev, { ret = OK; - entry = (struct smart_entry_header_s *)cur; + entry = (FAR struct smart_entry_header_s *)cur; if (entry->flags == 0xffff) { @@ -5937,7 +5950,7 @@ static int smart_fsck_directory(FAR struct smart_struct_s *dev, #ifdef CONFIG_DEBUG_FS_INFO strlcpy(entryname, - (const char *) (cur + sizeof(struct smart_entry_header_s)), + (FAR const char *)(cur + sizeof(struct smart_entry_header_s)), sizeof(entryname)); finfo("Check entry (name=%s flags=%02x logsector=%02x)\n", entryname, entry->flags, entry->firstsector); @@ -5998,7 +6011,7 @@ static int smart_fsck_directory(FAR struct smart_struct_s *dev, if (relocate) { - newsector = smart_findfreephyssector(dev, FALSE); + newsector = smart_findfreephyssector(dev, false); if (newsector == 0xffff) { ret = -ENOSPC; diff --git a/drivers/mtd/w25.c b/drivers/mtd/w25.c index 8e1d8ffecc..fd0df35015 100644 --- a/drivers/mtd/w25.c +++ b/drivers/mtd/w25.c @@ -652,7 +652,7 @@ static bool w25_is_erased(struct w25_dev_s *priv, off_t address, off_t size) { /* Check if all bytes of page is in erased state. */ - w25_byteread(priv, (unsigned char *)buf, address, W25_PAGE_SIZE); + w25_byteread(priv, (FAR unsigned char *)buf, address, W25_PAGE_SIZE); for (i = 0; i < W25_PAGE_SIZE / sizeof(uint32_t); i++) { diff --git a/drivers/mtd/w25qxxxjv.c b/drivers/mtd/w25qxxxjv.c index 5c14e482d2..1eb25a80d7 100644 --- a/drivers/mtd/w25qxxxjv.c +++ b/drivers/mtd/w25qxxxjv.c @@ -392,11 +392,11 @@ static int w25qxxxjv_get_die_from_addr(FAR struct w25qxxxjv_dev_s *priv, off_t addr); static int w25qxxxjv_readid(FAR struct w25qxxxjv_dev_s *priv); static int w25qxxxjv_protect(FAR struct w25qxxxjv_dev_s *priv, - off_t startblock, size_t nblocks); + off_t startblock, size_t nblocks); static int w25qxxxjv_unprotect(FAR struct w25qxxxjv_dev_s *priv, - off_t startblock, size_t nblocks); + off_t startblock, size_t nblocks); static bool w25qxxxjv_isprotected(FAR struct w25qxxxjv_dev_s *priv, - uint8_t status, off_t address); + uint8_t status, off_t address); static int w25qxxxjv_erase_sector(FAR struct w25qxxxjv_dev_s *priv, off_t offset); static int w25qxxxjv_erase_chip(FAR struct w25qxxxjv_dev_s *priv); @@ -1098,7 +1098,7 @@ static int w25qxxxjv_write_page(FAR struct w25qxxxjv_dev_s *priv, /* Set up varying parts of the transfer description */ meminfo.addr = address; - meminfo.buffer = (void *)buffer; + meminfo.buffer = (FAR void *)buffer; /* Write one page */ diff --git a/drivers/net/ftmac100.c b/drivers/net/ftmac100.c index a00c781292..f209a5f98d 100644 --- a/drivers/net/ftmac100.c +++ b/drivers/net/ftmac100.c @@ -135,8 +135,8 @@ #define INT_MASK_ALL_DISABLED 0 -#define putreg32(v, x) (*(volatile uint32_t*)(x) = (v)) -#define getreg32(x) (*(uint32_t *)(x)) +#define putreg32(v, x) (*(FAR volatile uint32_t*)(x) = (v)) +#define getreg32(x) (*(FAR volatile uint32_t *)(x)) /**************************************************************************** * Private Types @@ -190,7 +190,7 @@ static struct ftmac100_driver_s g_ftmac100[CONFIG_FTMAC100_NINTERFACES] /* Common TX logic */ static int ftmac100_transmit(FAR struct ftmac100_driver_s *priv); -static int ftmac100_txpoll(struct net_driver_s *dev); +static int ftmac100_txpoll(FAR struct net_driver_s *dev); /* Interrupt handling */ @@ -337,7 +337,7 @@ static int ftmac100_transmit(FAR struct ftmac100_driver_s *priv) * ****************************************************************************/ -static int ftmac100_txpoll(struct net_driver_s *dev) +static int ftmac100_txpoll(FAR struct net_driver_s *dev) { FAR struct ftmac100_driver_s *priv = (FAR struct ftmac100_driver_s *)dev->d_private; @@ -620,7 +620,7 @@ static void ftmac100_receive(FAR struct ftmac100_driver_s *priv) } len = FTMAC100_RXDES0_RFL(rxdes->rxdes0); - data = (uint8_t *)rxdes->rxdes2; + data = (FAR uint8_t *)rxdes->rxdes2; ninfo ("RX buffer %d (%08x), %x received (%d)\n", priv->rx_pointer, data, len, diff --git a/drivers/net/ksz9477.c b/drivers/net/ksz9477.c index b7c2a5101d..7915dd8963 100644 --- a/drivers/net/ksz9477.c +++ b/drivers/net/ksz9477.c @@ -368,7 +368,7 @@ int ksz9477_init(ksz9477_port_t master_port) /* Check that the SGMII block is alive and indirect accesses work */ ret = ksz9477_sgmii_read_indirect(KSZ9477_SGMII_ID1, - (uint16_t *)®val32, 2); + (FAR uint16_t *)®val32, 2); if (ret != OK || regval32 != SGMII_PHY_ID) { nerr("SGMII port access failure, id %x, ret %d\n", regval32, ret); diff --git a/drivers/net/ksz9477_i2c.c b/drivers/net/ksz9477_i2c.c index 35618d826c..beb5aaab38 100644 --- a/drivers/net/ksz9477_i2c.c +++ b/drivers/net/ksz9477_i2c.c @@ -32,13 +32,13 @@ * Private Data ****************************************************************************/ -static struct i2c_master_s *g_ksz9477_i2c_bus; +static FAR struct i2c_master_s *g_ksz9477_i2c_bus; /**************************************************************************** * Private Functions ****************************************************************************/ -static void setup_i2c_transfer(struct i2c_msg_s *msg, uint8_t *data, +static void setup_i2c_transfer(FAR struct i2c_msg_s *msg, uint8_t *data, size_t len, bool read) { msg[0].frequency = KSZ9477_I2C_SPEED; @@ -52,30 +52,30 @@ static void setup_i2c_transfer(struct i2c_msg_s *msg, uint8_t *data, * Public Functions ****************************************************************************/ -int ksz9477_read(struct ksz9477_transfer_s *read_msg) +int ksz9477_read(FAR struct ksz9477_transfer_s *read_msg) { struct i2c_msg_s msg[2]; /* Set up to write the address */ - setup_i2c_transfer(&msg[0], (uint8_t *)&read_msg->reg, + setup_i2c_transfer(&msg[0], (FAR uint8_t *)&read_msg->reg, sizeof(read_msg->reg), false); /* Followed by the read data */ - setup_i2c_transfer(&msg[1], (uint8_t *)&read_msg->data, + setup_i2c_transfer(&msg[1], (FAR uint8_t *)&read_msg->data, read_msg->len - sizeof(read_msg->reg), true); return I2C_TRANSFER(g_ksz9477_i2c_bus, msg, 2); } -int ksz9477_write(struct ksz9477_transfer_s *write_msg) +int ksz9477_write(FAR struct ksz9477_transfer_s *write_msg) { struct i2c_msg_s msg; /* Set up to write the address and data */ - setup_i2c_transfer(&msg, (uint8_t *)&write_msg->reg, + setup_i2c_transfer(&msg, (FAR uint8_t *)&write_msg->reg, write_msg->len, false); return I2C_TRANSFER(g_ksz9477_i2c_bus, &msg, 1); @@ -95,7 +95,7 @@ int ksz9477_write(struct ksz9477_transfer_s *write_msg) * ****************************************************************************/ -int ksz9477_i2c_init(struct i2c_master_s *i2c_bus, +int ksz9477_i2c_init(FAR struct i2c_master_s *i2c_bus, ksz9477_port_t master_port) { if (!i2c_bus) diff --git a/drivers/net/lan91c111.c b/drivers/net/lan91c111.c index 293c22e140..629d8fd066 100644 --- a/drivers/net/lan91c111.c +++ b/drivers/net/lan91c111.c @@ -1263,7 +1263,7 @@ static int lan91c111_ioctl(FAR struct net_driver_s *dev, int cmd, unsigned long arg) { FAR struct lan91c111_driver_s *priv = dev->d_private; - struct mii_ioctl_data_s *req = (void *)arg; + FAR struct mii_ioctl_data_s *req = (FAR void *)arg; int ret = OK; net_lock(); diff --git a/drivers/net/lan9250.c b/drivers/net/lan9250.c index 37d9b15d46..43f7dfb304 100644 --- a/drivers/net/lan9250.c +++ b/drivers/net/lan9250.c @@ -973,7 +973,7 @@ static inline void lan9250_send_buffer(FAR struct lan9250_driver_s *priv, meminfo.cmd = LAN9250_SPI_WRITE; meminfo.addr = LAN9250_TXDFR; meminfo.addrlen = sizeof(uint16_t); - meminfo.buffer = (void *)buffer; + meminfo.buffer = (FAR void *)buffer; meminfo.buflen = LAN9250_ALIGN(buflen); meminfo.dummies = 0; meminfo.flags = QSPIMEM_WRITE; @@ -2029,7 +2029,7 @@ static int lan9250_interrupt(int irq, FAR void *context, FAR void *arg) priv->lower->disable(priv->lower); return work_queue(LAN9250_WORK, &priv->irq_work, lan9250_int_worker, - (void *)priv, 0); + (FAR void *)priv, 0); } /**************************************************************************** @@ -2438,7 +2438,7 @@ int lan9250_initialize( memset(priv, 0, sizeof(struct lan9250_driver_s)); - dev->d_buf = (uint8_t *)priv->pktbuf; + dev->d_buf = (FAR uint8_t *)priv->pktbuf; dev->d_ifup = lan9250_ifup; dev->d_ifdown = lan9250_ifdown; dev->d_txavail = lan9250_txavail; diff --git a/drivers/note/noteram_driver.c b/drivers/note/noteram_driver.c index 5c552c2d2e..22aa6ac6d3 100644 --- a/drivers/note/noteram_driver.c +++ b/drivers/note/noteram_driver.c @@ -498,7 +498,7 @@ static int noteram_ioctl(FAR struct file *filep, int cmd, unsigned long arg) } else { - *(unsigned int *)arg = drv->ni_overwrite; + *(FAR unsigned int *)arg = drv->ni_overwrite; ret = OK; } break; @@ -515,7 +515,7 @@ static int noteram_ioctl(FAR struct file *filep, int cmd, unsigned long arg) } else { - drv->ni_overwrite = *(unsigned int *)arg; + drv->ni_overwrite = *(FAR unsigned int *)arg; ret = OK; } break; @@ -624,7 +624,7 @@ static void noteram_dump_init_context(FAR struct noteram_dump_context_s *ctx) * Name: get_task_name ****************************************************************************/ -static const char *get_task_name(pid_t pid) +static FAR const char *get_task_name(pid_t pid) { FAR const char *taskname; diff --git a/drivers/pipes/pipe_common.h b/drivers/pipes/pipe_common.h index 77f0b42fcb..48512a32fa 100644 --- a/drivers/pipes/pipe_common.h +++ b/drivers/pipes/pipe_common.h @@ -134,7 +134,7 @@ struct pipe_dev_s * retained in the f_priv field of the 'struct file'. */ - struct pollfd *d_fds[CONFIG_DEV_PIPE_NPOLLWAITERS]; + FAR struct pollfd *d_fds[CONFIG_DEV_PIPE_NPOLLWAITERS]; }; /**************************************************************************** diff --git a/drivers/power/battery/bq769x0.c b/drivers/power/battery/bq769x0.c index d4e29545b3..afd412a1d0 100644 --- a/drivers/power/battery/bq769x0.c +++ b/drivers/power/battery/bq769x0.c @@ -635,7 +635,7 @@ static int bq769x0_updategain(FAR struct bq769x0_dev_s *priv) return ret; } - ret = bq769x0_getreg8(priv, BQ769X0_REG_ADCOFFSET, (uint8_t *)&offset); + ret = bq769x0_getreg8(priv, BQ769X0_REG_ADCOFFSET, (FAR uint8_t *)&offset); if (ret < 0) { baterr("ERROR: Error reading from BQ769X0! Error = %d\n", ret); @@ -1588,7 +1588,7 @@ static int bq769x0_getcurrent(FAR struct bq769x0_dev_s *priv, /* Get the CC register data (a signed value) */ ret = bq769x0_getreg16(priv, BQ769X0_REG_CC_HI, - (uint16_t *)&ccval); + (FAR uint16_t *)&ccval); if (ret < 0) { baterr("ERROR: Error reading from BQ769X0! Error = %d\n", ret); diff --git a/drivers/rc/lirc_dev.c b/drivers/rc/lirc_dev.c index 8a8764961a..b763e6737c 100644 --- a/drivers/rc/lirc_dev.c +++ b/drivers/rc/lirc_dev.c @@ -256,7 +256,7 @@ static int lirc_ioctl(FAR struct file *filep, int cmd, unsigned long arg) FAR struct lirc_fh_s *fh = filep->f_priv; FAR struct lirc_lowerhalf_s *lower = fh->lower; FAR struct lirc_upperhalf_s *upper = lower->priv; - FAR unsigned int *val = (unsigned int *)(uintptr_t)arg; + FAR unsigned int *val = (FAR unsigned int *)(uintptr_t)arg; int ret; ret = nxmutex_lock(&upper->lock); diff --git a/drivers/rptun/rptun.c b/drivers/rptun/rptun.c index 2ca3b601f8..4709d21d82 100644 --- a/drivers/rptun/rptun.c +++ b/drivers/rptun/rptun.c @@ -1011,7 +1011,7 @@ int rptun_initialize(FAR struct rptun_dev_s *dev) nxsem_init(&priv->semtx, 0, 0); nxsem_init(&priv->semrx, 0, 0); snprintf(arg1, sizeof(arg1), "0x%" PRIxPTR, (uintptr_t)priv); - argv[0] = (void *)RPTUN_GET_CPUNAME(dev); + argv[0] = (FAR void *)RPTUN_GET_CPUNAME(dev); argv[1] = arg1; argv[2] = NULL; diff --git a/drivers/sensors/adxl372.c b/drivers/sensors/adxl372.c index 95eb9d01ec..b7c0ee689f 100644 --- a/drivers/sensors/adxl372.c +++ b/drivers/sensors/adxl372.c @@ -565,7 +565,7 @@ static ssize_t adxl372_dvr_read(FAR void *instance, FAR char *buffer, DEBUGASSERT(priv != NULL); - adxl372_read_registerblk(priv, priv->seek_address, (uint8_t *)buffer, + adxl372_read_registerblk(priv, priv->seek_address, (FAR uint8_t *)buffer, buflen); /* Permute accelerometer data out fields */ @@ -602,7 +602,7 @@ static ssize_t adxl372_dvr_write(FAR void *instance, return -EROFS; } - adxl372_write_registerblk(priv, priv->seek_address, (uint8_t *)buffer, + adxl372_write_registerblk(priv, priv->seek_address, (FAR uint8_t *)buffer, buflen); return buflen; @@ -877,7 +877,7 @@ int adxl372_register(FAR const char *devpath, priv->flink = g_adxl372_list; g_adxl372_list = priv; - config->leaf_handle = (void *) priv; + config->leaf_handle = (FAR void *)priv; config->sc_ops = &g_adxl372_dops; return OK; diff --git a/drivers/sensors/apds9960.c b/drivers/sensors/apds9960.c index 9ad54c8063..272c9f2185 100644 --- a/drivers/sensors/apds9960.c +++ b/drivers/sensors/apds9960.c @@ -1023,7 +1023,7 @@ static int apds9960_readgesture(FAR struct apds9960_dev_s *priv) { bytes_read = fifo_level * 4; ret = apds9960_i2c_read(priv, APDS9960_GFIFO_U, - (uint8_t *) fifo_data, bytes_read); + (FAR uint8_t *)fifo_data, bytes_read); if (ret < 0) { snerr("ERROR: Failed to read APDS9960_GFIFO_U!\n"); diff --git a/drivers/sensors/bh1749nuc_base.c b/drivers/sensors/bh1749nuc_base.c index 01e86ad875..35f5ff725b 100644 --- a/drivers/sensors/bh1749nuc_base.c +++ b/drivers/sensors/bh1749nuc_base.c @@ -92,7 +92,7 @@ uint16_t bh1749nuc_read16(FAR struct bh1749nuc_dev_s *priv, uint8_t regaddr) msg[1].frequency = priv->freq; msg[1].addr = priv->addr; msg[1].flags = I2C_M_READ; - msg[1].buffer = (uint8_t *)®val; + msg[1].buffer = (FAR uint8_t *)®val; msg[1].length = 2; ret = I2C_TRANSFER(priv->i2c, msg, 2); diff --git a/drivers/sensors/bmi160_base.c b/drivers/sensors/bmi160_base.c index 41b40b3120..b43d2db4a1 100644 --- a/drivers/sensors/bmi160_base.c +++ b/drivers/sensors/bmi160_base.c @@ -208,7 +208,7 @@ uint16_t bmi160_getreg16(FAR struct bmi160_dev_s *priv, uint8_t regaddr) msg[1].frequency = priv->freq; msg[1].addr = priv->addr; msg[1].flags = I2C_M_READ; - msg[1].buffer = (uint8_t *)®val; + msg[1].buffer = (FAR uint8_t *)®val; msg[1].length = 2; ret = I2C_TRANSFER(priv->i2c, msg, 2); diff --git a/drivers/sensors/bmi270_uorb.c b/drivers/sensors/bmi270_uorb.c index 68aaa9229f..25b1f8431d 100644 --- a/drivers/sensors/bmi270_uorb.c +++ b/drivers/sensors/bmi270_uorb.c @@ -526,7 +526,7 @@ static int bmi270_thread(int argc, FAR char **argv) /* Get data */ - bmi270_getregs(&gyro->base, BMI270_DATA_8, (uint8_t *)data, 12); + bmi270_getregs(&gyro->base, BMI270_DATA_8, (FAR uint8_t *)data, 12); /* Read accel */ diff --git a/drivers/sensors/bmp180_base.c b/drivers/sensors/bmp180_base.c index 834faa3b63..f8e133ef8b 100644 --- a/drivers/sensors/bmp180_base.c +++ b/drivers/sensors/bmp180_base.c @@ -122,7 +122,7 @@ uint16_t bmp180_getreg16(FAR struct bmp180_dev_s *priv, uint8_t regaddr) /* Read register */ - ret = i2c_read(priv->i2c, &config, (uint8_t *)®val, 2); + ret = i2c_read(priv->i2c, &config, (FAR uint8_t *)®val, 2); if (ret < 0) { snerr("ERROR: i2c_read failed: %d\n", ret); @@ -165,7 +165,7 @@ void bmp180_putreg8(FAR struct bmp180_dev_s *priv, uint8_t regaddr, /* Write the register address and value */ - ret = i2c_write(priv->i2c, &config, (uint8_t *) &data, 2); + ret = i2c_write(priv->i2c, &config, (FAR uint8_t *)&data, 2); if (ret < 0) { snerr("ERROR: i2c_write failed: %d\n", ret); diff --git a/drivers/sensors/fakesensor_uorb.c b/drivers/sensors/fakesensor_uorb.c index 01cb0464fc..35f5112bc7 100644 --- a/drivers/sensors/fakesensor_uorb.c +++ b/drivers/sensors/fakesensor_uorb.c @@ -105,7 +105,7 @@ static struct gps_ops_s g_fakegps_ops = ****************************************************************************/ static int fakesensor_read_csv_line(FAR struct file *file, - char *buffer, int len, int start) + FAR char *buffer, int len, int start) { int i; diff --git a/drivers/sensors/hc_sr04.c b/drivers/sensors/hc_sr04.c index 89a203ebdd..67d0378f2e 100644 --- a/drivers/sensors/hc_sr04.c +++ b/drivers/sensors/hc_sr04.c @@ -75,7 +75,7 @@ struct hcsr04_dev_s int time_start_pulse; int time_finish_pulse; volatile bool rising; - struct pollfd *fds[CONFIG_HCSR04_NPOLLWAITERS]; + FAR struct pollfd *fds[CONFIG_HCSR04_NPOLLWAITERS]; }; /**************************************************************************** @@ -341,7 +341,7 @@ static int hcsr04_poll(FAR struct file *filep, FAR struct pollfd *fds, { /* This is a request to tear down the poll. */ - struct pollfd **slot = (struct pollfd **)fds->priv; + FAR struct pollfd **slot = (FAR struct pollfd **)fds->priv; DEBUGASSERT(slot != NULL); /* Remove all memory of the poll setup */ diff --git a/drivers/sensors/hdc1008.c b/drivers/sensors/hdc1008.c index db57bb5347..77c73d1eca 100644 --- a/drivers/sensors/hdc1008.c +++ b/drivers/sensors/hdc1008.c @@ -799,7 +799,7 @@ static int hdc1008_ioctl(FAR struct file *filep, int cmd, unsigned long arg) ret = hdc1008_getreg(priv, HDC1008_REG_CONFIGURATION, ®); if (ret >= 0) { - *(uint16_t *)arg = reg; + *(FAR uint16_t *)arg = reg; } hdc1008_dbg("read config ret: %d\n", ret); diff --git a/drivers/sensors/hts221.c b/drivers/sensors/hts221.c index 447787018e..931c746ce0 100644 --- a/drivers/sensors/hts221.c +++ b/drivers/sensors/hts221.c @@ -126,12 +126,12 @@ static int hts221_poll(FAR struct file *filep, FAR struct pollfd *fds, struct hts221_dev_s { - struct i2c_master_s *i2c; + FAR struct i2c_master_s *i2c; uint8_t addr; - hts221_config_t *config; + FAR hts221_config_t *config; mutex_t devlock; volatile bool int_pending; - struct pollfd *fds[CONFIG_HTS221_NPOLLWAITERS]; + FAR struct pollfd *fds[CONFIG_HTS221_NPOLLWAITERS]; struct { int16_t t0_out; @@ -756,7 +756,7 @@ static int hts221_load_calibration_data(FAR struct hts221_dev_s *priv) * they are a good candidate to be added to entropy pool. */ - up_rngaddentropy(RND_SRC_HW, (uint32_t *)&priv->calib, + up_rngaddentropy(RND_SRC_HW, (FAR uint32_t *)&priv->calib, sizeof(priv->calib) / sizeof(uint32_t)); return OK; @@ -1124,7 +1124,7 @@ static int hts221_poll(FAR struct file *filep, FAR struct pollfd *fds, { /* This is a request to tear down the poll. */ - struct pollfd **slot = (struct pollfd **)fds->priv; + FAR struct pollfd **slot = (FAR struct pollfd **)fds->priv; DEBUGASSERT(slot != NULL); /* Remove all memory of the poll setup */ diff --git a/drivers/sensors/kxtj9.c b/drivers/sensors/kxtj9.c index 6de877264a..4b0e6dd385 100644 --- a/drivers/sensors/kxtj9.c +++ b/drivers/sensors/kxtj9.c @@ -427,7 +427,7 @@ static int kxtj9_read_sensor_data(FAR struct kxtj9_dev_s *priv, return ret; } - kxtj9_reg_read(priv, XOUT_L, (uint8_t *)acc_data, 6); + kxtj9_reg_read(priv, XOUT_L, (FAR uint8_t *)acc_data, 6); /* 12 bit resolution, get rid of the lowest 4 bits */ diff --git a/drivers/sensors/lis2dh.c b/drivers/sensors/lis2dh.c index 5cdf616732..216b5100fd 100644 --- a/drivers/sensors/lis2dh.c +++ b/drivers/sensors/lis2dh.c @@ -86,7 +86,7 @@ struct lis2dh_dev_s FAR struct i2c_master_s *i2c; /* I2C interface */ uint8_t addr; /* I2C address */ FAR struct lis2dh_config_s *config; /* Platform specific configuration */ - struct lis2dh_setup *setup; /* User defined device operation mode setup */ + FAR struct lis2dh_setup *setup; /* User defined device operation mode setup */ struct lis2dh_vector_s vector_data; /* Latest read data read from lis2dh */ int scale; /* Full scale in milliG */ mutex_t devlock; /* Manages exclusive access to this structure */ @@ -97,7 +97,7 @@ struct lis2dh_dev_s #else volatile bool int_pending; /* Interrupt received but data not read, yet */ #endif - struct pollfd *fds[CONFIG_LIS2DH_NPOLLWAITERS]; + FAR struct pollfd *fds[CONFIG_LIS2DH_NPOLLWAITERS]; }; /**************************************************************************** @@ -628,13 +628,13 @@ static int lis2dh_ioctl(FAR struct file *filep, int cmd, unsigned long arg) case SNIOC_READ_TEMP: { - ret = lis2dh_read_temp(priv, (int16_t *)arg); + ret = lis2dh_read_temp(priv, (FAR int16_t *)arg); } break; case SNIOC_WHO_AM_I: { - ret = lis2dh_who_am_i(priv, (uint8_t *)arg); + ret = lis2dh_who_am_i(priv, (FAR uint8_t *)arg); } break; @@ -722,7 +722,7 @@ static int lis2dh_poll(FAR struct file *filep, FAR struct pollfd *fds, { /* This is a request to tear down the poll. */ - struct pollfd **slot = (struct pollfd **)fds->priv; + FAR struct pollfd **slot = (FAR struct pollfd **)fds->priv; DEBUGASSERT(slot != NULL); /* Remove all memory of the poll setup */ @@ -1376,7 +1376,7 @@ static unsigned int lis2dh_get_fifo_readings(FAR struct lis2dh_dev_s *priv, struct lis2dh_vector_s sample; } - *buf = (void *)&res->measurements[res->header.meas_count]; + *buf = (FAR void *)&res->measurements[res->header.meas_count]; bool xy_axis_fixup = priv->setup->xy_axis_fixup; size_t buflen = readcount * 6; @@ -1391,7 +1391,7 @@ static unsigned int lis2dh_get_fifo_readings(FAR struct lis2dh_dev_s *priv, } if (lis2dh_access(priv, ST_LIS2DH_OUT_X_L_REG, - (void *)buf, buflen) != buflen) + (FAR void *)buf, buflen) != buflen) { lis2dh_dbg("lis2dh: Failed to read FIFO (%d bytes, %d samples)\n", buflen, readcount); @@ -1401,7 +1401,7 @@ static unsigned int lis2dh_get_fifo_readings(FAR struct lis2dh_dev_s *priv, /* Add something to entropy pool. */ - up_rngaddentropy(RND_SRC_SENSOR, (void *)buf, buflen / 4); + up_rngaddentropy(RND_SRC_SENSOR, (FAR void *)buf, buflen / 4); /* Convert raw values to mG */ diff --git a/drivers/sensors/lm92.c b/drivers/sensors/lm92.c index 6964df802f..29d659fc77 100644 --- a/drivers/sensors/lm92.c +++ b/drivers/sensors/lm92.c @@ -452,7 +452,7 @@ static int lm92_ioctl(FAR struct file *filep, int cmd, unsigned long arg) case SNIOC_WRITECONF: ret = lm92_writeconf(priv, (uint8_t)arg); - sninfo("conf: %02x ret: %d\n", *(uint8_t *)arg, ret); + sninfo("conf: %02x ret: %d\n", *(FAR uint8_t *)arg, ret); break; /* Shutdown the LM92. Arg: None */ diff --git a/drivers/sensors/lps25h.c b/drivers/sensors/lps25h.c index 1f2c72ef76..32d97be58b 100644 --- a/drivers/sensors/lps25h.c +++ b/drivers/sensors/lps25h.c @@ -115,13 +115,13 @@ struct lps25h_dev_s { - struct i2c_master_s *i2c; + FAR struct i2c_master_s *i2c; uint8_t addr; bool irqenabled; volatile bool int_pending; mutex_t devlock; sem_t waitsem; - lps25h_config_t *config; + FAR lps25h_config_t *config; }; enum LPS25H_RES_CONF_AVG_PRES @@ -258,7 +258,7 @@ static int lps25h_do_transfer(FAR struct lps25h_dev_s *dev, return ret; } -static int lps25h_write_reg8(struct lps25h_dev_s *dev, uint8_t reg_addr, +static int lps25h_write_reg8(FAR struct lps25h_dev_s *dev, uint8_t reg_addr, const uint8_t value) { struct i2c_msg_s msgv[2] = @@ -274,7 +274,7 @@ static int lps25h_write_reg8(struct lps25h_dev_s *dev, uint8_t reg_addr, .frequency = CONFIG_LPS25H_I2C_FREQUENCY, .addr = dev->addr, .flags = I2C_M_NOSTART, - .buffer = (void *)&value, + .buffer = (FAR void *)&value, .length = 1 } }; @@ -677,7 +677,7 @@ static int lps25h_read_temper(FAR struct lps25h_dev_s *dev, return ret; } -static int lps25h_who_am_i(struct lps25h_dev_s *dev, +static int lps25h_who_am_i(FAR struct lps25h_dev_s *dev, lps25h_who_am_i_data * who_am_i_data) { uint8_t who_addr = LPS25H_WHO_AM_I; diff --git a/drivers/sensors/lsm9ds1_uorb.c b/drivers/sensors/lsm9ds1_uorb.c index 6875d5b583..df8879b394 100644 --- a/drivers/sensors/lsm9ds1_uorb.c +++ b/drivers/sensors/lsm9ds1_uorb.c @@ -620,7 +620,7 @@ static int lsm9ds1_thread(int argc, FAR char **argv) if (accel->enabled) { ret = lsm9ds1_readreg(&accel->base, - LSM9DS1_OUT_X_L_XL, (uint8_t *)adata, 6); + LSM9DS1_OUT_X_L_XL, (FAR uint8_t *)adata, 6); lsm9ds1_accel_data(accel, adata); } @@ -629,7 +629,7 @@ static int lsm9ds1_thread(int argc, FAR char **argv) if (gyro->enabled) { ret = lsm9ds1_readreg(&gyro->base, - LSM9DS1_OUT_X_L_G, (uint8_t *)gdata, 6); + LSM9DS1_OUT_X_L_G, (FAR uint8_t *)gdata, 6); lsm9ds1_gyro_data(gyro, gdata); } @@ -638,7 +638,7 @@ static int lsm9ds1_thread(int argc, FAR char **argv) if (mag->enabled) { ret = lsm9ds1_readreg(&mag->base, - LSM9DS1_OUT_X_L_M, (uint8_t *)mdata, 6); + LSM9DS1_OUT_X_L_M, (FAR uint8_t *)mdata, 6); lsm9ds1_mag_data(mag, mdata); } diff --git a/drivers/sensors/ltr308_uorb.c b/drivers/sensors/ltr308_uorb.c index 783e368b08..2ff8ace35d 100644 --- a/drivers/sensors/ltr308_uorb.c +++ b/drivers/sensors/ltr308_uorb.c @@ -198,7 +198,7 @@ static int ltr308_get_reg24(FAR struct ltr308_dev_s *priv, uint8_t regaddr, *val = 0; for (i = 0; i < 3; i++, regaddr++) { - ret = ltr308_get_reg8(priv, regaddr, ((uint8_t *)val) + i); + ret = ltr308_get_reg8(priv, regaddr, ((FAR uint8_t *)val) + i); if (ret < 0) { return ret; diff --git a/drivers/sensors/max44009.c b/drivers/sensors/max44009.c index 6704df00ac..76ec998690 100644 --- a/drivers/sensors/max44009.c +++ b/drivers/sensors/max44009.c @@ -79,7 +79,7 @@ struct max44009_dev_s uint8_t addr; uint8_t cref; bool int_pending; - struct pollfd *fds[CONFIG_MAX44009_NPOLLWAITERS]; + FAR struct pollfd *fds[CONFIG_MAX44009_NPOLLWAITERS]; }; /**************************************************************************** @@ -168,14 +168,14 @@ static int max44009_write_reg8(FAR struct max44009_dev_s *dev, .frequency = CONFIG_MAX44009_I2C_FREQUENCY, .addr = dev->addr, .flags = 0, - .buffer = (void *)&command[0], + .buffer = (FAR void *)&command[0], .length = 1 }, { .frequency = CONFIG_MAX44009_I2C_FREQUENCY, .addr = dev->addr, .flags = I2C_M_NOSTART, - .buffer = (void *)&command[1], + .buffer = (FAR void *)&command[1], .length = 1 } }; @@ -836,7 +836,7 @@ static int max44009_poll(FAR struct file *filep, FAR struct pollfd *fds, { /* This is a request to tear down the poll. */ - struct pollfd **slot = (struct pollfd **)fds->priv; + FAR struct pollfd **slot = (FAR struct pollfd **)fds->priv; DEBUGASSERT(slot != NULL); /* Remove all memory of the poll setup */ diff --git a/drivers/sensors/mb7040.c b/drivers/sensors/mb7040.c index 7ab8d25808..a826839fca 100644 --- a/drivers/sensors/mb7040.c +++ b/drivers/sensors/mb7040.c @@ -287,7 +287,7 @@ static int mb7040_ioctl(FAR struct file *filep, int cmd, unsigned long arg) case SNIOC_CHANGEADDR: ret = mb7040_changeaddr(priv, (uint8_t)arg); - sninfo("new addr: %02x ret: %d\n", *(uint8_t *)arg, ret); + sninfo("new addr: %02x ret: %d\n", *(FAR uint8_t *)arg, ret); break; /* Unrecognized commands */ diff --git a/drivers/sensors/mlx90614.c b/drivers/sensors/mlx90614.c index f4d34b60c7..2465d901e5 100644 --- a/drivers/sensors/mlx90614.c +++ b/drivers/sensors/mlx90614.c @@ -127,7 +127,7 @@ static int mlx90614_read_word(FAR struct mlx90614_dev_s *priv, uint8_t cmd, /* Point "buffer" to checkcrc[3] to fill it with received bytes */ - buffer = (uint8_t *) &checkcrc[3]; + buffer = (FAR uint8_t *)&checkcrc[3]; #endif /* Set up the I2C configuration */ diff --git a/drivers/sensors/mpu60x0.c b/drivers/sensors/mpu60x0.c index 7bc7b65a4b..765cf13822 100644 --- a/drivers/sensors/mpu60x0.c +++ b/drivers/sensors/mpu60x0.c @@ -542,10 +542,10 @@ static inline int __mpu_read_imu(FAR struct mpu_dev_s *dev, { if (dev->fifo_enabled) { - return __mpu_read_reg(dev, FIFO_R_W, (uint8_t *)buf, sizeof(*buf)); + return __mpu_read_reg(dev, FIFO_R_W, (FAR uint8_t *)buf, sizeof(*buf)); } - return __mpu_read_reg(dev, ACCEL_XOUT_H, (uint8_t *)buf, sizeof(*buf)); + return __mpu_read_reg(dev, ACCEL_XOUT_H, (FAR uint8_t *)buf, sizeof(*buf)); } /* __mpu_read_pwr_mgmt_1() @@ -950,7 +950,7 @@ static ssize_t mpu_read(FAR struct file *filep, FAR char *buf, size_t len) if (send_len) { - memcpy(buf, ((uint8_t *)&dev->buf) + dev->bufpos, send_len); + memcpy(buf, ((FAR uint8_t *)&dev->buf) + dev->bufpos, send_len); } /* Move the cursor, to mark them as sent. */ diff --git a/drivers/sensors/mpu9250_uorb.c b/drivers/sensors/mpu9250_uorb.c index acd32b47ce..a8697852b7 100644 --- a/drivers/sensors/mpu9250_uorb.c +++ b/drivers/sensors/mpu9250_uorb.c @@ -924,7 +924,8 @@ static inline int mpu9250_modify_reg(FAR struct mpu9250_dev_s *dev, static inline int mpu9250_read_imu(FAR struct mpu9250_dev_s *dev, FAR struct sensor_data_s *buf) { - return mpu9250_read_reg(dev, ACCEL_XOUT_H, (uint8_t *) buf, sizeof(*buf)); + return mpu9250_read_reg(dev, ACCEL_XOUT_H, (FAR uint8_t *)buf, + sizeof(*buf)); } /* mpu9250_read_pwr_mgmt_1() @@ -941,7 +942,7 @@ static inline uint8_t mpu9250_read_pwr_mgmt_1(FAR struct mpu9250_dev_s *dev) } static inline int mpu9250_write_signal_reset(FAR struct mpu9250_dev_s *dev, - uint8_t val) + uint8_t val) { return mpu9250_write_reg(dev, SIGNAL_PATH_RESET, &val, sizeof(val)); } diff --git a/drivers/sensors/ms58xx.c b/drivers/sensors/ms58xx.c index b8e6b74996..a6096b0a54 100644 --- a/drivers/sensors/ms58xx.c +++ b/drivers/sensors/ms58xx.c @@ -854,7 +854,7 @@ static int ms58xx_ioctl(FAR struct file *filep, int cmd, unsigned long arg) case SNIOC_OVERSAMPLING: ret = ms58xx_setosr(priv, (uint16_t)arg); - sninfo("osr: %04x ret: %d\n", *(uint16_t *)arg, ret); + sninfo("osr: %04x ret: %d\n", *(FAR uint16_t *)arg, ret); break; /* Unrecognized commands */ diff --git a/drivers/sensors/sht4x.c b/drivers/sensors/sht4x.c index 0d97e41253..239517776b 100644 --- a/drivers/sensors/sht4x.c +++ b/drivers/sensors/sht4x.c @@ -564,7 +564,10 @@ static ssize_t sht4x_read(FAR struct file *filep, FAR char *buffer, /* If file position is non-zero, then we're at the end of file. */ - if (filep->f_pos > 0) return 0; + if (filep->f_pos > 0) + { + return 0; + } /* Get exclusive access */ @@ -605,7 +608,10 @@ static ssize_t sht4x_read(FAR struct file *filep, FAR char *buffer, length = snprintf(buffer, buflen, "%ld m" SHT4X_TEMP_UNIT ", %d %%RH\n", data.temp, data.hum / 100); - if (length > buflen) length = buflen; + if (length > buflen) + { + length = buflen; + } filep->f_pos += length; nxmutex_unlock(&priv->devlock); @@ -664,15 +670,15 @@ static int sht4x_ioctl(FAR struct file *filep, int cmd, unsigned long arg) union sht4x_serialno_t serialno; err = sht4x_cmd(priv, SHT4X_READ_SERIAL, 10, &serialno.halves.msb, &serialno.halves.lsb); - *((uint32_t *)(arg)) = serialno.full; + *((FAR uint32_t *)(arg)) = serialno.full; } break; case SNIOC_READ_RAW_DATA: err = sht4x_cmd(priv, g_precision_read[priv->precision], g_measurement_times[priv->precision], - &((struct sht4x_raw_data_s *)(arg))->raw_temp, - &((struct sht4x_raw_data_s *)(arg))->raw_hum); + &((FAR struct sht4x_raw_data_s *)(arg))->raw_temp, + &((FAR struct sht4x_raw_data_s *)(arg))->raw_hum); break; case SNIOC_MEASURE: @@ -684,8 +690,9 @@ static int sht4x_ioctl(FAR struct file *filep, int cmd, unsigned long arg) err = sht4x_cmd(priv, g_precision_read[priv->precision], g_measurement_times[priv->precision], &raw_t, &raw_h); - ((struct sht4x_conv_data_s *)(arg))->temp = sht4x_calc_temp(raw_t); - ((struct sht4x_conv_data_s *)(arg))->hum = sht4x_calc_hum(raw_h); + ((FAR struct sht4x_conv_data_s *)(arg))->temp = + sht4x_calc_temp(raw_t); + ((FAR struct sht4x_conv_data_s *)(arg))->hum = sht4x_calc_hum(raw_h); } break; @@ -704,13 +711,14 @@ static int sht4x_ioctl(FAR struct file *filep, int cmd, unsigned long arg) /* Caller must pass heater option in the temperature argument. */ - uint16_t raw_t = ((struct sht4x_conv_data_s *)(arg))->temp; + uint16_t raw_t = ((FAR struct sht4x_conv_data_s *)(arg))->temp; uint16_t raw_h; err = sht4x_cmd(priv, g_heat_cmds[raw_t], g_heat_times[raw_t], &raw_t, &raw_h); - ((struct sht4x_conv_data_s *)(arg))->temp = sht4x_calc_temp(raw_t); - ((struct sht4x_conv_data_s *)(arg))->hum = sht4x_calc_hum(raw_h); + ((FAR struct sht4x_conv_data_s *)(arg))->temp = + sht4x_calc_temp(raw_t); + ((FAR struct sht4x_conv_data_s *)(arg))->hum = sht4x_calc_hum(raw_h); clock_systime_timespec(&priv->last_heat); /* Update last heat time. */ } break; diff --git a/drivers/sensors/vl53l1x.c b/drivers/sensors/vl53l1x.c index 0e698c1cc9..586e714da2 100644 --- a/drivers/sensors/vl53l1x.c +++ b/drivers/sensors/vl53l1x.c @@ -784,7 +784,7 @@ static uint8_t vl53l1x_getreg8(FAR struct vl53l1x_dev_s *priv, /* Write the register address */ - ret = i2c_write(priv->i2c, &config, (uint8_t *)®addr, 2); + ret = i2c_write(priv->i2c, &config, (FAR uint8_t *)®addr, 2); if (ret < 0) { snerr("ERROR: i2c_write failed: %d\n", ret); @@ -836,7 +836,7 @@ static uint16_t vl53l1x_getreg16(FAR struct vl53l1x_dev_s *priv, /* Register to read */ sninfo("Reg %02x %\n", reg_addr_aux[0], reg_addr_aux[1]); - ret = i2c_write(priv->i2c, &config, (uint8_t *)®_addr_aux, 2); + ret = i2c_write(priv->i2c, &config, (FAR uint8_t *)®_addr_aux, 2); if (ret < 0) { snerr("ERROR: i2c_write failed: %d\n", ret); @@ -845,7 +845,7 @@ static uint16_t vl53l1x_getreg16(FAR struct vl53l1x_dev_s *priv, /* Read register */ - ret = i2c_read(priv->i2c, &config, (uint8_t *) & regval, 2); + ret = i2c_read(priv->i2c, &config, (FAR uint8_t *) & regval, 2); if (ret < 0) { snerr("ERROR: i2c_read failed: %d\n", ret); @@ -942,7 +942,7 @@ static void vl53l1x_putreg8(FAR struct vl53l1x_dev_s *priv, uint16_t regaddr, /* Write the register address and value */ - ret = i2c_write(priv->i2c, &config, (uint8_t *) & data, 3); + ret = i2c_write(priv->i2c, &config, (FAR uint8_t *) & data, 3); if (ret < 0) { snerr("ERROR: i2c_write failed: %d\n", ret); @@ -978,7 +978,7 @@ static void vl53l1x_putreg16(FAR struct vl53l1x_dev_s *priv, /* Write the register address and value */ - ret = i2c_write(priv->i2c, &config, (uint8_t *) & data, 4); + ret = i2c_write(priv->i2c, &config, (FAR uint8_t *) & data, 4); if (ret < 0) { snerr("ERROR: i2c_write failed: %d\n", ret); @@ -1016,7 +1016,7 @@ static void vl53l1x_putreg32(FAR struct vl53l1x_dev_s *priv, /* Write the register address and value */ - ret = i2c_write(priv->i2c, &config, (uint8_t *) & data, 7); + ret = i2c_write(priv->i2c, &config, (FAR uint8_t *) & data, 7); if (ret < 0) { snerr("ERROR: i2c_write failed: %d\n", ret); @@ -1079,8 +1079,8 @@ static void vl53l1x_ioctl(FAR struct file *filep, int cmd, uint16_t arg) { sninfo("Calibrating distance\n"); int16_t offset; - vl53l1x_getoffset(priv, (int16_t *)&offset); - vl53l1x_calibrateoffset(priv, arg, (int16_t *)&offset); + vl53l1x_getoffset(priv, (FAR int16_t *)&offset); + vl53l1x_calibrateoffset(priv, arg, (FAR int16_t *)&offset); } break; diff --git a/drivers/sensors/xen1210.c b/drivers/sensors/xen1210.c index d8d1fb7435..23cda293a1 100644 --- a/drivers/sensors/xen1210.c +++ b/drivers/sensors/xen1210.c @@ -137,7 +137,7 @@ static ssize_t xen1210_read(FAR struct file *filep, FAR char *buffer, /* Return read sample */ - buffer = (FAR char *) &priv->sample; + buffer = (FAR char *)&priv->sample; nxmutex_unlock(&priv->lock); return sizeof(struct xen1210_sample_s); diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c index 5d746b83f4..2164a1d61c 100644 --- a/drivers/serial/serial.c +++ b/drivers/serial/serial.c @@ -123,7 +123,7 @@ static int uart_unlink(FAR struct inode *inode); #ifdef CONFIG_TTY_LAUNCH_ENTRY /* Lanch program entry, this must be supplied by the application. */ -int CONFIG_TTY_LAUNCH_ENTRYPOINT(int argc, char *argv[]); +int CONFIG_TTY_LAUNCH_ENTRYPOINT(int argc, FAR char *argv[]); #endif /**************************************************************************** @@ -714,7 +714,10 @@ static int uart_close(FAR struct file *filep) flags = enter_critical_section(); /* Disable interrupts */ uart_detach(dev); /* Detach interrupts */ - if (!dev->isconsole) /* Check for the serial console UART */ + + /* Check for the serial console UART */ + + if (!dev->isconsole) { uart_shutdown(dev); /* Disable the UART */ } @@ -2053,7 +2056,7 @@ void uart_reset_sem(FAR uart_dev_t *dev) #if defined(CONFIG_TTY_SIGINT) || defined(CONFIG_TTY_SIGTSTP) || \ defined(CONFIG_TTY_FORCE_PANIC) || defined(CONFIG_TTY_LAUNCH) -int uart_check_special(FAR uart_dev_t *dev, const char *buf, size_t size) +int uart_check_special(FAR uart_dev_t *dev, FAR const char *buf, size_t size) { size_t i; diff --git a/drivers/syslog/ramlog.c b/drivers/syslog/ramlog.c index e7f6922f8b..6a9aec1693 100644 --- a/drivers/syslog/ramlog.c +++ b/drivers/syslog/ramlog.c @@ -578,7 +578,7 @@ static int ramlog_file_poll(FAR struct file *filep, FAR struct pollfd *fds, { /* This is a request to tear down the poll. */ - struct pollfd **slot = (struct pollfd **)fds->priv; + FAR struct pollfd **slot = (FAR struct pollfd **)fds->priv; /* Remove all memory of the poll setup */ diff --git a/drivers/syslog/syslog_rpmsg_server.c b/drivers/syslog/syslog_rpmsg_server.c index f4e82392f1..3795023e57 100644 --- a/drivers/syslog/syslog_rpmsg_server.c +++ b/drivers/syslog/syslog_rpmsg_server.c @@ -259,7 +259,7 @@ static int syslog_rpmsg_ept_cb(FAR struct rpmsg_endpoint *ept, unsigned int newsize = priv->nextpos + copied; if (newsize > priv->alloced) { - char *newbuf = kmm_realloc(priv->tmpbuf, newsize); + FAR char *newbuf = kmm_realloc(priv->tmpbuf, newsize); if (newbuf != NULL) { priv->tmpbuf = newbuf; diff --git a/drivers/usbdev/cdcacm.c b/drivers/usbdev/cdcacm.c index c3057f7a90..2804c5d747 100644 --- a/drivers/usbdev/cdcacm.c +++ b/drivers/usbdev/cdcacm.c @@ -1818,7 +1818,9 @@ static int cdcacm_setup(FAR struct usbdevclass_driver_s *driver, * with the setup command. */ - if (dataout && len <= SIZEOF_CDC_LINECODING) /* REVISIT */ + /* REVISIT */ + + if (dataout && len <= SIZEOF_CDC_LINECODING) { memcpy(&priv->linecoding, dataout, SIZEOF_CDC_LINECODING); diff --git a/drivers/usbdev/cdcecm.c b/drivers/usbdev/cdcecm.c index 1441a9af1d..0518737131 100644 --- a/drivers/usbdev/cdcecm.c +++ b/drivers/usbdev/cdcecm.c @@ -1820,7 +1820,7 @@ static int cdcecm_classobject(int minor, /* Network device initialization */ - self->dev.d_buf = (uint8_t *)self->pktbuf; + self->dev.d_buf = (FAR uint8_t *)self->pktbuf; self->dev.d_ifup = cdcecm_ifup; /* I/F up (new IP address) callback */ self->dev.d_ifdown = cdcecm_ifdown; /* I/F down callback */ self->dev.d_txavail = cdcecm_txavail; /* New TX data callback */ diff --git a/drivers/usbdev/usbdev_trace.c b/drivers/usbdev/usbdev_trace.c index 2bc787e6a7..af6e723905 100644 --- a/drivers/usbdev/usbdev_trace.c +++ b/drivers/usbdev/usbdev_trace.c @@ -82,7 +82,7 @@ static usbtrace_idset_t g_maskedidset = CONFIG_USBDEV_TRACE_INITIALIDSET; #if !defined(CONFIG_USBDEV_TRACE) && \ (defined(CONFIG_DEBUG_FEATURES) && defined(CONFIG_DEBUG_USB)) -static int usbtrace_syslog(const char *fmt, ...) +static int usbtrace_syslog(FAR const char *fmt, ...) { va_list ap; diff --git a/drivers/usbdev/usbmsc.c b/drivers/usbdev/usbmsc.c index a2c91853b0..524cb818d8 100644 --- a/drivers/usbdev/usbmsc.c +++ b/drivers/usbdev/usbmsc.c @@ -1244,7 +1244,7 @@ static int usbmsc_sync_wait(FAR struct usbmsc_dev_s *priv) * ****************************************************************************/ -int usbmsc_configure(unsigned int nluns, void **handle) +int usbmsc_configure(unsigned int nluns, FAR void **handle) { FAR struct usbmsc_alloc_s *alloc; FAR struct usbmsc_dev_s *priv; diff --git a/drivers/usbdev/usbmsc.h b/drivers/usbdev/usbmsc.h index 39f8aad4b0..ee96007b86 100644 --- a/drivers/usbdev/usbmsc.h +++ b/drivers/usbdev/usbmsc.h @@ -585,7 +585,7 @@ FAR const struct usb_qualdesc_s *usbmsc_getqualdesc(void); * ****************************************************************************/ -int usbmsc_scsi_main(int argc, char *argv[]); +int usbmsc_scsi_main(int argc, FAR char *argv[]); /**************************************************************************** * Name: usbmsc_setconfig diff --git a/drivers/usbdev/usbmsc_scsi.c b/drivers/usbdev/usbmsc_scsi.c index 63444e8675..9ff3844aec 100644 --- a/drivers/usbdev/usbmsc_scsi.c +++ b/drivers/usbdev/usbmsc_scsi.c @@ -104,49 +104,50 @@ /* Debug ********************************************************************/ #if defined(CONFIG_DEBUG_INFO) && defined (CONFIG_DEBUG_USB) -static void usbmsc_dumpdata(const char *msg, const uint8_t *buf, - int buflen); +static void usbmsc_dumpdata(FAR const char *msg, const uint8_t *buf, + int buflen); #else # define usbmsc_dumpdata(msg, buf, len) #endif /* Utility Support Functions ************************************************/ -static uint16_t usbmsc_getbe16(uint8_t *buf); -static uint32_t usbmsc_getbe32(uint8_t *buf); -static void usbmsc_putbe16(uint8_t * buf, uint16_t val); -static void usbmsc_putbe24(uint8_t *buf, uint32_t val); -static void usbmsc_putbe32(uint8_t *buf, uint32_t val); +static uint16_t usbmsc_getbe16(FAR uint8_t *buf); +static uint32_t usbmsc_getbe32(FAR uint8_t *buf); +static void usbmsc_putbe16(FAR uint8_t * buf, uint16_t val); +static void usbmsc_putbe24(FAR uint8_t *buf, uint32_t val); +static void usbmsc_putbe32(FAR uint8_t *buf, uint32_t val); #if 0 /* not used */ -static uint16_t usbmsc_getle16(uint8_t *buf); +static uint16_t usbmsc_getle16(FAR uint8_t *buf); #endif -static uint32_t usbmsc_getle32(uint8_t *buf); +static uint32_t usbmsc_getle32(FAR uint8_t *buf); #if 0 /* not used */ -static void usbmsc_putle16(uint8_t * buf, uint16_t val); +static void usbmsc_putle16(FAR uint8_t * buf, uint16_t val); #endif -static void usbmsc_putle32(uint8_t *buf, uint32_t val); +static void usbmsc_putle32(FAR uint8_t *buf, uint32_t val); /* SCSI Command Processing **************************************************/ static inline int usbmsc_cmdtestunitready(FAR struct usbmsc_dev_s *priv); static inline int usbmsc_cmdrequestsense(FAR struct usbmsc_dev_s *priv, - FAR uint8_t *buf); + FAR uint8_t *buf); static inline int usbmsc_cmdread6(FAR struct usbmsc_dev_s *priv); static inline int usbmsc_cmdwrite6(FAR struct usbmsc_dev_s *priv); static inline int usbmsc_cmdinquiry(FAR struct usbmsc_dev_s *priv, - FAR uint8_t *buf); + FAR uint8_t *buf); static inline int usbmsc_cmdmodeselect6(FAR struct usbmsc_dev_s *priv); -static int usbmsc_modepage(FAR struct usbmsc_dev_s *priv, - FAR uint8_t *buf, uint8_t pcpgcode, int *mdlen); +static int usbmsc_modepage(FAR struct usbmsc_dev_s *priv, + FAR uint8_t *buf, uint8_t pcpgcode, + FAR int *mdlen); static inline int usbmsc_cmdmodesense6(FAR struct usbmsc_dev_s *priv, - FAR uint8_t *buf); + FAR uint8_t *buf); static inline int usbmsc_cmdstartstopunit(FAR struct usbmsc_dev_s *priv); static inline int usbmsc_cmdpreventmediumremoval( FAR struct usbmsc_dev_s *priv); static inline int usbmsc_cmdreadformatcapacity(FAR struct usbmsc_dev_s *priv, - FAR uint8_t *buf); + FAR uint8_t *buf); static inline int usbmsc_cmdreadcapacity10(FAR struct usbmsc_dev_s *priv, - FAR uint8_t *buf); + FAR uint8_t *buf); static inline int usbmsc_cmdread10(FAR struct usbmsc_dev_s *priv); static inline int usbmsc_cmdwrite10(FAR struct usbmsc_dev_s *priv); static inline int usbmsc_cmdverify10(FAR struct usbmsc_dev_s *priv); @@ -154,26 +155,26 @@ static inline int usbmsc_cmdsynchronizecache10( FAR struct usbmsc_dev_s *priv); static inline int usbmsc_cmdmodeselect10(FAR struct usbmsc_dev_s *priv); static inline int usbmsc_cmdmodesense10(FAR struct usbmsc_dev_s *priv, - FAR uint8_t *buf); + FAR uint8_t *buf); static inline int usbmsc_cmdread12(FAR struct usbmsc_dev_s *priv); static inline int usbmsc_cmdwrite12(FAR struct usbmsc_dev_s *priv); static inline int usbmsc_setupcmd(FAR struct usbmsc_dev_s *priv, - uint8_t cdblen, uint8_t flags); + uint8_t cdblen, uint8_t flags); /* SCSI Worker Thread *******************************************************/ -static int usbmsc_idlestate(FAR struct usbmsc_dev_s *priv); -static int usbmsc_cmdparsestate(FAR struct usbmsc_dev_s *priv); -static int usbmsc_cmdreadstate(FAR struct usbmsc_dev_s *priv); -static int usbmsc_cmdwritestate(FAR struct usbmsc_dev_s *priv); -static int usbmsc_cmdfinishstate(FAR struct usbmsc_dev_s *priv); -static int usbmsc_cmdstatusstate(FAR struct usbmsc_dev_s *priv); +static int usbmsc_idlestate(FAR struct usbmsc_dev_s *priv); +static int usbmsc_cmdparsestate(FAR struct usbmsc_dev_s *priv); +static int usbmsc_cmdreadstate(FAR struct usbmsc_dev_s *priv); +static int usbmsc_cmdwritestate(FAR struct usbmsc_dev_s *priv); +static int usbmsc_cmdfinishstate(FAR struct usbmsc_dev_s *priv); +static int usbmsc_cmdstatusstate(FAR struct usbmsc_dev_s *priv); /**************************************************************************** * Private Data ****************************************************************************/ -static const char *g_productrevision = "0101"; +static FAR const char *g_productrevision = "0101"; /**************************************************************************** * Private Functions @@ -188,7 +189,8 @@ static const char *g_productrevision = "0101"; ****************************************************************************/ #if defined(CONFIG_DEBUG_INFO) && defined (CONFIG_DEBUG_USB) -static void usbmsc_dumpdata(const char *msg, const uint8_t *buf, int buflen) +static void usbmsc_dumpdata(FAR const char *msg, FAR const uint8_t *buf, + int buflen) { int i; @@ -214,7 +216,7 @@ static void usbmsc_dumpdata(const char *msg, const uint8_t *buf, int buflen) * ****************************************************************************/ -static uint16_t usbmsc_getbe16(uint8_t *buf) +static uint16_t usbmsc_getbe16(FAR uint8_t *buf) { return ((uint16_t)buf[0] << 8) | ((uint16_t)buf[1]); } @@ -227,7 +229,7 @@ static uint16_t usbmsc_getbe16(uint8_t *buf) * ****************************************************************************/ -static uint32_t usbmsc_getbe32(uint8_t *buf) +static uint32_t usbmsc_getbe32(FAR uint8_t *buf) { return ((uint32_t)buf[0] << 24) | ((uint32_t)buf[1] << 16) | ((uint32_t)buf[2] << 8) | ((uint32_t)buf[3]); @@ -242,7 +244,7 @@ static uint32_t usbmsc_getbe32(uint8_t *buf) * ****************************************************************************/ -static void usbmsc_putbe16(uint8_t * buf, uint16_t val) +static void usbmsc_putbe16(FAR uint8_t * buf, uint16_t val) { buf[0] = val >> 8; buf[1] = val; @@ -257,7 +259,7 @@ static void usbmsc_putbe16(uint8_t * buf, uint16_t val) * ****************************************************************************/ -static void usbmsc_putbe24(uint8_t *buf, uint32_t val) +static void usbmsc_putbe24(FAR uint8_t *buf, uint32_t val) { buf[0] = val >> 16; buf[1] = val >> 8; @@ -273,7 +275,7 @@ static void usbmsc_putbe24(uint8_t *buf, uint32_t val) * ****************************************************************************/ -static void usbmsc_putbe32(uint8_t *buf, uint32_t val) +static void usbmsc_putbe32(FAR uint8_t *buf, uint32_t val) { buf[0] = val >> 24; buf[1] = val >> 16; @@ -290,7 +292,7 @@ static void usbmsc_putbe32(uint8_t *buf, uint32_t val) ****************************************************************************/ #if 0 /* not used */ -static uint16_t usbmsc_getle16(uint8_t *buf) +static uint16_t usbmsc_getle16(FAR uint8_t *buf) { return ((uint16_t)buf[1] << 8) | ((uint16_t)buf[0]); } @@ -304,7 +306,7 @@ static uint16_t usbmsc_getle16(uint8_t *buf) * ****************************************************************************/ -static uint32_t usbmsc_getle32(uint8_t *buf) +static uint32_t usbmsc_getle32(FAR uint8_t *buf) { return ((uint32_t)buf[3] << 24) | ((uint32_t)buf[2] << 16) | ((uint32_t)buf[1] << 8) | ((uint32_t)buf[0]); @@ -320,7 +322,7 @@ static uint32_t usbmsc_getle32(uint8_t *buf) ****************************************************************************/ #if 0 /* not used */ -static void usbmsc_putle16(uint8_t * buf, uint16_t val) +static void usbmsc_putle16(FAR uint8_t *buf, uint16_t val) { buf[0] = val; buf[1] = val >> 8; @@ -336,7 +338,7 @@ static void usbmsc_putle16(uint8_t * buf, uint16_t val) * ****************************************************************************/ -static void usbmsc_putle32(uint8_t *buf, uint32_t val) +static void usbmsc_putle32(FAR uint8_t *buf, uint32_t val) { buf[0] = val; buf[1] = val >> 8; @@ -424,14 +426,14 @@ static inline int usbmsc_cmdrequestsense(FAR struct usbmsc_dev_s *priv, FAR uint8_t *buf) { FAR struct scsicmd_requestsense_s *request = - (FAR struct scsicmd_requestsense_s *)priv->cdb; + (FAR struct scsicmd_requestsense_s *)priv->cdb; FAR struct scsiresp_fixedsensedata_s *response = - (FAR struct scsiresp_fixedsensedata_s *)buf; + (FAR struct scsiresp_fixedsensedata_s *)buf; FAR struct usbmsc_lun_s *lun; uint32_t sd; uint32_t sdinfo; uint8_t cdblen; - int ret; + int ret; /* Extract the host allocation length */ @@ -446,7 +448,7 @@ static inline int usbmsc_cmdrequestsense(FAR struct usbmsc_dev_s *priv, { /* Try MS-Windows REQUEST SENSE with cbw->cdblen == 12 */ - cdblen = SCSICMD_REQUESTSENSE_MSSIZEOF; + cdblen = SCSICMD_REQUESTSENSE_MSSIZEOF; } ret = usbmsc_setupcmd(priv, cdblen, @@ -729,7 +731,7 @@ static inline int usbmsc_cmdinquiry(FAR struct usbmsc_dev_s *priv, static inline int usbmsc_cmdmodeselect6(FAR struct usbmsc_dev_s *priv) { FAR struct scsicmd_modeselect6_s *modeselect = - (FAR struct scsicmd_modeselect6_s *)priv->cdb; + (FAR struct scsicmd_modeselect6_s *)priv->cdb; priv->u.alloclen = modeselect->plen; usbmsc_setupcmd(priv, SCSICMD_MODESELECT6_SIZEOF, @@ -750,10 +752,10 @@ static inline int usbmsc_cmdmodeselect6(FAR struct usbmsc_dev_s *priv) ****************************************************************************/ static int usbmsc_modepage(FAR struct usbmsc_dev_s *priv, FAR uint8_t *buf, - uint8_t pcpgcode, int *mdlen) + uint8_t pcpgcode, FAR int *mdlen) { FAR struct scsiresp_cachingmodepage_s *cmp = - (FAR struct scsiresp_cachingmodepage_s *)buf; + (FAR struct scsiresp_cachingmodepage_s *)buf; /* Saving parms not supported */ @@ -823,9 +825,9 @@ static int inline usbmsc_cmdmodesense6(FAR struct usbmsc_dev_s *priv, FAR uint8_t *buf) { FAR struct scsicmd_modesense6_s *modesense = - (FAR struct scsicmd_modesense6_s *)priv->cdb; + (FAR struct scsicmd_modesense6_s *)priv->cdb; FAR struct scsiresp_modeparameterhdr6_s *mph = - (FAR struct scsiresp_modeparameterhdr6_s *)buf; + (FAR struct scsiresp_modeparameterhdr6_s *)buf; #ifndef CONFIG_USBMSC_NOT_STALL_BULKEP int mdlen; #endif @@ -930,7 +932,7 @@ static inline int { #ifdef CONFIG_USBMSC_REMOVABLE FAR struct scsicmd_preventmediumremoval_s *pmr = - (FAR struct scsicmd_preventmediumremoval_s *)priv->cdb; + (FAR struct scsicmd_preventmediumremoval_s *)priv->cdb; #endif FAR struct usbmsc_lun_s *lun; int ret; @@ -975,7 +977,7 @@ static inline int usbmsc_cmdreadformatcapacity(FAR struct usbmsc_dev_s *priv, FAR uint8_t *buf) { FAR struct scsicmd_readformatcapcacities_s *rfc = - (FAR struct scsicmd_readformatcapcacities_s *)priv->cdb; + (FAR struct scsicmd_readformatcapcacities_s *)priv->cdb; FAR struct scsiresp_readformatcapacities_s *hdr; FAR struct usbmsc_lun_s *lun; int ret; @@ -1014,9 +1016,9 @@ static int inline usbmsc_cmdreadcapacity10(FAR struct usbmsc_dev_s *priv, FAR uint8_t *buf) { FAR struct scsicmd_readcapacity10_s *rcc = - (FAR struct scsicmd_readcapacity10_s *)priv->cdb; + (FAR struct scsicmd_readcapacity10_s *)priv->cdb; FAR struct scsiresp_readcapacity10_s *rcr = - (FAR struct scsiresp_readcapacity10_s *)buf; + (FAR struct scsiresp_readcapacity10_s *)buf; FAR struct usbmsc_lun_s *lun; uint32_t lba; int ret; @@ -1059,7 +1061,8 @@ static int inline usbmsc_cmdreadcapacity10(FAR struct usbmsc_dev_s *priv, static inline int usbmsc_cmdread10(FAR struct usbmsc_dev_s *priv) { - struct scsicmd_read10_s *read10 = (struct scsicmd_read10_s *)priv->cdb; + FAR struct scsicmd_read10_s *read10 = + (FAR struct scsicmd_read10_s *)priv->cdb; FAR struct usbmsc_lun_s *lun; int ret; @@ -1127,7 +1130,8 @@ static inline int usbmsc_cmdread10(FAR struct usbmsc_dev_s *priv) static inline int usbmsc_cmdwrite10(FAR struct usbmsc_dev_s *priv) { - struct scsicmd_write10_s *write10 = (struct scsicmd_write10_s *)priv->cdb; + FAR struct scsicmd_write10_s *write10 = + (FAR struct scsicmd_write10_s *)priv->cdb; FAR struct usbmsc_lun_s *lun; int ret; @@ -1208,12 +1212,12 @@ static inline int usbmsc_cmdverify10(FAR struct usbmsc_dev_s *priv) FAR struct scsicmd_verify10_s *verf = (FAR struct scsicmd_verify10_s *)priv->cdb; FAR struct usbmsc_lun_s *lun; - uint32_t lba; - uint16_t blocks; - size_t sector; + uint32_t lba; + uint16_t blocks; + size_t sector; ssize_t nread; - int ret; - int i; + int ret; + int i; priv->u.alloclen = 0; ret = usbmsc_setupcmd(priv, SCSICMD_VERIFY10_SIZEOF, USBMSC_FLAGS_DIRNONE); @@ -1325,7 +1329,7 @@ static inline int usbmsc_cmdsynchronizecache10(FAR struct usbmsc_dev_s *priv) static inline int usbmsc_cmdmodeselect10(FAR struct usbmsc_dev_s *priv) { FAR struct scsicmd_modeselect10_s *modeselect = - (FAR struct scsicmd_modeselect10_s *)priv->cdb; + (FAR struct scsicmd_modeselect10_s *)priv->cdb; priv->u.alloclen = usbmsc_getbe16(modeselect->parmlen); usbmsc_setupcmd(priv, SCSICMD_MODESELECT10_SIZEOF, @@ -1349,9 +1353,9 @@ static int inline usbmsc_cmdmodesense10(FAR struct usbmsc_dev_s *priv, FAR uint8_t *buf) { FAR struct scsicmd_modesense10_s *modesense = - (FAR struct scsicmd_modesense10_s *)priv->cdb; + (FAR struct scsicmd_modesense10_s *)priv->cdb; FAR struct scsiresp_modeparameterhdr10_s *mph = - (FAR struct scsiresp_modeparameterhdr10_s *)buf; + (FAR struct scsiresp_modeparameterhdr10_s *)buf; int mdlen; int ret; @@ -1410,7 +1414,8 @@ static int inline usbmsc_cmdmodesense10(FAR struct usbmsc_dev_s *priv, static inline int usbmsc_cmdread12(FAR struct usbmsc_dev_s *priv) { - struct scsicmd_read12_s *read12 = (struct scsicmd_read12_s *)priv->cdb; + FAR struct scsicmd_read12_s *read12 = + (FAR struct scsicmd_read12_s *)priv->cdb; FAR struct usbmsc_lun_s *lun; int ret; @@ -1478,7 +1483,8 @@ static inline int usbmsc_cmdread12(FAR struct usbmsc_dev_s *priv) static inline int usbmsc_cmdwrite12(FAR struct usbmsc_dev_s *priv) { - struct scsicmd_write12_s *write12 = (struct scsicmd_write12_s *)priv->cdb; + FAR struct scsicmd_write12_s *write12 = + (FAR struct scsicmd_write12_s *)priv->cdb; FAR struct usbmsc_lun_s *lun; int ret; @@ -2235,8 +2241,8 @@ static int usbmsc_cmdreadstate(FAR struct usbmsc_dev_s *priv) FAR struct usbdev_req_s *req; irqstate_t flags; ssize_t nread; - uint8_t *src; - uint8_t *dest; + FAR uint8_t *src; + FAR uint8_t *dest; int nbytes; int ret; @@ -2391,8 +2397,8 @@ static int usbmsc_cmdwritestate(FAR struct usbmsc_dev_s *priv) FAR struct usbdev_req_s *req; ssize_t nwritten; uint16_t xfrd; - uint8_t *src; - uint8_t *dest; + FAR uint8_t *src; + FAR uint8_t *dest; int nbytes; int ret; @@ -2826,7 +2832,7 @@ static int usbmsc_cmdstatusstate(FAR struct usbmsc_dev_s *priv) * ****************************************************************************/ -int usbmsc_scsi_main(int argc, char *argv[]) +int usbmsc_scsi_main(int argc, FAR char *argv[]) { FAR struct usbmsc_dev_s *priv; irqstate_t flags; diff --git a/drivers/usbhost/usbhost_bthci.c b/drivers/usbhost/usbhost_bthci.c index ed0fc1d0e9..7e3fa47787 100644 --- a/drivers/usbhost/usbhost_bthci.c +++ b/drivers/usbhost/usbhost_bthci.c @@ -134,8 +134,8 @@ static void usbhost_destroy(FAR void *arg); /* Helpers for usbhci_connect() */ static inline int usbhci_cfgdesc(FAR struct usbhost_state_s *priv, - FAR const uint8_t *configdesc, - int desclen); + FAR const uint8_t *configdesc, + int desclen); static inline int usbhost_devinit(FAR struct usbhost_state_s *priv); /* (Little Endian) Data helpers */ @@ -150,14 +150,14 @@ static inline void usbhost_tfree(FAR struct usbhost_state_s *priv); /* struct usbhost_registry_s methods */ -static struct usbhost_class_s * +static FAR struct usbhost_class_s * usbhost_create(FAR struct usbhost_hubport_s *hport, FAR const struct usbhost_id_s *id); /* struct usbhost_class_s methods */ static int usbhci_connect(FAR struct usbhost_class_s *usbclass, - FAR const uint8_t *configdesc, int desclen); + FAR const uint8_t *configdesc, int desclen); static int usbhost_disconnected(FAR struct usbhost_class_s *usbclass); /* Driver methods -- @@ -172,17 +172,17 @@ static void usbhost_event_callback(FAR void *arg, ssize_t nbytes); static void usbhost_acl_callback(FAR void *arg, ssize_t nbytes); static ssize_t usbhost_cmd_tx(FAR struct usbhost_state_s *priv, - FAR const void *buffer, size_t buflen); + FAR const void *buffer, size_t buflen); static ssize_t usbhost_acl_tx(FAR struct usbhost_state_s *priv, - FAR const void *buffer, size_t buflen); + FAR const void *buffer, size_t buflen); static int usbhost_bthci_send(FAR struct bt_driver_s *dev, - enum bt_buf_type_e type, - FAR void *data, size_t len); + enum bt_buf_type_e type, + FAR void *data, size_t len); static int usbhost_bthci_open(FAR struct bt_driver_s *dev); static void usbhost_bthci_close(FAR struct bt_driver_s *dev); static int usbhost_bthci_ioctl(FAR struct bt_driver_s *dev, - int cmd, unsigned long arg); + int cmd, unsigned long arg); /**************************************************************************** * Private Data @@ -426,14 +426,14 @@ static void usbhost_destroy(FAR void *arg) ****************************************************************************/ static inline int usbhci_cfgdesc(FAR struct usbhost_state_s *priv, - FAR const uint8_t *configdesc, int desclen) + FAR const uint8_t *configdesc, int desclen) { FAR struct usbhost_hubport_s *hport; FAR struct usb_cfgdesc_s *cfgdesc; FAR struct usb_desc_s *desc; - FAR struct usbhost_epdesc_s bindesc; - FAR struct usbhost_epdesc_s boutdesc; - FAR struct usbhost_epdesc_s iindesc; + struct usbhost_epdesc_s bindesc; + struct usbhost_epdesc_s boutdesc; + struct usbhost_epdesc_s iindesc; int remaining; uint8_t found = 0; int ret; @@ -681,15 +681,16 @@ static inline int usbhci_cfgdesc(FAR struct usbhost_state_s *priv, static int usbhost_ctrl_cmd(FAR struct usbhost_state_s *priv, uint8_t type, uint8_t req, uint16_t value, - uint16_t indx, uint8_t *payload, uint16_t len) + uint16_t indx, FAR uint8_t *payload, + uint16_t len) { FAR struct usbhost_hubport_s *hport; - struct usb_ctrlreq_s *ctrlreq; + FAR struct usb_ctrlreq_s *ctrlreq; int ret; hport = priv->usbclass.hport; - ctrlreq = (struct usb_ctrlreq_s *)priv->ctrlreq; + ctrlreq = (FAR struct usb_ctrlreq_s *)priv->ctrlreq; ctrlreq->type = type; ctrlreq->req = req; @@ -809,7 +810,7 @@ static void usbhost_event_work(FAR void *arg) ****************************************************************************/ static ssize_t usbhost_cmd_tx(FAR struct usbhost_state_s *priv, - FAR const void *buffer, size_t buflen) + FAR const void *buffer, size_t buflen) { int ret; @@ -818,7 +819,7 @@ static ssize_t usbhost_cmd_tx(FAR struct usbhost_state_s *priv, ret = usbhost_ctrl_cmd(priv, USB_REQ_DIR_OUT | USB_REQ_TYPE_CLASS | USB_REQ_RECIPIENT_DEVICE, - 0, 0, 0, (uint8_t *)buffer, buflen); + 0, 0, 0, (FAR uint8_t *)buffer, buflen); nxmutex_unlock(&priv->lock); @@ -923,7 +924,7 @@ static void usbhost_acl_callback(FAR void *arg, ssize_t nbytes) ****************************************************************************/ static ssize_t usbhost_acl_tx(FAR struct usbhost_state_s *priv, - FAR const void *buffer, size_t buflen) + FAR const void *buffer, size_t buflen) { ssize_t nwritten = 0; FAR struct usbhost_hubport_s *hport; @@ -933,7 +934,7 @@ static ssize_t usbhost_acl_tx(FAR struct usbhost_state_s *priv, nxmutex_lock(&priv->lock); nwritten = DRVR_TRANSFER(hport->drvr, priv->bulkout, - (uint8_t *)buffer, buflen); + (FAR uint8_t *)buffer, buflen); if (nwritten < 0) { @@ -968,8 +969,8 @@ static ssize_t usbhost_acl_tx(FAR struct usbhost_state_s *priv, ****************************************************************************/ static int usbhost_bthci_send(FAR struct bt_driver_s *dev, - enum bt_buf_type_e type, - FAR void *data, size_t len) + enum bt_buf_type_e type, + FAR void *data, size_t len) { int ret; FAR struct usbhost_state_s *priv; @@ -1048,7 +1049,7 @@ static void usbhost_bthci_close(FAR struct bt_driver_s *dev) ****************************************************************************/ static int usbhost_bthci_ioctl(FAR struct bt_driver_s *dev, - int cmd, unsigned long arg) + int cmd, unsigned long arg) { return -ENOTTY; } @@ -1127,7 +1128,7 @@ static inline int usbhost_devinit(FAR struct usbhost_state_s *priv) * ****************************************************************************/ -static inline uint16_t usbhost_getle16(const uint8_t *val) +static inline uint16_t usbhost_getle16(FAR const uint8_t *val) { return (uint16_t)val[1] << 8 | (uint16_t)val[0]; } @@ -1147,7 +1148,7 @@ static inline uint16_t usbhost_getle16(const uint8_t *val) * ****************************************************************************/ -static void usbhost_putle16(uint8_t *dest, uint16_t val) +static void usbhost_putle16(FAR uint8_t *dest, uint16_t val) { /* Little endian means LSB first in byte stream */ @@ -1375,7 +1376,7 @@ usbhost_create(FAR struct usbhost_hubport_s *hport, ****************************************************************************/ static int usbhci_connect(FAR struct usbhost_class_s *usbclass, - FAR const uint8_t *configdesc, int desclen) + FAR const uint8_t *configdesc, int desclen) { FAR struct usbhost_state_s *priv = (FAR struct usbhost_state_s *)usbclass; int ret; @@ -1434,7 +1435,7 @@ static int usbhci_connect(FAR struct usbhost_class_s *usbclass, * ****************************************************************************/ -static int usbhost_disconnected(struct usbhost_class_s *usbclass) +static int usbhost_disconnected(FAR struct usbhost_class_s *usbclass) { FAR struct usbhost_state_s *priv = (FAR struct usbhost_state_s *)usbclass; irqstate_t flags; diff --git a/drivers/usbhost/usbhost_cdcmbim.c b/drivers/usbhost/usbhost_cdcmbim.c index 005bbdee8d..8ce26bfb05 100644 --- a/drivers/usbhost/usbhost_cdcmbim.c +++ b/drivers/usbhost/usbhost_cdcmbim.c @@ -225,7 +225,7 @@ struct usbhost_cdcmbim_s uint16_t bulkmxpacket; /* Max packet size for Bulk OUT endpoint */ uint16_t ntbseq; /* NTB sequence number */ - struct pollfd *fds[CONFIG_USBHOST_CDCMBIM_NPOLLWAITERS]; + FAR struct pollfd *fds[CONFIG_USBHOST_CDCMBIM_NPOLLWAITERS]; /* Network device members */ @@ -268,10 +268,10 @@ static inline int usbhost_devinit(FAR struct usbhost_cdcmbim_s *priv); /* (Little Endian) Data helpers */ -static inline uint16_t usbhost_getle16(const uint8_t *val); -static inline void usbhost_putle16(uint8_t *dest, uint16_t val); -static inline uint32_t usbhost_getle32(const uint8_t *val); -static void usbhost_putle32(uint8_t *dest, uint32_t val); +static inline uint16_t usbhost_getle16(FAR const uint8_t *val); +static inline void usbhost_putle16(FAR uint8_t *dest, uint16_t val); +static inline uint32_t usbhost_getle32(FAR const FAR uint8_t *val); +static void usbhost_putle32(FAR uint8_t *dest, uint32_t val); /* Buffer memory management */ @@ -280,9 +280,9 @@ static void usbhost_free_buffers(FAR struct usbhost_cdcmbim_s *priv); /* struct usbhost_registry_s methods */ -static struct usbhost_class_s - *usbhost_create(FAR struct usbhost_hubport_s *hport, - FAR const struct usbhost_id_s *id); +static FAR struct usbhost_class_s * +usbhost_create(FAR struct usbhost_hubport_s *hport, + FAR const struct usbhost_id_s *id); /* struct usbhost_class_s methods */ @@ -301,16 +301,16 @@ static int cdcwdm_poll(FAR struct file *filep, FAR struct pollfd *fds, /* NuttX network callback functions */ -static int cdcmbim_ifup(struct net_driver_s *dev); -static int cdcmbim_ifdown(struct net_driver_s *dev); -static int cdcmbim_txavail(struct net_driver_s *dev); +static int cdcmbim_ifup(FAR struct net_driver_s *dev); +static int cdcmbim_ifdown(FAR struct net_driver_s *dev); +static int cdcmbim_txavail(FAR struct net_driver_s *dev); /* Network support functions */ -static void cdcmbim_receive(struct usbhost_cdcmbim_s *priv, uint8_t *buf, - size_t len); +static void cdcmbim_receive(FAR struct usbhost_cdcmbim_s *priv, + FAR uint8_t *buf, size_t len); -static int cdcmbim_txpoll(struct net_driver_s *dev); +static int cdcmbim_txpoll(FAR struct net_driver_s *dev); /**************************************************************************** * Private Data @@ -364,15 +364,16 @@ static uint32_t g_devinuse; static int usbhost_ctrl_cmd(FAR struct usbhost_cdcmbim_s *priv, uint8_t type, uint8_t req, uint16_t value, - uint16_t iface, uint8_t *payload, uint16_t len) + uint16_t iface, FAR uint8_t *payload, + uint16_t len) { FAR struct usbhost_hubport_s *hport; - struct usb_ctrlreq_s *ctrlreq; + FAR struct usb_ctrlreq_s *ctrlreq; int ret; hport = priv->usbclass.hport; - ctrlreq = (struct usb_ctrlreq_s *)priv->ctrlreq; + ctrlreq = (FAR struct usb_ctrlreq_s *)priv->ctrlreq; ctrlreq->type = type; ctrlreq->req = req; @@ -508,7 +509,7 @@ static ssize_t cdcwdm_write(FAR struct file *filep, FAR const char *buffer, USB_REQ_DIR_OUT | USB_REQ_TYPE_CLASS | USB_REQ_RECIPIENT_INTERFACE, USB_CDC_SEND_ENCAPSULATED_COMMAND, - 0, priv->ctrlif, (uint8_t *)buffer, buflen); + 0, priv->ctrlif, (FAR uint8_t *)buffer, buflen); nxmutex_unlock(&priv->lock); @@ -591,7 +592,7 @@ static int cdcwdm_poll(FAR struct file *filep, FAR struct pollfd *fds, { /* This is a request to tear down the poll. */ - struct pollfd **slot = (struct pollfd **)fds->priv; + FAR struct pollfd **slot = (FAR struct pollfd **)fds->priv; DEBUGASSERT(slot); /* Remove all memory of the poll setup */ @@ -710,7 +711,7 @@ static inline void usbhost_mkdevname(FAR struct usbhost_cdcmbim_s *priv, static void usbhost_bulkin_callback(FAR void *arg, ssize_t nbytes) { - struct usbhost_cdcmbim_s *priv = (struct usbhost_cdcmbim_s *)arg; + FAR struct usbhost_cdcmbim_s *priv = (FAR struct usbhost_cdcmbim_s *)arg; uint32_t delay = 0; DEBUGASSERT(priv); @@ -741,15 +742,15 @@ static void usbhost_bulkin_callback(FAR void *arg, ssize_t nbytes) static void usbhost_bulkin_work(FAR void *arg) { - struct usbhost_cdcmbim_s *priv; - struct usbhost_hubport_s *hport; - struct usb_cdc_ncm_nth16_s *nth; + FAR struct usbhost_cdcmbim_s *priv; + FAR struct usbhost_hubport_s *hport; + FAR struct usb_cdc_ncm_nth16_s *nth; uint16_t ndpoffset; uint16_t dgram_len; uint16_t dgram_off; uint16_t block_len; - priv = (struct usbhost_cdcmbim_s *)arg; + priv = (FAR struct usbhost_cdcmbim_s *)arg; DEBUGASSERT(priv); hport = priv->usbclass.hport; @@ -770,7 +771,7 @@ static void usbhost_bulkin_work(FAR void *arg) /* Parse the NTB header */ - nth = (struct usb_cdc_ncm_nth16_s *)priv->rxnetbuf; + nth = (FAR struct usb_cdc_ncm_nth16_s *)priv->rxnetbuf; if (usbhost_getle32(nth->signature) != USB_CDC_NCM_NTH16_SIGNATURE) { @@ -797,9 +798,9 @@ static void usbhost_bulkin_work(FAR void *arg) do { - struct usb_cdc_ncm_dpe16_s *dpe; - struct usb_cdc_ncm_ndp16_s *ndp - = (struct usb_cdc_ncm_ndp16_s *)(priv->rxnetbuf + ndpoffset); + FAR struct usb_cdc_ncm_dpe16_s *dpe; + FAR struct usb_cdc_ncm_ndp16_s *ndp + = (FAR struct usb_cdc_ncm_ndp16_s *)(priv->rxnetbuf + ndpoffset); ndpoffset = usbhost_getle16(ndp->next_ndp_index); @@ -820,7 +821,7 @@ static void usbhost_bulkin_work(FAR void *arg) out: DRVR_ASYNCH(hport->drvr, priv->bulkin, - (uint8_t *)priv->rxnetbuf, CDCMBIM_NETBUF_SIZE, + (FAR uint8_t *)priv->rxnetbuf, CDCMBIM_NETBUF_SIZE, usbhost_bulkin_callback, priv); nxmutex_unlock(&priv->lock); } @@ -853,7 +854,7 @@ static void usbhost_rxdata_work(FAR void *arg) }; FAR struct usbhost_cdcmbim_s *priv; - struct mbim_header_s *hdr; + FAR struct mbim_header_s *hdr; uint32_t len; int ret; @@ -881,7 +882,7 @@ static void usbhost_rxdata_work(FAR void *arg) goto errout; } - hdr = (struct mbim_header_s *)priv->comm_rxbuf; + hdr = (FAR struct mbim_header_s *)priv->comm_rxbuf; len = usbhost_getle32(hdr->len); if (len > priv->maxctrlsize) @@ -1168,9 +1169,9 @@ static int usbhost_cfgdesc(FAR struct usbhost_cdcmbim_s *priv, FAR struct usbhost_hubport_s *hport; FAR struct usb_cfgdesc_s *cfgdesc; FAR struct usb_desc_s *desc; - FAR struct usbhost_epdesc_s bindesc; - FAR struct usbhost_epdesc_s boutdesc; - FAR struct usbhost_epdesc_s iindesc; + struct usbhost_epdesc_s bindesc; + struct usbhost_epdesc_s boutdesc; + struct usbhost_epdesc_s iindesc; int remaining; uint8_t found = 0; int ret; @@ -1209,20 +1210,20 @@ static int usbhost_cfgdesc(FAR struct usbhost_cdcmbim_s *priv, { case USB_DESC_TYPE_CSINTERFACE: { - FAR struct usb_csifdesc_s *csdesc = (FAR struct usb_csifdesc_s *) - desc; + FAR struct usb_csifdesc_s *csdesc = + (FAR struct usb_csifdesc_s *)desc; /* MBIM functional descriptor */ if (csdesc->subtype == CDC_DSUBTYPE_MBIM) { FAR struct usb_mbim_desc_s *mbim = - (FAR struct usb_mbim_desc_s *)desc; + (FAR struct usb_mbim_desc_s *)desc; priv->maxctrlsize = usbhost_getle16(mbim->max_ctrl_message); uinfo("MBIM max control size: %u\n", priv->maxctrlsize); uinfo("MBIM max segment size: %u\n", - usbhost_getle16(mbim->max_segment_size)); + usbhost_getle16(mbim->max_segment_size)); } } break; @@ -1233,8 +1234,8 @@ static int usbhost_cfgdesc(FAR struct usbhost_cdcmbim_s *priv, case USB_DESC_TYPE_INTERFACE: { - FAR struct usb_ifdesc_s *ifdesc = (FAR struct usb_ifdesc_s *) - configdesc; + FAR struct usb_ifdesc_s *ifdesc = + (FAR struct usb_ifdesc_s *)configdesc; uinfo("Interface descriptor\n"); DEBUGASSERT(remaining >= USB_SIZEOF_IFDESC); @@ -1267,8 +1268,8 @@ static int usbhost_cfgdesc(FAR struct usbhost_cdcmbim_s *priv, case USB_DESC_TYPE_ENDPOINT: { - FAR struct usb_epdesc_s *epdesc = (FAR struct usb_epdesc_s *) - configdesc; + FAR struct usb_epdesc_s *epdesc = + (FAR struct usb_epdesc_s *)configdesc; uinfo("Endpoint descriptor\n"); DEBUGASSERT(remaining >= USB_SIZEOF_EPDESC); @@ -1479,7 +1480,7 @@ static int cdc_ncm_read_parameters(FAR struct usbhost_cdcmbim_s *priv) USB_REQ_DIR_IN | USB_REQ_TYPE_CLASS | USB_REQ_RECIPIENT_INTERFACE, USB_CDC_GET_NTB_PARAMETERS, - 0, priv->ctrlif, (uint8_t *)¶ms, + 0, priv->ctrlif, (FAR uint8_t *)¶ms, sizeof(params)); if (ret == OK) { @@ -1556,7 +1557,7 @@ static inline int usbhost_devinit(FAR struct usbhost_cdcmbim_s *priv) printf("set NTB input size failed: %d\n", ret); } - #if 0 +#if 0 /* Set max datagram size to MTU */ ret = cdc_ncm_set_max_dgram_size(priv, 2048); @@ -1564,7 +1565,7 @@ static inline int usbhost_devinit(FAR struct usbhost_cdcmbim_s *priv) { printf("Failed to set max dgram size: %d\n", ret); } - #endif +#endif /* Register the driver */ @@ -1656,7 +1657,7 @@ static inline int usbhost_devinit(FAR struct usbhost_cdcmbim_s *priv) * ****************************************************************************/ -static inline uint16_t usbhost_getle16(const uint8_t *val) +static inline uint16_t usbhost_getle16(FAR const uint8_t *val) { return (uint16_t)val[1] << 8 | (uint16_t)val[0]; } @@ -1676,7 +1677,7 @@ static inline uint16_t usbhost_getle16(const uint8_t *val) * ****************************************************************************/ -static void usbhost_putle16(uint8_t *dest, uint16_t val) +static void usbhost_putle16(FAR uint8_t *dest, uint16_t val) { dest[0] = val & 0xff; /* Little endian means LS byte first in byte stream */ dest[1] = val >> 8; @@ -1697,12 +1698,12 @@ static void usbhost_putle16(uint8_t *dest, uint16_t val) * ****************************************************************************/ -static inline uint32_t usbhost_getle32(const uint8_t *val) +static inline uint32_t usbhost_getle32(FAR const uint8_t *val) { /* Little endian means LS halfword first in byte stream */ return (uint32_t)usbhost_getle16(&val[2]) << 16 | - (uint32_t)usbhost_getle16(val); + (uint32_t)usbhost_getle16(val); } /**************************************************************************** @@ -1720,7 +1721,7 @@ static inline uint32_t usbhost_getle32(const uint8_t *val) * ****************************************************************************/ -static void usbhost_putle32(uint8_t *dest, uint32_t val) +static void usbhost_putle32(FAR uint8_t *dest, uint32_t val) { /* Little endian means LS halfword first in byte stream */ @@ -1890,9 +1891,9 @@ static void usbhost_free_buffers(FAR struct usbhost_cdcmbim_s *priv) * ****************************************************************************/ -static FAR struct usbhost_class_s - *usbhost_create(FAR struct usbhost_hubport_s *hport, - FAR const struct usbhost_id_s *id) +static FAR struct usbhost_class_s * +usbhost_create(FAR struct usbhost_hubport_s *hport, + FAR const struct usbhost_id_s *id) { FAR struct usbhost_cdcmbim_s *priv; @@ -1979,8 +1980,8 @@ static FAR struct usbhost_class_s static int usbhost_connect(FAR struct usbhost_class_s *usbclass, FAR const uint8_t *configdesc, int desclen) { - FAR struct usbhost_cdcmbim_s *priv = (FAR struct usbhost_cdcmbim_s *) - usbclass; + FAR struct usbhost_cdcmbim_s *priv = + (FAR struct usbhost_cdcmbim_s *)usbclass; int ret; DEBUGASSERT(priv != NULL && @@ -2030,10 +2031,10 @@ static int usbhost_connect(FAR struct usbhost_class_s *usbclass, * ****************************************************************************/ -static int usbhost_disconnected(struct usbhost_class_s *usbclass) +static int usbhost_disconnected(FAR struct usbhost_class_s *usbclass) { - FAR struct usbhost_cdcmbim_s *priv = (FAR struct usbhost_cdcmbim_s *) - usbclass; + FAR struct usbhost_cdcmbim_s *priv = + (FAR struct usbhost_cdcmbim_s *)usbclass; irqstate_t flags; DEBUGASSERT(priv != NULL); @@ -2099,12 +2100,12 @@ static int usbhost_disconnected(struct usbhost_class_s *usbclass) * ****************************************************************************/ -static int cdcmbim_transmit(struct usbhost_cdcmbim_s *priv) +static int cdcmbim_transmit(FAR struct usbhost_cdcmbim_s *priv) { - struct usbhost_hubport_s *hport; - struct usb_cdc_ncm_nth16_s *nth; - struct usb_cdc_ncm_ndp16_s *ndp; - struct usb_cdc_ncm_dpe16_s *dpe; + FAR struct usbhost_hubport_s *hport; + FAR struct usb_cdc_ncm_nth16_s *nth; + FAR struct usb_cdc_ncm_ndp16_s *ndp; + FAR struct usb_cdc_ncm_dpe16_s *dpe; ssize_t ret; uint16_t len = 0; @@ -2117,7 +2118,7 @@ static int cdcmbim_transmit(struct usbhost_cdcmbim_s *priv) NETDEV_TXPACKETS(&priv->netdev); len = sizeof(struct usb_cdc_ncm_nth16_s); - nth = (struct usb_cdc_ncm_nth16_s *)priv->txnetbuf; + nth = (FAR struct usb_cdc_ncm_nth16_s *)priv->txnetbuf; /* Begin filling NTH */ @@ -2192,8 +2193,8 @@ static int cdcmbim_transmit(struct usbhost_cdcmbim_s *priv) * ****************************************************************************/ -static void cdcmbim_receive(struct usbhost_cdcmbim_s *priv, - uint8_t *buf, size_t len) +static void cdcmbim_receive(FAR struct usbhost_cdcmbim_s *priv, + FAR uint8_t *buf, size_t len) { uinfo("received packet: %d len\n", len); @@ -2263,10 +2264,10 @@ static void cdcmbim_receive(struct usbhost_cdcmbim_s *priv, * ****************************************************************************/ -static int cdcmbim_txpoll(struct net_driver_s *dev) +static int cdcmbim_txpoll(FAR struct net_driver_s *dev) { - struct usbhost_cdcmbim_s *priv = (struct usbhost_cdcmbim_s *) - dev->d_private; + FAR struct usbhost_cdcmbim_s *priv = + (FAR struct usbhost_cdcmbim_s *)dev->d_private; /* If the polling resulted in data that should be sent out on the network, * the field d_len is set to a value > 0. @@ -2302,11 +2303,11 @@ static int cdcmbim_txpoll(struct net_driver_s *dev) * ****************************************************************************/ -static int cdcmbim_ifup(struct net_driver_s *dev) +static int cdcmbim_ifup(FAR struct net_driver_s *dev) { - struct usbhost_cdcmbim_s *priv = (struct usbhost_cdcmbim_s *) - dev->d_private; - struct usbhost_hubport_s *hport = priv->usbclass.hport; + FAR struct usbhost_cdcmbim_s *priv = + (FAR struct usbhost_cdcmbim_s *)dev->d_private; + FAR struct usbhost_hubport_s *hport = priv->usbclass.hport; int ret; #ifdef CONFIG_NET_IPv4 @@ -2354,10 +2355,10 @@ static int cdcmbim_ifup(struct net_driver_s *dev) * ****************************************************************************/ -static int cdcmbim_ifdown(struct net_driver_s *dev) +static int cdcmbim_ifdown(FAR struct net_driver_s *dev) { - struct usbhost_cdcmbim_s *priv = (struct usbhost_cdcmbim_s *) - dev->d_private; + FAR struct usbhost_cdcmbim_s *priv = + (FAR struct usbhost_cdcmbim_s *)dev->d_private; irqstate_t flags; flags = enter_critical_section(); @@ -2389,9 +2390,9 @@ static int cdcmbim_ifdown(struct net_driver_s *dev) * ****************************************************************************/ -static void cdcmbim_txavail_work(void *arg) +static void cdcmbim_txavail_work(FAR void *arg) { - struct usbhost_cdcmbim_s *priv = (struct usbhost_cdcmbim_s *)arg; + FAR struct usbhost_cdcmbim_s *priv = (FAR struct usbhost_cdcmbim_s *)arg; net_lock(); @@ -2424,10 +2425,10 @@ static void cdcmbim_txavail_work(void *arg) * ****************************************************************************/ -static int cdcmbim_txavail(struct net_driver_s *dev) +static int cdcmbim_txavail(FAR struct net_driver_s *dev) { - struct usbhost_cdcmbim_s *priv = (struct usbhost_cdcmbim_s *) - dev->d_private; + FAR struct usbhost_cdcmbim_s *priv = + (FAR struct usbhost_cdcmbim_s *)dev->d_private; if (work_available(&priv->txpollwork)) { diff --git a/drivers/usbhost/usbhost_hidkbd.c b/drivers/usbhost/usbhost_hidkbd.c index b0a6f9d251..f3f9725e84 100644 --- a/drivers/usbhost/usbhost_hidkbd.c +++ b/drivers/usbhost/usbhost_hidkbd.c @@ -215,7 +215,7 @@ struct usbhost_state_s * retained in the f_priv field of the 'struct file'. */ - struct pollfd *fds[CONFIG_HIDKBD_NPOLLWAITERS]; + FAR struct pollfd *fds[CONFIG_HIDKBD_NPOLLWAITERS]; /* Buffer used to collect and buffer incoming keyboard characters */ @@ -280,7 +280,7 @@ static inline void usbhost_encodescancode(FAR struct usbhost_state_s *priv, uint8_t scancode, uint8_t modifier); #endif -static int usbhost_kbdpoll(int argc, char *argv[]); +static int usbhost_kbdpoll(int argc, FAR char *argv[]); #ifdef CONFIG_HIDKBD_NOGETREPORT static void usbhost_kbd_work(FAR void *arg); @@ -291,7 +291,8 @@ static int usbhost_extract_keys(FAR struct usbhost_state_s *priv); static int usbhost_send_request(FAR struct usbhost_state_s *priv, uint8_t dir, uint8_t req, uint16_t value, - uint16_t index, uint16_t len, uint8_t *data); + uint16_t index, uint16_t len, + FAR uint8_t *data); static inline bool usbhost_get_capslock(void); static inline void usbhost_toggle_capslock(void); @@ -305,8 +306,8 @@ static inline int usbhost_devinit(FAR struct usbhost_state_s *priv); /* (Little Endian) Data helpers */ -static inline uint16_t usbhost_getle16(const uint8_t *val); -static inline void usbhost_putle16(uint8_t *dest, uint16_t val); +static inline uint16_t usbhost_getle16(FAR const uint8_t *val); +static inline void usbhost_putle16(FAR uint8_t *dest, uint16_t val); /* Transfer descriptor memory management */ @@ -1365,7 +1366,7 @@ static void usbhost_kbd_callback(FAR void *arg, ssize_t nbytes) * ****************************************************************************/ -static int usbhost_kbdpoll(int argc, char *argv[]) +static int usbhost_kbdpoll(int argc, FAR char *argv[]) { FAR struct usbhost_state_s *priv; irqstate_t flags; @@ -2035,7 +2036,7 @@ errout: * ****************************************************************************/ -static inline uint16_t usbhost_getle16(const uint8_t *val) +static inline uint16_t usbhost_getle16(FAR const uint8_t *val) { return (uint16_t)val[1] << 8 | (uint16_t)val[0]; } @@ -2055,7 +2056,7 @@ static inline uint16_t usbhost_getle16(const uint8_t *val) * ****************************************************************************/ -static void usbhost_putle16(uint8_t *dest, uint16_t val) +static void usbhost_putle16(FAR uint8_t *dest, uint16_t val) { dest[0] = val & 0xff; /* Little endian means LS byte first in byte stream */ dest[1] = val >> 8; @@ -2207,7 +2208,7 @@ static int usbhost_send_request(FAR struct usbhost_state_s *priv, uint16_t value, uint16_t index, uint16_t len, - uint8_t *data) + FAR uint8_t *data) { FAR struct usbhost_hubport_s *hport; int ret = OK; @@ -2852,7 +2853,7 @@ static int usbhost_poll(FAR struct file *filep, FAR struct pollfd *fds, { /* This is a request to tear down the poll. */ - struct pollfd **slot = (struct pollfd **)fds->priv; + FAR struct pollfd **slot = (FAR struct pollfd **)fds->priv; DEBUGASSERT(slot); /* Remove all memory of the poll setup */ diff --git a/drivers/usbhost/usbhost_hidmouse.c b/drivers/usbhost/usbhost_hidmouse.c index 6b6f824cd8..3886f926f9 100644 --- a/drivers/usbhost/usbhost_hidmouse.c +++ b/drivers/usbhost/usbhost_hidmouse.c @@ -242,7 +242,7 @@ struct usbhost_state_s * bound to this class instance */ - struct usbhost_driver_s *drvr; + FAR struct usbhost_driver_s *drvr; /* The remainder of the fields are provide o the mouse class driver */ @@ -280,7 +280,7 @@ struct usbhost_state_s * retained in the f_priv field of the 'struct file'. */ - struct pollfd *fds[CONFIG_HIDMOUSE_NPOLLWAITERS]; + FAR struct pollfd *fds[CONFIG_HIDMOUSE_NPOLLWAITERS]; }; /**************************************************************************** @@ -310,7 +310,7 @@ static bool usbhost_touchscreen(FAR struct usbhost_state_s *priv, FAR struct usbhid_mousereport_s *rpt); #endif static bool usbhost_threshold(FAR struct usbhost_state_s *priv); -static int usbhost_mouse_poll(int argc, char *argv[]); +static int usbhost_mouse_poll(int argc, FAR char *argv[]); static int usbhost_sample(FAR struct usbhost_state_s *priv, FAR struct mouse_sample_s *sample); static int usbhost_waitsample(FAR struct usbhost_state_s *priv, @@ -939,7 +939,7 @@ static bool usbhost_threshold(FAR struct usbhost_state_s *priv) * ****************************************************************************/ -static int usbhost_mouse_poll(int argc, char *argv[]) +static int usbhost_mouse_poll(int argc, FAR char *argv[]) { FAR struct usbhost_state_s *priv; FAR struct usbhost_hubport_s *hport; @@ -2384,7 +2384,7 @@ static int usbhost_poll(FAR struct file *filep, FAR struct pollfd *fds, { /* This is a request to tear down the poll. */ - struct pollfd **slot = (struct pollfd **)fds->priv; + FAR struct pollfd **slot = (FAR struct pollfd **)fds->priv; DEBUGASSERT(slot); /* Remove all memory of the poll setup */ diff --git a/drivers/usbhost/usbhost_xboxcontroller.c b/drivers/usbhost/usbhost_xboxcontroller.c index cc89ce1cec..1e1883b1ac 100644 --- a/drivers/usbhost/usbhost_xboxcontroller.c +++ b/drivers/usbhost/usbhost_xboxcontroller.c @@ -176,7 +176,7 @@ struct usbhost_state_s * retained in the f_priv field of the 'struct file'. */ - struct pollfd *fds[CONFIG_XBOXCONTROLLER_NPOLLWAITERS]; + FAR struct pollfd *fds[CONFIG_XBOXCONTROLLER_NPOLLWAITERS]; }; /**************************************************************************** @@ -202,7 +202,7 @@ static void usbhost_destroy(FAR void *arg); /* Polling support */ static void usbhost_pollnotify(FAR struct usbhost_state_s *dev); -static int usbhost_xboxcontroller_poll(int argc, char *argv[]); +static int usbhost_xboxcontroller_poll(int argc, FAR char *argv[]); /* Helpers for usbhost_connect() */ @@ -213,8 +213,8 @@ static inline int usbhost_devinit(FAR struct usbhost_state_s *priv); /* (Little Endian) Data helpers */ -static inline uint16_t usbhost_getle16(const uint8_t *val); -static inline void usbhost_putle16(uint8_t *dest, uint16_t val); +static inline uint16_t usbhost_getle16(FAR const uint8_t *val); +static inline void usbhost_putle16(FAR uint8_t *dest, uint16_t val); /* Transfer descriptor memory management */ @@ -540,7 +540,7 @@ static void usbhost_pollnotify(FAR struct usbhost_state_s *priv) * ****************************************************************************/ -static int usbhost_xboxcontroller_poll(int argc, char *argv[]) +static int usbhost_xboxcontroller_poll(int argc, FAR char *argv[]) { FAR struct usbhost_state_s *priv; FAR struct usbhost_hubport_s *hport; @@ -791,18 +791,18 @@ static int usbhost_xboxcontroller_poll(int argc, char *argv[]) XBOX_BUTTON_STICK_RIGHT_INDEX, XBOX_BUTTON_STICK_RIGHT_MASK); - priv->rpt.trigger_left = - ((int16_t *)(priv->tbuffer))[XBOX_BUTTON_TRIGGER_LEFT]; - priv->rpt.trigger_right = - ((int16_t *)(priv->tbuffer))[XBOX_BUTTON_TRIGGER_RIGHT]; - priv->rpt.stick_left_x = - ((int16_t *)(priv->tbuffer))[XBOX_BUTTON_STICK_LEFT_X]; - priv->rpt.stick_left_y = - ((int16_t *)(priv->tbuffer))[XBOX_BUTTON_STICK_LEFT_Y]; - priv->rpt.stick_right_x = - ((int16_t *)(priv->tbuffer))[XBOX_BUTTON_STICK_RIGHT_X]; - priv->rpt.stick_right_y = - ((int16_t *)(priv->tbuffer))[XBOX_BUTTON_STICK_RIGHT_Y]; + priv->rpt.trigger_left = ((FAR int16_t *) + (priv->tbuffer))[XBOX_BUTTON_TRIGGER_LEFT]; + priv->rpt.trigger_right = ((FAR int16_t *) + (priv->tbuffer))[XBOX_BUTTON_TRIGGER_RIGHT]; + priv->rpt.stick_left_x = ((FAR int16_t *) + (priv->tbuffer))[XBOX_BUTTON_STICK_LEFT_X]; + priv->rpt.stick_left_y = ((FAR int16_t *) + (priv->tbuffer))[XBOX_BUTTON_STICK_LEFT_Y]; + priv->rpt.stick_right_x = ((FAR int16_t *) + (priv->tbuffer))[XBOX_BUTTON_STICK_RIGHT_X]; + priv->rpt.stick_right_y = ((FAR int16_t *) + (priv->tbuffer))[XBOX_BUTTON_STICK_RIGHT_Y]; priv->valid = true; @@ -1381,7 +1381,7 @@ errout: * ****************************************************************************/ -static inline uint16_t usbhost_getle16(const uint8_t *val) +static inline uint16_t usbhost_getle16(FAR const uint8_t *val) { return (uint16_t)val[1] << 8 | (uint16_t)val[0]; } @@ -1401,7 +1401,7 @@ static inline uint16_t usbhost_getle16(const uint8_t *val) * ****************************************************************************/ -static void usbhost_putle16(uint8_t *dest, uint16_t val) +static void usbhost_putle16(FAR uint8_t *dest, uint16_t val) { dest[0] = val & 0xff; /* Little endian means LS byte first in byte stream */ dest[1] = val >> 8; diff --git a/drivers/usbmisc/fusb301.c b/drivers/usbmisc/fusb301.c index 7aaec7274c..df5dd950cf 100644 --- a/drivers/usbmisc/fusb301.c +++ b/drivers/usbmisc/fusb301.c @@ -587,7 +587,7 @@ static int fusb301_ioctl(FAR struct file *filep, int cmd, unsigned long arg) { case USBCIOC_READ_DEVID: { - ret = fusb301_read_device_id(priv, (uint8_t *)arg); + ret = fusb301_read_device_id(priv, (FAR uint8_t *)arg); } break; @@ -611,13 +611,13 @@ static int fusb301_ioctl(FAR struct file *filep, int cmd, unsigned long arg) case USBCIOC_READ_STATUS: { - ret = fusb301_read_status(priv, (uint8_t *)arg); + ret = fusb301_read_status(priv, (FAR uint8_t *)arg); } break; case USBCIOC_READ_DEVTYPE: { - ret = fusb301_read_devtype(priv, (uint8_t *)arg); + ret = fusb301_read_devtype(priv, (FAR uint8_t *)arg); } break; @@ -714,7 +714,7 @@ static int fusb301_poll(FAR struct file *filep, { /* This is a request to tear down the poll. */ - struct pollfd **slot = (struct pollfd **)fds->priv; + FAR struct pollfd **slot = (FAR struct pollfd **)fds->priv; DEBUGASSERT(slot != NULL); /* Remove all memory of the poll setup */ diff --git a/drivers/usbmisc/fusb302.c b/drivers/usbmisc/fusb302.c index dec50015b0..9cd65f38d3 100644 --- a/drivers/usbmisc/fusb302.c +++ b/drivers/usbmisc/fusb302.c @@ -803,7 +803,9 @@ static void fusb302_worker(FAR void *arg) nxmutex_lock(&priv->devlock); - if (!priv->int_pending) /* just to double check we really should be here */ + /* just to double check we really should be here */ + + if (!priv->int_pending) { fusb302_err("ERROR: worker task run with no interrupt\n"); goto error_exit; @@ -1703,7 +1705,7 @@ static int fusb302_ioctl(FAR struct file *filep, int cmd, unsigned long arg) { case USBCIOC_READ_DEVID: { - ret = fusb302_read_device_id(priv, (uint8_t *)arg); + ret = fusb302_read_device_id(priv, (FAR uint8_t *)arg); } break; @@ -1720,7 +1722,7 @@ static int fusb302_ioctl(FAR struct file *filep, int cmd, unsigned long arg) break; case USBCIOC_READ_STATUS: { - ret = fusb302_read_status(priv, (uint8_t *)arg); + ret = fusb302_read_status(priv, (FAR uint8_t *)arg); } break; @@ -1811,7 +1813,7 @@ static int fusb302_poll(FAR struct file *filep, { /* This is a request to tear down the poll. */ - struct pollfd **slot = (struct pollfd **)fds->priv; + FAR struct pollfd **slot = (FAR struct pollfd **)fds->priv; DEBUGASSERT(slot != NULL); /* Remove all memory of the poll setup */ diff --git a/drivers/usbmisc/fusb303.c b/drivers/usbmisc/fusb303.c index 5c529b56b4..7bb456282d 100644 --- a/drivers/usbmisc/fusb303.c +++ b/drivers/usbmisc/fusb303.c @@ -774,7 +774,7 @@ static int fusb303_ioctl(FAR struct file *filep, int cmd, unsigned long arg) { case USBCIOC_READ_DEVID: { - ret = fusb303_read_device_id(priv, (uint8_t *)arg, NULL); + ret = fusb303_read_device_id(priv, (FAR uint8_t *)arg, NULL); } break; @@ -798,13 +798,13 @@ static int fusb303_ioctl(FAR struct file *filep, int cmd, unsigned long arg) case USBCIOC_READ_STATUS: { - ret = fusb303_read_status(priv, (uint8_t *)arg); + ret = fusb303_read_status(priv, (FAR uint8_t *)arg); } break; case USBCIOC_READ_DEVTYPE: { - ret = fusb303_read_devtype(priv, (uint8_t *)arg); + ret = fusb303_read_devtype(priv, (FAR uint8_t *)arg); } break; @@ -902,7 +902,7 @@ static int fusb303_poll(FAR struct file *filep, FAR struct pollfd *fds, { /* This is a request to tear down the poll. */ - struct pollfd **slot = (struct pollfd **)fds->priv; + FAR struct pollfd **slot = (FAR struct pollfd **)fds->priv; DEBUGASSERT(slot != NULL); /* Remove all memory of the poll setup */ diff --git a/drivers/usbmonitor/usbmonitor.c b/drivers/usbmonitor/usbmonitor.c index 421a518172..a15fddae6b 100644 --- a/drivers/usbmonitor/usbmonitor.c +++ b/drivers/usbmonitor/usbmonitor.c @@ -144,7 +144,7 @@ static int usbmonitor_tracecallback(struct usbtrace_s *trace, void *arg) } #endif -static int usbmonitor_daemon(int argc, char **argv) +static int usbmonitor_daemon(int argc, FAR char **argv) { uinfo("Running: %d\n", g_usbmonitor.pid); diff --git a/drivers/video/goldfish_fb.c b/drivers/video/goldfish_fb.c index efb4a66d73..eee45a2eb4 100644 --- a/drivers/video/goldfish_fb.c +++ b/drivers/video/goldfish_fb.c @@ -33,11 +33,11 @@ ****************************************************************************/ #ifndef putreg32 -#define putreg32(v, x) (*(volatile uint32_t *)(x) = (v)) +#define putreg32(v, x) (*(FAR volatile uint32_t *)(x) = (v)) #endif #ifndef getreg32 -#define getreg32(x) (*(uint32_t *)(x)) +#define getreg32(x) (*(FAR volatile uint32_t *)(x)) #endif /**************************************************************************** diff --git a/drivers/video/v4l2_cap.c b/drivers/video/v4l2_cap.c index af002cc9d8..3c938c788e 100644 --- a/drivers/video/v4l2_cap.c +++ b/drivers/video/v4l2_cap.c @@ -126,7 +126,7 @@ struct capture_scene_params_s int32_t blue; int32_t gamma; uint32_t gamma_curve_sz; - uint8_t *gamma_curve; + FAR uint8_t *gamma_curve; int32_t ev; bool hflip_video; bool vflip_video; @@ -159,7 +159,7 @@ typedef struct capture_scene_params_s capture_scene_params_t; struct capture_parameter_name_s { uint32_t id; - const char *name; + FAR const char *name; }; typedef struct capture_parameter_name_s capture_parameter_name_t; diff --git a/drivers/wireless/bluetooth/bt_uart.c b/drivers/wireless/bluetooth/bt_uart.c index b56be92dbd..4b0a87e9bd 100644 --- a/drivers/wireless/bluetooth/bt_uart.c +++ b/drivers/wireless/bluetooth/bt_uart.c @@ -150,7 +150,7 @@ static void btuart_rxwork(FAR void *arg) goto errout_with_busy; } - hdr = (void *)(data + H4_HEADER_SIZE); + hdr = (FAR void *)(data + H4_HEADER_SIZE); if (data[0] == H4_EVT) { diff --git a/drivers/wireless/cc1101.c b/drivers/wireless/cc1101.c index c5d29a53b3..0a1e0da7aa 100644 --- a/drivers/wireless/cc1101.c +++ b/drivers/wireless/cc1101.c @@ -932,7 +932,7 @@ void cc1101_setpacketctrl(struct cc1101_dev_s *dev) * ****************************************************************************/ -FAR int cc1101_init2(FAR struct cc1101_dev_s *dev) +int cc1101_init2(FAR struct cc1101_dev_s *dev) { int ret; diff --git a/drivers/wireless/ieee80211/bcm43xxx/bcmf_cdc.c b/drivers/wireless/ieee80211/bcm43xxx/bcmf_cdc.c index 7655eea3ee..f4c3ad292d 100644 --- a/drivers/wireless/ieee80211/bcm43xxx/bcmf_cdc.c +++ b/drivers/wireless/ieee80211/bcm43xxx/bcmf_cdc.c @@ -66,32 +66,36 @@ begin_packed_struct struct bcmf_cdc_header * Private Function Prototypes ****************************************************************************/ -static struct bcmf_frame_s *bcmf_cdc_allocate_frame( - FAR struct bcmf_dev_s *priv, char *name, - uint8_t *data, uint32_t len); +static FAR struct bcmf_frame_s *bcmf_cdc_allocate_frame( + FAR struct bcmf_dev_s *priv, FAR char *name, + FAR uint8_t *data, uint32_t len); static int bcmf_cdc_sendframe(FAR struct bcmf_dev_s *priv, uint32_t cmd, - int ifidx, bool set, struct bcmf_frame_s *frame); + int ifidx, bool set, + FAR struct bcmf_frame_s *frame); static int bcmf_cdc_control_request(FAR struct bcmf_dev_s *priv, - uint32_t ifidx, bool set, uint32_t cmd, - char *name, uint8_t *data, uint32_t *len); + uint32_t ifidx, bool set, uint32_t cmd, + FAR char *name, FAR uint8_t *data, + FAR uint32_t *len); static int bcmf_cdc_control_request_unsafe(FAR struct bcmf_dev_s *priv, - uint32_t ifidx, bool set, uint32_t cmd, - char *name, uint8_t *data, uint32_t *len); + uint32_t ifidx, bool set, + uint32_t cmd, FAR char *name, + FAR uint8_t *data, + FAR uint32_t *len); /**************************************************************************** * Private Functions ****************************************************************************/ -struct bcmf_frame_s *bcmf_cdc_allocate_frame(FAR struct bcmf_dev_s *priv, - char *name, uint8_t *data, - uint32_t len) +static FAR struct bcmf_frame_s * +bcmf_cdc_allocate_frame(FAR struct bcmf_dev_s *priv, FAR char *name, + FAR uint8_t *data, uint32_t len) { uint32_t data_len; uint16_t name_len; - struct bcmf_frame_s *frame; + FAR struct bcmf_frame_s *frame; if (name) { @@ -132,10 +136,10 @@ struct bcmf_frame_s *bcmf_cdc_allocate_frame(FAR struct bcmf_dev_s *priv, } int bcmf_cdc_sendframe(FAR struct bcmf_dev_s *priv, uint32_t cmd, - int ifidx, bool set, struct bcmf_frame_s *frame) + int ifidx, bool set, FAR struct bcmf_frame_s *frame) { - struct bcmf_cdc_header *header = - (struct bcmf_cdc_header *)frame->data; + FAR struct bcmf_cdc_header *header = + (FAR struct bcmf_cdc_header *)frame->data; uint32_t cdc_data_len; /* Setup control frame header */ @@ -159,8 +163,9 @@ int bcmf_cdc_sendframe(FAR struct bcmf_dev_s *priv, uint32_t cmd, } int bcmf_cdc_control_request(FAR struct bcmf_dev_s *priv, - uint32_t ifidx, bool set, uint32_t cmd, - char *name, uint8_t *data, uint32_t *len) + uint32_t ifidx, bool set, uint32_t cmd, + FAR char *name, FAR uint8_t *data, + FAR uint32_t *len) { int ret; @@ -179,11 +184,12 @@ int bcmf_cdc_control_request(FAR struct bcmf_dev_s *priv, } int bcmf_cdc_control_request_unsafe(FAR struct bcmf_dev_s *priv, - uint32_t ifidx, bool set, uint32_t cmd, - char *name, uint8_t *data, uint32_t *len) + uint32_t ifidx, bool set, uint32_t cmd, + FAR char *name, FAR uint8_t *data, + FAR uint32_t *len) { int ret; - struct bcmf_frame_s *frame; + FAR struct bcmf_frame_s *frame; uint32_t out_len = *len; *len = 0; @@ -263,8 +269,8 @@ int bcmf_cdc_control_request_unsafe(FAR struct bcmf_dev_s *priv, ****************************************************************************/ int bcmf_cdc_iovar_request(FAR struct bcmf_dev_s *priv, - uint32_t ifidx, bool set, char *name, - uint8_t *data, uint32_t *len) + uint32_t ifidx, bool set, FAR char *name, + FAR uint8_t *data, FAR uint32_t *len) { return bcmf_cdc_control_request(priv, ifidx, set, set ? WLC_SET_VAR : WLC_GET_VAR, name, @@ -272,17 +278,16 @@ int bcmf_cdc_iovar_request(FAR struct bcmf_dev_s *priv, } int bcmf_cdc_iovar_request_unsafe(FAR struct bcmf_dev_s *priv, - uint32_t ifidx, bool set, char *name, - uint8_t *data, uint32_t *len) + uint32_t ifidx, bool set, FAR char *name, + FAR uint8_t *data, FAR uint32_t *len) { return bcmf_cdc_control_request_unsafe(priv, ifidx, set, - set ? WLC_SET_VAR : WLC_GET_VAR, name, - data, len); + set ? WLC_SET_VAR : WLC_GET_VAR, + name, data, len); } -int bcmf_cdc_ioctl(FAR struct bcmf_dev_s *priv, - uint32_t ifidx, bool set, uint32_t cmd, - uint8_t *data, uint32_t *len) +int bcmf_cdc_ioctl(FAR struct bcmf_dev_s *priv, uint32_t ifidx, bool set, + uint32_t cmd, FAR uint8_t *data, FAR uint32_t *len) { return bcmf_cdc_control_request(priv, ifidx, set, cmd, NULL, data, len); } @@ -292,10 +297,10 @@ int bcmf_cdc_ioctl(FAR struct bcmf_dev_s *priv, ****************************************************************************/ int bcmf_cdc_process_control_frame(FAR struct bcmf_dev_s *priv, - struct bcmf_frame_s *frame) + FAR struct bcmf_frame_s *frame) { unsigned int data_size; - struct bcmf_cdc_header *cdc_header; + FAR struct bcmf_cdc_header *cdc_header; /* Check frame */ @@ -307,7 +312,7 @@ int bcmf_cdc_process_control_frame(FAR struct bcmf_dev_s *priv, return -EINVAL; } - cdc_header = (struct bcmf_cdc_header *)frame->data; + cdc_header = (FAR struct bcmf_cdc_header *)frame->data; if (data_size < cdc_header->len || data_size < sizeof(struct bcmf_cdc_header) + cdc_header->len) @@ -333,7 +338,7 @@ int bcmf_cdc_process_control_frame(FAR struct bcmf_dev_s *priv, priv->control_rxdata_len = cdc_header->len; } - memcpy(priv->control_rxdata, (uint8_t *)&cdc_header[1], + memcpy(priv->control_rxdata, (FAR uint8_t *)&cdc_header[1], priv->control_rxdata_len); } diff --git a/drivers/wireless/ieee80211/bcm43xxx/bcmf_cdc.h b/drivers/wireless/ieee80211/bcm43xxx/bcmf_cdc.h index 5e835b24b5..0624a9cacd 100644 --- a/drivers/wireless/ieee80211/bcm43xxx/bcmf_cdc.h +++ b/drivers/wireless/ieee80211/bcm43xxx/bcmf_cdc.h @@ -36,21 +36,21 @@ /* Send safe cdc request */ int bcmf_cdc_iovar_request(FAR struct bcmf_dev_s *priv, - uint32_t ifidx, bool set, char *name, - uint8_t *data, uint32_t *len); + uint32_t ifidx, bool set, FAR char *name, + FAR uint8_t *data, FAR uint32_t *len); int bcmf_cdc_ioctl(FAR struct bcmf_dev_s *priv, uint32_t ifidx, bool set, - uint32_t cmd, uint8_t *data, uint32_t *len); + uint32_t cmd, FAR uint8_t *data, FAR uint32_t *len); /* Send cdc request without locking control_mutex */ int bcmf_cdc_iovar_request_unsafe(FAR struct bcmf_dev_s *priv, - uint32_t ifidx, bool set, char *name, - uint8_t *data, uint32_t *len); + uint32_t ifidx, bool set, FAR char *name, + FAR uint8_t *data, FAR uint32_t *len); /* Callback used by bus layer to notify cdc response frame is available */ int bcmf_cdc_process_control_frame(FAR struct bcmf_dev_s *priv, - struct bcmf_frame_s *frame); + FAR struct bcmf_frame_s *frame); #endif /* __DRIVERS_WIRELESS_IEEE80211_BCM43XXX_BCMF_CDC_H */ diff --git a/drivers/wireless/ieee80211/bcm43xxx/bcmf_core.h b/drivers/wireless/ieee80211/bcm43xxx/bcmf_core.h index e891117dba..c6377ab192 100644 --- a/drivers/wireless/ieee80211/bcm43xxx/bcmf_core.h +++ b/drivers/wireless/ieee80211/bcm43xxx/bcmf_core.h @@ -66,7 +66,7 @@ static inline int bcmf_read_sbregw(FAR bcmf_interface_dev_t *ibus, uint32_t address, void *value) { - return bcmf_read_sbreg(ibus, address, (uint8_t *)value, 4); + return bcmf_read_sbreg(ibus, address, (FAR uint8_t *)value, 4); } static inline int bcmf_write_sbregb(FAR bcmf_interface_dev_t *ibus, @@ -78,7 +78,7 @@ static inline int bcmf_write_sbregb(FAR bcmf_interface_dev_t *ibus, static inline int bcmf_write_sbregw(FAR bcmf_interface_dev_t *ibus, uint32_t address, uint32_t reg) { - return bcmf_write_sbreg(ibus, address, (uint8_t *)®, 4); + return bcmf_write_sbreg(ibus, address, (FAR uint8_t *)®, 4); } #endif /* __DRIVERS_WIRELESS_IEEE80211_BCM43XXX_BCMF_CORE_H */ diff --git a/drivers/wireless/ieee80211/bcm43xxx/bcmf_driver.c b/drivers/wireless/ieee80211/bcm43xxx/bcmf_driver.c index d30ccf7ad6..bdf5cbd74a 100644 --- a/drivers/wireless/ieee80211/bcm43xxx/bcmf_driver.c +++ b/drivers/wireless/ieee80211/bcm43xxx/bcmf_driver.c @@ -630,7 +630,7 @@ void bcmf_wl_auth_event_handler(FAR struct bcmf_dev_s *priv, return; } - bcmf_hexdump((uint8_t *)event, len, (unsigned long)event); + bcmf_hexdump((FAR uint8_t *)event, len, (unsigned long)event); if (type == WLC_E_PSK_SUP) { @@ -1718,7 +1718,7 @@ int bcmf_wl_get_channel(FAR struct bcmf_dev_s *priv, int interface) out_len = sizeof(ci); ret = bcmf_cdc_ioctl(priv, interface, false, - WLC_GET_CHANNEL, (uint8_t *)&ci, &out_len); + WLC_GET_CHANNEL, (FAR uint8_t *)&ci, &out_len); return ret == OK ? ci.target_channel : ret; } @@ -2154,7 +2154,7 @@ int bcmf_wl_get_country(FAR struct bcmf_dev_s *priv, FAR struct iwreq *iwr) if (ret == OK) { memcpy(iwr->u.data.pointer, country, 2); - ((uint8_t *)iwr->u.data.pointer)[2] = '\0'; + ((FAR uint8_t *)iwr->u.data.pointer)[2] = '\0'; } return ret; @@ -2247,7 +2247,7 @@ int bcmf_wl_set_pta_priority(FAR struct bcmf_dev_s *priv, uint32_t prio) out_len = sizeof(wl_pta_t); ret = bcmf_cdc_iovar_request(priv, CHIP_STA_INTERFACE, true, IOVAR_STR_COEX_PARA, - (uint8_t *)&pta_prio_map[prio], + (FAR uint8_t *)&pta_prio_map[prio], &out_len); if (ret == OK) { diff --git a/drivers/wireless/ieee80211/bcm43xxx/bcmf_gpio.c b/drivers/wireless/ieee80211/bcm43xxx/bcmf_gpio.c index 7fdd0de542..501979674e 100644 --- a/drivers/wireless/ieee80211/bcm43xxx/bcmf_gpio.c +++ b/drivers/wireless/ieee80211/bcm43xxx/bcmf_gpio.c @@ -47,16 +47,19 @@ int bcmf_set_gpio(FAR struct bcmf_dev_s *priv, int pin, bool value) uint32_t buf_len = sizeof(buffer); - if (!(((FAR bcmf_interface_dev_t *)priv->bus)->ready)) return -EIO; + if (!(((FAR bcmf_interface_dev_t *)priv->bus)->ready)) + { + return -EIO; + } - buffer.mask = 1 << pin; - buffer.value = value ? (1 << pin) : 0; + buffer.mask = 1u << pin; + buffer.value = value ? (1u << pin) : 0; return bcmf_cdc_iovar_request(priv, CHIP_STA_INTERFACE, true, IOVAR_STR_GPIOOUT, - (uint8_t *)&buffer, + (FAR uint8_t *)&buffer, &buf_len); } @@ -70,15 +73,21 @@ int bcmf_get_gpio(FAR struct bcmf_dev_s *priv, int pin, bool *value) uint32_t buf_len = sizeof(buffer); int ret; - if (!(((FAR bcmf_interface_dev_t *)priv->bus)->ready)) return -EIO; + if (!(((FAR bcmf_interface_dev_t *)priv->bus)->ready)) + { + return -EIO; + } ret = bcmf_cdc_iovar_request(priv, CHIP_STA_INTERFACE, false, IOVAR_STR_CCGPIOIN, - (uint8_t *)&buffer, + (FAR uint8_t *)&buffer, &buf_len); - if (ret != OK) return ret; + if (ret != OK) + { + return ret; + } *value = (buffer & (1 << pin)) != 0; diff --git a/drivers/wireless/ieee80211/bcm43xxx/bcmf_gspi.c b/drivers/wireless/ieee80211/bcm43xxx/bcmf_gspi.c index ee8d377dab..e4397d8052 100644 --- a/drivers/wireless/ieee80211/bcm43xxx/bcmf_gspi.c +++ b/drivers/wireless/ieee80211/bcm43xxx/bcmf_gspi.c @@ -347,7 +347,7 @@ static int bcmf_gspi_thread_isr(int isr, FAR void *context, FAR void *arg) * Name: bcmf_gspi_thread ****************************************************************************/ -static int bcmf_gspi_thread(int argc, char **argv) +static int bcmf_gspi_thread(int argc, FAR char **argv) { FAR struct bcmf_dev_s *priv; FAR bcmf_gspi_dev_t *gbus; @@ -544,7 +544,10 @@ static int bcmf_gspi_init_device(FAR bcmf_gspi_dev_t *gbus) return ret; } - if (REV16(buffer[0]) == CYW_REG_TEST_RO_PATTERN) break; + if (REV16(buffer[0]) == CYW_REG_TEST_RO_PATTERN) + { + break; + } } if (i == BCMF_GSPI_READY_TRYS) diff --git a/drivers/wireless/ieee80211/bcm43xxx/bcmf_gspi_f2_frame.c b/drivers/wireless/ieee80211/bcm43xxx/bcmf_gspi_f2_frame.c index d77b719d63..ed2768c082 100644 --- a/drivers/wireless/ieee80211/bcm43xxx/bcmf_gspi_f2_frame.c +++ b/drivers/wireless/ieee80211/bcm43xxx/bcmf_gspi_f2_frame.c @@ -108,7 +108,7 @@ static int f2_frame_rx_fail(FAR bcmf_gspi_dev_t *gbus, bool retry) ****************************************************************************/ int process_f2_frame_header(FAR bcmf_interface_dev_t *gbus, - f2_frame_header_t *header) + FAR f2_frame_header_t *header) { if (header->data_offset < sizeof(f2_frame_header_t) || header->data_offset > header->size) @@ -143,16 +143,14 @@ int process_f2_frame_header(FAR bcmf_interface_dev_t *gbus, * OK on success, negated error code on failure. ****************************************************************************/ -int bcmf_gspi_read_f2_frame(FAR struct bcmf_dev_s *priv, - int frame_length) +int bcmf_gspi_read_f2_frame(FAR struct bcmf_dev_s *priv, int frame_length) { - FAR bcmf_gspi_dev_t *gbus = (FAR bcmf_gspi_dev_t *)priv->bus; - FAR gspi_dev_t *gspi = gbus->gspi; - - bcmf_interface_frame_t *iframe; - f2_frame_header_t *header; - int ret; - uint16_t checksum; + FAR bcmf_gspi_dev_t *gbus = (FAR bcmf_gspi_dev_t *)priv->bus; + FAR gspi_dev_t *gspi = gbus->gspi; + FAR bcmf_interface_frame_t *iframe; + FAR f2_frame_header_t *header; + int ret; + uint16_t checksum; /* Request free frame buffer */ @@ -186,7 +184,7 @@ int bcmf_gspi_read_f2_frame(FAR struct bcmf_dev_s *priv, gspi_f2_dma, 0, frame_length, - (uint32_t *) iframe->data); + (FAR uint32_t *)iframe->data); if (ret != OK) { @@ -195,7 +193,7 @@ int bcmf_gspi_read_f2_frame(FAR struct bcmf_dev_s *priv, goto exit_abort; } - header = (f2_frame_header_t *)iframe->data; + header = (FAR f2_frame_header_t *)iframe->data; if (header->size == 0) { @@ -211,7 +209,7 @@ int bcmf_gspi_read_f2_frame(FAR struct bcmf_dev_s *priv, header->size, header->checksum); - bcmf_hexdump((uint8_t *)header, MIN(header->size, 64), 0); + bcmf_hexdump((FAR uint8_t *)header, MIN(header->size, 64), 0); f2_frame_rx_fail(gbus, false); return -EINVAL; @@ -310,12 +308,12 @@ exit_free_frame: int bcmf_gspi_send_f2_frame(FAR struct bcmf_dev_s *priv) { - FAR bcmf_gspi_dev_t *gbus = (FAR bcmf_gspi_dev_t *)priv->bus; - FAR gspi_dev_t *gspi = gbus->gspi; - f2_frame_header_t *header; - bcmf_interface_frame_t *iframe; - int ret; - bool is_txframe; + FAR bcmf_gspi_dev_t *gbus = (FAR bcmf_gspi_dev_t *)priv->bus; + FAR gspi_dev_t *gspi = gbus->gspi; + FAR f2_frame_header_t *header; + FAR bcmf_interface_frame_t *iframe; + int ret; + bool is_txframe; if (list_is_empty(&gbus->tx_queue)) { @@ -345,7 +343,7 @@ int bcmf_gspi_send_f2_frame(FAR struct bcmf_dev_s *priv) is_txframe = iframe->tx; - header = (f2_frame_header_t *)iframe->header.base; + header = (FAR f2_frame_header_t *)iframe->header.base; /* Set frame sequence id */ @@ -378,7 +376,7 @@ int bcmf_gspi_send_f2_frame(FAR struct bcmf_dev_s *priv) gspi_f2_dma, 0, iframe->header.len, - (FAR uint32_t *) iframe->header.base); + (FAR uint32_t *)iframe->header.base); /* Free frame buffer */ diff --git a/drivers/wireless/ieee80211/bcm43xxx/bcmf_sdio.c b/drivers/wireless/ieee80211/bcm43xxx/bcmf_sdio.c index e3168cc8d9..d268a09d67 100644 --- a/drivers/wireless/ieee80211/bcm43xxx/bcmf_sdio.c +++ b/drivers/wireless/ieee80211/bcm43xxx/bcmf_sdio.c @@ -465,7 +465,7 @@ int bcmf_bus_setup_interrupts(FAR struct bcmf_sdio_dev_s *sbus) /* Configure gpio interrupt pin */ - bcmf_board_setup_oob_irq(sbus->minor, bcmf_oob_irq, (void *)sbus); + bcmf_board_setup_oob_irq(sbus->minor, bcmf_oob_irq, (FAR void *)sbus); /* Enable function 2 interrupt */ diff --git a/drivers/wireless/ieee80211/bcm43xxx/bcmf_sdpcm.c b/drivers/wireless/ieee80211/bcm43xxx/bcmf_sdpcm.c index bf81ac0033..fd84cf6f72 100644 --- a/drivers/wireless/ieee80211/bcm43xxx/bcmf_sdpcm.c +++ b/drivers/wireless/ieee80211/bcm43xxx/bcmf_sdpcm.c @@ -77,7 +77,7 @@ begin_packed_struct struct bcmf_sdpcm_header static int bcmf_sdpcm_rxfail(FAR bcmf_interface_dev_t *ibus, bool retry); static int bcmf_sdpcm_process_header(FAR bcmf_interface_dev_t *ibus, - struct bcmf_sdpcm_header *header); + FAR struct bcmf_sdpcm_header *header); /**************************************************************************** * Private Data @@ -102,15 +102,15 @@ int bcmf_sdpcm_rxfail(FAR bcmf_interface_dev_t *ibus, bool retry) /* Send NAK to retry to read frame */ bcmf_write_sbregb(ibus, - CORE_BUS_REG(ibus->chip->core_base[SDIOD_CORE_ID], - tosbmailbox), SMB_NAK); + CORE_BUS_REG(ibus->chip->core_base[SDIOD_CORE_ID], + tosbmailbox), SMB_NAK); } return 0; } int bcmf_sdpcm_process_header(FAR bcmf_interface_dev_t *ibus, - struct bcmf_sdpcm_header *header) + FAR struct bcmf_sdpcm_header *header) { if (header->data_offset < sizeof(struct bcmf_sdpcm_header) || header->data_offset > header->size) @@ -136,9 +136,9 @@ int bcmf_sdpcm_readframe(FAR struct bcmf_dev_s *priv) int ret; uint16_t len; uint16_t checksum; - struct bcmf_sdpcm_header *header; - struct bcmf_sdpcm_header tmp_hdr; - bcmf_interface_frame_t *iframe; + FAR struct bcmf_sdpcm_header *header; + FAR struct bcmf_sdpcm_header tmp_hdr; + FAR bcmf_interface_frame_t *iframe; FAR bcmf_interface_dev_t *ibus = (FAR bcmf_interface_dev_t *)priv->bus; /* Read the first 4 bytes of sdpcm header @@ -146,7 +146,7 @@ int bcmf_sdpcm_readframe(FAR struct bcmf_dev_s *priv) */ ret = bcmf_transfer_bytes(ibus, false, 2, 0, - (uint8_t *)&tmp_hdr, + (FAR uint8_t *)&tmp_hdr, FIRST_WORD_SIZE); if (ret != OK) { @@ -183,7 +183,7 @@ int bcmf_sdpcm_readframe(FAR struct bcmf_dev_s *priv) wlinfo("Flow control\n"); ret = bcmf_transfer_bytes(ibus, false, 2, 0, - (uint8_t *)&tmp_hdr + FIRST_WORD_SIZE, + (FAR uint8_t *)&tmp_hdr + FIRST_WORD_SIZE, FC_UPDATE_PKT_LENGTH - FIRST_WORD_SIZE); if (ret != OK) { @@ -214,7 +214,7 @@ int bcmf_sdpcm_readframe(FAR struct bcmf_dev_s *priv) /* Read out the rest of the header to get the bus credit information */ ret = bcmf_transfer_bytes(ibus, false, 2, 0, - (uint8_t *)&tmp_hdr + FIRST_WORD_SIZE, + (FAR uint8_t *)&tmp_hdr + FIRST_WORD_SIZE, FC_UPDATE_PKT_LENGTH - FIRST_WORD_SIZE); if (ret != OK) { @@ -247,7 +247,7 @@ int bcmf_sdpcm_readframe(FAR struct bcmf_dev_s *priv) } ret = bcmf_transfer_bytes(ibus, false, 2, 0, - (uint8_t *)header + FIRST_WORD_SIZE, + (FAR uint8_t *)header + FIRST_WORD_SIZE, len - FIRST_WORD_SIZE); if (ret != OK) { @@ -279,7 +279,7 @@ int bcmf_sdpcm_readframe(FAR struct bcmf_dev_s *priv) header->flow_control, header->credit); - bcmf_hexdump((uint8_t *)header, header->size, (unsigned int)header); + bcmf_hexdump((FAR uint8_t *)header, header->size, (unsigned int)header); #endif /* Process and validate header */ @@ -357,8 +357,8 @@ int bcmf_sdpcm_sendframe(FAR struct bcmf_dev_s *priv) { int ret; bool is_txframe; - bcmf_interface_frame_t *iframe; - struct bcmf_sdpcm_header *header; + FAR bcmf_interface_frame_t *iframe; + FAR struct bcmf_sdpcm_header *header; FAR bcmf_interface_dev_t *ibus = (FAR bcmf_interface_dev_t *)priv->bus; if (list_is_empty(&ibus->tx_queue)) @@ -422,12 +422,12 @@ int bcmf_sdpcm_sendframe(FAR struct bcmf_dev_s *priv) } int bcmf_sdpcm_queue_frame(FAR struct bcmf_dev_s *priv, - struct bcmf_frame_s *frame, bool control) + FAR struct bcmf_frame_s *frame, bool control) { FAR bcmf_interface_dev_t *ibus = (FAR bcmf_interface_dev_t *)priv->bus; - bcmf_interface_frame_t *iframe = (bcmf_interface_frame_t *)frame; - struct bcmf_sdpcm_header *header = - (struct bcmf_sdpcm_header *)iframe->data; + bcmf_interface_frame_t *iframe = (FAR bcmf_interface_frame_t *)frame; + FAR struct bcmf_sdpcm_header *header = + (FAR struct bcmf_sdpcm_header *)iframe->data; int semcount; /* Prepare sw header */ @@ -468,11 +468,11 @@ int bcmf_sdpcm_queue_frame(FAR struct bcmf_dev_s *priv, return OK; } -struct bcmf_frame_s *bcmf_sdpcm_alloc_frame(FAR struct bcmf_dev_s *priv, - unsigned int len, bool block, - bool control) +FAR struct bcmf_frame_s *bcmf_sdpcm_alloc_frame(FAR struct bcmf_dev_s *priv, + unsigned int len, bool block, + bool control) { - bcmf_interface_frame_t *iframe; + FAR bcmf_interface_frame_t *iframe; unsigned int header_len = sizeof(struct bcmf_sdpcm_header); if (!control) @@ -501,14 +501,14 @@ struct bcmf_frame_s *bcmf_sdpcm_alloc_frame(FAR struct bcmf_dev_s *priv, } void bcmf_sdpcm_free_frame(FAR struct bcmf_dev_s *priv, - struct bcmf_frame_s *frame) + FAR struct bcmf_frame_s *frame) { bcmf_interface_free_frame(priv, (bcmf_interface_frame_t *)frame); } -struct bcmf_frame_s *bcmf_sdpcm_get_rx_frame(FAR struct bcmf_dev_s *priv) +FAR struct bcmf_frame_s *bcmf_sdpcm_get_rx_frame(FAR struct bcmf_dev_s *priv) { - bcmf_interface_frame_t *iframe; + FAR bcmf_interface_frame_t *iframe; FAR bcmf_interface_dev_t *ibus = (FAR bcmf_interface_dev_t *)priv->bus; if (nxmutex_lock(&ibus->queue_lock) < 0) diff --git a/drivers/wireless/ieee802154/at86rf23x/at86rf23x.c b/drivers/wireless/ieee802154/at86rf23x/at86rf23x.c index c22566b761..c9c2f42b9b 100644 --- a/drivers/wireless/ieee802154/at86rf23x/at86rf23x.c +++ b/drivers/wireless/ieee802154/at86rf23x/at86rf23x.c @@ -115,14 +115,14 @@ struct at86rf23x_dev_s static void at86rf23x_lock(FAR struct spi_dev_s *spi); static void at86rf23x_unlock(FAR struct spi_dev_s *spi); static void at86rf23x_setreg(FAR struct spi_dev_s *spi, uint32_t addr, - uint8_t val); + uint8_t val); static uint8_t at86rf23x_getreg(FAR struct spi_dev_s *spi, uint32_t addr); static int at86rf23x_writeframe(FAR struct spi_dev_s *spi, - FAR uint8_t *frame, uint8_t len); + FAR uint8_t *frame, uint8_t len); static uint8_t at86rf23x_readframe(FAR struct spi_dev_s *spi, - FAR uint8_t *frame_rx); + FAR uint8_t *frame_rx); static int at86rf23x_set_trxstate(FAR struct at86rf23x_dev_s *dev, - uint8_t state, uint8_t force); + uint8_t state, uint8_t force); static uint8_t at86rf23x_get_trxstate(FAR struct at86rf23x_dev_s *dev); static int at86rf23x_resetrf(FAR struct at86rf23x_dev_s *dev); static int at86rf23x_initialize(FAR struct at86rf23x_dev_s *dev); @@ -134,46 +134,47 @@ static void at86rf23x_irqworker(FAR void *arg); static int at86rf23x_interrupt(int irq, FAR void *context, FAR void *arg); static int at86rf23x_setchannel(FAR struct ieee802154_radio_s *ieee, - uint8_t chan); + uint8_t chan); static int at86rf23x_getchannel(FAR struct ieee802154_radio_s *ieee, - FAR uint8_t *chan); + FAR uint8_t *chan); static int at86rf23x_setpanid(FAR struct ieee802154_radio_s *ieee, - uint16_t panid); + uint16_t panid); static int at86rf23x_getpanid(FAR struct ieee802154_radio_s *ieee, - FAR uint16_t *panid); + FAR uint16_t *panid); static int at86rf23x_setsaddr(FAR struct ieee802154_radio_s *ieee, - uint16_t saddr); + uint16_t saddr); static int at86rf23x_getsaddr(FAR struct ieee802154_radio_s *ieee, - FAR uint16_t *saddr); + FAR uint16_t *saddr); static int at86rf23x_seteaddr(FAR struct ieee802154_radio_s *ieee, - FAR uint8_t *eaddr); + FAR uint8_t *eaddr); static int at86rf23x_geteaddr(FAR struct ieee802154_radio_s *ieee, - FAR uint8_t *eaddr); + FAR uint8_t *eaddr); static int at86rf23x_setpromisc(FAR struct ieee802154_radio_s *ieee, - bool promisc); + bool promisc); static int at86rf23x_getpromisc(FAR struct ieee802154_radio_s *ieee, - FAR bool *promisc); + FAR bool *promisc); static int at86rf23x_setdevmode(FAR struct ieee802154_radio_s *ieee, - uint8_t mode); + uint8_t mode); static int at86rf23x_getdevmode(FAR struct ieee802154_radio_s *ieee, - FAR uint8_t *mode); + FAR uint8_t *mode); static int at86rf23x_settxpower(FAR struct ieee802154_radio_s *ieee, - int32_t txpwr); + int32_t txpwr); static int at86rf23x_gettxpower(FAR struct ieee802154_radio_s *ieee, - FAR int32_t *txpwr); + FAR int32_t *txpwr); static int at86rf23x_setcca(FAR struct ieee802154_radio_s *ieee, - FAR struct ieee802154_cca_s *cca); + FAR struct ieee802154_cca_s *cca); static int at86rf23x_getcca(FAR struct ieee802154_radio_s *ieee, - FAR struct ieee802154_cca_s *cca); + FAR struct ieee802154_cca_s *cca); static int at86rf23x_energydetect(FAR struct ieee802154_radio_s *ieee, - FAR uint8_t *energy); + FAR uint8_t *energy); /* Driver operations */ -static int at86rf23x_rxenable(FAR struct ieee802154_radio_s *ieee, - bool state, FAR struct ieee802154_packet_s *packet); -static int at86rf23x_transmit(FAR struct ieee802154_radio_s *ieee, - FAR struct ieee802154_packet_s *packet); +static int at86rf23x_rxenable(FAR struct ieee802154_radio_s *ieee, + bool state, + FAR struct ieee802154_packet_s *packet); +static int at86rf23x_transmit(FAR struct ieee802154_radio_s *ieee, + FAR struct ieee802154_packet_s *packet); /**************************************************************************** * Private Data @@ -724,8 +725,8 @@ static int at86rf23x_getchannel(FAR struct ieee802154_radio_s *ieee, static int at86rf23x_setpanid(FAR struct ieee802154_radio_s *ieee, uint16_t panid) { - FAR struct at86rf23x_dev_s *dev = (struct at86rf23x_dev_s *)ieee; - uint8_t *pan = (uint8_t *)&panid; + FAR struct at86rf23x_dev_s *dev = (FAR struct at86rf23x_dev_s *)ieee; + uint8_t *pan = (FAR uint8_t *)&panid; at86rf23x_setreg(dev->spi, RF23X_REG_PANID0, pan[0]); at86rf23x_setreg(dev->spi, RF23X_REG_PANID1, pan[1]); @@ -744,8 +745,8 @@ static int at86rf23x_setpanid(FAR struct ieee802154_radio_s *ieee, static int at86rf23x_getpanid(FAR struct ieee802154_radio_s *ieee, FAR uint16_t *panid) { - FAR struct at86rf23x_dev_s *dev = (struct at86rf23x_dev_s *)ieee; - uint8_t *pan = (uint8_t *)panid; + FAR struct at86rf23x_dev_s *dev = (FAR struct at86rf23x_dev_s *)ieee; + uint8_t *pan = (FAR uint8_t *)panid; /* TODO: Check if we need to pay attention to endianness */ @@ -765,8 +766,8 @@ static int at86rf23x_getpanid(FAR struct ieee802154_radio_s *ieee, static int at86rf23x_setsaddr(FAR struct ieee802154_radio_s *ieee, uint16_t saddr) { - FAR struct at86rf23x_dev_s *dev = (struct at86rf23x_dev_s *)ieee; - uint8_t *addr = (uint8_t *)&saddr; + FAR struct at86rf23x_dev_s *dev = (FAR struct at86rf23x_dev_s *)ieee; + uint8_t *addr = (FAR uint8_t *)&saddr; at86rf23x_setreg(dev->spi, RF23X_REG_SADDR0, addr[0]); at86rf23x_setreg(dev->spi, RF23X_REG_SADDR1, addr[1]); @@ -785,8 +786,8 @@ static int at86rf23x_setsaddr(FAR struct ieee802154_radio_s *ieee, static int at86rf23x_getsaddr(FAR struct ieee802154_radio_s *ieee, FAR uint16_t *saddr) { - FAR struct at86rf23x_dev_s *dev = (struct at86rf23x_dev_s *)ieee; - uint8_t *addr = (uint8_t *)saddr; + FAR struct at86rf23x_dev_s *dev = (FAR struct at86rf23x_dev_s *)ieee; + uint8_t *addr = (FAR uint8_t *)saddr; /* TODO: Check if we need to pay attention to endianness */ @@ -807,7 +808,7 @@ static int at86rf23x_getsaddr(FAR struct ieee802154_radio_s *ieee, static int at86rf23x_seteaddr(FAR struct ieee802154_radio_s *ieee, FAR uint8_t *eaddr) { - FAR struct at86rf23x_dev_s *dev = (struct at86rf23x_dev_s *)ieee; + FAR struct at86rf23x_dev_s *dev = (FAR struct at86rf23x_dev_s *)ieee; /* TODO: Check if we need to pay attention to endianness */ @@ -834,7 +835,7 @@ static int at86rf23x_seteaddr(FAR struct ieee802154_radio_s *ieee, static int at86rf23x_geteaddr(FAR struct ieee802154_radio_s *ieee, FAR uint8_t *eaddr) { - FAR struct at86rf23x_dev_s *dev = (struct at86rf23x_dev_s *)ieee; + FAR struct at86rf23x_dev_s *dev = (FAR struct at86rf23x_dev_s *)ieee; /* TODO: Check if we need to pay attention to endianness */ @@ -861,7 +862,7 @@ static int at86rf23x_geteaddr(FAR struct ieee802154_radio_s *ieee, static int at86rf23x_setpromisc(FAR struct ieee802154_radio_s *ieee, bool promisc) { - FAR struct at86rf23x_dev_s *dev = (struct at86rf23x_dev_s *)ieee; + FAR struct at86rf23x_dev_s *dev = (FAR struct at86rf23x_dev_s *)ieee; /* TODO: Check what mode I should be in to activate promiscuous mode: * This is way to simple of an implementation. Many other things should @@ -883,7 +884,7 @@ static int at86rf23x_setpromisc(FAR struct ieee802154_radio_s *ieee, static int at86rf23x_getpromisc(FAR struct ieee802154_radio_s *ieee, FAR bool *promisc) { - FAR struct at86rf23x_dev_s *dev = (struct at86rf23x_dev_s *)ieee; + FAR struct at86rf23x_dev_s *dev = (FAR struct at86rf23x_dev_s *)ieee; *promisc = at86rf23x_getregbits(dev->spi, RF23X_XAHCTRL1_BITS_PROM_MODE); return OK; @@ -900,7 +901,7 @@ static int at86rf23x_getpromisc(FAR struct ieee802154_radio_s *ieee, static int at86rf23x_setdevmode(FAR struct ieee802154_radio_s *ieee, uint8_t mode) { - FAR struct at86rf23x_dev_s *dev = (struct at86rf23x_dev_s *)ieee; + FAR struct at86rf23x_dev_s *dev = (FAR struct at86rf23x_dev_s *)ieee; /* Define dev mode */ @@ -936,7 +937,7 @@ static int at86rf23x_setdevmode(FAR struct ieee802154_radio_s *ieee, static int at86rf23x_getdevmode(FAR struct ieee802154_radio_s *ieee, FAR uint8_t *mode) { - FAR struct at86rf23x_dev_s *dev = (struct at86rf23x_dev_s *)ieee; + FAR struct at86rf23x_dev_s *dev = (FAR struct at86rf23x_dev_s *)ieee; int val; val = at86rf23x_getregbits(dev->spi, RF23X_CSMASEED1_IAMCOORD_BITS); @@ -963,7 +964,7 @@ static int at86rf23x_getdevmode(FAR struct ieee802154_radio_s *ieee, static int at86rf23x_settxpower(FAR struct ieee802154_radio_s *ieee, int32_t txpwr) { - FAR struct at86rf23x_dev_s *dev = (struct at86rf23x_dev_s *)ieee; + FAR struct at86rf23x_dev_s *dev = (FAR struct at86rf23x_dev_s *)ieee; /* TODO: * this needs a lot of work to make sure all chips can share this function @@ -986,7 +987,7 @@ static int at86rf23x_settxpower(FAR struct ieee802154_radio_s *ieee, static int at86rf23x_gettxpower(FAR struct ieee802154_radio_s *ieee, FAR int32_t *txpwr) { - FAR struct at86rf23x_dev_s *dev = (struct at86rf23x_dev_s *)ieee; + FAR struct at86rf23x_dev_s *dev = (FAR struct at86rf23x_dev_s *)ieee; uint8_t reg; /* TODO: this needs a lot of work to make sure all chips can share this @@ -1079,7 +1080,7 @@ static int at86rf23x_setcca(FAR struct ieee802154_radio_s *ieee, FAR struct ieee802154_cca_s *cca) { - FAR struct at86rf23x_dev_s *dev = (struct at86rf23x_dev_s *)ieee; + FAR struct at86rf23x_dev_s *dev = (FAR struct at86rf23x_dev_s *)ieee; /* TODO: This doesn't fit the RF233 completely come back to this */ @@ -1118,7 +1119,7 @@ static static int at86rf23x_getcca(FAR struct ieee802154_radio_s *ieee, FAR struct ieee802154_cca_s *cca) { - FAR struct at86rf23x_dev_s *dev = (struct at86rf23x_dev_s *)ieee; + FAR struct at86rf23x_dev_s *dev = (FAR struct at86rf23x_dev_s *)ieee; #warning at86rf23x_getcca not implemented. @@ -1221,9 +1222,9 @@ static int at86rf23x_resetrf(FAR struct at86rf23x_dev_s *dev) * ****************************************************************************/ -static int - at86rf23x_rxenable(FAR struct ieee802154_radio_s *ieee, bool state, - FAR struct ieee802154_packet_s *packet) +static int at86rf23x_rxenable(FAR struct ieee802154_radio_s *ieee, + bool state, + FAR struct ieee802154_packet_s *packet) { FAR struct at86rf23x_dev_s *dev = (FAR struct at86rf23x_dev_s *)ieee; @@ -1481,8 +1482,8 @@ static int at86rf23x_transmit(FAR struct ieee802154_radio_s *ieee, ****************************************************************************/ FAR struct ieee802154_radio_s * - at86rf23x_init(FAR struct spi_dev_s *spi, - FAR const struct at86rf23x_lower_s *lower) +at86rf23x_init(FAR struct spi_dev_s *spi, + FAR const struct at86rf23x_lower_s *lower) { FAR struct at86rf23x_dev_s *dev; struct ieee802154_cca_s cca; diff --git a/drivers/wireless/spirit/lib/spirit_radio.c b/drivers/wireless/spirit/lib/spirit_radio.c index 4cd78b0aa0..f33b067059 100644 --- a/drivers/wireless/spirit/lib/spirit_radio.c +++ b/drivers/wireless/spirit/lib/spirit_radio.c @@ -1239,7 +1239,7 @@ int32_t spirit_radio_get_foffset(FAR struct spirit_library_s *spirit) offtmp &= 0x0fff; } - fcoffset = *((int16_t *)(&offtmp)); + fcoffset = *((FAR int16_t *)(&offtmp)); /* Calculates the frequency offset and return it */ diff --git a/fs/binfs/fs_binfs.c b/fs/binfs/fs_binfs.c index 4ea17cd4cc..617b90d293 100644 --- a/fs/binfs/fs_binfs.c +++ b/fs/binfs/fs_binfs.c @@ -58,11 +58,11 @@ struct binfs_dir_s * Private Function Prototypes ****************************************************************************/ -static int binfs_open(FAR struct file *filep, const char *relpath, +static int binfs_open(FAR struct file *filep, FAR const char *relpath, int oflags, mode_t mode); static int binfs_close(FAR struct file *filep); static ssize_t binfs_read(FAR struct file *filep, - char *buffer, size_t buflen); + FAR char *buffer, size_t buflen); static int binfs_ioctl(FAR struct file *filep, int cmd, unsigned long arg); @@ -191,7 +191,7 @@ static int binfs_close(FAR struct file *filep) ****************************************************************************/ static ssize_t binfs_read(FAR struct file *filep, - char *buffer, size_t buflen) + FAR char *buffer, size_t buflen) { /* Reading is not supported. Just return end-of-file */ @@ -466,8 +466,8 @@ static int binfs_statfs(struct inode *mountpt, struct statfs *buf) * ****************************************************************************/ -static int binfs_stat(struct inode *mountpt, - const char *relpath, struct stat *buf) +static int binfs_stat(FAR struct inode *mountpt, FAR const char *relpath, + FAR struct stat *buf) { finfo("Entry\n"); int index; diff --git a/fs/cromfs/fs_cromfs.c b/fs/cromfs/fs_cromfs.c index bf83256904..6399277010 100644 --- a/fs/cromfs/fs_cromfs.c +++ b/fs/cromfs/fs_cromfs.c @@ -111,61 +111,65 @@ struct cromfs_comparenode_s /* Helpers */ static FAR void *cromfs_offset2addr(FAR const struct cromfs_volume_s *fs, - uint32_t offset); + uint32_t offset); static uint32_t cromfs_addr2offset(FAR const struct cromfs_volume_s *fs, - FAR const void *addr); + FAR const void *addr); static int cromfs_follow_link(FAR const struct cromfs_volume_s *fs, - FAR const struct cromfs_node_s **ppnode, bool follow, - FAR struct cromfs_node_s *newnode); + FAR const struct cromfs_node_s **ppnode, + bool follow, + FAR struct cromfs_node_s *newnode); static int cromfs_foreach_node(FAR const struct cromfs_volume_s *fs, - FAR const struct cromfs_node_s *node, - bool follow, cromfs_foreach_t callback, FAR void *arg); + FAR const struct cromfs_node_s *node, + bool follow, cromfs_foreach_t callback, + FAR void *arg); static uint16_t cromfs_seglen(FAR const char *relpath); static int cromfs_child_node(FAR const struct cromfs_volume_s *fs, - FAR const struct cromfs_node_s *node, - FAR struct cromfs_nodeinfo_s *info); + FAR const struct cromfs_node_s *node, + FAR struct cromfs_nodeinfo_s *info); static int cromfs_compare_node(FAR const struct cromfs_volume_s *fs, - FAR const struct cromfs_node_s *node, uint32_t offset, - FAR void *arg); + FAR const struct cromfs_node_s *node, + uint32_t offset, + FAR void *arg); static int cromfs_find_node(FAR const struct cromfs_volume_s *fs, - FAR const char *relpath, - FAR struct cromfs_nodeinfo_s *info, - FAR uint32_t *offset); + FAR const char *relpath, + FAR struct cromfs_nodeinfo_s *info, + FAR uint32_t *offset); /* Common file system methods */ -static int cromfs_open(FAR struct file *filep, const char *relpath, - int oflags, mode_t mode); +static int cromfs_open(FAR struct file *filep, FAR const char *relpath, + int oflags, mode_t mode); static int cromfs_close(FAR struct file *filep); static ssize_t cromfs_read(FAR struct file *filep, - char *buffer, size_t buflen); + FAR char *buffer, size_t buflen); static int cromfs_ioctl(FAR struct file *filep, - int cmd, unsigned long arg); + int cmd, unsigned long arg); static int cromfs_dup(FAR const struct file *oldp, - FAR struct file *newp); + FAR struct file *newp); static int cromfs_fstat(FAR const struct file *filep, - FAR struct stat *buf); + FAR struct stat *buf); static int cromfs_opendir(FAR struct inode *mountpt, - FAR const char *relpath, FAR struct fs_dirent_s **dir); + FAR const char *relpath, + FAR struct fs_dirent_s **dir); static int cromfs_closedir(FAR struct inode *mountpt, - FAR struct fs_dirent_s *dir); + FAR struct fs_dirent_s *dir); static int cromfs_readdir(FAR struct inode *mountpt, - FAR struct fs_dirent_s *dir, - FAR struct dirent *entry); + FAR struct fs_dirent_s *dir, + FAR struct dirent *entry); static int cromfs_rewinddir(FAR struct inode *mountpt, - FAR struct fs_dirent_s *dir); + FAR struct fs_dirent_s *dir); static int cromfs_bind(FAR struct inode *blkdriver, - FAR const void *data, FAR void **handle); + FAR const void *data, FAR void **handle); static int cromfs_unbind(FAR void *handle, FAR struct inode **blkdriver, - unsigned int flags); + unsigned int flags); static int cromfs_statfs(FAR struct inode *mountpt, - FAR struct statfs *buf); + FAR struct statfs *buf); static int cromfs_stat(FAR struct inode *mountpt, - FAR const char *relpath, FAR struct stat *buf); + FAR const char *relpath, FAR struct stat *buf); /**************************************************************************** * Public Data @@ -959,8 +963,10 @@ static ssize_t cromfs_read(FAR struct file *filep, FAR char *buffer, DEBUGASSERT(ulen > copyoffs); copysize = ulen - copyoffs; - if (copysize > remaining) /* Clip to the size really needed */ + if (copysize > remaining) { + /* Clip to the size really needed */ + copysize = remaining; } @@ -1019,8 +1025,10 @@ static ssize_t cromfs_read(FAR struct file *filep, FAR char *buffer, DEBUGASSERT(ulen > copyoffs); copysize = ulen - copyoffs; - if (copysize > remaining) /* Clip to the size really needed */ + if (copysize > remaining) { + /* Clip to the size really needed */ + copysize = remaining; } @@ -1195,7 +1203,7 @@ static int cromfs_opendir(FAR struct inode *mountpt, FAR const char *relpath, { FAR const struct cromfs_volume_s *fs; FAR struct cromfs_dir_s *cdir; - FAR struct cromfs_nodeinfo_s info; + struct cromfs_nodeinfo_s info; uint32_t offset; int ret; @@ -1415,8 +1423,8 @@ static int cromfs_rewinddir(FAR struct inode *mountpt, * ****************************************************************************/ -static int cromfs_bind(FAR struct inode *blkdriver, const void *data, - void **handle) +static int cromfs_bind(FAR struct inode *blkdriver, FAR const void *data, + FAR void **handle) { finfo("blkdriver: %p data: %p handle: %p\n", blkdriver, data, handle); @@ -1438,7 +1446,7 @@ static int cromfs_bind(FAR struct inode *blkdriver, const void *data, ****************************************************************************/ static int cromfs_unbind(FAR void *handle, FAR struct inode **blkdriver, - unsigned int flags) + unsigned int flags) { finfo("handle: %p blkdriver: %p flags: %02x\n", handle, blkdriver, flags); @@ -1452,7 +1460,7 @@ static int cromfs_unbind(FAR void *handle, FAR struct inode **blkdriver, * ****************************************************************************/ -static int cromfs_statfs(struct inode *mountpt, struct statfs *buf) +static int cromfs_statfs(struct inode *mountpt, FAR struct statfs *buf) { FAR struct cromfs_volume_s *fs; diff --git a/fs/driver/fs_blockpartition.c b/fs/driver/fs_blockpartition.c index f39075ec40..58811e565a 100644 --- a/fs/driver/fs_blockpartition.c +++ b/fs/driver/fs_blockpartition.c @@ -55,14 +55,14 @@ struct part_struct_s static int part_open(FAR struct inode *inode); static int part_close(FAR struct inode *inode); static ssize_t part_read(FAR struct inode *inode, FAR unsigned char *buffer, - blkcnt_t start_sector, unsigned int nsectors); + blkcnt_t start_sector, unsigned int nsectors); static ssize_t part_write(FAR struct inode *inode, - FAR const unsigned char *buffer, blkcnt_t start_sector, - unsigned int nsectors); + FAR const unsigned char *buffer, + blkcnt_t start_sector, unsigned int nsectors); static int part_geometry(FAR struct inode *inode, - FAR struct geometry *geometry); + FAR struct geometry *geometry); static int part_ioctl(FAR struct inode *inode, int cmd, - unsigned long arg); + unsigned long arg); #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS static int part_unlink(FAR struct inode *inode); #endif @@ -139,7 +139,7 @@ static int part_close(FAR struct inode *inode) * ****************************************************************************/ -static ssize_t part_read(FAR struct inode *inode, unsigned char *buffer, +static ssize_t part_read(FAR struct inode *inode, FAR unsigned char *buffer, blkcnt_t start_sector, unsigned int nsectors) { FAR struct part_struct_s *dev = inode->i_private; @@ -186,7 +186,8 @@ static ssize_t part_write(FAR struct inode *inode, * ****************************************************************************/ -static int part_geometry(FAR struct inode *inode, struct geometry *geometry) +static int part_geometry(FAR struct inode *inode, + FAR struct geometry *geometry) { FAR struct part_struct_s *dev = inode->i_private; FAR struct inode *parent = dev->parent; @@ -210,7 +211,7 @@ static int part_geometry(FAR struct inode *inode, struct geometry *geometry) static int part_ioctl(FAR struct inode *inode, int cmd, unsigned long arg) { - FAR uintptr_t ptr_arg = (uintptr_t)arg; + uintptr_t ptr_arg = (uintptr_t)arg; FAR struct part_struct_s *dev = inode->i_private; FAR struct inode *parent = dev->parent; int ret = -ENOTTY; diff --git a/fs/fat/fs_fat32.h b/fs/fat/fs_fat32.h index 1f3ad5261f..0fe97a0e68 100644 --- a/fs/fat/fs_fat32.h +++ b/fs/fat/fs_fat32.h @@ -1077,8 +1077,8 @@ EXTERN int fat_dirtruncate(FAR struct fat_mountpt_s *fs, FAR uint8_t *direntry); EXTERN int fat_dirshrink(FAR struct fat_mountpt_s *fs, FAR uint8_t *direntry, off_t length); -EXTERN int fat_dirextend(FAR FAR struct fat_mountpt_s *fs, - FAR FAR struct fat_file_s *ff, off_t length); +EXTERN int fat_dirextend(FAR struct fat_mountpt_s *fs, + FAR struct fat_file_s *ff, off_t length); EXTERN int fat_dircreate(FAR struct fat_mountpt_s *fs, FAR struct fat_dirinfo_s *dirinfo); EXTERN int fat_remove(FAR struct fat_mountpt_s *fs, diff --git a/fs/fat/fs_fat32attrib.c b/fs/fat/fs_fat32attrib.c index 91ef922e4f..ecc03d0def 100644 --- a/fs/fat/fs_fat32attrib.c +++ b/fs/fat/fs_fat32attrib.c @@ -46,11 +46,11 @@ static int fat_attrib(const char *path, fat_attrib_t *retattrib, fat_attrib_t setbits, fat_attrib_t clearbits) { - struct fat_mountpt_s *fs; + FAR struct fat_mountpt_s *fs; struct fat_dirinfo_s dirinfo; struct inode_search_s desc; FAR struct inode *inode; - uint8_t *direntry; + FAR uint8_t *direntry; uint8_t oldattributes; uint8_t newattributes; int ret; @@ -174,7 +174,7 @@ errout: * Name: fat_getattrib ****************************************************************************/ -int fat_getattrib(const char *path, fat_attrib_t *attrib) +int fat_getattrib(FAR const char *path, FAR fat_attrib_t *attrib) { return fat_attrib(path, attrib, 0, 0); } @@ -183,7 +183,7 @@ int fat_getattrib(const char *path, fat_attrib_t *attrib) * Name: fat_setattrib ****************************************************************************/ -int fat_setattrib(const char *path, fat_attrib_t setbits, +int fat_setattrib(FAR const char *path, fat_attrib_t setbits, fat_attrib_t clearbits) { return fat_attrib(path, NULL, setbits, clearbits); diff --git a/fs/fat/fs_fat32dirent.c b/fs/fat/fs_fat32dirent.c index c8a4ed1af3..4adb9109ca 100644 --- a/fs/fat/fs_fat32dirent.c +++ b/fs/fat/fs_fat32dirent.c @@ -146,7 +146,7 @@ static int fat_putsfdirentry(FAR struct fat_mountpt_s *fs, uint8_t attributes, uint32_t fattime); #if defined(CONFIG_FAT_LFN) && defined(CONFIG_FAT_LFN_UTF8) -static int fat_utf8toucs(FAR const char **str, lfnchar *ucs); +static int fat_utf8toucs(FAR const char **str, FAR lfnchar *ucs); static int fat_ucstoutf8(FAR uint8_t *dest, uint8_t offset, lfnchar ucs); #endif @@ -162,7 +162,7 @@ static int fat_ucstoutf8(FAR uint8_t *dest, uint8_t offset, lfnchar ucs); * ****************************************************************************/ #if defined(CONFIG_FAT_LFN) && defined(CONFIG_FAT_LFN_UTF8) -static int fat_utf8toucs(FAR const char **str, lfnchar *ucs) +static int fat_utf8toucs(FAR const char **str, FAR lfnchar *ucs) { uint8_t chr; lfnchar tucs; @@ -669,14 +669,14 @@ errout: #ifdef CONFIG_FAT_LFN static inline int fat_createalias(FAR struct fat_dirinfo_s *dirinfo) { - uint8_t ch; /* Current character being processed */ - lfnchar *ext; /* Pointer to the extension substring */ - lfnchar *src; /* Pointer to the long file name source */ - int len; /* Total length of the long file name */ - int namechars; /* Number of characters available in long name */ - int extchars; /* Number of characters available in long name extension */ - int endndx; /* Maximum index into the short name array */ - int ndx; /* Index to store next character */ + uint8_t ch; /* Current character being processed */ + FAR lfnchar *ext; /* Pointer to the extension substring */ + FAR lfnchar *src; /* Pointer to the long file name source */ + int len; /* Total length of the long file name */ + int namechars; /* Number of characters available in long name */ + int extchars; /* Number of characters available in long name extension */ + int endndx; /* Maximum index into the short name array */ + int ndx; /* Index to store next character */ /* First, let's decide what is name and what is extension */ @@ -3109,7 +3109,7 @@ int fat_remove(FAR struct fat_mountpt_s *fs, FAR const char *relpath, { struct fat_dirinfo_s dirinfo; uint32_t dircluster; - uint8_t *direntry; + FAR uint8_t *direntry; int ret; /* Find the directory entry referring to the entry to be deleted */ diff --git a/fs/hostfs/hostfs.c b/fs/hostfs/hostfs.c index 2815ed80ee..80253fc096 100644 --- a/fs/hostfs/hostfs.c +++ b/fs/hostfs/hostfs.c @@ -67,58 +67,59 @@ struct hostfs_dir_s ****************************************************************************/ static int hostfs_open(FAR struct file *filep, FAR const char *relpath, - int oflags, mode_t mode); + int oflags, mode_t mode); static int hostfs_close(FAR struct file *filep); static ssize_t hostfs_read(FAR struct file *filep, FAR char *buffer, - size_t buflen); + size_t buflen); static ssize_t hostfs_write(FAR struct file *filep, FAR const char *buffer, - size_t buflen); + size_t buflen); static off_t hostfs_seek(FAR struct file *filep, off_t offset, - int whence); + int whence); static int hostfs_ioctl(FAR struct file *filep, int cmd, - unsigned long arg); + unsigned long arg); static int hostfs_sync(FAR struct file *filep); static int hostfs_dup(FAR const struct file *oldp, - FAR struct file *newp); + FAR struct file *newp); static int hostfs_fstat(FAR const struct file *filep, - FAR struct stat *buf); + FAR struct stat *buf); static int hostfs_fchstat(FAR const struct file *filep, - FAR const struct stat *buf, int flags); + FAR const struct stat *buf, int flags); static int hostfs_ftruncate(FAR struct file *filep, - off_t length); + off_t length); static int hostfs_opendir(FAR struct inode *mountpt, - FAR const char *relpath, - FAR struct fs_dirent_s **dir); + FAR const char *relpath, + FAR struct fs_dirent_s **dir); static int hostfs_closedir(FAR struct inode *mountpt, - FAR struct fs_dirent_s *dir); + FAR struct fs_dirent_s *dir); static int hostfs_readdir(FAR struct inode *mountpt, - FAR struct fs_dirent_s *dir, - FAR struct dirent *entry); + FAR struct fs_dirent_s *dir, + FAR struct dirent *entry); static int hostfs_rewinddir(FAR struct inode *mountpt, - FAR struct fs_dirent_s *dir); + FAR struct fs_dirent_s *dir); static int hostfs_bind(FAR struct inode *blkdriver, - FAR const void *data, FAR void **handle); + FAR const void *data, FAR void **handle); static int hostfs_unbind(FAR void *handle, FAR struct inode **blkdriver, - unsigned int flags); + unsigned int flags); static int hostfs_statfs(FAR struct inode *mountpt, - FAR struct statfs *buf); + FAR struct statfs *buf); static int hostfs_unlink(FAR struct inode *mountpt, - FAR const char *relpath); + FAR const char *relpath); static int hostfs_mkdir(FAR struct inode *mountpt, - FAR const char *relpath, mode_t mode); -static int hostfs_rmdir(FAR struct inode *mountpt, const char *relpath); + FAR const char *relpath, mode_t mode); +static int hostfs_rmdir(FAR struct inode *mountpt, + FAR const char *relpath); static int hostfs_rename(FAR struct inode *mountpt, - FAR const char *oldrelpath, - FAR const char *newrelpath); + FAR const char *oldrelpath, + FAR const char *newrelpath); static int hostfs_stat(FAR struct inode *mountpt, - FAR const char *relpath, FAR struct stat *buf); + FAR const char *relpath, FAR struct stat *buf); static int hostfs_chstat(FAR struct inode *mountpt, - FAR const char *relpath, - FAR const struct stat *buf, int flags); + FAR const char *relpath, + FAR const struct stat *buf, int flags); /**************************************************************************** * Private Data @@ -1022,8 +1023,8 @@ static int hostfs_bind(FAR struct inode *blkdriver, FAR const void *data, { FAR struct hostfs_mountpt_s *fs; FAR char *options; - char *saveptr; - char *ptr; + FAR char *saveptr; + FAR char *ptr; int len; int ret; diff --git a/fs/inode/fs_inodereserve.c b/fs/inode/fs_inodereserve.c index 6f6ce6a2e0..67b45c1a8c 100644 --- a/fs/inode/fs_inodereserve.c +++ b/fs/inode/fs_inodereserve.c @@ -48,7 +48,7 @@ static ino_t g_ino; static int inode_namelen(FAR const char *name) { - const char *tmp = name; + FAR const char *tmp = name; while (*tmp && *tmp != '/') { tmp++; @@ -61,7 +61,7 @@ static int inode_namelen(FAR const char *name) * Name: inode_namecpy ****************************************************************************/ -static void inode_namecpy(char *dest, const char *src) +static void inode_namecpy(FAR char *dest, FAR const char *src) { while (*src && *src != '/') { diff --git a/fs/mnemofs/mnemofs_journal.c b/fs/mnemofs/mnemofs_journal.c index 242cbd1a39..93682eacd5 100644 --- a/fs/mnemofs/mnemofs_journal.c +++ b/fs/mnemofs/mnemofs_journal.c @@ -244,8 +244,8 @@ errout: FAR static char *ser_log(FAR const struct mfs_jrnl_log_s * const x, FAR char * const out) { - char *o = out; - mfs_t i = 0; + FAR char *o = out; + mfs_t i; o = mfs_ser_mfs(x->depth, o); o = mfs_ser_mfs(x->sz_new, o); @@ -285,8 +285,8 @@ FAR static char *ser_log(FAR const struct mfs_jrnl_log_s * const x, FAR static const char *deser_log(FAR const char * const in, FAR struct mfs_jrnl_log_s * const x) { - mfs_t k = 0; - const char *i = in; + FAR const char *i = in; + mfs_t k; i = mfs_deser_mfs(i, &x->depth); i = mfs_deser_mfs(i, &x->sz_new); @@ -428,9 +428,9 @@ int mfs_jrnl_fmt(FAR struct mfs_sb_s * const sb, FAR mfs_t *blk1, /* Write magic sequence, size of jrnlarr, and then the jrnlarr. */ - sz = MFS_JRNL_SUFFIXSZ + ((CONFIG_MNEMOFS_JOURNAL_NBLKS + 2) * 4); + sz = MFS_JRNL_SUFFIXSZ + ((CONFIG_MNEMOFS_JOURNAL_NBLKS + 2) * 4); - buf = kmm_zalloc(sz); + buf = kmm_zalloc(sz); if (predict_false(buf == NULL)) { ret = -ENOMEM; @@ -528,7 +528,7 @@ void mfs_jrnl_free(FAR struct mfs_sb_s * const sb) mfs_t mfs_jrnl_blkidx2blk(FAR const struct mfs_sb_s * const sb, const mfs_t blk_idx) { - int ret = OK; + int ret = OK; mfs_t pg; mfs_t idx; mfs_t blk; diff --git a/fs/mnemofs/mnemofs_util.c b/fs/mnemofs/mnemofs_util.c index e977ea3530..c1fd2f333d 100644 --- a/fs/mnemofs/mnemofs_util.c +++ b/fs/mnemofs/mnemofs_util.c @@ -195,7 +195,7 @@ FAR const char *mfs_deser_64(FAR const char * const in, FAR char *mfs_ser_ctz(FAR const struct mfs_ctz_s * const x, FAR char * const out) { - char *o = out; + FAR char *o = out; o = mfs_ser_mfs(x->pg_e, o); o = mfs_ser_mfs(x->idx_e, o); @@ -205,7 +205,7 @@ FAR char *mfs_ser_ctz(FAR const struct mfs_ctz_s * const x, FAR const char *mfs_deser_ctz(FAR const char * const in, FAR struct mfs_ctz_s * const x) { - const char *i = in; + FAR const char *i = in; i = mfs_deser_mfs(i, &x->pg_e); i = mfs_deser_mfs(i, &x->idx_e); @@ -215,7 +215,7 @@ FAR const char *mfs_deser_ctz(FAR const char * const in, FAR char *mfs_ser_path(FAR const struct mfs_path_s * const x, FAR char * const out) { - char *o = out; + FAR char *o = out; o = mfs_ser_ctz(&x->ctz, o); o = mfs_ser_mfs(x->off, o); @@ -226,7 +226,7 @@ FAR char *mfs_ser_path(FAR const struct mfs_path_s * const x, FAR const char *mfs_deser_path(FAR const char * const in, FAR struct mfs_path_s * const x) { - const char *i = in; + FAR const char *i = in; i = mfs_deser_ctz(i, &x->ctz); i = mfs_deser_mfs(i, &x->off); @@ -237,7 +237,7 @@ FAR const char *mfs_deser_path(FAR const char * const in, FAR char *mfs_ser_timespec(FAR const struct timespec * const x, FAR char * const out) { - char *o = out; + FAR char *o = out; o = mfs_ser_64(x->tv_sec, o); o = mfs_ser_64(x->tv_nsec, o); @@ -248,8 +248,8 @@ FAR char *mfs_ser_timespec(FAR const struct timespec * const x, FAR const char *mfs_deser_timespec(FAR const char * const in, FAR struct timespec * const x) { - uint64_t tmp; - const char *i = in; + uint64_t tmp; + FAR const char *i = in; i = mfs_deser_64(i, &tmp); x->tv_sec = tmp; diff --git a/fs/mount/fs_procfs_mount.c b/fs/mount/fs_procfs_mount.c index 36ace5ecc6..06b8074f1a 100644 --- a/fs/mount/fs_procfs_mount.c +++ b/fs/mount/fs_procfs_mount.c @@ -101,30 +101,30 @@ struct mount_info_s /* Helpers */ static void mount_sprintf(FAR struct mount_info_s *info, - FAR const char *fmt, ...) printf_like(2, 3); + FAR const char *fmt, ...) printf_like(2, 3); #ifndef CONFIG_FS_PROCFS_EXCLUDE_MOUNT static int mount_entry(FAR const char *mountpoint, - FAR struct statfs *statbuf, FAR void *arg); + FAR struct statfs *statbuf, FAR void *arg); #endif #ifndef CONFIG_FS_PROCFS_EXCLUDE_BLOCKS static int blocks_entry(FAR const char *mountpoint, - FAR struct statfs *statbuf, FAR void *arg); + FAR struct statfs *statbuf, FAR void *arg); #endif #ifndef CONFIG_FS_PROCFS_EXCLUDE_USAGE static int usage_entry(FAR const char *mountpoint, - FAR struct statfs *statbuf, FAR void *arg); + FAR struct statfs *statbuf, FAR void *arg); #endif /* File system methods */ static int mount_open(FAR struct file *filep, FAR const char *relpath, - int oflags, mode_t mode); + int oflags, mode_t mode); static int mount_close(FAR struct file *filep); static ssize_t mount_read(FAR struct file *filep, FAR char *buffer, - size_t buflen); + size_t buflen); static int mount_dup(FAR const struct file *oldp, - FAR struct file *newp); + FAR struct file *newp); static int mount_stat(FAR const char *relpath, FAR struct stat *buf); @@ -563,7 +563,7 @@ static int mount_dup(FAR const struct file *oldp, FAR struct file *newp) * ****************************************************************************/ -static int mount_stat(const char *relpath, struct stat *buf) +static int mount_stat(FAR const char *relpath, FAR struct stat *buf) { memset(buf, 0, sizeof(struct stat)); buf->st_mode = S_IFREG | S_IROTH | S_IRGRP | S_IRUSR; diff --git a/fs/nfs/xdr_subs.h b/fs/nfs/xdr_subs.h index e8f77851f3..5326419792 100644 --- a/fs/nfs/xdr_subs.h +++ b/fs/nfs/xdr_subs.h @@ -71,24 +71,24 @@ #define fxdr_nfsv3time(f, t) \ { \ - (t)->tv_sec = ntohl(((struct nfsv3_time *)(f))->nfsv3_sec); \ - (t)->tv_nsec = ntohl(((struct nfsv3_time *)(f))->nfsv3_nsec); \ + (t)->tv_sec = ntohl(((FAR struct nfsv3_time *)(f))->nfsv3_sec); \ + (t)->tv_nsec = ntohl(((FAR struct nfsv3_time *)(f))->nfsv3_nsec); \ } #define txdr_nfsv3time(f, t) \ { \ - ((struct nfsv3_time *)(t))->nfsv3_sec = htonl((f)->tv_sec); \ - ((struct nfsv3_time *)(t))->nfsv3_nsec = htonl((f)->tv_nsec); \ + ((FAR struct nfsv3_time *)(t))->nfsv3_sec = htonl((f)->tv_sec); \ + ((FAR struct nfsv3_time *)(t))->nfsv3_nsec = htonl((f)->tv_nsec); \ } #define fxdr_hyper(f) \ - ((((uint64_t)ntohl(((uint32_t *)(f))[0])) << 32) | \ - (uint64_t)(ntohl(((uint32_t *)(f))[1]))) + ((((uint64_t)ntohl(((FAR uint32_t *)(f))[0])) << 32) | \ + (uint64_t)(ntohl(((FAR uint32_t *)(f))[1]))) #define txdr_hyper(f, t) \ { \ - ((uint32_t *)(t))[0] = htonl((uint32_t)((f) >> 32)); \ - ((uint32_t *)(t))[1] = htonl((uint32_t)((f) & 0xffffffff)); \ + ((FAR uint32_t *)(t))[0] = htonl((uint32_t)((f) >> 32)); \ + ((FAR uint32_t *)(t))[1] = htonl((uint32_t)((f) & 0xffffffff)); \ } /* Macros for dealing with byte data saved in uint32_t aligned memory */ diff --git a/fs/smartfs/smartfs_utils.c b/fs/smartfs/smartfs_utils.c index 7cd03753f9..d764ad8eab 100644 --- a/fs/smartfs/smartfs_utils.c +++ b/fs/smartfs/smartfs_utils.c @@ -76,7 +76,7 @@ static struct smartfs_mountpt_s *g_mounthead = NULL; uint16_t smartfs_rdle16(FAR const void *val) { return (uint16_t)((FAR const uint8_t *)val)[1] << 8 | - (uint16_t)((FAR const uint8_t *)val)[0]; + (uint16_t)((FAR const uint8_t *)val)[0]; } /**************************************************************************** @@ -119,7 +119,7 @@ uint32_t smartfs_rdle32(FAR const void *val) /* Little endian means LS halfword first in byte stream */ return (uint32_t)smartfs_rdle16(&((FAR const uint8_t *)val)[2]) << 16 | - (uint32_t)smartfs_rdle16(val); + (uint32_t)smartfs_rdle16(val); } /**************************************************************************** @@ -156,7 +156,7 @@ void smartfs_wrle32(uint8_t *dest, uint32_t val) * ****************************************************************************/ -int smartfs_mount(struct smartfs_mountpt_s *fs, bool writeable) +int smartfs_mount(FAR struct smartfs_mountpt_s *fs, bool writeable) { FAR struct inode *inode; struct geometry geo; @@ -274,7 +274,7 @@ int smartfs_mount(struct smartfs_mountpt_s *fs, bool writeable) /* We did it! */ - fs->fs_mounted = TRUE; + fs->fs_mounted = true; finfo("SMARTFS:\n"); finfo("\t Sector size: %d\n", fs->fs_llformat.sectorsize); @@ -303,16 +303,16 @@ errout: * ****************************************************************************/ -int smartfs_unmount(struct smartfs_mountpt_s *fs) +int smartfs_unmount(FAR struct smartfs_mountpt_s *fs) { - int ret = OK; - struct inode *inode; + int ret = OK; + FAR struct inode *inode; #if defined(CONFIG_SMARTFS_MULTI_ROOT_DIRS) || \ (defined(CONFIG_FS_PROCFS) && !defined(CONFIG_FS_PROCFS_EXCLUDE_SMARTFS)) - struct smartfs_mountpt_s *nextfs; - struct smartfs_mountpt_s *prevfs; - int count = 0; - int found = FALSE; + FAR struct smartfs_mountpt_s *nextfs; + FAR struct smartfs_mountpt_s *prevfs; + int count = 0; + bool found = false; #endif #if defined(CONFIG_SMARTFS_MULTI_ROOT_DIRS) || \ @@ -334,7 +334,7 @@ int smartfs_unmount(struct smartfs_mountpt_s *fs) if (nextfs == fs) { - found = TRUE; + found = true; } /* Keep track of the previous entry until our's is found */ @@ -387,8 +387,8 @@ int smartfs_unmount(struct smartfs_mountpt_s *fs) /* Set the buffer's to invalid value to catch program bugs */ - fs->fs_rwbuffer = (char *) 0xdeadbeef; - fs->fs_workbuffer = (char *) 0xdeadbeef; + fs->fs_rwbuffer = (FAR char *)0xdeadbeef; + fs->fs_workbuffer = (FAR char *)0xdeadbeef; } /* Now removed ourselves from the linked list */ @@ -443,22 +443,24 @@ int smartfs_unmount(struct smartfs_mountpt_s *fs) * ****************************************************************************/ -int smartfs_finddirentry(struct smartfs_mountpt_s *fs, - struct smartfs_entry_s *direntry, const char *relpath, - uint16_t *parentdirsector, const char **filename) +int smartfs_finddirentry(FAR struct smartfs_mountpt_s *fs, + FAR struct smartfs_entry_s *direntry, + FAR const char *relpath, + FAR uint16_t *parentdirsector, + FAR const char **filename) { int ret = -ENOENT; - const char *segment; - const char *ptr; - uint16_t seglen; - uint16_t depth = 0; - uint16_t dirstack[CONFIG_SMARTFS_DIRDEPTH]; - uint16_t dirsector; - uint16_t entrysize; - uint16_t offset; - struct smartfs_chain_header_s *header; - struct smart_read_write_s readwrite; - struct smartfs_entry_header_s *entry; + FAR const char *segment; + FAR const char *ptr; + uint16_t seglen; + uint16_t depth = 0; + uint16_t dirstack[CONFIG_SMARTFS_DIRDEPTH]; + uint16_t dirsector; + uint16_t entrysize; + uint16_t offset; + FAR struct smartfs_chain_header_s *header; + struct smart_read_write_s readwrite; + FAR struct smartfs_entry_header_s *entry; /* Set the initial value of the output */ @@ -579,7 +581,7 @@ int smartfs_finddirentry(struct smartfs_mountpt_s *fs, /* Point to next sector in chain */ - header = (struct smartfs_chain_header_s *) fs->fs_rwbuffer; + header = (FAR struct smartfs_chain_header_s *) fs->fs_rwbuffer; dirsector = SMARTFS_NEXTSECTOR(header); /* Search for the entry */ @@ -824,23 +826,22 @@ int smartfs_createentry(FAR struct smartfs_mountpt_s *fs, uint16_t sectorno, FAR struct smartfs_ofile_s *sf) { - struct smart_read_write_s readwrite; - int ret; - uint16_t psector; - uint16_t nextsector; - uint16_t offset; - uint16_t found; - uint16_t entrysize; - struct smartfs_entry_header_s *entry; - struct smartfs_chain_header_s *chainheader; - int update_chain = 0; - struct smart_read_write_s update_readwrite; - struct smartfs_chain_header_s update_header; + struct smart_read_write_s readwrite; + int ret; + uint16_t psector; + uint16_t nextsector; + uint16_t offset; + bool found = false; + uint16_t entrysize; + FAR struct smartfs_entry_header_s *entry; + FAR struct smartfs_chain_header_s *chainheader; + struct smart_read_write_s update_readwrite; + struct smartfs_chain_header_s update_header; + int update_chain = 0; /* Start at the 1st sector in the parent directory */ psector = parentdirsector; - found = FALSE; entrysize = sizeof(struct smartfs_entry_header_s) + fs->fs_llformat.namesize; @@ -862,8 +863,8 @@ int smartfs_createentry(FAR struct smartfs_mountpt_s *fs, readwrite.logsector = psector; readwrite.count = fs->fs_llformat.availbytes; readwrite.offset = 0; - readwrite.buffer = (uint8_t *) fs->fs_rwbuffer; - ret = FS_IOCTL(fs, BIOC_READSECT, (unsigned long) &readwrite); + readwrite.buffer = (FAR uint8_t *)fs->fs_rwbuffer; + ret = FS_IOCTL(fs, BIOC_READSECT, (unsigned long)&readwrite); if (ret < 0) { goto errout; @@ -871,7 +872,7 @@ int smartfs_createentry(FAR struct smartfs_mountpt_s *fs, /* Get the next chained sector */ - chainheader = (struct smartfs_chain_header_s *) fs->fs_rwbuffer; + chainheader = (FAR struct smartfs_chain_header_s *)fs->fs_rwbuffer; nextsector = SMARTFS_NEXTSECTOR(chainheader); /* Search for an empty entry in this sector */ @@ -895,14 +896,15 @@ int smartfs_createentry(FAR struct smartfs_mountpt_s *fs, { /* We found an empty entry. Use it. */ - found = TRUE; + found = true; break; } /* Not available. Skip to next entry */ offset += entrysize; - entry = (struct smartfs_entry_header_s *) &fs->fs_rwbuffer[offset]; + entry = (FAR struct smartfs_entry_header_s *) + &fs->fs_rwbuffer[offset]; } /* If we found an entry, stop the search */ @@ -930,7 +932,7 @@ int smartfs_createentry(FAR struct smartfs_mountpt_s *fs, /* Chain the next sector into this sector. */ - *((uint16_t *)update_header.nextsector) = nextsector; + *((FAR uint16_t *)update_header.nextsector) = nextsector; update_readwrite.logsector = psector; update_readwrite.offset = offsetof(struct smartfs_chain_header_s, nextsector); @@ -976,7 +978,7 @@ int smartfs_createentry(FAR struct smartfs_mountpt_s *fs, goto errout; } - nextsector = (uint16_t) ret; + nextsector = (uint16_t)ret; /* Set the newly allocated sector's type (file or dir) */ @@ -989,7 +991,7 @@ int smartfs_createentry(FAR struct smartfs_mountpt_s *fs, memset(sf->buffer, CONFIG_SMARTFS_ERASEDSTATE, fs->fs_llformat.availbytes); - chainheader = (struct smartfs_chain_header_s *) sf->buffer; + chainheader = (FAR struct smartfs_chain_header_s *)sf->buffer; chainheader->type = SMARTFS_SECTOR_TYPE_FILE; sf->bflags = SMARTFS_BFLAG_DIRTY | SMARTFS_BFLAG_NEWALLOC; } @@ -1009,7 +1011,7 @@ int smartfs_createentry(FAR struct smartfs_mountpt_s *fs, readwrite.offset = offsetof(struct smartfs_chain_header_s, type); readwrite.buffer = (uint8_t *) &chainheader->type; readwrite.logsector = nextsector; - ret = FS_IOCTL(fs, BIOC_WRITESECT, (unsigned long) &readwrite); + ret = FS_IOCTL(fs, BIOC_WRITESECT, (unsigned long)&readwrite); if (ret < 0) { ferr("ERROR: Error %d setting new sector type for sector %d\n", @@ -1100,18 +1102,18 @@ errout: * ****************************************************************************/ -int smartfs_deleteentry(struct smartfs_mountpt_s *fs, - struct smartfs_entry_s *entry) +int smartfs_deleteentry(FAR struct smartfs_mountpt_s *fs, + FAR struct smartfs_entry_s *entry) { - int ret; - uint16_t nextsector; - uint16_t sector; - uint16_t count; - uint16_t entrysize; - uint16_t offset; - struct smartfs_entry_header_s *direntry; - struct smartfs_chain_header_s *header; - struct smart_read_write_s readwrite; + int ret; + uint16_t nextsector; + uint16_t sector; + uint16_t count; + uint16_t entrysize; + uint16_t offset; + FAR struct smartfs_entry_header_s *direntry; + FAR struct smartfs_chain_header_s *header; + struct smart_read_write_s readwrite; /* Okay, delete the file. Loop through each sector and release them * @@ -1127,7 +1129,7 @@ int smartfs_deleteentry(struct smartfs_mountpt_s *fs, */ nextsector = entry->firstsector; - header = (struct smartfs_chain_header_s *) fs->fs_rwbuffer; + header = (FAR struct smartfs_chain_header_s *) fs->fs_rwbuffer; readwrite.offset = 0; readwrite.count = sizeof(struct smartfs_chain_header_s); readwrite.buffer = (uint8_t *) fs->fs_rwbuffer; @@ -1329,17 +1331,17 @@ errout: * ****************************************************************************/ -int smartfs_countdirentries(struct smartfs_mountpt_s *fs, - struct smartfs_entry_s *entry) +int smartfs_countdirentries(FAR struct smartfs_mountpt_s *fs, + FAR struct smartfs_entry_s *entry) { - int ret; - uint16_t nextsector; - uint16_t offset; - uint16_t entrysize; - int count; - struct smartfs_entry_header_s *direntry; - struct smartfs_chain_header_s *header; - struct smart_read_write_s readwrite; + int ret; + uint16_t nextsector; + uint16_t offset; + uint16_t entrysize; + int count; + FAR struct smartfs_entry_header_s *direntry; + FAR struct smartfs_chain_header_s *header; + struct smart_read_write_s readwrite; /* Walk through the directory's sectors and count entries */ @@ -1362,7 +1364,7 @@ int smartfs_countdirentries(struct smartfs_mountpt_s *fs, /* Validate this is a directory type sector */ - header = (struct smartfs_chain_header_s *) fs->fs_rwbuffer; + header = (FAR struct smartfs_chain_header_s *) fs->fs_rwbuffer; if (header->type != SMARTFS_SECTOR_TYPE_DIR) { ferr("ERROR: Sector %d is not a DIR sector!\n", nextsector); @@ -1430,7 +1432,7 @@ int smartfs_sync_internal(FAR struct smartfs_mountpt_s *fs, { /* Update the header with the number of bytes written */ - header = (struct smartfs_chain_header_s *)sf->buffer; + header = (FAR struct smartfs_chain_header_s *)sf->buffer; if (SMARTFS_USED(header) == SMARTFS_ERASEDSTATE_16BIT) { @@ -1487,7 +1489,7 @@ int smartfs_sync_internal(FAR struct smartfs_mountpt_s *fs, /* Add new byteswritten to existing value */ - header = (struct smartfs_chain_header_s *) fs->fs_rwbuffer; + header = (FAR struct smartfs_chain_header_s *) fs->fs_rwbuffer; if (SMARTFS_USED(header) == SMARTFS_ERASEDSTATE_16BIT) { @@ -1621,7 +1623,7 @@ off_t smartfs_seek_internal(FAR struct smartfs_mountpt_s *fs, sf->filepos = 0; } - header = (struct smartfs_chain_header_s *) fs->fs_rwbuffer; + header = (FAR struct smartfs_chain_header_s *) fs->fs_rwbuffer; while ((sf->currsector != SMARTFS_ERASEDSTATE_16BIT) && (sf->filepos + fs->fs_llformat.availbytes - sizeof(struct smartfs_chain_header_s) < newpos)) @@ -1707,7 +1709,7 @@ int smartfs_shrinkfile(FAR struct smartfs_mountpt_s *fs, entry = &sf->entry; nextsector = entry->firstsector; - header = (struct smartfs_chain_header_s *)fs->fs_rwbuffer; + header = (FAR struct smartfs_chain_header_s *)fs->fs_rwbuffer; remaining = length; available = fs->fs_llformat.availbytes - sizeof(struct smartfs_chain_header_s); @@ -1863,7 +1865,7 @@ int smartfs_shrinkfile(FAR struct smartfs_mountpt_s *fs, dest = (FAR uint8_t *)&sf->buffer[offset]; destsize = fs->fs_llformat.availbytes - offset; - header = (struct smartfs_chain_header_s *)sf->buffer; + header = (FAR struct smartfs_chain_header_s *)sf->buffer; SMARTFS_SET_USED(header, length); SMARTFS_SET_NEXTSECTOR(header, SMARTFS_ERASEDSTATE_16BIT); @@ -1871,7 +1873,7 @@ int smartfs_shrinkfile(FAR struct smartfs_mountpt_s *fs, memset(dest, CONFIG_SMARTFS_ERASEDSTATE, destsize); - header = (struct smartfs_chain_header_s *)sf->buffer; + header = (FAR struct smartfs_chain_header_s *)sf->buffer; header->type = SMARTFS_SECTOR_TYPE_FILE; sf->bflags = SMARTFS_BFLAG_DIRTY; } @@ -2012,7 +2014,7 @@ int smartfs_extendfile(FAR struct smartfs_mountpt_s *fs, /* Copy the new sector to the old one and chain it */ - header = (struct smartfs_chain_header_s *) sf->buffer; + header = (FAR struct smartfs_chain_header_s *) sf->buffer; SMARTFS_SET_NEXTSECTOR(header, ret); /* Now sync the file to write this sector out */ @@ -2068,7 +2070,7 @@ int smartfs_extendfile(FAR struct smartfs_mountpt_s *fs, /* Copy the new sector to the old one and chain it */ - header = (struct smartfs_chain_header_s *)fs->fs_rwbuffer; + header = (FAR struct smartfs_chain_header_s *)fs->fs_rwbuffer; SMARTFS_SET_NEXTSECTOR(header, ret); readwrite.offset = offsetof(struct smartfs_chain_header_s, diff --git a/fs/spiffs/src/spiffs_core.c b/fs/spiffs/src/spiffs_core.c index 381eb561e1..9e445d5f58 100644 --- a/fs/spiffs/src/spiffs_core.c +++ b/fs/spiffs/src/spiffs_core.c @@ -1392,8 +1392,8 @@ int spiffs_fobj_create(FAR struct spiffs_s *fs, #ifdef CONFIG_SPIFFS_LEADING_SLASH objndx_hdr.name[0] = '/'; #endif - strlcpy((char *)objndx_hdr.name + SPIFFS_LEADING_SLASH_SIZE, - (const char *)name, + strlcpy((FAR char *)objndx_hdr.name + SPIFFS_LEADING_SLASH_SIZE, + (FAR const char *)name, CONFIG_SPIFFS_NAME_MAX); /* Update page */ @@ -2124,7 +2124,7 @@ ssize_t spiffs_fobj_append(FAR struct spiffs_s *fs, { /* Update object index header page */ - ((FAR int16_t *)((FAR uint8_t *) objhdr + + ((FAR int16_t *)((FAR uint8_t *)objhdr + sizeof(struct spiffs_pgobj_ndxheader_s)))[data_spndx] = data_page; @@ -2137,7 +2137,7 @@ ssize_t spiffs_fobj_append(FAR struct spiffs_s *fs, { /* Update object index page */ - ((FAR int16_t *)((FAR uint8_t *) objndx + + ((FAR int16_t *)((FAR uint8_t *)objndx + sizeof(struct spiffs_page_objndx_s))) [SPIFFS_OBJNDX_ENTRY(fs, data_spndx)] = data_page; @@ -3000,7 +3000,7 @@ int spiffs_fobj_truncate(FAR struct spiffs_s *fs, /* Get data page from object index header page */ data_pgndx = - ((FAR int16_t *)((FAR uint8_t *) objhdr + + ((FAR int16_t *)((FAR uint8_t *)objhdr + sizeof(struct spiffs_pgobj_ndxheader_s)))[data_spndx]; ((FAR int16_t *)((FAR uint8_t *)objhdr + @@ -3151,7 +3151,7 @@ int spiffs_fobj_truncate(FAR struct spiffs_s *fs, { /* Update object index header page */ - ((FAR int16_t *)((FAR uint8_t *) objhdr + + ((FAR int16_t *)((FAR uint8_t *)objhdr + sizeof(struct spiffs_pgobj_ndxheader_s)))[data_spndx] = new_data_pgndx; @@ -3413,7 +3413,7 @@ ssize_t spiffs_object_read(FAR struct spiffs_s *fs, /* Get data page from object index page */ data_pgndx = - ((FAR int16_t *)((FAR uint8_t *) objndx + + ((FAR int16_t *)((FAR uint8_t *)objndx + sizeof(struct spiffs_page_objndx_s))) [SPIFFS_OBJNDX_ENTRY(fs, data_spndx)]; } diff --git a/fs/spiffs/src/spiffs_core.h b/fs/spiffs/src/spiffs_core.h index feae62bbee..74c8e4f336 100644 --- a/fs/spiffs/src/spiffs_core.h +++ b/fs/spiffs/src/spiffs_core.h @@ -420,10 +420,10 @@ begin_packed_struct struct spiffs_page_objndx_s /* callback func for object lookup visitor */ -typedef int (*spiffs_callback_t)(FAR struct spiffs_s *fs, int16_t objid, - int16_t blkndx, int entry, - FAR const void *user_const, - FAR void *user_var); +typedef CODE int (*spiffs_callback_t)(FAR struct spiffs_s *fs, int16_t objid, + int16_t blkndx, int entry, + FAR const void *user_const, + FAR void *user_var); /**************************************************************************** * Public Function Prototypes @@ -436,7 +436,7 @@ int spiffs_phys_cpy(FAR struct spiffs_s *fs, int spiffs_foreach_objlu(FAR struct spiffs_s *fs, int16_t starting_block, int starting_lu_entry, uint8_t flags, int16_t objid, spiffs_callback_t v, FAR const void *user_const, - FAR void *user_var, FAR int16_t *blkndx, int *lu_entry); + FAR void *user_var, FAR int16_t *blkndx, FAR int *lu_entry); int spiffs_erase_block(FAR struct spiffs_s *fs, int16_t blkndx); int spiffs_objlu_scan(FAR struct spiffs_s *fs); int spiffs_objlu_find_free_objid(FAR struct spiffs_s *fs, diff --git a/fs/spiffs/src/spiffs_gc.c b/fs/spiffs/src/spiffs_gc.c index 41ae54fa8a..7ff0bc3a5f 100644 --- a/fs/spiffs/src/spiffs_gc.c +++ b/fs/spiffs/src/spiffs_gc.c @@ -160,7 +160,7 @@ static int spiffs_gc_erase_block(FAR struct spiffs_s *fs, int16_t blkndx) static int spiffs_gc_epage_stats(FAR struct spiffs_s *fs, int16_t blkndx) { - FAR int16_t *objlu_buf = (int16_t *) fs->lu_work; + FAR int16_t *objlu_buf = (FAR int16_t *)fs->lu_work; uint32_t dele = 0; uint32_t allo = 0; int entries_per_page = (SPIFFS_GEO_PAGE_SIZE(fs) / sizeof(int16_t)); @@ -993,7 +993,7 @@ static int spiffs_gc_clean(FAR struct spiffs_s *fs, int16_t blkndx) int spiffs_gc_quick(FAR struct spiffs_s *fs, uint16_t max_free_pages) { - FAR int16_t *objlu_buf = (int16_t *) fs->lu_work; + FAR int16_t *objlu_buf = (FAR int16_t *)fs->lu_work; uint32_t cur_block_addr = 0; uint32_t blocks = SPIFFS_GEO_BLOCK_COUNT(fs); int16_t cur_block = 0; diff --git a/fs/unionfs/fs_unionfs.c b/fs/unionfs/fs_unionfs.c index e89a261d6a..ab7abc2bed 100644 --- a/fs/unionfs/fs_unionfs.c +++ b/fs/unionfs/fs_unionfs.c @@ -96,105 +96,119 @@ struct unionfs_file_s /* Helper functions */ static FAR const char *unionfs_offsetpath(FAR const char *relpath, - FAR const char *prefix); + FAR const char *prefix); static bool unionfs_ispartprefix(FAR const char *partprefix, - FAR const char *prefix); + FAR const char *prefix); static int unionfs_tryopen(FAR struct file *filep, - FAR const char *relpath, FAR const char *prefix, int oflags, - mode_t mode); + FAR const char *relpath, + FAR const char *prefix, int oflags, + mode_t mode); static int unionfs_tryopendir(FAR struct inode *inode, - FAR const char *relpath, FAR const char *prefix, - FAR struct fs_dirent_s **dir); + FAR const char *relpath, + FAR const char *prefix, + FAR struct fs_dirent_s **dir); static int unionfs_trymkdir(FAR struct inode *inode, - FAR const char *relpath, FAR const char *prefix, - mode_t mode); + FAR const char *relpath, + FAR const char *prefix, + mode_t mode); static int unionfs_tryrmdir(FAR struct inode *inode, - FAR const char *relpath, FAR const char *prefix); + FAR const char *relpath, + FAR const char *prefix); static int unionfs_tryunlink(FAR struct inode *inode, - FAR const char *relpath, FAR const char *prefix); + FAR const char *relpath, + FAR const char *prefix); static int unionfs_tryrename(FAR struct inode *mountpt, - FAR const char *oldrelpath, FAR const char *newrelpath, - FAR const char *prefix); + FAR const char *oldrelpath, + FAR const char *newrelpath, + FAR const char *prefix); static int unionfs_trystat(FAR struct inode *inode, - FAR const char *relpath, FAR const char *prefix, - FAR struct stat *buf); + FAR const char *relpath, + FAR const char *prefix, + FAR struct stat *buf); static int unionfs_trychstat(FAR struct inode *inode, - FAR const char *relpath, FAR const char *prefix, - FAR const struct stat *buf, int flags); + FAR const char *relpath, + FAR const char *prefix, + FAR const struct stat *buf, int flags); static int unionfs_trystatdir(FAR struct inode *inode, - FAR const char *relpath, FAR const char *prefix); + FAR const char *relpath, + FAR const char *prefix); static int unionfs_trystatfile(FAR struct inode *inode, - FAR const char *relpath, FAR const char *prefix); + FAR const char *relpath, + FAR const char *prefix); static FAR char *unionfs_relpath(FAR const char *path, - FAR const char *name); + FAR const char *name); static int unionfs_unbind_child(FAR struct unionfs_mountpt_s *um); static void unionfs_destroy(FAR struct unionfs_inode_s *ui); /* Operations on opened files (with struct file) */ -static int unionfs_open(FAR struct file *filep, const char *relpath, - int oflags, mode_t mode); +static int unionfs_open(FAR struct file *filep, FAR const char *relpath, + int oflags, mode_t mode); static int unionfs_close(FAR struct file *filep); static ssize_t unionfs_read(FAR struct file *filep, FAR char *buffer, - size_t buflen); + size_t buflen); static ssize_t unionfs_write(FAR struct file *filep, FAR const char *buffer, - size_t buflen); + size_t buflen); static off_t unionfs_seek(FAR struct file *filep, off_t offset, - int whence); + int whence); static int unionfs_ioctl(FAR struct file *filep, int cmd, - unsigned long arg); + unsigned long arg); static int unionfs_sync(FAR struct file *filep); static int unionfs_dup(FAR const struct file *oldp, - FAR struct file *newp); + FAR struct file *newp); static int unionfs_fstat(FAR const struct file *filep, - FAR struct stat *buf); + FAR struct stat *buf); static int unionfs_fchstat(FAR const struct file *filep, - FAR const struct stat *buf, int flags); + FAR const struct stat *buf, int flags); static int unionfs_truncate(FAR struct file *filep, off_t length); /* Operations on directories */ -static int unionfs_opendir(struct inode *mountpt, const char *relpath, - FAR struct fs_dirent_s **dir); +static int unionfs_opendir(FAR struct inode *mountpt, + FAR const char *relpath, + FAR struct fs_dirent_s **dir); static int unionfs_closedir(FAR struct inode *mountpt, - FAR struct fs_dirent_s *dir); + FAR struct fs_dirent_s *dir); static int unionfs_readdir(FAR struct inode *mountpt, - FAR struct fs_dirent_s *dir, - FAR struct dirent *entry); + FAR struct fs_dirent_s *dir, + FAR struct dirent *entry); static int unionfs_rewinddir(FAR struct inode *mountpt, - FAR struct fs_dirent_s *dir); + FAR struct fs_dirent_s *dir); static int unionfs_bind(FAR struct inode *blkdriver, - FAR const void *data, FAR void **handle); + FAR const void *data, FAR void **handle); static int unionfs_unbind(FAR void *handle, FAR struct inode **blkdriver, - unsigned int flags); + unsigned int flags); static int unionfs_statfs(FAR struct inode *mountpt, - FAR struct statfs *buf); + FAR struct statfs *buf); /* Operations on paths */ static int unionfs_unlink(FAR struct inode *mountpt, - FAR const char *relpath); + FAR const char *relpath); static int unionfs_mkdir(FAR struct inode *mountpt, - FAR const char *relpath, mode_t mode); + FAR const char *relpath, mode_t mode); static int unionfs_rmdir(FAR struct inode *mountpt, - FAR const char *relpath); + FAR const char *relpath); static int unionfs_rename(FAR struct inode *mountpt, - FAR const char *oldrelpath, FAR const char *newrelpath); + FAR const char *oldrelpath, + FAR const char *newrelpath); static int unionfs_stat(FAR struct inode *mountpt, - FAR const char *relpath, FAR struct stat *buf); + FAR const char *relpath, FAR struct stat *buf); static int unionfs_chstat(FAR struct inode *mountpt, - FAR const char *relpath, - FAR const struct stat *buf, int flags); + FAR const char *relpath, + FAR const struct stat *buf, int flags); /* Initialization */ static int unionfs_getmount(FAR const char *path, - FAR struct inode **inode); + FAR struct inode **inode); static int unionfs_dobind(FAR const char *fspath1, - FAR const char *prefix1, FAR const char *fspath2, - FAR const char *prefix2, FAR void **handle); + FAR const char *prefix1, + FAR const char *fspath2, + FAR const char *prefix2, + FAR void **handle); /**************************************************************************** * Public Data @@ -594,7 +608,7 @@ static int unionfs_trystatdir(FAR struct inode *inode, FAR const char *relpath, FAR const char *prefix) { - FAR struct stat buf; + struct stat buf; int ret; /* Check if relative path refers to a directory. */ @@ -616,7 +630,7 @@ static int unionfs_trystatfile(FAR struct inode *inode, FAR const char *relpath, FAR const char *prefix) { - FAR struct stat buf; + struct stat buf; int ret; /* Check if relative path refers to a regular file. We specifically @@ -996,7 +1010,7 @@ static int unionfs_close(FAR struct file *filep) ****************************************************************************/ static ssize_t unionfs_read(FAR struct file *filep, FAR char *buffer, - size_t buflen) + size_t buflen) { FAR struct unionfs_inode_s *ui; FAR struct unionfs_file_s *uf; @@ -1029,7 +1043,7 @@ static ssize_t unionfs_read(FAR struct file *filep, FAR char *buffer, ****************************************************************************/ static ssize_t unionfs_write(FAR struct file *filep, FAR const char *buffer, - size_t buflen) + size_t buflen) { FAR struct unionfs_inode_s *ui; FAR struct unionfs_file_s *uf; @@ -1523,7 +1537,7 @@ errout_with_udir: ****************************************************************************/ static int unionfs_closedir(FAR struct inode *mountpt, - FAR struct fs_dirent_s *dir) + FAR struct fs_dirent_s *dir) { FAR struct unionfs_inode_s *ui; FAR struct unionfs_mountpt_s *um; @@ -1862,7 +1876,8 @@ static int unionfs_readdir(FAR struct inode *mountpt, * Name: unionfs_rewindir ****************************************************************************/ -static int unionfs_rewinddir(struct inode *mountpt, struct fs_dirent_s *dir) +static int unionfs_rewinddir(FAR struct inode *mountpt, + FAR struct fs_dirent_s *dir) { FAR struct unionfs_inode_s *ui; FAR struct unionfs_mountpt_s *um; @@ -2324,8 +2339,8 @@ static int unionfs_rmdir(FAR struct inode *mountpt, FAR const char *relpath) ****************************************************************************/ static int unionfs_rename(FAR struct inode *mountpt, - FAR const char *oldrelpath, - FAR const char *newrelpath) + FAR const char *oldrelpath, + FAR const char *newrelpath) { FAR struct unionfs_inode_s *ui; FAR struct unionfs_mountpt_s *um; @@ -2390,7 +2405,7 @@ static int unionfs_rename(FAR struct inode *mountpt, ****************************************************************************/ static int unionfs_stat(FAR struct inode *mountpt, FAR const char *relpath, - FAR struct stat *buf) + FAR struct stat *buf) { FAR struct unionfs_inode_s *ui; FAR struct unionfs_mountpt_s *um; diff --git a/graphics/nxglib/cursor/nxglib_cursor_backup.c b/graphics/nxglib/cursor/nxglib_cursor_backup.c index c6efb56d1b..afec6a885a 100644 --- a/graphics/nxglib/cursor/nxglib_cursor_backup.c +++ b/graphics/nxglib/cursor/nxglib_cursor_backup.c @@ -69,7 +69,7 @@ void NXGL_FUNCNAME(nxglib_cursor_backup, NXGLIB_SUFFIX) FAR const uint8_t *sline; FAR uint8_t *dline; FAR const NXGL_PIXEL_T *src; - FAR FAR NXGL_PIXEL_T *dest; + FAR NXGL_PIXEL_T *dest; nxgl_coord_t width; nxgl_coord_t height; nxgl_coord_t sstride; diff --git a/graphics/nxterm/nxterm.h b/graphics/nxterm/nxterm.h index 2b9b6e6501..b34e1669ed 100644 --- a/graphics/nxterm/nxterm.h +++ b/graphics/nxterm/nxterm.h @@ -157,7 +157,7 @@ struct nxterm_state_s * retained in the f_priv field of the 'struct file'. */ - struct pollfd *fds[CONFIG_NXTERM_NPOLLWAITERS]; + FAR struct pollfd *fds[CONFIG_NXTERM_NPOLLWAITERS]; #endif /* CONFIG_NXTERM_NXKBDIN */ }; diff --git a/graphics/nxterm/nxterm_kbdin.c b/graphics/nxterm/nxterm_kbdin.c index a4607546f5..01eb9c46d6 100644 --- a/graphics/nxterm/nxterm_kbdin.c +++ b/graphics/nxterm/nxterm_kbdin.c @@ -289,7 +289,7 @@ int nxterm_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup) { /* This is a request to tear down the poll. */ - struct pollfd **slot = (struct pollfd **)fds->priv; + FAR struct pollfd **slot = (FAR struct pollfd **)fds->priv; #ifdef CONFIG_DEBUG_GRAPHICS if (!slot) diff --git a/include/crypto/cryptodev.h b/include/crypto/cryptodev.h index 9544934d7a..6e579e9516 100644 --- a/include/crypto/cryptodev.h +++ b/include/crypto/cryptodev.h @@ -361,10 +361,11 @@ extern const uint8_t hmac_opad_buffer[HMAC_MAX_BLOCK_LEN]; int crypto_newsession(FAR uint64_t *, FAR struct cryptoini *, int); int crypto_freesession(uint64_t); int crypto_register(uint32_t, FAR int *, - CODE int (*)(uint32_t *, struct cryptoini *), + CODE int (*)(FAR uint32_t *, FAR struct cryptoini *), CODE int (*)(uint64_t), CODE int (*)(FAR struct cryptop *)); -int crypto_kregister(uint32_t, FAR int *, CODE int (*)(struct cryptkop *)); +int crypto_kregister(uint32_t, FAR int *, + CODE int (*)(FAR struct cryptkop *)); int crypto_unregister(uint32_t, int); int crypto_get_driverid(uint8_t); int crypto_invoke(FAR struct cryptop *); diff --git a/include/crypto/xform.h b/include/crypto/xform.h index c8dd3024ab..96462676f1 100644 --- a/include/crypto/xform.h +++ b/include/crypto/xform.h @@ -56,11 +56,11 @@ struct auth_hash uint16_t authsize; uint16_t ctxsize; uint16_t blocksize; - CODE void (*init) (FAR void *); - CODE void (*setkey) (FAR void *, FAR const uint8_t *, uint16_t); - CODE void (*reinit) (FAR void *, FAR const uint8_t *, uint16_t); - CODE int (*update) (FAR void *, FAR const uint8_t *, size_t); - CODE void (*final) (FAR uint8_t *, FAR void *); + CODE void (*init)(FAR void *); + CODE void (*setkey)(FAR void *, FAR const uint8_t *, uint16_t); + CODE void (*reinit)(FAR void *, FAR const uint8_t *, uint16_t); + CODE int (*update)(FAR void *, FAR const uint8_t *, size_t); + CODE void (*final)(FAR uint8_t *, FAR void *); }; struct enc_xform @@ -72,10 +72,10 @@ struct enc_xform uint16_t minkey; uint16_t maxkey; uint16_t ctxsize; - CODE void (*encrypt) (caddr_t, FAR uint8_t *); - CODE void (*decrypt) (caddr_t, FAR uint8_t *); - CODE int (*setkey) (void *, FAR uint8_t *, int len); - CODE void (*reinit) (caddr_t, FAR uint8_t *); + CODE void (*encrypt)(caddr_t, FAR uint8_t *); + CODE void (*decrypt)(caddr_t, FAR uint8_t *); + CODE int (*setkey)(FAR void *, FAR uint8_t *, int len); + CODE void (*reinit)(caddr_t, FAR uint8_t *); }; struct comp_algo diff --git a/include/nuttx/1wire/1wire.h b/include/nuttx/1wire/1wire.h index ad6c10efc3..1d67ed6b16 100644 --- a/include/nuttx/1wire/1wire.h +++ b/include/nuttx/1wire/1wire.h @@ -177,16 +177,17 @@ struct onewire_dev_s; struct onewire_ops_s { - int (*reset)(FAR struct onewire_dev_s *dev); - int (*write)(FAR struct onewire_dev_s *dev, FAR const uint8_t *buffer, - int buflen); - int (*read)(FAR struct onewire_dev_s *dev, FAR uint8_t *buffer, - int buflen); - int (*exchange)(FAR struct onewire_dev_s *dev, bool reset, - FAR const uint8_t *txbuffer, int txbuflen, - FAR uint8_t *rxbuffer, int rxbuflen); - int (*writebit)(FAR struct onewire_dev_s *dev, FAR const uint8_t *bit); - int (*readbit)(FAR struct onewire_dev_s *dev, FAR uint8_t *bit); + CODE int (*reset)(FAR struct onewire_dev_s *dev); + CODE int (*write)(FAR struct onewire_dev_s *dev, FAR const uint8_t *buffer, + int buflen); + CODE int (*read)(FAR struct onewire_dev_s *dev, FAR uint8_t *buffer, + int buflen); + CODE int (*exchange)(FAR struct onewire_dev_s *dev, bool reset, + FAR const uint8_t *txbuffer, int txbuflen, + FAR uint8_t *rxbuffer, int rxbuflen); + CODE int (*writebit)(FAR struct onewire_dev_s *dev, + FAR const uint8_t *bit); + CODE int (*readbit)(FAR struct onewire_dev_s *dev, FAR uint8_t *bit); }; /* 1-Wire private data. This structure only defines the initial fields of the @@ -196,7 +197,7 @@ struct onewire_ops_s struct onewire_dev_s { - const struct onewire_ops_s *ops; /* 1-Wire vtable */ + FAR const struct onewire_ops_s *ops; /* 1-Wire vtable */ }; /**************************************************************************** diff --git a/include/nuttx/analog/adc.h b/include/nuttx/analog/adc.h index 9cb482f78a..0bbd4162b0 100644 --- a/include/nuttx/analog/adc.h +++ b/include/nuttx/analog/adc.h @@ -199,7 +199,7 @@ struct adc_dev_s * retained in the f_priv field of the 'struct file'. */ - struct pollfd *fds[CONFIG_ADC_NPOLLWAITERS]; + FAR struct pollfd *fds[CONFIG_ADC_NPOLLWAITERS]; #endif /* CONFIG_ADC */ }; diff --git a/include/nuttx/analog/comp.h b/include/nuttx/analog/comp.h index de59756114..0455d4a3de 100644 --- a/include/nuttx/analog/comp.h +++ b/include/nuttx/analog/comp.h @@ -108,7 +108,7 @@ struct comp_dev_s /* pollfd's for output transition events */ - struct pollfd *d_fds[CONFIG_DEV_COMP_NPOLLWAITERS]; + FAR struct pollfd *d_fds[CONFIG_DEV_COMP_NPOLLWAITERS]; #endif /* Fields provided by lower half COMP logic */ diff --git a/include/nuttx/audio/audio.h b/include/nuttx/audio/audio.h index 30d308eb57..e50eca70f4 100644 --- a/include/nuttx/audio/audio.h +++ b/include/nuttx/audio/audio.h @@ -493,11 +493,11 @@ struct audio_msg_s #ifdef CONFIG_AUDIO_BUILTIN_SOUNDS struct audio_sound_s { - const char *name; /* Name of the sound */ + FAR const char *name; /* Name of the sound */ uint32_t id; /* ID of the sound */ uint32_t type; /* Type of sound */ uint32_t size; /* Number of bytes in the sound */ - const uint8_t *data; /* Pointer to the data */ + FAR const uint8_t *data; /* Pointer to the data */ }; #endif @@ -524,10 +524,12 @@ struct audio_buf_desc_s #ifdef CONFIG_AUDIO_MULTI_SESSION typedef CODE void (*audio_callback_t)(FAR void *priv, uint16_t reason, - FAR struct ap_buffer_s *apb, uint16_t status, FAR void *session); + FAR struct ap_buffer_s *apb, + uint16_t status, FAR void *session); #else typedef CODE void (*audio_callback_t)(FAR void *priv, uint16_t reason, - FAR struct ap_buffer_s *apb, uint16_t status); + FAR struct ap_buffer_s *apb, + uint16_t status); #endif /* This structure is a set a callback functions used to call from the upper- @@ -548,7 +550,7 @@ struct audio_ops_s */ CODE int (*getcaps)(FAR struct audio_lowerhalf_s *dev, int type, - FAR struct audio_caps_s *caps); + FAR struct audio_caps_s *caps); /* This method is called to bind the lower-level driver to the upper-level * driver and to configure the driver for a specific mode of @@ -560,10 +562,11 @@ struct audio_ops_s #ifdef CONFIG_AUDIO_MULTI_SESSION CODE int (*configure)(FAR struct audio_lowerhalf_s *dev, - FAR void *session, FAR const struct audio_caps_s *caps); + FAR void *session, + FAR const struct audio_caps_s *caps); #else CODE int (*configure)(FAR struct audio_lowerhalf_s *dev, - FAR const struct audio_caps_s *caps); + FAR const struct audio_caps_s *caps); #endif /* This method is called when the driver is closed. The lower half driver @@ -631,7 +634,7 @@ struct audio_ops_s */ CODE int (*allocbuffer)(FAR struct audio_lowerhalf_s *dev, - FAR struct audio_buf_desc_s *apb); + FAR struct audio_buf_desc_s *apb); /* Free an audio pipeline buffer. If the lower-level driver * provides an allocbuffer routine, it should also provide the @@ -639,7 +642,7 @@ struct audio_ops_s */ CODE int (*freebuffer)(FAR struct audio_lowerhalf_s *dev, - FAR struct audio_buf_desc_s *apb); + FAR struct audio_buf_desc_s *apb); /* Enqueue a buffer for processing. * This is a non-blocking enqueue operation. @@ -656,12 +659,12 @@ struct audio_ops_s */ CODE int (*enqueuebuffer)(FAR struct audio_lowerhalf_s *dev, - FAR struct ap_buffer_s *apb); + FAR struct ap_buffer_s *apb); /* Cancel a previously enqueued buffer. */ CODE int (*cancelbuffer)(FAR struct audio_lowerhalf_s *dev, - FAR struct ap_buffer_s *apb); + FAR struct ap_buffer_s *apb); /* Lower-half logic may support platform-specific ioctl commands */ @@ -726,7 +729,7 @@ struct audio_lowerhalf_s * buffer, reporting asynchronous event, reporting errors, etc. */ - FAR audio_callback_t upper; + audio_callback_t upper; /* The private opaque pointer to be passed to upper-layer during * callbacks diff --git a/include/nuttx/fdt.h b/include/nuttx/fdt.h index 6ec27800f0..64c6fc663c 100644 --- a/include/nuttx/fdt.h +++ b/include/nuttx/fdt.h @@ -133,7 +133,7 @@ int fdt_get_irq(FAR const void *fdt, int nodeoffset, ****************************************************************************/ int fdt_get_irq_by_path(FAR const void *fdt, int offset, - const char *path, int irqbase); + FAR const char *path, int irqbase); /**************************************************************************** * Name: fdt_get_parent_address_cells @@ -210,7 +210,7 @@ uintptr_t fdt_ld_by_cells(FAR const void *value, int cells); ****************************************************************************/ uintptr_t fdt_get_reg_base_by_name(FAR const void *fdt, int offset, - const char *reg_name); + FAR const char *reg_name); /**************************************************************************** * Name: fdt_get_reg_base @@ -304,7 +304,7 @@ bool fdt_device_is_available(FAR const void * fdt, int offset); * ****************************************************************************/ -const char *fdt_get_node_label(FAR const void *fdt, int offset); +FAR const char *fdt_get_node_label(FAR const void *fdt, int offset); /**************************************************************************** * Name: fdt_get_clock_frequency diff --git a/include/nuttx/fs/fs.h b/include/nuttx/fs/fs.h index 04f8c07558..56d9376f90 100644 --- a/include/nuttx/fs/fs.h +++ b/include/nuttx/fs/fs.h @@ -505,7 +505,7 @@ struct filelist */ FAR struct file *fl_prefile; - FAR struct file fl_prefiles[CONFIG_NFILE_DESCRIPTORS_PER_BLOCK]; + struct file fl_prefiles[CONFIG_NFILE_DESCRIPTORS_PER_BLOCK]; }; /* The following structure defines the list of files used for standard C I/O. diff --git a/include/nuttx/fs/userfs.h b/include/nuttx/fs/userfs.h index 21fb491c57..2a27a505ea 100644 --- a/include/nuttx/fs/userfs.h +++ b/include/nuttx/fs/userfs.h @@ -357,7 +357,7 @@ struct userfs_fstat_response_s { uint8_t resp; /* Must be USERFS_RESP_FSTAT */ int ret; /* Result of the operation */ - FAR struct stat buf; /* Returned file system status */ + struct stat buf; /* Returned file system status */ }; struct userfs_truncate_request_s @@ -507,7 +507,7 @@ struct userfs_stat_response_s { uint8_t resp; /* Must be USERFS_RESP_STAT */ int ret; /* Result of the operation */ - FAR struct stat buf; /* Returned status of the directory entry */ + struct stat buf; /* Returned status of the directory entry */ }; struct userfs_destroy_request_s diff --git a/include/nuttx/i2c/i2c_slave.h b/include/nuttx/i2c/i2c_slave.h index 2bbaccf618..5948e1516a 100644 --- a/include/nuttx/i2c/i2c_slave.h +++ b/include/nuttx/i2c/i2c_slave.h @@ -214,31 +214,29 @@ typedef enum i2c_slave_complete_e /* The callback function */ -typedef int (i2c_slave_callback_t)(FAR void *arg, i2c_slave_complete_t state, - size_t len); +typedef CODE int (i2c_slave_callback_t)(FAR void *arg, + i2c_slave_complete_t state, + size_t len); /* The I2C vtable */ struct i2c_slave_s; struct i2c_slaveops_s { - int (*setownaddress)(FAR struct i2c_slave_s *dev, - int addr, - int nbits); + CODE int (*setownaddress)(FAR struct i2c_slave_s *dev, int addr, + int nbits); - int (*write)(FAR struct i2c_slave_s *dev, - FAR const uint8_t *buffer, - int buflen); + CODE int (*write)(FAR struct i2c_slave_s *dev, FAR const uint8_t *buffer, + int buflen); - int (*read)(FAR struct i2c_slave_s *dev, - FAR uint8_t *buffer, - int buflen); + CODE int (*read)(FAR struct i2c_slave_s *dev, FAR uint8_t *buffer, + int buflen); - int (*registercallback)(FAR struct i2c_slave_s *dev, - i2c_slave_callback_t *callback, - FAR void *arg); - int (*setup)(FAR struct i2c_slave_s *dev); - int (*shutdown)(FAR struct i2c_slave_s *dev); + CODE int (*registercallback)(FAR struct i2c_slave_s *dev, + FAR i2c_slave_callback_t *callback, + FAR void *arg); + CODE int (*setup)(FAR struct i2c_slave_s *dev); + CODE int (*shutdown)(FAR struct i2c_slave_s *dev); }; /* I2C private data. This structure only defines the initial fields of the @@ -248,7 +246,7 @@ struct i2c_slaveops_s struct i2c_slave_s { - const struct i2c_slaveops_s *ops; /* I2C vtable */ + FAR const struct i2c_slaveops_s *ops; /* I2C vtable */ }; /**************************************************************************** diff --git a/include/nuttx/input/cypress_mbr3108.h b/include/nuttx/input/cypress_mbr3108.h index fa18fc96a2..3f76baa1de 100644 --- a/include/nuttx/input/cypress_mbr3108.h +++ b/include/nuttx/input/cypress_mbr3108.h @@ -108,11 +108,10 @@ begin_packed_struct struct mbr3108_sensor_debug_s struct mbr3108_board_s { - int (*irq_attach) (FAR struct mbr3108_board_s *state, - xcpt_t isr, - FAR void *arg); - void (*irq_enable) (FAR struct mbr3108_board_s *state, bool enable); - int (*set_power) (FAR struct mbr3108_board_s *state, bool on); + CODE int (*irq_attach)(FAR struct mbr3108_board_s *state, xcpt_t isr, + FAR void *arg); + CODE void (*irq_enable)(FAR struct mbr3108_board_s *state, bool enable); + CODE int (*set_power)(FAR struct mbr3108_board_s *state, bool on); }; /**************************************************************************** @@ -124,7 +123,7 @@ struct mbr3108_board_s int cypress_mbr3108_register(FAR const char *devpath, FAR struct i2c_master_s *dev, uint8_t i2c_devaddr, - struct mbr3108_board_s *board_config, - const struct mbr3108_sensor_conf_s *sensor_conf); + FAR struct mbr3108_board_s *board_config, + FAR const struct mbr3108_sensor_conf_s *sensor_conf); #endif /* __INCLUDE_NUTTX_INPUT_CYPRESS_MBR3108_H */ diff --git a/include/nuttx/lcd/ft80x.h b/include/nuttx/lcd/ft80x.h index 0a0c532a60..6e04fb1701 100644 --- a/include/nuttx/lcd/ft80x.h +++ b/include/nuttx/lcd/ft80x.h @@ -1702,7 +1702,7 @@ struct ft80x_registers_s struct ft80x_fade_s { - uint8_t duty ; /* Terminal backlight duty as a percentage (0-100) */ + uint8_t duty; /* Terminal backlight duty as a percentage (0-100) */ uint16_t delay; /* Total number of milliseconds for the fade (10-16700) */ }; diff --git a/include/nuttx/lcd/lcd.h b/include/nuttx/lcd/lcd.h index 6063e415bc..432c841d1e 100644 --- a/include/nuttx/lcd/lcd.h +++ b/include/nuttx/lcd/lcd.h @@ -81,8 +81,9 @@ struct lcd_planeinfo_s * (range: 0 < npixels <= xres-col) */ - int (*putrun)(FAR struct lcd_dev_s *dev, fb_coord_t row, fb_coord_t col, - FAR const uint8_t *buffer, size_t npixels); + CODE int (*putrun)(FAR struct lcd_dev_s *dev, fb_coord_t row, + fb_coord_t col, FAR const uint8_t *buffer, + size_t npixels); /* This method can be used to write a rectangular area to the LCD: * @@ -103,10 +104,10 @@ struct lcd_planeinfo_s * used. */ - int (*putarea)(FAR struct lcd_dev_s *dev, fb_coord_t row_start, - fb_coord_t row_end, fb_coord_t col_start, - fb_coord_t col_end, FAR const uint8_t *buffer, - fb_coord_t stride); + CODE int (*putarea)(FAR struct lcd_dev_s *dev, fb_coord_t row_start, + fb_coord_t row_end, fb_coord_t col_start, + fb_coord_t col_end, FAR const uint8_t *buffer, + fb_coord_t stride); /* This method can be used to read a partial raster line from the LCD: * @@ -119,8 +120,8 @@ struct lcd_planeinfo_s * (range: 0 < npixels <= xres-col) */ - int (*getrun)(FAR struct lcd_dev_s *dev, fb_coord_t row, - fb_coord_t col, FAR uint8_t *buffer, size_t npixels); + CODE int (*getrun)(FAR struct lcd_dev_s *dev, fb_coord_t row, + fb_coord_t col, FAR uint8_t *buffer, size_t npixels); /* This method can be used to read a rectangular area from the LCD: * @@ -138,10 +139,10 @@ struct lcd_planeinfo_s * used. */ - int (*getarea)(FAR struct lcd_dev_s *dev, fb_coord_t row_start, - fb_coord_t row_end, fb_coord_t col_start, - fb_coord_t col_end, FAR uint8_t *buffer, - fb_coord_t stride); + CODE int (*getarea)(FAR struct lcd_dev_s *dev, fb_coord_t row_start, + fb_coord_t row_end, fb_coord_t col_start, + fb_coord_t col_end, FAR uint8_t *buffer, + fb_coord_t stride); /* This method can be used to redraw display's content. * @@ -156,7 +157,7 @@ struct lcd_planeinfo_s * implemented. */ - int (*redraw)(FAR struct lcd_dev_s *dev); + CODE int (*redraw)(FAR struct lcd_dev_s *dev); /* Plane color characteristics ********************************************/ @@ -198,10 +199,10 @@ struct lcd_dev_s * configuration of each LCD color plane. */ - int (*getvideoinfo)(FAR struct lcd_dev_s *dev, - FAR struct fb_videoinfo_s *vinfo); - int (*getplaneinfo)(FAR struct lcd_dev_s *dev, unsigned int planeno, - FAR struct lcd_planeinfo_s *pinfo); + CODE int (*getvideoinfo)(FAR struct lcd_dev_s *dev, + FAR struct fb_videoinfo_s *vinfo); + CODE int (*getplaneinfo)(FAR struct lcd_dev_s *dev, unsigned int planeno, + FAR struct lcd_planeinfo_s *pinfo); /* LCD RGB Mapping ********************************************************/ @@ -210,9 +211,9 @@ struct lcd_dev_s */ #ifdef CONFIG_FB_CMAP - int (*getcmap)(FAR struct lcd_dev_s *dev, FAR struct fb_cmap_s *cmap); - int (*putcmap)(FAR struct lcd_dev_s *dev, - FAR const struct fb_cmap_s *cmap); + CODE int (*getcmap)(FAR struct lcd_dev_s *dev, FAR struct fb_cmap_s *cmap); + CODE int (*putcmap)(FAR struct lcd_dev_s *dev, + FAR const struct fb_cmap_s *cmap); #endif /* Cursor Controls ********************************************************/ @@ -222,10 +223,10 @@ struct lcd_dev_s */ #ifdef CONFIG_FB_HWCURSOR - int (*getcursor)(FAR struct lcd_dev_s *dev, - FAR struct fb_cursorattrib_s *attrib); - int (*setcursor)(FAR struct lcd_dev_s *dev, - FAR struct fb_setcursor_s *settings); + CODE int (*getcursor)(FAR struct lcd_dev_s *dev, + FAR struct fb_cursorattrib_s *attrib); + CODE int (*setcursor)(FAR struct lcd_dev_s *dev, + FAR struct fb_setcursor_s *settings); #endif /* LCD Specific Controls **************************************************/ @@ -235,44 +236,44 @@ struct lcd_dev_s * setting. */ - int (*getpower)(struct lcd_dev_s *dev); + CODE int (*getpower)(struct lcd_dev_s *dev); /* Enable/disable LCD panel power (0: full off - CONFIG_LCD_MAXPOWER: full * on). On backlit LCDs, this setting may correspond to the backlight * setting. */ - int (*setpower)(struct lcd_dev_s *dev, int power); + CODE int (*setpower)(struct lcd_dev_s *dev, int power); /* Get the current contrast setting (0-CONFIG_LCD_MAXCONTRAST) */ - int (*getcontrast)(struct lcd_dev_s *dev); + CODE int (*getcontrast)(struct lcd_dev_s *dev); /* Set LCD panel contrast (0-CONFIG_LCD_MAXCONTRAST) */ - int (*setcontrast)(struct lcd_dev_s *dev, unsigned int contrast); + CODE int (*setcontrast)(struct lcd_dev_s *dev, unsigned int contrast); /* Set LCD panel frame rate (0: disable refresh) */ - int (*setframerate)(struct lcd_dev_s *dev, int rate); + CODE int (*setframerate)(struct lcd_dev_s *dev, int rate); /* Get LCD panel frame rate (0: disable refresh) */ - int (*getframerate)(struct lcd_dev_s *dev); + CODE int (*getframerate)(struct lcd_dev_s *dev); /* Get LCD panel area alignment */ - int (*getareaalign)(FAR struct lcd_dev_s *dev, - FAR struct lcddev_area_align_s *align); + CODE int (*getareaalign)(FAR struct lcd_dev_s *dev, + FAR struct lcddev_area_align_s *align); /* Passthrough unknown ioctl commands. */ - int (*ioctl)(FAR struct lcd_dev_s *dev, int cmd, unsigned long arg); + CODE int (*ioctl)(FAR struct lcd_dev_s *dev, int cmd, unsigned long arg); /* open/close window. */ - int (*open)(FAR struct lcd_dev_s *dev); - int (*close)(FAR struct lcd_dev_s *dev); + CODE int (*open)(FAR struct lcd_dev_s *dev); + CODE int (*close)(FAR struct lcd_dev_s *dev); }; /**************************************************************************** diff --git a/include/nuttx/leds/ws2812.h b/include/nuttx/leds/ws2812.h index f5e5b17c81..99fefc22dc 100644 --- a/include/nuttx/leds/ws2812.h +++ b/include/nuttx/leds/ws2812.h @@ -94,7 +94,7 @@ struct ws2812_dev_s FAR char *data, size_t len); - void *private; /* Private data for opened device */ + FAR void *private; /* Private data for opened device */ uint32_t clock; mutex_t lock; int port; diff --git a/include/nuttx/lib/modlib.h b/include/nuttx/lib/modlib.h index 77fc8a545c..aa35b26088 100644 --- a/include/nuttx/lib/modlib.h +++ b/include/nuttx/lib/modlib.h @@ -151,7 +151,7 @@ struct module_s { FAR struct module_s *flink; /* Supports a singly linked list */ #ifdef HAVE_MODLIB_NAMES - FAR char modname[MODLIB_NAMEMAX]; /* Module name */ + char modname[MODLIB_NAMEMAX]; /* Module name */ #endif #if defined(CONFIG_FS_PROCFS) && !defined(CONFIG_FS_PROCFS_EXCLUDE_MODULE) mod_initializer_t initializer; /* Module initializer function */ @@ -202,7 +202,7 @@ struct mod_loadinfo_s FAR Elf_Phdr *phdr; /* Buffered module program headers */ FAR Elf_Shdr *shdr; /* Buffered module section headers */ FAR void *exported; /* Module exports */ - uint8_t *iobuffer; /* File I/O buffer */ + FAR uint8_t *iobuffer; /* File I/O buffer */ uintptr_t datasec; /* ET_DYN - data area start from Phdr */ uintptr_t segpad; /* Padding between text and data */ uintptr_t initarr; /* .init_array */ diff --git a/include/nuttx/modem/alt1250.h b/include/nuttx/modem/alt1250.h index 4d924fe554..b466f2907c 100644 --- a/include/nuttx/modem/alt1250.h +++ b/include/nuttx/modem/alt1250.h @@ -90,7 +90,7 @@ #define ALTCOM_FD_SET(s, set) ALTCOM_FDSETSAFESET(s, (set)->fd_bits[(s)/8] |= (1 << ((s) & 7))) #define ALTCOM_FD_CLR(s, set) ALTCOM_FDSETSAFESET(s, (set)->fd_bits[(s)/8] &= ~(1 << ((s) & 7))) #define ALTCOM_FD_ISSET(s, set) ALTCOM_FDSETSAFEGET(s, (set)->fd_bits[(s)/8] & (1 << ((s) & 7))) -#define ALTCOM_FD_ZERO(set) memset((void*)(set), 0, sizeof(*(set))) +#define ALTCOM_FD_ZERO(set) memset((FAR void*)(set), 0, sizeof(*(set))) #define ALTCOM_DNS_SERVERS (4) #define ALTCOM_REPEVT_FLAG_SIMSTAT (1 << 0) @@ -308,16 +308,16 @@ struct alt_readdata_s struct alt1250_lower_s { - FAR struct spi_dev_s * (*poweron)(bool keep_on); - void (*poweroff)(void); - bool (*powerstatus)(void); - int (*hiber_mode)(bool); - void (*reset)(void); - void (*irqattach)(xcpt_t handler); - void (*irqenable)(bool enable); - bool (*get_sready)(void); - void (*set_mready)(bool on); - void (*set_wakeup)(bool on); + CODE FAR struct spi_dev_s * (*poweron)(bool keep_on); + CODE void (*poweroff)(void); + CODE bool (*powerstatus)(void); + CODE int (*hiber_mode)(bool); + CODE void (*reset)(void); + CODE void (*irqattach)(xcpt_t handler); + CODE void (*irqenable)(bool enable); + CODE bool (*get_sready)(void); + CODE void (*set_mready)(bool on); + CODE void (*set_wakeup)(bool on); }; struct altcom_fd_set_s @@ -355,12 +355,15 @@ struct alt1250_dev_s struct alt_evtbuf_inst_s select_inst; }; -typedef int32_t (*compose_handler_t)(FAR void **arg, size_t arglen, - uint8_t altver, FAR uint8_t *pktbuf, const size_t pktsz, - FAR uint16_t *altcid); -typedef int32_t (*parse_handler_t)(FAR struct alt1250_dev_s *dev, - FAR uint8_t *pktbuf, size_t pktsz, uint8_t altver, FAR void **arg, - size_t arglen, FAR uint64_t *bitmap); +typedef CODE int32_t (*compose_handler_t)(FAR void **arg, size_t arglen, + uint8_t altver, + FAR uint8_t *pktbuf, + const size_t pktsz, + FAR uint16_t *altcid); +typedef CODE int32_t (*parse_handler_t)(FAR struct alt1250_dev_s *dev, + FAR uint8_t *pktbuf, size_t pktsz, + uint8_t altver, FAR void **arg, + size_t arglen, FAR uint64_t *bitmap); /**************************************************************************** * Public Function Prototypes @@ -392,7 +395,8 @@ extern "C" ****************************************************************************/ FAR void *alt1250_register(FAR const char *devpath, - FAR struct spi_dev_s *dev, FAR const struct alt1250_lower_s *lower); + FAR struct spi_dev_s *dev, + FAR const struct alt1250_lower_s *lower); #undef EXTERN #ifdef __cplusplus diff --git a/include/nuttx/mtd/mtd.h b/include/nuttx/mtd/mtd.h index e6356e0b0e..5b394ac326 100644 --- a/include/nuttx/mtd/mtd.h +++ b/include/nuttx/mtd/mtd.h @@ -136,9 +136,9 @@ struct mtd_protect_s struct mtd_byte_write_s { - uint32_t offset; /* Offset within the device to write to */ - uint16_t count; /* Number of bytes to write */ - const uint8_t *buffer; /* Pointer to the data to write */ + uint32_t offset; /* Offset within the device to write to */ + uint16_t count; /* Number of bytes to write */ + FAR const uint8_t *buffer; /* Pointer to the data to write */ }; /* This structure describes a range of erase sectors to be erased. */ @@ -165,14 +165,15 @@ struct mtd_dev_s * or subsector. */ - int (*erase)(FAR struct mtd_dev_s *dev, off_t startblock, size_t nblocks); + CODE int (*erase)(FAR struct mtd_dev_s *dev, off_t startblock, + size_t nblocks); /* Read/write from the specified read/write blocks */ - ssize_t (*bread)(FAR struct mtd_dev_s *dev, off_t startblock, - size_t nblocks, FAR uint8_t *buffer); - ssize_t (*bwrite)(FAR struct mtd_dev_s *dev, off_t startblock, - size_t nblocks, FAR const uint8_t *buffer); + CODE ssize_t (*bread)(FAR struct mtd_dev_s *dev, off_t startblock, + size_t nblocks, FAR uint8_t *buffer); + CODE ssize_t (*bwrite)(FAR struct mtd_dev_s *dev, off_t startblock, + size_t nblocks, FAR const uint8_t *buffer); /* Some devices may support byte oriented reads (optional). Most MTD * devices are inherently block oriented so byte-oriented writing is not @@ -180,11 +181,11 @@ struct mtd_dev_s * if it requires buffering. */ - ssize_t (*read)(FAR struct mtd_dev_s *dev, off_t offset, size_t nbytes, - FAR uint8_t *buffer); + CODE ssize_t (*read)(FAR struct mtd_dev_s *dev, off_t offset, + size_t nbytes, FAR uint8_t *buffer); #ifdef CONFIG_MTD_BYTE_WRITE - ssize_t (*write)(FAR struct mtd_dev_s *dev, off_t offset, size_t nbytes, - FAR const uint8_t *buffer); + CODE ssize_t (*write)(FAR struct mtd_dev_s *dev, off_t offset, + size_t nbytes, FAR const uint8_t *buffer); #endif /* Support other, less frequently used commands: @@ -195,12 +196,12 @@ struct mtd_dev_s * (see include/nuttx/fs/ioctl.h) */ - int (*ioctl)(FAR struct mtd_dev_s *dev, int cmd, unsigned long arg); + CODE int (*ioctl)(FAR struct mtd_dev_s *dev, int cmd, unsigned long arg); /* Check/Mark bad block for the specified block number */ - int (*isbad)(FAR struct mtd_dev_s *dev, off_t block); - int (*markbad)(FAR struct mtd_dev_s *dev, off_t block); + CODE int (*isbad)(FAR struct mtd_dev_s *dev, off_t block); + CODE int (*markbad)(FAR struct mtd_dev_s *dev, off_t block); /* Name of this MTD device */ diff --git a/include/nuttx/mtd/nand_wrapper.h b/include/nuttx/mtd/nand_wrapper.h index 28304d107b..4dffe1b492 100644 --- a/include/nuttx/mtd/nand_wrapper.h +++ b/include/nuttx/mtd/nand_wrapper.h @@ -65,13 +65,13 @@ extern "C" ****************************************************************************/ int nand_wrapper_erase(FAR struct mtd_dev_s *dev, off_t startblock, - size_t nblocks); + size_t nblocks); ssize_t nand_wrapper_bread(FAR struct mtd_dev_s *dev, off_t startpage, - size_t npages, FAR uint8_t *buffer); + size_t npages, FAR uint8_t *buffer); ssize_t nand_wrapper_bwrite(FAR struct mtd_dev_s *dev, off_t startpage, - size_t npages, FAR const uint8_t *buffer); + size_t npages, FAR const uint8_t *buffer); int nand_wrapper_ioctl(FAR struct mtd_dev_s *dev, int cmd, - unsigned long arg); + unsigned long arg); int nand_wrapper_isbad(FAR struct mtd_dev_s *dev, off_t block); int nand_wrapper_markbad(FAR struct mtd_dev_s *dev, off_t block); void nand_wrapper_initialize(void); @@ -81,4 +81,4 @@ void nand_wrapper_initialize(void); } #endif -#endif /* __TESTING_NAND_RAM_NAND_RAM_H */ \ No newline at end of file +#endif /* __TESTING_NAND_RAM_NAND_RAM_H */ diff --git a/include/nuttx/net/ksz9477.h b/include/nuttx/net/ksz9477.h index bd6c766460..3af03d99f8 100644 --- a/include/nuttx/net/ksz9477.h +++ b/include/nuttx/net/ksz9477.h @@ -85,7 +85,7 @@ extern "C" ****************************************************************************/ #ifdef CONFIG_NET_KSZ9477_I2C -int ksz9477_i2c_init(struct i2c_master_s *i2c_bus, +int ksz9477_i2c_init(FAR struct i2c_master_s *i2c_bus, ksz9477_port_t master_port); #else # error Only I2c interface currently supported diff --git a/include/nuttx/net/lan9250.h b/include/nuttx/net/lan9250.h index 4d068359a4..fe5dc0cab8 100644 --- a/include/nuttx/net/lan9250.h +++ b/include/nuttx/net/lan9250.h @@ -56,17 +56,18 @@ struct lan9250_lower_s { - int (*attach)(FAR const struct lan9250_lower_s *lower, xcpt_t handler, - FAR void *arg); - void (*enable)(FAR const struct lan9250_lower_s *lower); - void (*disable)(FAR const struct lan9250_lower_s *lower); + CODE int (*attach)(FAR const struct lan9250_lower_s *lower, + xcpt_t handler, FAR void *arg); + CODE void (*enable)(FAR const struct lan9250_lower_s *lower); + CODE void (*disable)(FAR const struct lan9250_lower_s *lower); /* This function is optional and used to get a specific MAC address from * a MCU-specific implementation. If this function is NULL, the LAN9250 * driver will not read the MAC from the CPU. */ - void (*getmac)(FAR const struct lan9250_lower_s *lower, FAR uint8_t *mac); + CODE void (*getmac)(FAR const struct lan9250_lower_s *lower, + FAR uint8_t *mac); }; /**************************************************************************** diff --git a/include/nuttx/net/netdev.h b/include/nuttx/net/netdev.h index 4d9810a953..e4221a1ee3 100644 --- a/include/nuttx/net/netdev.h +++ b/include/nuttx/net/netdev.h @@ -512,16 +512,16 @@ struct net_driver_s /* Driver callbacks */ - int (*d_ifup)(FAR struct net_driver_s *dev); - int (*d_ifdown)(FAR struct net_driver_s *dev); - int (*d_txavail)(FAR struct net_driver_s *dev); + CODE int (*d_ifup)(FAR struct net_driver_s *dev); + CODE int (*d_ifdown)(FAR struct net_driver_s *dev); + CODE int (*d_txavail)(FAR struct net_driver_s *dev); #ifdef CONFIG_NET_MCASTGROUP - int (*d_addmac)(FAR struct net_driver_s *dev, FAR const uint8_t *mac); - int (*d_rmmac)(FAR struct net_driver_s *dev, FAR const uint8_t *mac); + CODE int (*d_addmac)(FAR struct net_driver_s *dev, FAR const uint8_t *mac); + CODE int (*d_rmmac)(FAR struct net_driver_s *dev, FAR const uint8_t *mac); #endif #ifdef CONFIG_NETDEV_IOCTL - int (*d_ioctl)(FAR struct net_driver_s *dev, int cmd, - unsigned long arg); + CODE int (*d_ioctl)(FAR struct net_driver_s *dev, int cmd, + unsigned long arg); #endif /* Drivers may attached device-specific, private information */ diff --git a/include/nuttx/net/netdev_lowerhalf.h b/include/nuttx/net/netdev_lowerhalf.h index 4bf780a8a9..a500a8886e 100644 --- a/include/nuttx/net/netdev_lowerhalf.h +++ b/include/nuttx/net/netdev_lowerhalf.h @@ -136,8 +136,8 @@ struct netdev_lowerhalf_s struct netdev_ops_s { - int (*ifup)(FAR struct netdev_lowerhalf_s *dev); - int (*ifdown)(FAR struct netdev_lowerhalf_s *dev); + CODE int (*ifup)(FAR struct netdev_lowerhalf_s *dev); + CODE int (*ifdown)(FAR struct netdev_lowerhalf_s *dev); /* transmit - Try to send a packet, non-blocking, own the netpkt and * need to call netpkt_free to free it sometime later. @@ -148,27 +148,30 @@ struct netdev_ops_s * will be recycled by upper half. */ - int (*transmit)(FAR struct netdev_lowerhalf_s *dev, FAR netpkt_t *pkt); + CODE int (*transmit)(FAR struct netdev_lowerhalf_s *dev, + FAR netpkt_t *pkt); /* receive - Try to receive a packet, non-blocking * Returned Value: * A netpkt contains the packet, or NULL if no more packets. */ - FAR netpkt_t *(*receive)(FAR struct netdev_lowerhalf_s *dev); + CODE FAR netpkt_t *(*receive)(FAR struct netdev_lowerhalf_s *dev); #ifdef CONFIG_NET_MCASTGROUP - int (*addmac)(FAR struct netdev_lowerhalf_s *dev, FAR const uint8_t *mac); - int (*rmmac)(FAR struct netdev_lowerhalf_s *dev, FAR const uint8_t *mac); + CODE int (*addmac)(FAR struct netdev_lowerhalf_s *dev, + FAR const uint8_t *mac); + CODE int (*rmmac)(FAR struct netdev_lowerhalf_s *dev, + FAR const uint8_t *mac); #endif #ifdef CONFIG_NETDEV_IOCTL - int (*ioctl)(FAR struct netdev_lowerhalf_s *dev, int cmd, - unsigned long arg); + CODE int (*ioctl)(FAR struct netdev_lowerhalf_s *dev, int cmd, + unsigned long arg); #endif /* reclaim - try to reclaim packets sent by netdev. */ - void (*reclaim)(FAR struct netdev_lowerhalf_s *dev); + CODE void (*reclaim)(FAR struct netdev_lowerhalf_s *dev); }; /* This structure is a set of wireless handlers, leave unsupported operations @@ -176,17 +179,17 @@ struct netdev_ops_s */ #ifdef CONFIG_NETDEV_WIRELESS_HANDLER -typedef int (*iw_handler_rw)(FAR struct netdev_lowerhalf_s *dev, - FAR struct iwreq *iwr, bool set); -typedef int (*iw_handler_ro)(FAR struct netdev_lowerhalf_s *dev, - FAR struct iwreq *iwr); +typedef CODE int (*iw_handler_rw)(FAR struct netdev_lowerhalf_s *dev, + FAR struct iwreq *iwr, bool set); +typedef CODE int (*iw_handler_ro)(FAR struct netdev_lowerhalf_s *dev, + FAR struct iwreq *iwr); struct wireless_ops_s { /* Connect / disconnect operation, should exist if essid or bssid exists */ - int (*connect)(FAR struct netdev_lowerhalf_s *dev); - int (*disconnect)(FAR struct netdev_lowerhalf_s *dev); + CODE int (*connect)(FAR struct netdev_lowerhalf_s *dev); + CODE int (*disconnect)(FAR struct netdev_lowerhalf_s *dev); /* The following attributes need both set and get. */ diff --git a/include/nuttx/nx/nxfonts.h b/include/nuttx/nx/nxfonts.h index 77bebf168f..5e63b0b820 100644 --- a/include/nuttx/nx/nxfonts.h +++ b/include/nuttx/nx/nxfonts.h @@ -434,11 +434,11 @@ struct nx_font_s struct nx_fontpackage_s { - uint8_t id; /* The font ID */ - FAR const struct nx_font_s metrics; /* Font set metrics */ - FAR const struct nx_fontset_s font7; /* Fonts for 7-bit encoding */ + uint8_t id; /* The font ID */ + const struct nx_font_s metrics; /* Font set metrics */ + const struct nx_fontset_s font7; /* Fonts for 7-bit encoding */ #if CONFIG_NXFONTS_CHARBITS >= 8 - FAR const struct nx_fontset_s font8; /* Fonts for 8-bit encoding */ + const struct nx_fontset_s font8; /* Fonts for 8-bit encoding */ #endif }; @@ -457,7 +457,7 @@ struct nxfonts_glyph_s uint8_t height; /* Height of this glyph (in rows) */ uint8_t width; /* Width of this glyph (in pixels) */ uint8_t stride; /* Width of the glyph row (in bytes) */ - FAR uint8_t bitmap[1]; /* Bitmap memory, actual size varies */ + uint8_t bitmap[1]; /* Bitmap memory, actual size varies */ }; #define SIZEOF_NXFONTS_GLYPH_S(b) (sizeof(struct nxfonts_glyph_s) + (b) - 1) diff --git a/include/nuttx/nx/nxmu.h b/include/nuttx/nx/nxmu.h index c2d425d986..292d172df9 100644 --- a/include/nuttx/nx/nxmu.h +++ b/include/nuttx/nx/nxmu.h @@ -177,7 +177,7 @@ struct nxclimsg_redraw_s { uint32_t msgid; /* NX_CLIMSG_REDRAW */ FAR struct nxbe_window_s *wnd; /* The handle to the window to redraw in */ - FAR struct nxgl_rect_s rect; /* The rectangle to be redrawn */ + struct nxgl_rect_s rect; /* The rectangle to be redrawn */ bool more; /* true: more redraw messages follow */ }; @@ -189,9 +189,9 @@ struct nxclimsg_newposition_s { uint32_t msgid; /* NX_CLIMSG_NEWPOSITION */ FAR struct nxbe_window_s *wnd; /* The window whose position/size has changed */ - FAR struct nxgl_size_s size; /* The current window size */ - FAR struct nxgl_point_s pos; /* The current window position */ - FAR struct nxgl_rect_s bounds; /* Size of screen */ + struct nxgl_size_s size; /* The current window size */ + struct nxgl_point_s pos; /* The current window position */ + struct nxgl_rect_s bounds; /* Size of screen */ }; /* This message reports a new mouse event to a particular window */ @@ -298,7 +298,7 @@ struct nxsvrmsg_curenable_s struct nxsvrmsg_curimage_s { uint32_t msgid; /* NX_SVRMSG_CURSOR_IMAGE */ - FAR struct nx_cursorimage_s image /* Describes the cursor image */ + struct nx_cursorimage_s image /* Describes the cursor image */ }; #endif @@ -307,7 +307,7 @@ struct nxsvrmsg_curimage_s struct nxsvrmsg_curpos_s { uint32_t msgid; /* NX_SVRMSG_CURSOR_SETPOS */ - FAR struct nxgl_point_s pos; /* The new cursor position */ + struct nxgl_point_s pos; /* The new cursor position */ }; #endif @@ -337,7 +337,7 @@ struct nxsvrmsg_setposition_s { uint32_t msgid; /* NX_SVRMSG_SETPOSITION */ FAR struct nxbe_window_s *wnd; /* The window whose position/size has changed */ - FAR struct nxgl_point_s pos; /* The new window position */ + struct nxgl_point_s pos; /* The new window position */ }; /* This message informs the server that the size @@ -348,7 +348,7 @@ struct nxsvrmsg_setsize_s { uint32_t msgid; /* NX_SVRMSG_SETSIZE */ FAR struct nxbe_window_s *wnd; /* The window whose position/size has changed */ - FAR struct nxgl_size_s size; /* The new window size */ + struct nxgl_size_s size; /* The new window size */ }; /* This message informs the server that the size @@ -444,7 +444,7 @@ struct nxsvrmsg_filltrapezoid_s { uint32_t msgid; /* NX_SVRMSG_FILLTRAP */ FAR struct nxbe_window_s *wnd; /* The window to fill */ - FAR struct nxgl_rect_s clip; /* The clipping window */ + struct nxgl_rect_s clip; /* The clipping window */ struct nxgl_trapezoid_s trap; /* The trapezoidal region in the window to fill */ nxgl_mxpixel_t color[CONFIG_NX_NPLANES]; /* Color to use in the fill */ @@ -472,7 +472,7 @@ struct nxsvrmsg_bitmap_s struct nxgl_point_s origin; /* Offset into the source image data */ unsigned int stride; /* The width of the full source image in pixels. */ - sem_t *sem_done; /* Semaphore to report when command is done. */ + FAR sem_t *sem_done; /* Semaphore to report when command is done. */ }; /* Set the color of the background */ @@ -506,7 +506,7 @@ struct nxsvrmsg_mousein_s struct nxsvrmsg_kbdin_s { uint32_t msgid; /* NX_SVRMSG_KBDIN */ - uint8_t nch ; /* Number of characters received */ + uint8_t nch; /* Number of characters received */ uint8_t ch[1]; /* Array of received characters */ }; #endif diff --git a/include/nuttx/power/powerled.h b/include/nuttx/power/powerled.h index 627e6025ed..9b72638a71 100644 --- a/include/nuttx/power/powerled.h +++ b/include/nuttx/power/powerled.h @@ -156,7 +156,7 @@ struct powerled_ops_s /* Set powerled parameters */ CODE int (*params_set)(FAR struct powerled_dev_s *dev, - struct powerled_params_s *param); + FAR struct powerled_params_s *param); /* Set powerled operation mode */ diff --git a/include/nuttx/sdio.h b/include/nuttx/sdio.h index e31df62374..9a6ba4ca5c 100644 --- a/include/nuttx/sdio.h +++ b/include/nuttx/sdio.h @@ -968,51 +968,59 @@ struct sdio_dev_s mutex_t mutex; /* Assures mutually exclusive access to the slot */ #ifdef CONFIG_SDIO_MUXBUS - int (*lock)(FAR struct sdio_dev_s *dev, bool lock); + CODE int (*lock)(FAR struct sdio_dev_s *dev, bool lock); #endif /* Initialization/setup */ - void (*reset)(FAR struct sdio_dev_s *dev); - sdio_capset_t (*capabilities)(FAR struct sdio_dev_s *dev); - sdio_statset_t (*status)(FAR struct sdio_dev_s *dev); - void (*widebus)(FAR struct sdio_dev_s *dev, bool enable); - void (*clock)(FAR struct sdio_dev_s *dev, enum sdio_clock_e rate); - int (*attach)(FAR struct sdio_dev_s *dev); + CODE void (*reset)(FAR struct sdio_dev_s *dev); + CODE sdio_capset_t (*capabilities)(FAR struct sdio_dev_s *dev); + CODE sdio_statset_t (*status)(FAR struct sdio_dev_s *dev); + CODE void (*widebus)(FAR struct sdio_dev_s *dev, bool enable); + CODE void (*clock)(FAR struct sdio_dev_s *dev, enum sdio_clock_e rate); + CODE int (*attach)(FAR struct sdio_dev_s *dev); /* Command/Status/Data Transfer */ - int (*sendcmd)(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t arg); + CODE int (*sendcmd)(FAR struct sdio_dev_s *dev, uint32_t cmd, + uint32_t arg); #ifdef CONFIG_SDIO_BLOCKSETUP - void (*blocksetup)(FAR struct sdio_dev_s *dev, unsigned int blocklen, - unsigned int nblocks); + CODE void (*blocksetup)(FAR struct sdio_dev_s *dev, unsigned int blocklen, + unsigned int nblocks); #endif - int (*recvsetup)(FAR struct sdio_dev_s *dev, FAR uint8_t *buffer, - size_t nbytes); - int (*sendsetup)(FAR struct sdio_dev_s *dev, FAR const uint8_t *buffer, - size_t nbytes); - int (*cancel)(FAR struct sdio_dev_s *dev); + CODE int (*recvsetup)(FAR struct sdio_dev_s *dev, FAR uint8_t *buffer, + size_t nbytes); + CODE int (*sendsetup)(FAR struct sdio_dev_s *dev, + FAR const uint8_t *buffer, size_t nbytes); + CODE int (*cancel)(FAR struct sdio_dev_s *dev); - int (*waitresponse)(FAR struct sdio_dev_s *dev, uint32_t cmd); - int (*recv_r1)(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t *R1); - int (*recv_r2)(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t R2[4]); - int (*recv_r3)(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t *R3); - int (*recv_r4)(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t *R4); - int (*recv_r5)(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t *R5); - int (*recv_r6)(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t *R6); - int (*recv_r7)(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t *R7); + CODE int (*waitresponse)(FAR struct sdio_dev_s *dev, uint32_t cmd); + CODE int (*recv_r1)(FAR struct sdio_dev_s *dev, uint32_t cmd, + FAR uint32_t *R1); + CODE int (*recv_r2)(FAR struct sdio_dev_s *dev, uint32_t cmd, + FAR uint32_t R2[4]); + CODE int (*recv_r3)(FAR struct sdio_dev_s *dev, uint32_t cmd, + FAR uint32_t *R3); + CODE int (*recv_r4)(FAR struct sdio_dev_s *dev, uint32_t cmd, + FAR uint32_t *R4); + CODE int (*recv_r5)(FAR struct sdio_dev_s *dev, uint32_t cmd, + FAR uint32_t *R5); + CODE int (*recv_r6)(FAR struct sdio_dev_s *dev, uint32_t cmd, + FAR uint32_t *R6); + CODE int (*recv_r7)(FAR struct sdio_dev_s *dev, uint32_t cmd, + FAR uint32_t *R7); /* Event/Callback support */ - void (*waitenable)(FAR struct sdio_dev_s *dev, sdio_eventset_t eventset, - uint32_t timeout); - sdio_eventset_t (*eventwait)(FAR struct sdio_dev_s *dev); - void (*callbackenable)(FAR struct sdio_dev_s *dev, - sdio_eventset_t eventset); + CODE void (*waitenable)(FAR struct sdio_dev_s *dev, + sdio_eventset_t eventset, uint32_t timeout); + CODE sdio_eventset_t (*eventwait)(FAR struct sdio_dev_s *dev); + CODE void (*callbackenable)(FAR struct sdio_dev_s *dev, + sdio_eventset_t eventset); #if defined(CONFIG_SCHED_WORKQUEUE) && defined(CONFIG_SCHED_HPWORK) - int (*registercallback)(FAR struct sdio_dev_s *dev, - worker_t callback, void *arg); + CODE int (*registercallback)(FAR struct sdio_dev_s *dev, + worker_t callback, FAR void *arg); #endif /* DMA. CONFIG_SDIO_DMA should be set if the driver supports BOTH DMA @@ -1022,15 +1030,16 @@ struct sdio_dev_s #ifdef CONFIG_SDIO_DMA #ifdef CONFIG_ARCH_HAVE_SDIO_PREFLIGHT - int (*dmapreflight)(FAR struct sdio_dev_s *dev, - FAR const uint8_t *buffer, size_t buflen); + CODE int (*dmapreflight)(FAR struct sdio_dev_s *dev, + FAR const uint8_t *buffer, size_t buflen); #endif - int (*dmarecvsetup)(FAR struct sdio_dev_s *dev, FAR uint8_t *buffer, - size_t buflen); - int (*dmasendsetup)(FAR struct sdio_dev_s *dev, - FAR const uint8_t *buffer, size_t buflen); + CODE int (*dmarecvsetup)(FAR struct sdio_dev_s *dev, FAR uint8_t *buffer, + size_t buflen); + CODE int (*dmasendsetup)(FAR struct sdio_dev_s *dev, + FAR const uint8_t *buffer, size_t buflen); #endif /* CONFIG_SDIO_DMA */ - void (*gotextcsd)(FAR struct sdio_dev_s *dev, FAR const uint8_t *buffer); + CODE void (*gotextcsd)(FAR struct sdio_dev_s *dev, + FAR const uint8_t *buffer); }; /**************************************************************************** diff --git a/include/nuttx/serial/serial.h b/include/nuttx/serial/serial.h index 13e5fc28c3..772fd23566 100644 --- a/include/nuttx/serial/serial.h +++ b/include/nuttx/serial/serial.h @@ -322,7 +322,7 @@ struct uart_dev_s /* Driver interface */ FAR const struct uart_ops_s *ops; /* Arch-specific operations */ - FAR void *priv; /* Used by the arch-specific logic */ + FAR void *priv; /* Used by the arch-specific logic */ /* The following is a list if poll structures of threads waiting for * driver events. The 'struct pollfd' reference for each open is also @@ -335,7 +335,7 @@ struct uart_dev_s uint8_t timeout; /* c_cc[VTIME] */ #endif - struct pollfd *fds[CONFIG_SERIAL_NPOLLWAITERS]; + FAR struct pollfd *fds[CONFIG_SERIAL_NPOLLWAITERS]; }; typedef struct uart_dev_s uart_dev_t; @@ -529,7 +529,8 @@ void uart_reset_sem(FAR uart_dev_t *dev); #if defined(CONFIG_TTY_SIGINT) || defined(CONFIG_TTY_SIGTSTP) || \ defined(CONFIG_TTY_FORCE_PANIC) || defined(CONFIG_TTY_LAUNCH) -int uart_check_special(FAR uart_dev_t *dev, const char *buf, size_t size); +int uart_check_special(FAR uart_dev_t *dev, FAR const char *buf, + size_t size); #endif /**************************************************************************** diff --git a/include/nuttx/timers/capture.h b/include/nuttx/timers/capture.h index 8271012cee..ea620701f2 100644 --- a/include/nuttx/timers/capture.h +++ b/include/nuttx/timers/capture.h @@ -72,7 +72,7 @@ struct cap_ops_s /* Get the result pwm capture edges value */ CODE int (*getedges)(FAR struct cap_lowerhalf_s *lower, - FAR uint32_t *edges); + FAR uint32_t *edges); }; /* This structure provides the publicly visible representation of the diff --git a/include/nuttx/timers/timer.h b/include/nuttx/timers/timer.h index 28ea9e9d0f..aedc753f9b 100644 --- a/include/nuttx/timers/timer.h +++ b/include/nuttx/timers/timer.h @@ -249,7 +249,7 @@ extern "C" static inline int timer_getstatus(FAR struct timer_lowerhalf_s *lower, - FAR struct timer_status_s *status) + FAR struct timer_status_s *status) { int ret; @@ -292,7 +292,7 @@ int timer_maxtimeout(FAR struct timer_lowerhalf_s *lower, static inline int timer_tick_getstatus(FAR struct timer_lowerhalf_s *lower, - FAR struct timer_status_s *status) + FAR struct timer_status_s *status) { int ret; diff --git a/include/nuttx/usb/usbdev.h b/include/nuttx/usb/usbdev.h index 318d24dd46..07f3dbe40c 100644 --- a/include/nuttx/usb/usbdev.h +++ b/include/nuttx/usb/usbdev.h @@ -253,11 +253,11 @@ struct composite_devdesc_s struct usbdev_ep_s; struct usbdev_req_s { - uint8_t *buf; /* Call: Buffer used for data; Return: Unchanged */ - uint8_t flags; /* See USBDEV_REQFLAGS_* definitions */ - uint16_t len; /* Call: Total length of data in buf; Return: Unchanged */ - uint16_t xfrd; /* Call: zero; Return: Bytes transferred so far */ - int16_t result; /* Call: zero; Return: Result of transfer (O or -errno) */ + FAR uint8_t *buf; /* Call: Buffer used for data; Return: Unchanged */ + uint8_t flags; /* See USBDEV_REQFLAGS_* definitions */ + uint16_t len; /* Call: Total length of data in buf; Return: Unchanged */ + uint16_t xfrd; /* Call: zero; Return: Bytes transferred so far */ + int16_t result; /* Call: zero; Return: Result of transfer (O or -errno) */ /* Callback when the transfer completes */ @@ -273,14 +273,14 @@ struct usbdev_epops_s /* Configure/enable and disable endpoint */ CODE int (*configure)(FAR struct usbdev_ep_s *ep, - FAR const struct usb_epdesc_s *desc, bool last); + FAR const struct usb_epdesc_s *desc, bool last); CODE int (*disable)(FAR struct usbdev_ep_s *ep); /* Allocate and free I/O requests */ CODE FAR struct usbdev_req_s *(*allocreq)(FAR struct usbdev_ep_s *ep); CODE void (*freereq)(FAR struct usbdev_ep_s *ep, - FAR struct usbdev_req_s *req); + FAR struct usbdev_req_s *req); /* Allocate and free I/O buffers */ @@ -292,9 +292,9 @@ struct usbdev_epops_s /* Submit and cancel I/O requests */ CODE int (*submit)(FAR struct usbdev_ep_s *ep, - FAR struct usbdev_req_s *req); + FAR struct usbdev_req_s *req); CODE int (*cancel)(FAR struct usbdev_ep_s *ep, - FAR struct usbdev_req_s *req); + FAR struct usbdev_req_s *req); /* Stall or resume an endpoint */ @@ -320,7 +320,8 @@ struct usbdev_ops_s /* Allocate and free endpoints */ CODE FAR struct usbdev_ep_s *(*allocep)(FAR struct usbdev_s *dev, - uint8_t epphy, bool in, uint8_t eptype); + uint8_t epphy, bool in, + uint8_t eptype); CODE void (*freeep)(FAR struct usbdev_s *dev, FAR struct usbdev_ep_s *ep); /* Get the frame number from the last SOF */ @@ -352,18 +353,19 @@ struct usbdev_s struct usbdevclass_driverops_s { CODE int (*bind)(FAR struct usbdevclass_driver_s *driver, - FAR struct usbdev_s *dev); + FAR struct usbdev_s *dev); CODE void (*unbind)(FAR struct usbdevclass_driver_s *driver, - FAR struct usbdev_s *dev); + FAR struct usbdev_s *dev); CODE int (*setup)(FAR struct usbdevclass_driver_s *driver, - FAR struct usbdev_s *dev, FAR const struct usb_ctrlreq_s *ctrl, - FAR uint8_t *dataout, size_t outlen); + FAR struct usbdev_s *dev, + FAR const struct usb_ctrlreq_s *ctrl, + FAR uint8_t *dataout, size_t outlen); CODE void (*disconnect)(FAR struct usbdevclass_driver_s *driver, - FAR struct usbdev_s *dev); + FAR struct usbdev_s *dev); CODE void (*suspend)(FAR struct usbdevclass_driver_s *driver, - FAR struct usbdev_s *dev); + FAR struct usbdev_s *dev); CODE void (*resume)(FAR struct usbdevclass_driver_s *driver, - FAR struct usbdev_s *dev); + FAR struct usbdev_s *dev); }; struct usbdevclass_driver_s diff --git a/include/nuttx/usb/usbhost.h b/include/nuttx/usb/usbhost.h index c5a1110d95..5cb30e44ef 100644 --- a/include/nuttx/usb/usbhost.h +++ b/include/nuttx/usb/usbhost.h @@ -733,8 +733,8 @@ struct usbhost_roothubport_s * compatible with usbhost_hubport_s. */ - struct usbhost_hubport_s hport; /* Common hub port definitions */ - struct usbhost_devaddr_s *pdevgen; /* Address generation data pointer */ + struct usbhost_hubport_s hport; /* Common hub port definitions */ + FAR struct usbhost_devaddr_s *pdevgen; /* Address generation data pointer */ }; /* struct usbhost_class_s provides access from the USB host driver to the @@ -836,7 +836,7 @@ struct usbhost_driver_s FAR const struct usbhost_epdesc_s *epdesc, FAR usbhost_ep_t *ep); CODE int (*epfree)(FAR struct usbhost_driver_s *drvr, - FAR usbhost_ep_t ep); + usbhost_ep_t ep); /* Some hardware supports special memory in which transfer descriptors can * be accessed more efficiently. The following methods provide a mechanism @@ -880,11 +880,11 @@ struct usbhost_driver_s */ CODE int (*ctrlin)(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep0, - FAR const struct usb_ctrlreq_s *req, - FAR uint8_t *buffer); + FAR const struct usb_ctrlreq_s *req, + FAR uint8_t *buffer); CODE int (*ctrlout)(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep0, - FAR const struct usb_ctrlreq_s *req, - FAR const uint8_t *buffer); + FAR const struct usb_ctrlreq_s *req, + FAR const uint8_t *buffer); /* Process a request to handle a transfer descriptor. This method will * enqueue the transfer request and wait for it to complete. Only one @@ -912,8 +912,8 @@ struct usbhost_driver_s #ifdef CONFIG_USBHOST_ASYNCH CODE int (*asynch)(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep, - FAR uint8_t *buffer, size_t buflen, - usbhost_asynch_t callback, FAR void *arg); + FAR uint8_t *buffer, size_t buflen, + usbhost_asynch_t callback, FAR void *arg); #endif /* Cancel any pending syncrhonous or asynchronous transfer on an @@ -929,8 +929,7 @@ struct usbhost_driver_s */ CODE int (*connect)(FAR struct usbhost_driver_s *drvr, - FAR struct usbhost_hubport_s *hport, - bool connected); + FAR struct usbhost_hubport_s *hport, bool connected); #endif /* Called by the class when an error occurs and driver has been @@ -941,7 +940,7 @@ struct usbhost_driver_s */ CODE void (*disconnect)(FAR struct usbhost_driver_s *drvr, - FAR struct usbhost_hubport_s *hport); + FAR struct usbhost_hubport_s *hport); }; /**************************************************************************** @@ -1004,7 +1003,7 @@ int usbhost_registerclass(FAR struct usbhost_registry_s *devclass); * ****************************************************************************/ -const struct usbhost_registry_s * +FAR const struct usbhost_registry_s * usbhost_findclass(FAR const struct usbhost_id_s *id); #ifdef CONFIG_USBHOST_HUB @@ -1076,7 +1075,7 @@ int usbhost_msc_initialize(void); ****************************************************************************/ int usbhost_msc_notifier_setup(worker_t worker, uint8_t event, char sdchar, - FAR void *arg); + FAR void *arg); /**************************************************************************** * Name: usbhost_msc_notifier_teardown diff --git a/include/nuttx/wireless/cc1101.h b/include/nuttx/wireless/cc1101.h index f17e34dbe8..e2915bbd45 100644 --- a/include/nuttx/wireless/cc1101.h +++ b/include/nuttx/wireless/cc1101.h @@ -426,7 +426,7 @@ EXTERN const struct c1101_rfsettings_s * Public Function Prototypes ****************************************************************************/ -FAR int cc1101_init2(FAR struct cc1101_dev_s *dev); +int cc1101_init2(FAR struct cc1101_dev_s *dev); /**************************************************************************** * Initialize Chipcon CC1101 Chip. diff --git a/include/nuttx/wireless/ieee80211/bcmf_board.h b/include/nuttx/wireless/ieee80211/bcmf_board.h index 18231f12cd..e6df4b5afa 100644 --- a/include/nuttx/wireless/ieee80211/bcmf_board.h +++ b/include/nuttx/wireless/ieee80211/bcmf_board.h @@ -107,7 +107,8 @@ void bcmf_board_reset(int minor, bool reset); * ****************************************************************************/ -void bcmf_board_setup_oob_irq(int minor, int (*func)(void *), void *arg); +void bcmf_board_setup_oob_irq(int minor, CODE int (*func)(FAR void *), + FAR void *arg); /**************************************************************************** * Name: bcmf_board_etheraddr diff --git a/include/nuttx/wireless/ieee80211/bcmf_gspi.h b/include/nuttx/wireless/ieee80211/bcmf_gspi.h index 0d8b24405b..a85ba06804 100644 --- a/include/nuttx/wireless/ieee80211/bcmf_gspi.h +++ b/include/nuttx/wireless/ieee80211/bcmf_gspi.h @@ -42,13 +42,13 @@ ****************************************************************************/ enum gspi_cmd_func_e - { - gspi_f0_bus = 0x0, - gspi_f1_backplane = 0x1, - gspi_f2_dma = 0x2, - gspi_f3_dma = 0x3, - gspi_f0_bus_rev16 = 0x4 /* variant of gspi_f0_bus that does REV16 */ - }; +{ + gspi_f0_bus = 0x0, + gspi_f1_backplane = 0x1, + gspi_f2_dma = 0x2, + gspi_f3_dma = 0x3, + gspi_f0_bus_rev16 = 0x4 /* variant of gspi_f0_bus that does REV16 */ +}; struct bcmf_dev_s; @@ -61,25 +61,25 @@ typedef struct gspi_dev_s * following fields before calling gspi_register. */ - FAR int (*init) (FAR struct gspi_dev_s *gspi); + CODE int (*init) (FAR struct gspi_dev_s *gspi); - FAR int (*deinit) (FAR struct gspi_dev_s *gspi); + CODE int (*deinit) (FAR struct gspi_dev_s *gspi); - FAR int (*set_isr) (FAR struct gspi_dev_s *gspi, + CODE int (*set_isr) (FAR struct gspi_dev_s *gspi, xcpt_t thread_isr, FAR void *thread_isr_arg); - FAR int (*interrupt_enable)(FAR struct gspi_dev_s *gspi, - bool enable); + CODE int (*interrupt_enable)(FAR struct gspi_dev_s *gspi, + bool enable); - FAR int (*write) (FAR struct gspi_dev_s *gspi, + CODE int (*write) (FAR struct gspi_dev_s *gspi, bool increment, enum gspi_cmd_func_e function, uint32_t address, uint16_t length, FAR const uint32_t *data); - FAR int (*read) (FAR struct gspi_dev_s *gspi, + CODE int (*read) (FAR struct gspi_dev_s *gspi, bool increment, enum gspi_cmd_func_e function, uint32_t address, @@ -92,7 +92,7 @@ typedef struct gspi_dev_s * Other fields must be set to zero. */ - void *io_dev; /* Private data for opened io device. */ + FAR void *io_dev; /* Private data for opened io device. */ FAR struct bcmf_dev_s *priv; /* Back pointer to bus. */ } gspi_dev_t; diff --git a/include/nuttx/wireless/ieee80211/ieee80211.h b/include/nuttx/wireless/ieee80211/ieee80211.h index f21372e0c9..bf9f5a74a5 100644 --- a/include/nuttx/wireless/ieee80211/ieee80211.h +++ b/include/nuttx/wireless/ieee80211/ieee80211.h @@ -865,7 +865,7 @@ static inline bool ieee80211_is_first_frag(uint16_t seq_ctrl) * hdr: 802.11 header of the frame */ -static inline bool ieee80211_is_frag(struct ieee80211_hdr *hdr) +static inline bool ieee80211_is_frag(FAR struct ieee80211_hdr *hdr) { return ieee80211_has_morefrags(hdr->frame_control) || hdr->seq_ctrl & cpu_to_le16(IEEE80211_SCTL_FRAG); @@ -2489,7 +2489,7 @@ enum ieee80211_he_highest_mcs_supported_subfield_enc */ static inline uint8_t -ieee80211_he_mcs_nss_size(const struct ieee80211_he_cap_elem *he_cap) +ieee80211_he_mcs_nss_size(FAR const struct ieee80211_he_cap_elem *he_cap) { uint8_t count = 4; @@ -2521,7 +2521,7 @@ ieee80211_he_mcs_nss_size(const struct ieee80211_he_cap_elem *he_cap) */ static inline uint8_t -ieee80211_he_ppe_size(uint8_t ppe_thres_hdr, const uint8_t *phy_cap_info) +ieee80211_he_ppe_size(uint8_t ppe_thres_hdr, FAR const uint8_t *phy_cap_info) { uint8_t n; @@ -2592,9 +2592,9 @@ struct ieee80211_he_6ghz_oper */ static inline uint8_t -ieee80211_he_oper_size(const uint8_t *he_oper_ie) +ieee80211_he_oper_size(FAR const uint8_t *he_oper_ie) { - struct ieee80211_he_operation *he_oper = (void *)he_oper_ie; + FAR struct ieee80211_he_operation *he_oper = (FAR void *)he_oper_ie; uint8_t oper_len = sizeof(struct ieee80211_he_operation); uint32_t he_oper_params; @@ -2627,10 +2627,10 @@ ieee80211_he_oper_size(const uint8_t *he_oper_ie) * Return: a pointer to the 6 GHz operation field, or NULL */ -static inline const struct ieee80211_he_6ghz_oper * -ieee80211_he_6ghz_oper(const struct ieee80211_he_operation *he_oper) +static inline FAR const struct ieee80211_he_6ghz_oper * +ieee80211_he_6ghz_oper(FAR const struct ieee80211_he_operation *he_oper) { - const uint8_t *ret = (void *)&he_oper->optional; + FAR const uint8_t *ret = (FAR void *)&he_oper->optional; uint32_t he_oper_params; if (!he_oper) @@ -2645,7 +2645,7 @@ ieee80211_he_6ghz_oper(const struct ieee80211_he_operation *he_oper) if (he_oper_params & IEEE80211_HE_OPERATION_CO_HOSTED_BSS) ret++; - return (void *)ret; + return (FAR void *)ret; } /* HE Spatial Reuse defines */ @@ -2665,9 +2665,9 @@ ieee80211_he_6ghz_oper(const struct ieee80211_he_operation *he_oper) */ static inline uint8_t -ieee80211_he_spr_size(const uint8_t *he_spr_ie) +ieee80211_he_spr_size(FAR const uint8_t *he_spr_ie) { - struct ieee80211_he_spr *he_spr = (void *)he_spr_ie; + FAR struct ieee80211_he_spr *he_spr = (FAR void *)he_spr_ie; uint8_t spr_len = sizeof(struct ieee80211_he_spr); uint8_t he_spr_params; @@ -3914,7 +3914,7 @@ struct ieee80211_he_6ghz_capa * 4 addr: 2 + 2 + 2 + 4*6 = 30 */ -static inline uint8_t *ieee80211_get_qos_ctl(struct ieee80211_hdr *hdr) +static inline uint8_t *ieee80211_get_qos_ctl(FAR struct ieee80211_hdr *hdr) { if (ieee80211_has_a4(hdr->frame_control)) return (uint8_t *)hdr + 30; @@ -3926,7 +3926,7 @@ static inline uint8_t *ieee80211_get_qos_ctl(struct ieee80211_hdr *hdr) * hdr: the frame */ -static inline uint8_t ieee80211_get_tid(struct ieee80211_hdr *hdr) +static inline uint8_t ieee80211_get_tid(FAR struct ieee80211_hdr *hdr) { uint8_t *qc = ieee80211_get_qos_ctl(hdr); @@ -3943,7 +3943,7 @@ static inline uint8_t ieee80211_get_tid(struct ieee80211_hdr *hdr) * field. */ -static inline uint8_t *ieee80211_get_sa(struct ieee80211_hdr *hdr) +static inline FAR uint8_t *ieee80211_get_sa(FAR struct ieee80211_hdr *hdr) { if (ieee80211_has_a4(hdr->frame_control)) return hdr->addr4; @@ -3962,7 +3962,7 @@ static inline uint8_t *ieee80211_get_sa(struct ieee80211_hdr *hdr) * field. */ -static inline uint8_t *ieee80211_get_da(struct ieee80211_hdr *hdr) +static inline FAR uint8_t *ieee80211_get_da(FAR struct ieee80211_hdr *hdr) { if (ieee80211_has_tods(hdr->frame_control)) return hdr->addr3; @@ -3975,7 +3975,8 @@ static inline uint8_t *ieee80211_get_da(struct ieee80211_hdr *hdr) * hdr: the frame (buffer must include at least the first octet of payload) */ -static inline bool _ieee80211_is_robust_mgmt_frame(struct ieee80211_hdr *hdr) +static inline bool +_ieee80211_is_robust_mgmt_frame(FAR struct ieee80211_hdr *hdr) { if (ieee80211_is_disassoc(hdr->frame_control) || ieee80211_is_deauth(hdr->frame_control)) diff --git a/include/sys/socket.h b/include/sys/socket.h index d723dfccae..0e9bb8c1c5 100644 --- a/include/sys/socket.h +++ b/include/sys/socket.h @@ -277,7 +277,7 @@ #define CMSG_OK(mhdr, cmsg) ((cmsg)->cmsg_len >= sizeof(struct cmsghdr) && \ (cmsg)->cmsg_len <= (unsigned long) \ ((mhdr)->msg_controllen - \ - ((char *)(cmsg) - (char *)(mhdr)->msg_control))) + ((FAR char *)(cmsg) - (FAR char *)(mhdr)->msg_control))) #define for_each_cmsghdr(cmsg, msg) \ for (cmsg = CMSG_FIRSTHDR(msg); \ cmsg; \ diff --git a/include/uuid.h b/include/uuid.h index 8907a7c0bb..9d98eaea71 100644 --- a/include/uuid.h +++ b/include/uuid.h @@ -87,19 +87,20 @@ extern "C" { #endif -int32_t uuid_compare(const uuid_t *, const uuid_t *, uint32_t *); -void uuid_create(uuid_t *, uint32_t *); -void uuid_create_nil(uuid_t *, uint32_t *); -int32_t uuid_equal(const uuid_t *, const uuid_t *, uint32_t *); -void uuid_from_string(const char *, uuid_t *, uint32_t *); -uint16_t uuid_hash(const uuid_t *, uint32_t *); -int32_t uuid_is_nil(const uuid_t *, uint32_t *); -void uuid_to_string(const uuid_t *, char **, uint32_t *); +int32_t uuid_compare(FAR const uuid_t *, FAR const uuid_t *, + FAR uint32_t *); +void uuid_create(FAR uuid_t *, FAR uint32_t *); +void uuid_create_nil(FAR uuid_t *, FAR uint32_t *); +int32_t uuid_equal(FAR const uuid_t *, FAR const uuid_t *, FAR uint32_t *); +void uuid_from_string(FAR const char *, FAR uuid_t *, FAR uint32_t *); +uint16_t uuid_hash(FAR const uuid_t *, FAR uint32_t *); +int32_t uuid_is_nil(FAR const uuid_t *, FAR uint32_t *); +void uuid_to_string(FAR const uuid_t *, FAR char **, FAR uint32_t *); -void uuid_enc_le(void *, const uuid_t *); -void uuid_dec_le(const void *, uuid_t *); -void uuid_enc_be(void *, const uuid_t *); -void uuid_dec_be(const void *, uuid_t *); +void uuid_enc_le(FAR void *, const FAR uuid_t *); +void uuid_dec_le(FAR const void *, FAR uuid_t *); +void uuid_enc_be(FAR void *, const FAR uuid_t *); +void uuid_dec_be(FAR const void *, FAR uuid_t *); #if defined(__cplusplus) } diff --git a/libs/libc/dirent/lib_scandir.c b/libs/libc/dirent/lib_scandir.c index c3bcc12efd..380517ce24 100644 --- a/libs/libc/dirent/lib_scandir.c +++ b/libs/libc/dirent/lib_scandir.c @@ -154,7 +154,7 @@ int scandir(FAR const char *path, FAR struct dirent ***namelist, * is really required given the directories' path name. */ - dsize = (size_t)(&d->d_name[strlen(d->d_name) + 1] - (char *)d); + dsize = (size_t)(&d->d_name[strlen(d->d_name) + 1] - (FAR char *)d); dnew = lib_malloc(dsize); if (!dnew) { diff --git a/libs/libc/inttypes/lib_strtoumax.c b/libs/libc/inttypes/lib_strtoumax.c index 51a71e6572..c81586eff7 100644 --- a/libs/libc/inttypes/lib_strtoumax.c +++ b/libs/libc/inttypes/lib_strtoumax.c @@ -95,7 +95,7 @@ uintmax_t strtoumax(FAR const char *nptr, FAR char **endptr, int base) if (endptr) { - *endptr = (char *)nptr; + *endptr = (FAR char *)nptr; } } diff --git a/libs/libc/locale/lib_iconv.c b/libs/libc/locale/lib_iconv.c index cdd003a567..4239915f15 100644 --- a/libs/libc/locale/lib_iconv.c +++ b/libs/libc/locale/lib_iconv.c @@ -860,7 +860,7 @@ size_t iconv(iconv_t cd, FAR char **in, FAR size_t *inb, goto starved; } - d = *((unsigned char *)*in + 1); + d = *((FAR unsigned char *)*in + 1); if (d < 0xa1 && type == GB2312) { goto ilseq; diff --git a/libs/libc/lzf/lzf_c.c b/libs/libc/lzf/lzf_c.c index b844022e03..216dc68dc6 100644 --- a/libs/libc/lzf/lzf_c.c +++ b/libs/libc/lzf/lzf_c.c @@ -186,7 +186,7 @@ size_t lzf_compress(FAR const void *const in_data, #ifdef CONFIG_LIBC_LZF_ALIGN && ((ref[1] << 8) | ref[0]) == ((ip[1] << 8) | ip[0]) #else - && *(uint16_t *)ref == *(uint16_t *)ip + && *(FAR uint16_t *)ref == *(FAR uint16_t *)ip #endif ) { diff --git a/libs/libc/lzf/lzf_d.c b/libs/libc/lzf/lzf_d.c index 1b3377dcc4..97c985d180 100644 --- a/libs/libc/lzf/lzf_d.c +++ b/libs/libc/lzf/lzf_d.c @@ -64,8 +64,8 @@ unsigned int lzf_decompress (FAR const void *const in_data, unsigned int in_len, FAR void *out_data, unsigned int out_len) { - FAR uint8_t const *ip = (const uint8_t *)in_data; - FAR uint8_t *op = (uint8_t *)out_data; + FAR uint8_t const *ip = (FAR const uint8_t *)in_data; + FAR uint8_t *op = (FAR uint8_t *)out_data; FAR uint8_t const *const in_end = ip + in_len; FAR uint8_t *const out_end = op + out_len; @@ -73,8 +73,10 @@ unsigned int lzf_decompress (FAR const void *const in_data, { unsigned int ctrl = *ip++; - if (ctrl < (1 << 5)) /* literal run */ + if (ctrl < (1 << 5)) { + /* literal run */ + ctrl++; if (op + ctrl > out_end) diff --git a/libs/libc/modlib/modlib_bind.c b/libs/libc/modlib/modlib_bind.c index 51ea10cd2b..a8602eb4f3 100644 --- a/libs/libc/modlib/modlib_bind.c +++ b/libs/libc/modlib/modlib_bind.c @@ -608,7 +608,7 @@ static int modlib_relocatedyn(FAR struct module_s *modp, return -ENOMEM; } - memset((void *)&reldata, 0, sizeof(reldata)); + memset((FAR void *)&reldata, 0, sizeof(reldata)); relas = (FAR Elf_Rela *)rels; for (i = 0; dyn[i].d_tag != DT_NULL; i++) diff --git a/libs/libc/modlib/modlib_symtab.c b/libs/libc/modlib/modlib_symtab.c index fbf8bbcec4..03e27e032b 100644 --- a/libs/libc/modlib/modlib_symtab.c +++ b/libs/libc/modlib/modlib_symtab.c @@ -62,7 +62,7 @@ extern int CONFIG_MODLIB_NSYMBOLS_VAR; ****************************************************************************/ static FAR const struct symtab_s *g_modlib_symtab; -static FAR int g_modlib_nsymbols; +static int g_modlib_nsymbols; /**************************************************************************** * Public Functions diff --git a/libs/libc/netdb/lib_gethostentbynamer.c b/libs/libc/netdb/lib_gethostentbynamer.c index 6ccd61ef1d..27c23b9f46 100644 --- a/libs/libc/netdb/lib_gethostentbynamer.c +++ b/libs/libc/netdb/lib_gethostentbynamer.c @@ -433,7 +433,7 @@ static int lib_find_answer(FAR const char *name, FAR struct hostent_s *host, #ifdef CONFIG_NETDB_DNSCLIENT static int lib_dns_query(FAR const char *hostname, - FAR union dns_addr_u *addr, int *naddr) + FAR union dns_addr_u *addr, FAR int *naddr) { /* Perform the query to get the IP address */ diff --git a/libs/libc/netdb/lib_protor.c b/libs/libc/netdb/lib_protor.c index 818c5d5004..8692a271d3 100644 --- a/libs/libc/netdb/lib_protor.c +++ b/libs/libc/netdb/lib_protor.c @@ -78,7 +78,7 @@ static const unsigned char g_protos[] = "\377raw" }; -static const char *g_aliases; +static FAR const char *g_aliases; /**************************************************************************** * Public Functions @@ -105,8 +105,8 @@ int getprotoent_r(FAR struct protoent *result_buf, FAR char *buf, } result_buf->p_proto = g_protos[idx]; - result_buf->p_name = (char *)&g_protos[idx + 1]; - result_buf->p_aliases = (char **)&g_aliases; + result_buf->p_name = (FAR char *)&g_protos[idx + 1]; + result_buf->p_aliases = (FAR char **)&g_aliases; idx += strlen(result_buf->p_name) + 2; result_buf->idx = idx; *result = result_buf; diff --git a/libs/libc/stdio/lib_libvsprintf.c b/libs/libc/stdio/lib_libvsprintf.c index 878b92217d..039ec56acd 100644 --- a/libs/libc/stdio/lib_libvsprintf.c +++ b/libs/libc/stdio/lib_libvsprintf.c @@ -482,13 +482,13 @@ static int vsprintf_internal(FAR struct lib_outstream_s *stream, flags &= ~(FL_LONG | FL_REPD_TYPE); #ifdef CONFIG_HAVE_LONG_LONG - if (sizeof(void *) == sizeof(unsigned long long)) + if (sizeof(FAR void *) == sizeof(unsigned long long)) { flags |= (FL_LONG | FL_REPD_TYPE); } else #endif - if (sizeof(void *) == sizeof(unsigned long)) + if (sizeof(FAR void *) == sizeof(unsigned long)) { flags |= FL_LONG; } diff --git a/libs/libc/string/lib_memmem.c b/libs/libc/string/lib_memmem.c index f54ea9817c..73d8afdba4 100644 --- a/libs/libc/string/lib_memmem.c +++ b/libs/libc/string/lib_memmem.c @@ -53,7 +53,7 @@ FAR void *memmem(FAR const void *haystack, size_t haystacklen, if (needlelen == 0) { - return (void *)haystack; + return (FAR void *)haystack; } if (needlelen > haystacklen) @@ -68,7 +68,7 @@ FAR void *memmem(FAR const void *haystack, size_t haystacklen, { if (++y == needlelen) { - return (void *)(h + i); + return (FAR void *)(h + i); } } } diff --git a/libs/libc/uuid/lib_uuid_compare.c b/libs/libc/uuid/lib_uuid_compare.c index 642f3acc93..56a70a56b8 100644 --- a/libs/libc/uuid/lib_uuid_compare.c +++ b/libs/libc/uuid/lib_uuid_compare.c @@ -56,7 +56,8 @@ * ****************************************************************************/ -int32_t uuid_compare(const uuid_t *a, const uuid_t *b, uint32_t *status) +int32_t uuid_compare(FAR const uuid_t *a, FAR const uuid_t *b, + FAR uint32_t *status) { if (status != NULL) { diff --git a/libs/libc/uuid/lib_uuid_create.c b/libs/libc/uuid/lib_uuid_create.c index 2c4da00594..41b61828b5 100644 --- a/libs/libc/uuid/lib_uuid_create.c +++ b/libs/libc/uuid/lib_uuid_create.c @@ -70,7 +70,7 @@ static int uuid_getrandom(FAR void *buf, size_t size, int flags) * ****************************************************************************/ -void uuid_create(uuid_t *u, uint32_t *status) +void uuid_create(FAR uuid_t *u, FAR uint32_t *status) { int ret; @@ -82,8 +82,8 @@ void uuid_create(uuid_t *u, uint32_t *status) if (ret < 0) { - unsigned long *beg = (unsigned long *)u; - unsigned long *end = (unsigned long *)(u + 1); + FAR unsigned long *beg = (FAR unsigned long *)u; + FAR unsigned long *end = (FAR unsigned long *)(u + 1); while (beg < end) { diff --git a/libs/libc/uuid/lib_uuid_create_nil.c b/libs/libc/uuid/lib_uuid_create_nil.c index e864235349..3c0a5f36b6 100644 --- a/libs/libc/uuid/lib_uuid_create_nil.c +++ b/libs/libc/uuid/lib_uuid_create_nil.c @@ -40,7 +40,7 @@ * ****************************************************************************/ -void uuid_create_nil(uuid_t *u, uint32_t *status) +void uuid_create_nil(FAR uuid_t *u, FAR uint32_t *status) { memset(u, 0, sizeof(*u)); diff --git a/libs/libc/uuid/lib_uuid_equal.c b/libs/libc/uuid/lib_uuid_equal.c index 9305a93e05..59977f742d 100644 --- a/libs/libc/uuid/lib_uuid_equal.c +++ b/libs/libc/uuid/lib_uuid_equal.c @@ -40,7 +40,9 @@ * ****************************************************************************/ -int32_t uuid_equal(const uuid_t *a, const uuid_t *b, uint32_t *status) +int32_t uuid_equal(FAR const uuid_t *a, FAR const uuid_t *b, + + FAR uint32_t *status) { if (status != NULL) { diff --git a/libs/libc/uuid/lib_uuid_from_string.c b/libs/libc/uuid/lib_uuid_from_string.c index 6dd4329f98..d1b10c6246 100644 --- a/libs/libc/uuid/lib_uuid_from_string.c +++ b/libs/libc/uuid/lib_uuid_from_string.c @@ -42,7 +42,7 @@ * ****************************************************************************/ -void uuid_from_string(const char *s, uuid_t *u, uint32_t *status) +void uuid_from_string(FAR const char *s, FAR uuid_t *u, FAR uint32_t *status) { int n; diff --git a/libs/libc/uuid/lib_uuid_hash.c b/libs/libc/uuid/lib_uuid_hash.c index 688430dae0..27915fae31 100644 --- a/libs/libc/uuid/lib_uuid_hash.c +++ b/libs/libc/uuid/lib_uuid_hash.c @@ -39,7 +39,7 @@ * ****************************************************************************/ -uint16_t uuid_hash(const uuid_t *u, uint32_t *status) +uint16_t uuid_hash(FAR const uuid_t *u, FAR uint32_t *status) { if (status) { diff --git a/libs/libc/uuid/lib_uuid_is_nil.c b/libs/libc/uuid/lib_uuid_is_nil.c index 6e5b721dab..f907e1c11c 100644 --- a/libs/libc/uuid/lib_uuid_is_nil.c +++ b/libs/libc/uuid/lib_uuid_is_nil.c @@ -40,7 +40,7 @@ * ****************************************************************************/ -int32_t uuid_is_nil(const uuid_t *u, uint32_t *status) +int32_t uuid_is_nil(FAR const uuid_t *u, FAR uint32_t *status) { static const uuid_t nil; diff --git a/libs/libc/uuid/lib_uuid_stream.c b/libs/libc/uuid/lib_uuid_stream.c index aa3e125c6a..1f03f36183 100644 --- a/libs/libc/uuid/lib_uuid_stream.c +++ b/libs/libc/uuid/lib_uuid_stream.c @@ -30,9 +30,9 @@ * Public Functions ****************************************************************************/ -void uuid_enc_le(void *buf, const uuid_t *uuid) +void uuid_enc_le(FAR void *buf, FAR const uuid_t *uuid) { - uuid_t *temp = buf; + FAR uuid_t *temp = buf; memcpy(temp, uuid, sizeof(*uuid)); #if BYTE_ORDER == BIG_ENDIAN @@ -42,9 +42,9 @@ void uuid_enc_le(void *buf, const uuid_t *uuid) #endif } -void uuid_dec_le(const void *buf, uuid_t *uuid) +void uuid_dec_le(FAR const void *buf, FAR uuid_t *uuid) { - const uuid_t *temp = buf; + FAR const uuid_t *temp = buf; memcpy(uuid, temp, sizeof(*uuid)); #if BYTE_ORDER == BIG_ENDIAN @@ -54,9 +54,9 @@ void uuid_dec_le(const void *buf, uuid_t *uuid) #endif } -void uuid_enc_be(void *buf, const uuid_t *uuid) +void uuid_enc_be(FAR void *buf, FAR const uuid_t *uuid) { - uuid_t *temp = buf; + FAR uuid_t *temp = buf; memcpy(temp, uuid, sizeof(*uuid)); #if BYTE_ORDER == LITTLE_ENDIAN @@ -66,9 +66,9 @@ void uuid_enc_be(void *buf, const uuid_t *uuid) #endif } -void uuid_dec_be(const void *buf, uuid_t *uuid) +void uuid_dec_be(FAR const void *buf, FAR uuid_t *uuid) { - const uuid_t *temp = buf; + FAR const uuid_t *temp = buf; memcpy(uuid, temp, sizeof(*uuid)); #if BYTE_ORDER == LITTLE_ENDIAN diff --git a/libs/libc/uuid/lib_uuid_to_string.c b/libs/libc/uuid/lib_uuid_to_string.c index e6eb1c7710..614d01fb77 100644 --- a/libs/libc/uuid/lib_uuid_to_string.c +++ b/libs/libc/uuid/lib_uuid_to_string.c @@ -41,7 +41,7 @@ * ****************************************************************************/ -void uuid_to_string(const uuid_t *u, char **s, uint32_t *status) +void uuid_to_string(FAR const uuid_t *u, FAR char **s, FAR uint32_t *status) { static const uuid_t nil; int c; diff --git a/libs/libxx/libcxxmini/libxx_cxa_guard.cxx b/libs/libxx/libcxxmini/libxx_cxa_guard.cxx index 6d2674495e..98fd2d255d 100644 --- a/libs/libxx/libcxxmini/libxx_cxa_guard.cxx +++ b/libs/libxx/libcxxmini/libxx_cxa_guard.cxx @@ -66,7 +66,7 @@ extern "C" #ifdef __ARM_EABI__ return !(*g & 1); #else - return !*(char *)g; + return !*(FAR char *)g; #endif } @@ -79,7 +79,7 @@ extern "C" #ifdef __ARM_EABI__ *g = 1; #else - *(char *)g = 1; + *(FAR char *)g = 1; #endif } diff --git a/mm/map/vm_region.c b/mm/map/vm_region.c index e2ea70f91e..de999cb40c 100644 --- a/mm/map/vm_region.c +++ b/mm/map/vm_region.c @@ -147,7 +147,7 @@ int vm_unmap_region(FAR void *vaddr, size_t size) DEBUGASSERT(size && vaddr); size += ((uintptr_t)vaddr & MM_PGMASK); - vaddr = (void *)MM_PGALIGNDOWN(vaddr); + vaddr = (FAR void *)MM_PGALIGNDOWN(vaddr); ret = up_shmdt((uintptr_t)vaddr, MM_NPAGES(size)); vm_release_region(get_current_mm(), vaddr, size); return ret; diff --git a/mm/shm/shmget.c b/mm/shm/shmget.c index eb04dcb1d3..0c6bcfc162 100644 --- a/mm/shm/shmget.c +++ b/mm/shm/shmget.c @@ -190,7 +190,7 @@ static int shm_extend(int shmid, size_t size) /* Zero the allocated page. */ - memset((void *)region->sr_pages[pgalloc], 0, MM_PGSIZE); + memset((FAR void *)region->sr_pages[pgalloc], 0, MM_PGSIZE); /* Increment the number of pages successfully allocated */ diff --git a/net/can/can.h b/net/can/can.h index 979fdb1aa2..b5361e71c7 100644 --- a/net/can/can.h +++ b/net/can/can.h @@ -66,7 +66,7 @@ struct can_poll_s { FAR struct socket *psock; /* Needed to handle loss of connection */ FAR struct net_driver_s *dev; /* Needed to free the callback structure */ - struct pollfd *fds; /* Needed to handle poll events */ + FAR struct pollfd *fds; /* Needed to handle poll events */ FAR struct devif_callback_s *cb; /* Needed to teardown the poll */ }; diff --git a/net/ipfrag/ipv6_frag.c b/net/ipfrag/ipv6_frag.c index 36bd94d80c..175c5031f5 100644 --- a/net/ipfrag/ipv6_frag.c +++ b/net/ipfrag/ipv6_frag.c @@ -354,8 +354,8 @@ ipv6_fragout_buildipv6fragheader(FAR struct ipv6_fragment_extension_s *frag, frag->reserved = 0; frag->msoffset = ipoff >> 8; frag->lsoffset = ipoff & 0xff; - *(uint16_t *)&frag->id[0] = HTONL(ipid) & 0xffff; - *(uint16_t *)&frag->id[2] = HTONL(ipid) >> 16; + *(FAR uint16_t *)&frag->id[0] = HTONL(ipid) & 0xffff; + *(FAR uint16_t *)&frag->id[2] = HTONL(ipid) >> 16; } /**************************************************************************** diff --git a/net/local/local.h b/net/local/local.h index 29950f6ea3..c46b0c1df7 100644 --- a/net/local/local.h +++ b/net/local/local.h @@ -144,7 +144,7 @@ struct local_conn_s * socket events. */ - struct pollfd *lc_event_fds[LOCAL_NPOLLWAITERS]; + FAR struct pollfd *lc_event_fds[LOCAL_NPOLLWAITERS]; struct pollfd lc_inout_fds[2*LOCAL_NPOLLWAITERS]; /* Union of fields unique to SOCK_STREAM client, server, and connected diff --git a/net/local/local_netpoll.c b/net/local/local_netpoll.c index 60974d49e8..fa52c2e83b 100644 --- a/net/local/local_netpoll.c +++ b/net/local/local_netpoll.c @@ -88,7 +88,7 @@ static int local_event_pollsetup(FAR struct local_conn_s *conn, { /* This is a request to tear down the poll. */ - struct pollfd **slot = (struct pollfd **)fds->priv; + FAR struct pollfd **slot = (FAR struct pollfd **)fds->priv; nxmutex_lock(&conn->lc_polllock); diff --git a/net/sixlowpan/sixlowpan_utils.c b/net/sixlowpan/sixlowpan_utils.c index a31efb8aa5..d5b382d7fb 100644 --- a/net/sixlowpan/sixlowpan_utils.c +++ b/net/sixlowpan/sixlowpan_utils.c @@ -541,7 +541,7 @@ static inline bool sixlowpan_issaddrbased(const net_ipv6addr_t ipaddr, { return (ipaddr[5] == HTONS(0x00ff) && ipaddr[6] == HTONS(0xfe00) && - ipaddr[7] == *(uint16_t *)saddr); + ipaddr[7] == *(FAR uint16_t *)saddr); } #endif @@ -553,12 +553,15 @@ static inline bool sixlowpan_iseaddrbased(const net_ipv6addr_t ipaddr, * can not be eaddr-based since EUI-64's are always universal */ - if ((ipaddr[4] & HTONS(0x0200)) == 0) return false; + if ((ipaddr[4] & HTONS(0x0200)) == 0) + { + return false; + } - return (ipaddr[4] == ((*(uint16_t *)eaddr) ^ HTONS(0x0200)) && - ipaddr[5] == *(uint16_t *)(eaddr + 2) && - ipaddr[6] == *(uint16_t *)(eaddr + 4) && - ipaddr[7] == *(uint16_t *)(eaddr + 6)); + return (ipaddr[4] == ((*(FAR uint16_t *)eaddr) ^ HTONS(0x0200)) && + ipaddr[5] == *(FAR uint16_t *)(eaddr + 2) && + ipaddr[6] == *(FAR uint16_t *)(eaddr + 4) && + ipaddr[7] == *(FAR uint16_t *)(eaddr + 6)); } #endif diff --git a/net/tcp/tcp.h b/net/tcp/tcp.h index fc6f847ce5..37a01d7032 100644 --- a/net/tcp/tcp.h +++ b/net/tcp/tcp.h @@ -157,7 +157,7 @@ struct tcp_hdr_s; /* Forward reference */ struct tcp_poll_s { FAR struct tcp_conn_s *conn; /* Needed to handle loss of connection */ - struct pollfd *fds; /* Needed to handle poll events */ + FAR struct pollfd *fds; /* Needed to handle poll events */ FAR struct devif_callback_s *cb; /* Needed to teardown the poll */ }; @@ -390,8 +390,8 @@ struct tcp_conn_s */ FAR void *accept_private; - int (*accept)(FAR struct tcp_conn_s *listener, - FAR struct tcp_conn_s *conn); + CODE int (*accept)(FAR struct tcp_conn_s *listener, + FAR struct tcp_conn_s *conn); /* The following is a list of poll structures of threads waiting for * socket events. diff --git a/net/udp/udp.h b/net/udp/udp.h index 4a40522e91..92e63be9f8 100644 --- a/net/udp/udp.h +++ b/net/udp/udp.h @@ -98,7 +98,7 @@ struct udp_poll_s { FAR struct udp_conn_s *conn; /* Needed to handle loss of connection */ FAR struct net_driver_s *dev; /* Needed to free the callback structure */ - struct pollfd *fds; /* Needed to handle poll events */ + FAR struct pollfd *fds; /* Needed to handle poll events */ FAR struct devif_callback_s *cb; /* Needed to teardown the poll */ }; @@ -171,7 +171,7 @@ struct udp_wrbuffer_s { sq_entry_t wb_node; /* Supports a singly linked list */ struct sockaddr_storage wb_dest; /* Destination address */ - struct iob_s *wb_iob; /* Head of the I/O buffer chain */ + FAR struct iob_s *wb_iob; /* Head of the I/O buffer chain */ }; #endif diff --git a/net/usrsock/usrsock.h b/net/usrsock/usrsock.h index 0eafb8e03f..4d486ad9e2 100644 --- a/net/usrsock/usrsock.h +++ b/net/usrsock/usrsock.h @@ -63,7 +63,7 @@ enum usrsock_conn_state_e struct usrsock_poll_s { FAR struct usrsock_conn_s *conn; /* Needed to handle loss of connection */ - struct pollfd *fds; /* Needed to handle poll events */ + FAR struct pollfd *fds; /* Needed to handle poll events */ FAR struct devif_callback_s *cb; /* Needed to teardown the poll */ }; @@ -78,9 +78,9 @@ struct usrsock_conn_s uint8_t crefs; /* Reference counts on this instance */ enum usrsock_conn_state_e state; /* State of kernel<->daemon link for conn */ - bool connected; /* Socket has been connected */ - int16_t usockid; /* Connection number used for kernel<->daemon */ - uint16_t flags; /* Socket state flags */ + bool connected; /* Socket has been connected */ + int16_t usockid; /* Connection number used for kernel<->daemon */ + uint16_t flags; /* Socket state flags */ struct { diff --git a/net/utils/net_cmsg.c b/net/utils/net_cmsg.c index 7aa145e640..e3e719866c 100644 --- a/net/utils/net_cmsg.c +++ b/net/utils/net_cmsg.c @@ -79,7 +79,7 @@ FAR void *cmsg_append(FAR struct msghdr *msg, int level, int type, memcpy(cmsgdata, value, value_len); } - msg->msg_control = (char *)msg->msg_control + cmsgspace; + msg->msg_control = (FAR char *)msg->msg_control + cmsgspace; msg->msg_controllen -= cmsgspace; return cmsgdata; diff --git a/sched/mqueue/mq_sndinternal.c b/sched/mqueue/mq_sndinternal.c index eceff480e5..5b3339c92b 100644 --- a/sched/mqueue/mq_sndinternal.c +++ b/sched/mqueue/mq_sndinternal.c @@ -73,7 +73,7 @@ ****************************************************************************/ #ifdef CONFIG_DEBUG_FEATURES -int nxmq_verify_send(FAR FAR struct file *mq, FAR const char *msg, +int nxmq_verify_send(FAR struct file *mq, FAR const char *msg, size_t msglen, unsigned int prio) { FAR struct inode *inode = mq->f_inode; diff --git a/wireless/bluetooth/bt_att.c b/wireless/bluetooth/bt_att.c index 3d93c0bdb2..be5c87f8fa 100644 --- a/wireless/bluetooth/bt_att.c +++ b/wireless/bluetooth/bt_att.c @@ -186,98 +186,105 @@ struct handler_info_s ****************************************************************************/ static void att_req_destroy(FAR struct bt_att_req_s *req); -static void send_err_rsp(struct bt_conn_s *conn, uint8_t req, - uint16_t handle, uint8_t err); -static uint8_t att_mtu_req(struct bt_conn_s *conn, struct bt_buf_s *data); -static uint8_t att_handle_rsp(struct bt_conn_s *conn, void *pdu, - uint16_t len, uint8_t err); +static void send_err_rsp(FAR struct bt_conn_s *conn, uint8_t req, + uint16_t handle, uint8_t err); +static uint8_t att_mtu_req(FAR struct bt_conn_s *conn, + FAR struct bt_buf_s *data); +static uint8_t att_handle_rsp(FAR struct bt_conn_s *conn, FAR void *pdu, + uint16_t len, uint8_t err); static uint8_t att_mtu_rsp(FAR struct bt_conn_s *conn, - FAR struct bt_buf_s *buf); + FAR struct bt_buf_s *buf); static bool range_is_valid(uint16_t start, uint16_t end, - FAR uint16_t *err); + FAR uint16_t *err); static uint8_t find_info_cb(FAR const struct bt_gatt_attr_s *attr, - FAR void *user_data); + FAR void *user_data); static uint8_t att_find_info_rsp(FAR struct bt_conn_s *conn, - uint16_t start_handle, uint16_t end_handle); + uint16_t start_handle, + uint16_t end_handle); static uint8_t att_find_info_req(FAR struct bt_conn_s *conn, - FAR struct bt_buf_s *data); + FAR struct bt_buf_s *data); static uint8_t find_type_cb(FAR const struct bt_gatt_attr_s *attr, - FAR void *user_data); + FAR void *user_data); static uint8_t att_find_type_rsp(FAR struct bt_conn_s *conn, - FAR uint16_t start_handle, uint16_t end_handle, - FAR const void *value, uint8_t value_len); + FAR uint16_t start_handle, + uint16_t end_handle, FAR const void *value, + uint8_t value_len); static uint8_t att_find_type_req(FAR struct bt_conn_s *conn, - FAR struct bt_buf_s *data); + FAR struct bt_buf_s *data); static bool uuid_create(FAR struct bt_uuid_s *uuid, - FAR struct bt_buf_s *data); + FAR struct bt_buf_s *data); static uint8_t read_type_cb(FAR const struct bt_gatt_attr_s *attr, - FAR void *user_data); + FAR void *user_data); static uint8_t att_read_type_rsp(FAR struct bt_conn_s *conn, - FAR struct bt_uuid_s *uuid, uint16_t start_handle, - uint16_t end_handle); + FAR struct bt_uuid_s *uuid, + uint16_t start_handle, + uint16_t end_handle); static uint8_t att_read_type_req(FAR struct bt_conn_s *conn, - FAR struct bt_buf_s *data); + FAR struct bt_buf_s *data); static uint8_t err_to_att(int err); static uint8_t check_perm(FAR struct bt_conn_s *conn, - FAR const struct bt_gatt_attr_s *attr, uint8_t mask); + FAR const struct bt_gatt_attr_s *attr, + uint8_t mask); static uint8_t read_cb(FAR const struct bt_gatt_attr_s *attr, - FAR void *user_data); + FAR void *user_data); static uint8_t att_read_rsp(FAR struct bt_conn_s *conn, uint8_t op, - uint8_t rsp, uint16_t handle, uint16_t offset); + uint8_t rsp, uint16_t handle, uint16_t offset); static uint8_t att_read_req(FAR struct bt_conn_s *conn, - FAR struct bt_buf_s *data); + FAR struct bt_buf_s *data); static uint8_t att_read_blob_req(FAR struct bt_conn_s *conn, - FAR struct bt_buf_s *data); + FAR struct bt_buf_s *data); static uint8_t att_read_mult_req(FAR struct bt_conn_s *conn, - FAR struct bt_buf_s *buf); + FAR struct bt_buf_s *buf); static uint8_t read_group_cb(FAR const struct bt_gatt_attr_s *attr, - FAR void *user_data); + FAR void *user_data); static uint8_t att_read_group_rsp(FAR struct bt_conn_s *conn, - FAR struct bt_uuid_s *uuid, uint16_t start_handle, - uint16_t end_handle); + FAR struct bt_uuid_s *uuid, + uint16_t start_handle, + uint16_t end_handle); static uint8_t att_read_group_req(FAR struct bt_conn_s *conn, - FAR struct bt_buf_s *data); + FAR struct bt_buf_s *data); static uint8_t write_cb(FAR const struct bt_gatt_attr_s *attr, - FAR void *user_data); + FAR void *user_data); static uint8_t att_write_rsp(FAR struct bt_conn_s *conn, uint8_t op, - uint8_t rsp, uint16_t handle, uint16_t offset, - FAR const void *value, uint8_t len); + uint8_t rsp, uint16_t handle, uint16_t offset, + FAR const void *value, uint8_t len); static uint8_t att_write_req(FAR struct bt_conn_s *conn, - FAR struct bt_buf_s *data); + FAR struct bt_buf_s *data); static uint8_t att_prepare_write_req(FAR struct bt_conn_s *conn, - FAR struct bt_buf_s *data); + FAR struct bt_buf_s *data); static uint8_t flush_cb(FAR const struct bt_gatt_attr_s *attr, - FAR void *user_data); + FAR void *user_data); static uint8_t att_exec_write_rsp(FAR struct bt_conn_s *conn, - uint8_t flags); + uint8_t flags); static uint8_t att_exec_write_req(FAR struct bt_conn_s *conn, - FAR struct bt_buf_s *data); + FAR struct bt_buf_s *data); static uint8_t att_write_cmd(FAR struct bt_conn_s *conn, - FAR struct bt_buf_s *data); + FAR struct bt_buf_s *data); static uint8_t att_signed_write_cmd(FAR struct bt_conn_s *conn, - FAR struct bt_buf_s *data); + FAR struct bt_buf_s *data); static uint8_t att_error_rsp(FAR struct bt_conn_s *conn, - FAR struct bt_buf_s *data); + FAR struct bt_buf_s *data); static uint8_t att_handle_find_info_rsp(FAR struct bt_conn_s *conn, - FAR struct bt_buf_s *buf); + FAR struct bt_buf_s *buf); static uint8_t att_handle_find_type_rsp(FAR struct bt_conn_s *conn, - FAR struct bt_buf_s *buf); + FAR struct bt_buf_s *buf); static uint8_t att_handle_read_type_rsp(FAR struct bt_conn_s *conn, - FAR struct bt_buf_s *buf); + FAR struct bt_buf_s *buf); static uint8_t att_handle_read_rsp(FAR struct bt_conn_s *conn, - FAR struct bt_buf_s *buf); + FAR struct bt_buf_s *buf); static uint8_t att_handle_read_blob_rsp(FAR struct bt_conn_s *conn, - FAR struct bt_buf_s *buf); + FAR struct bt_buf_s *buf); static uint8_t att_handle_read_mult_rsp(FAR struct bt_conn_s *conn, - FAR struct bt_buf_s *buf); + FAR struct bt_buf_s *buf); static uint8_t att_handle_write_rsp(FAR struct bt_conn_s *conn, - FAR struct bt_buf_s *buf); + FAR struct bt_buf_s *buf); static void bt_att_receive(FAR struct bt_conn_s *conn, - FAR struct bt_buf_s *buf, FAR void *context, uint16_t cid); + FAR struct bt_buf_s *buf, FAR void *context, + uint16_t cid); static void bt_att_connected(FAR struct bt_conn_s *conn, FAR void *context, - uint16_t cid); + uint16_t cid); static void bt_att_disconnected(FAR struct bt_conn_s *conn, - FAR void *context, uint16_t cid); + FAR void *context, uint16_t cid); /**************************************************************************** * Private Data @@ -431,10 +438,8 @@ static void att_req_destroy(FAR struct bt_att_req_s *req) memset(req, 0, sizeof(*req)); } -static void send_err_rsp(struct bt_conn_s *conn, - uint8_t req, - uint16_t handle, - uint8_t err) +static void send_err_rsp(FAR struct bt_conn_s *conn, uint8_t req, + uint16_t handle, uint8_t err) { struct bt_att_error_rsp_s *rsp; struct bt_buf_s *buf; @@ -460,16 +465,17 @@ static void send_err_rsp(struct bt_conn_s *conn, bt_l2cap_send(conn, BT_L2CAP_CID_ATT, buf); } -static uint8_t att_mtu_req(struct bt_conn_s *conn, struct bt_buf_s *data) +static uint8_t att_mtu_req(FAR struct bt_conn_s *conn, + FAR struct bt_buf_s *data) { FAR struct bt_att_s *att = conn->att; - struct bt_att_exchange_mtu_req_s *req; - struct bt_att_exchange_mtu_rsp_s *rsp; - struct bt_buf_s *buf; + FAR struct bt_att_exchange_mtu_req_s *req; + FAR struct bt_att_exchange_mtu_rsp_s *rsp; + FAR struct bt_buf_s *buf; uint16_t maxmtu; uint16_t mtu; - req = (void *)data->data; + req = (FAR void *)data->data; mtu = BT_LE162HOST(req->mtu); @@ -508,10 +514,8 @@ static uint8_t att_mtu_req(struct bt_conn_s *conn, struct bt_buf_s *data) return 0; } -static uint8_t att_handle_rsp(struct bt_conn_s *conn, - void *pdu, - uint16_t len, - uint8_t err) +static uint8_t att_handle_rsp(FAR struct bt_conn_s *conn, FAR void *pdu, + uint16_t len, uint8_t err) { FAR struct bt_att_s *att = conn->att; struct bt_att_req_s req; @@ -545,7 +549,7 @@ static uint8_t att_mtu_rsp(FAR struct bt_conn_s *conn, return 0; } - rsp = (void *)buf->data; + rsp = (FAR void *)buf->data; mtu = BT_LE162HOST(rsp->mtu); wlinfo("Server MTU %u\n", mtu); @@ -660,8 +664,7 @@ static uint8_t find_info_cb(FAR const struct bt_gatt_attr_s *attr, } static uint8_t att_find_info_rsp(FAR struct bt_conn_s *conn, - uint16_t start_handle, - uint16_t end_handle) + uint16_t start_handle, uint16_t end_handle) { struct find_info_data_s data; @@ -699,7 +702,7 @@ static uint8_t att_find_info_req(FAR struct bt_conn_s *conn, uint16_t end_handle; uint16_t err_handle; - req = (void *)data->data; + req = (FAR void *)data->data; start_handle = BT_LE162HOST(req->start_handle); end_handle = BT_LE162HOST(req->end_handle); @@ -778,8 +781,7 @@ static uint8_t find_type_cb(FAR const struct bt_gatt_attr_s *attr, static uint8_t att_find_type_rsp(FAR struct bt_conn_s *conn, FAR uint16_t start_handle, - uint16_t end_handle, - FAR const void *value, + uint16_t end_handle, FAR const void *value, uint8_t value_len) { struct find_type_data_s data; @@ -1148,7 +1150,7 @@ static uint8_t att_read_req(FAR struct bt_conn_s *conn, FAR struct bt_att_read_req_s *req; uint16_t handle; - req = (void *)data->data; + req = (FAR void *)data->data; handle = BT_LE162HOST(req->handle); @@ -1852,12 +1854,11 @@ void bt_att_initialize(void) } FAR struct bt_buf_s *bt_att_create_pdu(FAR struct bt_conn_s *conn, - uint8_t op, - size_t len) + uint8_t op, size_t len) { FAR struct bt_att_hdr_s *hdr; FAR struct bt_buf_s *buf; - FAR FAR struct bt_att_s *att = conn->att; + FAR struct bt_att_s *att = conn->att; if (len + sizeof(op) > att->mtu) { @@ -1907,7 +1908,7 @@ int bt_att_send(FAR struct bt_conn_s *conn, FAR struct bt_buf_s *buf, return -EBUSY; } - hdr = (void *)buf->data; + hdr = (FAR void *)buf->data; att->req.op = hdr->code; att->req.func = func; att->req.user_data = user_data; diff --git a/wireless/bluetooth/bt_conn.c b/wireless/bluetooth/bt_conn.c index fbb1a0dc61..7080a42d97 100644 --- a/wireless/bluetooth/bt_conn.c +++ b/wireless/bluetooth/bt_conn.c @@ -294,7 +294,7 @@ void bt_conn_receive(FAR struct bt_conn_s *conn, FAR struct bt_buf_s *buf, /* First packet */ - hdr = (void *)buf->data; + hdr = (FAR void *)buf->data; len = BT_LE162HOST(hdr->len); wlinfo("First, len %u final %u\n", buf->len, len); @@ -367,7 +367,7 @@ void bt_conn_receive(FAR struct bt_conn_s *conn, FAR struct bt_buf_s *buf, return; } - hdr = (void *)buf->data; + hdr = (FAR void *)buf->data; len = BT_LE162HOST(hdr->len); if (sizeof(*hdr) + len != buf->len) diff --git a/wireless/bluetooth/bt_ioctl.c b/wireless/bluetooth/bt_ioctl.c index 499ff59cea..13045f0661 100644 --- a/wireless/bluetooth/bt_ioctl.c +++ b/wireless/bluetooth/bt_ioctl.c @@ -777,7 +777,7 @@ int btnet_ioctl(FAR struct net_driver_s *netdev, int cmd, unsigned long arg) params->destroy = btnet_discover_destroy; params->start_handle = btreq->btr_dstart; params->end_handle = btreq->btr_dend; - params->p_data = (void *)arg; + params->p_data = (FAR void *)arg; btreq->btr_indx = 0; if (btreq->btr_duuid16 == 0) diff --git a/wireless/bluetooth/bt_l2cap.c b/wireless/bluetooth/bt_l2cap.c index 43b71b5ce6..6465426c2d 100644 --- a/wireless/bluetooth/bt_l2cap.c +++ b/wireless/bluetooth/bt_l2cap.c @@ -217,7 +217,7 @@ static void rej_not_understood(FAR struct bt_conn_s *conn, uint8_t ident) static void le_conn_param_rsp(FAR struct bt_conn_s *conn, FAR struct bt_buf_s *buf) { - struct bt_l2cap_conn_param_rsp_s *rsp = (void *)buf->data; + FAR struct bt_l2cap_conn_param_rsp_s *rsp = (FAR void *)buf->data; if (buf->len < sizeof(*rsp)) { @@ -262,7 +262,7 @@ static void le_conn_param_update_req(FAR struct bt_conn_s *conn, { FAR struct bt_l2cap_sig_hdr_s *hdr; FAR struct bt_l2cap_conn_param_rsp_s *rsp; - FAR struct bt_l2cap_conn_param_req_s *req = (void *)buf->data; + FAR struct bt_l2cap_conn_param_req_s *req = (FAR void *)buf->data; uint16_t min; uint16_t max; uint16_t latency; @@ -316,7 +316,7 @@ static void le_conn_param_update_req(FAR struct bt_conn_s *conn, static void le_sig(FAR struct bt_conn_s *conn, FAR struct bt_buf_s *buf, FAR void *context, uint16_t cid) { - struct bt_l2cap_sig_hdr_s *hdr = (FAR void *)buf->data; + FAR struct bt_l2cap_sig_hdr_s *hdr = (FAR void *)buf->data; uint16_t len; if (buf->len < sizeof(*hdr)) diff --git a/wireless/bluetooth/bt_smp.c b/wireless/bluetooth/bt_smp.c index 72e75871f9..e4175f805e 100644 --- a/wireless/bluetooth/bt_smp.c +++ b/wireless/bluetooth/bt_smp.c @@ -132,68 +132,70 @@ struct bt_smphandlers_s * Private Function Prototypes ****************************************************************************/ -static const char *h(FAR const void *buf, size_t len); +static FAR const char *h(FAR const void *buf, size_t len); static void xor_128(FAR const struct uint128_s *p, - FAR const struct uint128_s *q, FAR struct uint128_s *r); -static int le_encrypt(const uint8_t key[16], const uint8_t plaintext[16], - uint8_t enc_data[16]); + FAR const struct uint128_s *q, + FAR struct uint128_s *r); +static int le_encrypt(FAR const uint8_t key[16], + FAR const uint8_t plaintext[16], + FAR uint8_t enc_data[16]); static int le_rand(FAR void *buf, size_t len); static int smp_ah(FAR const uint8_t irk[16], FAR const uint8_t r[3], - FAR uint8_t out[3]); + FAR uint8_t out[3]); static int smp_c1(FAR const uint8_t k[16], FAR const uint8_t r[16], - FAR const uint8_t preq[7], FAR const uint8_t pres[7], - FAR const bt_addr_le_t *ia, FAR const bt_addr_le_t *ra, - FAR uint8_t enc_data[16]); -static int smp_s1(const uint8_t k[16], const uint8_t r1[16], - const uint8_t r2[16], uint8_t out[16]); + FAR const uint8_t preq[7], FAR const uint8_t pres[7], + FAR const bt_addr_le_t *ia, FAR const bt_addr_le_t *ra, + FAR uint8_t enc_data[16]); +static int smp_s1(FAR const uint8_t k[16], FAR const uint8_t r1[16], + FAR const uint8_t r2[16], FAR uint8_t out[16]); static FAR struct bt_buf_s *bt_smp_create_pdu(FAR struct bt_conn_s *conn, - uint8_t op, size_t len); + uint8_t op, size_t len); static void send_err_rsp(FAR struct bt_conn_s *conn, uint8_t reason); static int smp_init(struct bt_smp_s *smp); static uint8_t smp_pairing_req(FAR struct bt_conn_s *conn, - FAR struct bt_buf_s *buf); + FAR struct bt_buf_s *buf); static uint8_t smp_pairing_rsp(FAR struct bt_conn_s *conn, - FAR struct bt_buf_s *buf); + FAR struct bt_buf_s *buf); static uint8_t smp_send_pairing_random(FAR struct bt_conn_s *conn); static uint8_t smp_pairing_confirm(FAR struct bt_conn_s *conn, - FAR struct bt_buf_s *buf); + FAR struct bt_buf_s *buf); static uint8_t smp_pairing_random(FAR struct bt_conn_s *conn, - FAR struct bt_buf_s *buf); + FAR struct bt_buf_s *buf); static uint8_t smp_pairing_failed(FAR struct bt_conn_s *conn, - FAR struct bt_buf_s *buf); + FAR struct bt_buf_s *buf); static void bt_smp_distribute_keys(FAR struct bt_conn_s *conn); static uint8_t smp_encrypt_info(FAR struct bt_conn_s *conn, - FAR struct bt_buf_s *buf); + FAR struct bt_buf_s *buf); static uint8_t smp_master_ident(FAR struct bt_conn_s *conn, - FAR struct bt_buf_s *buf); + FAR struct bt_buf_s *buf); static uint8_t smp_ident_info(FAR struct bt_conn_s *conn, - FAR struct bt_buf_s *buf); + FAR struct bt_buf_s *buf); static uint8_t smp_ident_addr_info(FAR struct bt_conn_s *conn, - FAR struct bt_buf_s *buf); + FAR struct bt_buf_s *buf); static uint8_t smp_security_request(FAR struct bt_conn_s *conn, - FAR struct bt_buf_s *buf); + FAR struct bt_buf_s *buf); static void bt_smp_receive(FAR struct bt_conn_s *conn, - FAR struct bt_buf_s *buf, FAR void *context, - uint16_t cid); + FAR struct bt_buf_s *buf, FAR void *context, + uint16_t cid); static void bt_smp_connected(FAR struct bt_conn_s *conn, - FAR void *context, uint16_t cid); + FAR void *context, uint16_t cid); static void bt_smp_disconnected(FAR struct bt_conn_s *conn, - FAR void *context, uint16_t cid); -static void bt_smp_encrypt_change(FAR FAR struct bt_conn_s *conn, - FAR void *context, uint16_t cid); + FAR void *context, uint16_t cid); +static void bt_smp_encrypt_change(FAR struct bt_conn_s *conn, + FAR void *context, uint16_t cid); #ifdef CONFIG_BLUETOOTH_SMP_SELFTEST static void swap_buf(FAR const uint8_t *src, FAR uint8_t *dst, - uint16_t len); + uint16_t len); static void swap_in_place(FAR uint8_t * buf, uint16_t len); static int cmac_subkey(FAR const uint8_t *key, FAR uint8_t *k1, - FAR uint8_t *k2); + FAR uint8_t *k2); static void add_pad(FAR const uint8_t *in, FAR unsigned char *out, - int len); -static int bt_smp_aes_cmac(const uint8_t *key, const uint8_t *in, - size_t len, uint8_t *out); + int len); +static int bt_smp_aes_cmac(const uint8_t *key, FAR const uint8_t *in, + size_t len, uint8_t *out); static int aes_test(FAR const char *prefix, FAR const uint8_t *key, - FAR const uint8_t *m, uint16_t len, - FAR const uint8_t *mac); + FAR const uint8_t *m, uint16_t len, + FAR const uint8_t *mac); static int smp_aes_cmac_test(void); static int smp_self_test(void); #else @@ -315,7 +317,7 @@ static const uint8_t g_mac4[] = * in a single syslog call. */ -static const char *h(FAR const void *buf, size_t len) +static FAR const char *h(FAR const void *buf, size_t len) { static const char hex[] = "0123456789abcdef"; static char hexbufs[4][129]; @@ -352,8 +354,9 @@ static void xor_128(FAR const struct uint128_s *p, r->b = p->b ^ q->b; } -static int le_encrypt(const uint8_t key[16], const uint8_t plaintext[16], - uint8_t enc_data[16]) +static int le_encrypt(FAR const uint8_t key[16], + FAR const uint8_t plaintext[16], + FAR uint8_t enc_data[16]) { FAR struct bt_hci_cp_le_encrypt_s *cp; FAR struct bt_hci_rp_le_encrypt_s *rp; @@ -379,7 +382,7 @@ static int le_encrypt(const uint8_t key[16], const uint8_t plaintext[16], return err; } - rp = (void *)rsp->data; + rp = (FAR void *)rsp->data; memcpy(enc_data, rp->enc_data, sizeof(rp->enc_data)); bt_buf_release(rsp); @@ -501,8 +504,8 @@ static int smp_c1(FAR const uint8_t k[16], FAR const uint8_t r[16], return le_encrypt(k, enc_data, enc_data); } -static int smp_s1(const uint8_t k[16], const uint8_t r1[16], - const uint8_t r2[16], uint8_t out[16]) +static int smp_s1(FAR const uint8_t k[16], FAR const uint8_t r1[16], + FAR const uint8_t r2[16], FAR uint8_t out[16]) { /* The most significant 64-bits of r1 are discarded to generate r1' and the * most significant 64-bits of r2 are discarded to generate r2'. r1' is @@ -574,7 +577,7 @@ static int smp_init(struct bt_smp_s *smp) static uint8_t smp_pairing_req(FAR struct bt_conn_s *conn, FAR struct bt_buf_s *buf) { - FAR struct bt_smp_pairing_s *req = (void *)buf->data; + FAR struct bt_smp_pairing_s *req = (FAR void *)buf->data; FAR struct bt_smp_pairing_s *rsp; FAR struct bt_buf_s *rsp_buf; FAR struct bt_smp_s *smp = conn->smp; @@ -680,7 +683,7 @@ static uint8_t smp_send_pairing_confirm(FAR struct bt_conn_s *conn) static uint8_t smp_pairing_rsp(FAR struct bt_conn_s *conn, FAR struct bt_buf_s *buf) { - struct bt_smp_pairing_s *rsp = (void *)buf->data; + struct bt_smp_pairing_s *rsp = (FAR void *)buf->data; struct bt_smp_s *smp = conn->smp; wlinfo("\n"); @@ -727,7 +730,7 @@ static uint8_t smp_send_pairing_random(FAR struct bt_conn_s *conn) static uint8_t smp_pairing_confirm(FAR struct bt_conn_s *conn, FAR struct bt_buf_s *buf) { - struct bt_smp_pairing_confirm_s *req = (void *)buf->data; + struct bt_smp_pairing_confirm_s *req = (FAR void *)buf->data; struct bt_smp_s *smp = conn->smp; wlinfo("\n"); @@ -747,7 +750,7 @@ static uint8_t smp_pairing_confirm(FAR struct bt_conn_s *conn, static uint8_t smp_pairing_random(FAR struct bt_conn_s *conn, FAR struct bt_buf_s *buf) { - FAR struct bt_smp_pairing_random_s *req = (void *)buf->data; + FAR struct bt_smp_pairing_random_s *req = (FAR void *)buf->data; FAR const bt_addr_le_t *ra; FAR const bt_addr_le_t *ia; FAR struct bt_smp_s *smp = conn->smp; @@ -839,8 +842,8 @@ static uint8_t smp_pairing_random(FAR struct bt_conn_s *conn, static uint8_t smp_pairing_failed(FAR struct bt_conn_s *conn, FAR struct bt_buf_s *buf) { - struct bt_smp_pairing_fail_s *req = (void *)buf->data; - struct bt_smp_s *smp = conn->smp; + FAR struct bt_smp_pairing_fail_s *req = (FAR void *)buf->data; + FAR struct bt_smp_s *smp = conn->smp; wlerr("ERROR: reason 0x%x\n", req->reason); UNUSED(req); @@ -884,8 +887,8 @@ static void bt_smp_distribute_keys(FAR struct bt_conn_s *conn) if (smp->local_dist & BT_SMP_DIST_ENC_KEY) { - struct bt_smp_encrypt_info_s *info; - struct bt_smp_master_ident_s *ident; + FAR struct bt_smp_encrypt_info_s *info; + FAR struct bt_smp_master_ident_s *ident; bt_keys_add_type(keys, BT_KEYS_SLAVE_LTK); @@ -925,7 +928,7 @@ static void bt_smp_distribute_keys(FAR struct bt_conn_s *conn) static uint8_t smp_encrypt_info(FAR struct bt_conn_s *conn, FAR struct bt_buf_s *buf) { - FAR struct bt_smp_encrypt_info_s *req = (void *)buf->data; + FAR struct bt_smp_encrypt_info_s *req = (FAR void *)buf->data; FAR struct bt_smp_s *smp = conn->smp; FAR struct bt_keys_s *keys; @@ -949,7 +952,7 @@ static uint8_t smp_encrypt_info(FAR struct bt_conn_s *conn, static uint8_t smp_master_ident(FAR struct bt_conn_s *conn, FAR struct bt_buf_s *buf) { - FAR struct bt_smp_master_ident_s *req = (void *)buf->data; + FAR struct bt_smp_master_ident_s *req = (FAR void *)buf->data; FAR struct bt_smp_s *smp = conn->smp; FAR struct bt_keys_s *keys; @@ -1012,7 +1015,7 @@ static uint8_t smp_ident_info(FAR struct bt_conn_s *conn, static uint8_t smp_ident_addr_info(FAR struct bt_conn_s *conn, FAR struct bt_buf_s *buf) { - FAR struct bt_smp_ident_addr_info_s *req = (void *)buf->data; + FAR struct bt_smp_ident_addr_info_s *req = (FAR void *)buf->data; FAR struct bt_smp_s *smp = conn->smp; FAR struct bt_keys_s *keys; @@ -1192,7 +1195,7 @@ static void bt_smp_connected(FAR struct bt_conn_s *conn, FAR void *context, static void bt_smp_disconnected(FAR struct bt_conn_s *conn, FAR void *context, uint16_t cid) { - struct bt_smp_s *smp = conn->smp; + FAR struct bt_smp_s *smp = conn->smp; if (!smp) { @@ -1205,10 +1208,10 @@ static void bt_smp_disconnected(FAR struct bt_conn_s *conn, memset(smp, 0, sizeof(*smp)); } -static void bt_smp_encrypt_change(FAR FAR struct bt_conn_s *conn, +static void bt_smp_encrypt_change(FAR struct bt_conn_s *conn, FAR void *context, uint16_t cid) { - struct bt_smp_s *smp = conn->smp; + FAR struct bt_smp_s *smp = conn->smp; wlinfo("conn %p handle %u encrypt 0x%02x\n", conn, conn->handle, conn->encrypt); @@ -1257,7 +1260,7 @@ static void swap_buf(FAR const uint8_t *src, FAR uint8_t *dst, uint16_t len) } } -static void swap_in_place(FAR uint8_t * buf, uint16_t len) +static void swap_in_place(FAR uint8_t *buf, uint16_t len) { int i; int j; @@ -1305,7 +1308,7 @@ static int cmac_subkey(FAR const uint8_t *key, FAR uint8_t *k1, 0 }; - uint8_t *tmp = zero; + FAR uint8_t *tmp = zero; uint8_t l[16]; int err; @@ -1349,7 +1352,7 @@ static int cmac_subkey(FAR const uint8_t *key, FAR uint8_t *k1, { array_shift(k1, k2); xor_128((FAR struct uint128_s *)k2, - (struct uint128_s *FAR)rb, + (FAR struct uint128_s *)rb, (FAR struct uint128_s *)k2); } @@ -1470,7 +1473,7 @@ static int bt_smp_aes_cmac(FAR const uint8_t *key, FAR const uint8_t *in, xor_128((FAR struct uint128_s *)x, (FAR struct uint128_s *)&in[i * 16], - (FAR struct uint128_s *) y); + (FAR struct uint128_s *)y); swap_in_place(y, 16); @@ -1502,8 +1505,9 @@ static int bt_smp_aes_cmac(FAR const uint8_t *key, FAR const uint8_t *in, return err; } -static int aes_test(const char *prefix, const uint8_t *key, const uint8_t *m, - uint16_t len, const uint8_t * mac) +static int aes_test(FAR const char *prefix, FAR const uint8_t *key, + FAR const uint8_t *m, uint16_t len, + FAR const uint8_t * mac) { uint8_t out[16]; @@ -1593,7 +1597,7 @@ int bt_smp_initialize(void) int bt_smp_send_security_req(FAR struct bt_conn_s *conn) { - struct bt_smp_security_request_s *req; + FAR struct bt_smp_security_request_s *req; FAR struct bt_buf_s *req_buf; wlinfo("\n");