pkarashchenko commented on code in PR #6965: URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r988287050
########## arch/arm/src/imxrt/imxrt_flexpwm.c: ########## @@ -311,7 +311,7 @@ static struct imxrt_flexpwm_module_s g_pwm2_modules[] = { .used = true, .pin = GPIO_FLEXPWM2_MOD2_B - } + }. Review Comment: ```suggestion }, ``` ########## arch/arm/src/stm32h7/stm32_i2c.c: ########## @@ -2511,7 +2473,7 @@ static int stm32_i2c_transfer(struct i2c_master_s *dev, /* Ensure that address or flags don't change meanwhile */ - ret = nxsem_wait(&((struct stm32_i2c_inst_s *)dev)->priv->sem_excl); + ret = nxmutex_lock(&((struct stm32_i2c_inst_s *)dev)->priv->lock); Review Comment: ditto ########## arch/arm/src/stm32l4/stm32l4_i2c.c: ########## @@ -2724,7 +2686,7 @@ static int stm32l4_i2c_transfer(struct i2c_master_s *dev, /* Ensure that address or flags don't change meanwhile */ - ret = nxsem_wait(&((struct stm32l4_i2c_inst_s *)dev)->priv->sem_excl); + ret = nxmutex_lock(&((struct stm32l4_i2c_inst_s *)dev)->priv->lock); Review Comment: ditto ########## boards/arm/stm32/mikroe-stm32f4/src/stm32_mio283qt9a.c: ########## @@ -274,9 +274,9 @@ static void stm32_index(struct mio283qt9a_lcd_s *dev, uint8_t index) static uint16_t stm32_read(struct mio283qt9a_lcd_s *dev) { struct stm32f4_dev_s *priv = (struct stm32f4_dev_s *)dev; - uint32_t * volatile portsetreset = (uint32_t *) STM32_GPIOE_BSRR; - uint32_t * volatile portmode = (uint32_t *) STM32_GPIOE_MODER; - uint32_t * volatile portinput = (uint32_t *) STM32_GPIOE_IDR; + uint32_t * volatile portsetreset = (uint32_t *)STM32_GPIOE_BSRR; + uint32_t * volatile portmode = (uint32_t *)STM32_GPIOE_MODER; + uint32_t * volatile portinput = (uint32_t *)STM32_GPIOE_IDR; Review Comment: ```suggestion uint32_t * volatile portsetreset = (uint32_t *)STM32_GPIOE_BSRR; uint32_t * volatile portmode = (uint32_t *)STM32_GPIOE_MODER; uint32_t * volatile portinput = (uint32_t *)STM32_GPIOE_IDR; ``` ########## drivers/i2c/pca9540bdp.c: ########## @@ -161,7 +161,7 @@ static int pca9540bdp_transfer_on_port(FAR struct i2c_master_s *dev, } #ifdef CONFIG_I2C_RESET -static int pca9540bdp_reset_on_port (FAR struct i2c_master_s *dev) +static int pca9540bdp_reset_on_port(FAR struct i2c_master_s *dev) { FAR struct i2c_port_dev_s *port_dev = (struct i2c_port_dev_s *)dev; Review Comment: ```suggestion FAR struct i2c_port_dev_s *port_dev = (FAR struct i2c_port_dev_s *)dev; ``` ########## arch/arm/src/stm32f7/stm32_i2c.c: ########## @@ -2547,7 +2509,7 @@ static int stm32_i2c_transfer(struct i2c_master_s *dev, /* Ensure that address or flags don't change meanwhile */ - ret = nxsem_wait(&((struct stm32_i2c_inst_s *)dev)->priv->sem_excl); + ret = nxmutex_lock(&((struct stm32_i2c_inst_s *)dev)->priv->lock); Review Comment: ditto ########## arch/arm/src/rp2040/rp2040_flash_mtd.c: ########## @@ -155,17 +155,18 @@ extern const uint8_t rp2040_smart_flash_end[0]; static struct rp2040_flash_dev_s my_dev = { .mtd_dev = - { - rp2040_flash_erase, - rp2040_flash_block_read, - rp2040_flash_block_write, - rp2040_flash_byte_read, + { + rp2040_flash_erase, + rp2040_flash_block_read, + rp2040_flash_block_write, + rp2040_flash_byte_read, #ifdef CONFIG_MTD_BYTE_WRITE - NULL, + NULL, #endif - rp2040_flash_ioctl, - "rp_flash" - } + rp2040_flash_ioctl, + "rp_flash" + }, + .lock = NXMUTEX_INITIALIZER, }; static bool initialized = false; Review Comment: Optional ```suggestion static bool initialized; ``` ########## boards/arm/imxrt/imxrt1064-evk/src/imxrt_flexspi_nor.c: ########## @@ -201,7 +201,7 @@ static struct imxrt_flexspi_nor_dev_s g_flexspi_nor = .name = "imxrt_flexspi_nor" }, .flexspi = (void *)0, Review Comment: ```suggestion .flexspi = NULL, ``` ########## boards/arm/stm32/mikroe-stm32f4/src/stm32_mio283qt2.c: ########## @@ -166,7 +166,7 @@ static void stm32_tinydelay(void) static inline void stm32_command(void) { - uint32_t * volatile portsetreset = (uint32_t *) STM32_GPIOE_BSRR; + uint32_t * volatile portsetreset = (uint32_t *)STM32_GPIOE_BSRR; Review Comment: ```suggestion uint32_t * volatile portsetreset = (uint32_t *)STM32_GPIOE_BSRR; ``` ########## arch/arm/src/stm32l4/stm32l4_i2c.c: ########## @@ -3038,43 +2985,35 @@ struct i2c_master_s *stm32l4_i2cbus_initialize(int port) * ****************************************************************************/ -int stm32l4_i2cbus_uninitialize(struct i2c_master_s * dev) +int stm32l4_i2cbus_uninitialize(struct i2c_master_s *dev) { - irqstate_t irqs; - + struct stm32l4_i2c_priv_s *priv = ((struct stm32l4_i2c_inst_s *)dev)->priv; Review Comment: ditto ########## drivers/1wire/1wire.c: ########## @@ -138,7 +138,6 @@ static int onewire_pm_prepare(FAR struct pm_callback_s *cb, int domain, struct onewire_master_s *master = (struct onewire_master_s *)((char *)cb - offsetof(struct onewire_master_s, pm_cb)); Review Comment: ```suggestion FAR struct onewire_master_s *master = (FAR struct onewire_master_s *)((FAR char *)cb - offsetof(struct onewire_master_s, pm_cb)); ``` ########## arch/arm/src/stm32h7/stm32_i2c.c: ########## @@ -2833,43 +2780,36 @@ struct i2c_master_s *stm32_i2cbus_initialize(int port) * ****************************************************************************/ -int stm32_i2cbus_uninitialize(struct i2c_master_s * dev) +int stm32_i2cbus_uninitialize(struct i2c_master_s *dev) { - irqstate_t irqs; + struct stm32_i2c_priv_s *priv = ((struct stm32_i2c_inst_s *)dev)->priv; Review Comment: ditto ########## boards/arm/stm32/mikroe-stm32f4/src/stm32_mio283qt9a.c: ########## @@ -166,7 +166,7 @@ static void stm32_tinydelay(void) static inline void stm32_command(void) { - uint32_t * volatile portsetreset = (uint32_t *) STM32_GPIOE_BSRR; + uint32_t * volatile portsetreset = (uint32_t *)STM32_GPIOE_BSRR; Review Comment: ```suggestion uint32_t * volatile portsetreset = (uint32_t *)STM32_GPIOE_BSRR; ``` ########## arch/arm/src/stm32f0l0g0/stm32_i2c.c: ########## @@ -2845,43 +2778,36 @@ struct i2c_master_s *stm32_i2cbus_initialize(int port) * ****************************************************************************/ -int stm32_i2cbus_uninitialize(struct i2c_master_s * dev) +int stm32_i2cbus_uninitialize(struct i2c_master_s *dev) { - irqstate_t irqs; + struct stm32_i2c_priv_s *priv = ((struct stm32_i2c_inst_s *)dev)->priv; Review Comment: Let's move `priv = ((struct stm32_i2c_inst_s *)dev)->priv;` after `DEBUGASSERT(dev);` ########## arch/risc-v/src/bl602/bl602_serial.c: ########## @@ -448,7 +448,7 @@ static int bl602_ioctl(struct file *filep, int cmd, unsigned long arg) case TCGETS: do { - struct termios * termiosp = (struct termios *)arg; + struct termios *termiosp = (struct termios *)arg; Review Comment: ```suggestion struct termios *termiosp = (struct termios *)arg; ``` ########## arch/arm/src/stm32f7/stm32_i2c.c: ########## @@ -2869,43 +2817,36 @@ struct i2c_master_s *stm32_i2cbus_initialize(int port) * ****************************************************************************/ -int stm32_i2cbus_uninitialize(struct i2c_master_s * dev) +int stm32_i2cbus_uninitialize(struct i2c_master_s *dev) { - irqstate_t irqs; + struct stm32_i2c_priv_s *priv = ((struct stm32_i2c_inst_s *)dev)->priv; Review Comment: ditto ########## drivers/audio/cxd56_src.c: ########## @@ -165,7 +164,7 @@ static int cxd56_src_process(FAR struct ap_buffer_s *apb) #ifdef DUMP_DATA file_write(&dump_file_pre, - (char *) (apb->samp + apb->curbyte), + (char *)(apb->samp + apb->curbyte), Review Comment: ```suggestion (FAR char *)(apb->samp + apb->curbyte), ``` ########## boards/arm/stm32/mikroe-stm32f4/src/stm32_mio283qt2.c: ########## @@ -274,9 +274,9 @@ static void stm32_index(struct mio283qt2_lcd_s *dev, uint8_t index) static uint16_t stm32_read(struct mio283qt2_lcd_s *dev) { struct stm32f4_dev_s *priv = (struct stm32f4_dev_s *)dev; - uint32_t * volatile portsetreset = (uint32_t *) STM32_GPIOE_BSRR; - uint32_t * volatile portmode = (uint32_t *) STM32_GPIOE_MODER; - uint32_t * volatile portinput = (uint32_t *) STM32_GPIOE_IDR; + uint32_t * volatile portsetreset = (uint32_t *)STM32_GPIOE_BSRR; + uint32_t * volatile portmode = (uint32_t *)STM32_GPIOE_MODER; + uint32_t * volatile portinput = (uint32_t *)STM32_GPIOE_IDR; Review Comment: ```suggestion uint32_t * volatile portsetreset = (uint32_t *)STM32_GPIOE_BSRR; uint32_t * volatile portmode = (uint32_t *)STM32_GPIOE_MODER; uint32_t * volatile portinput = (uint32_t *)STM32_GPIOE_IDR; ``` ########## arch/arm/src/stm32f0l0g0/stm32_i2c.c: ########## @@ -2521,7 +2468,7 @@ static int stm32_i2c_transfer(struct i2c_master_s *dev, /* Ensure that address or flags don't change meanwhile */ - ret = stm32_i2c_sem_wait(dev); + ret = nxmutex_lock(&((struct stm32_i2c_inst_s *)dev)->priv->lock); Review Comment: adding ``` struct stm32_i2c_priv_s *priv; DEBUGASSERT(dev); /* Get I2C private structure */ priv = ((struct stm32_i2c_inst_s *)dev)->priv; ``` would simplify the readability ########## drivers/audio/cxd56.c: ########## @@ -1312,15 +1312,15 @@ static void _process_audio_with_src(cxd56_dmahandle_t hdl, uint16_t err_code) { FAR struct ap_buffer_s *src_apb; - src_apb = (struct ap_buffer_s *) dq_get(&dev->down_runq); + src_apb = (struct ap_buffer_s *)dq_get(&dev->down_runq); Review Comment: ```suggestion src_apb = (FAR struct ap_buffer_s *)dq_get(&dev->down_runq); ``` ########## drivers/audio/cxd56_src.c: ########## @@ -509,13 +508,13 @@ int cxd56_src_deinit(void) while (dq_count(g_src.inq)) { - src_apb = (struct ap_buffer_s *) dq_get(g_src.inq); + src_apb = (struct ap_buffer_s *)dq_get(g_src.inq); Review Comment: ```suggestion src_apb = (FAR struct ap_buffer_s *)dq_get(g_src.inq); ``` ########## drivers/audio/cxd56.c: ########## @@ -1312,15 +1312,15 @@ static void _process_audio_with_src(cxd56_dmahandle_t hdl, uint16_t err_code) { FAR struct ap_buffer_s *src_apb; - src_apb = (struct ap_buffer_s *) dq_get(&dev->down_runq); + src_apb = (struct ap_buffer_s *)dq_get(&dev->down_runq); src_apb->nbytes = 0; dq_put(&dev->down_doneq, &src_apb->dq_entry); if (src_apb->flags & AUDIO_APB_SRC_FINAL) { struct ap_buffer_s *apb; Review Comment: ```suggestion FAR struct ap_buffer_s *apb; ``` ########## drivers/audio/cxd56_src.c: ########## @@ -509,13 +508,13 @@ int cxd56_src_deinit(void) while (dq_count(g_src.inq)) { - src_apb = (struct ap_buffer_s *) dq_get(g_src.inq); + src_apb = (struct ap_buffer_s *)dq_get(g_src.inq); kmm_free(src_apb); } while (dq_count(g_src.outq)) { - src_apb = (struct ap_buffer_s *) dq_get(g_src.outq); + src_apb = (struct ap_buffer_s *)dq_get(g_src.outq); Review Comment: ```suggestion src_apb = (FAR struct ap_buffer_s *)dq_get(g_src.outq); ``` ########## drivers/contactless/pn532.c: ########## @@ -523,7 +523,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, (uint8_t *)&resp, 9); Review Comment: ```suggestion pn532_read(dev, (FAR uint8_t *)&resp, 9); ``` ########## drivers/audio/cxd56_src.c: ########## @@ -141,7 +140,7 @@ static struct ap_buffer_s *cxd56_src_get_apb(void) } else { - src_apb = (struct ap_buffer_s *) dq_get(g_src.inq); + src_apb = (struct ap_buffer_s *)dq_get(g_src.inq); Review Comment: ```suggestion src_apb = (FAR struct ap_buffer_s *)dq_get(g_src.inq); ``` ########## drivers/contactless/pn532.c: ########## @@ -483,7 +483,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, (uint8_t *)f, sizeof(struct pn532_frame)); Review Comment: ```suggestion pn532_read(dev, (FAR uint8_t *)f, sizeof(struct pn532_frame)); ``` ########## drivers/contactless/pn532.c: ########## @@ -997,7 +997,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, + (uint8_t *)&tag_data->data, Review Comment: ```suggestion (FAR uint8_t *)&tag_data->data, ``` ########## drivers/contactless/pn532.c: ########## @@ -348,7 +348,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", (uint8_t *)f, FRAME_SIZE(f)); Review Comment: ```suggestion tracetx("command sent", (FAR uint8_t *)f, FRAME_SIZE(f)); ``` ########## drivers/contactless/pn532.c: ########## @@ -557,7 +557,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", (uint8_t *)f->data, 3); Review Comment: ```suggestion tracerx("sam config response", (FAR uint8_t *)f->data, 3); ``` ########## drivers/contactless/pn532.c: ########## @@ -785,12 +785,12 @@ static int pn532_read_passive_target(FAR struct pn532_dev_s *dev, return pn532_write_frame(dev, f); } -bool pn532_set_rf_config(struct pn532_dev_s * dev, - struct pn_rf_config_s * conf) +bool pn532_set_rf_config(struct pn532_dev_s *dev, Review Comment: ```suggestion bool pn532_set_rf_config(FAR struct pn532_dev_s *dev, ``` ########## drivers/contactless/pn532.c: ########## @@ -800,8 +800,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, (uint8_t *)f, 10); + tracerx("rf config response", (uint8_t *)f, 10); Review Comment: ```suggestion tracerx("rf config response", (FAR uint8_t *)f, 10); ``` ########## drivers/contactless/pn532.c: ########## @@ -410,7 +410,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, (uint8_t *)&ack, 6); Review Comment: ```suggestion pn532_read(dev, (FAR uint8_t *)&ack, 6); ``` ########## drivers/contactless/pn532.c: ########## @@ -800,8 +800,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, (uint8_t *)f, 10); Review Comment: ```suggestion pn532_read(dev, (FAR uint8_t *)f, 10); ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org