pkarashchenko commented on code in PR #6965: URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r988375148
########## drivers/ipcc/ipcc_register.c: ########## @@ -176,7 +176,7 @@ int ipcc_register(FAR struct ipcc_lower_s *ipcc) /* nxsem_init can't really fail us if we provide it with valid params */ - nxsem_init(&priv->exclsem, 0, 1); + nxmutex_init(&priv->lock); nxsem_init(&priv->rxsem, 0, 0); nxsem_init(&priv->txsem, 0, 1); Review Comment: Let's disable priority inheritance here ########## drivers/lcd/max7219.c: ########## @@ -290,14 +290,14 @@ static struct max7219_dev_s g_max7219dev = static inline void __set_bit(int nr, uint8_t * addr) { uint8_t mask = BIT_MASK(nr); - uint8_t *p = ((uint8_t *) addr) + BIT_BYTE(nr); + uint8_t *p = ((uint8_t *)addr) + BIT_BYTE(nr); *p |= mask; } static inline void __clear_bit(int nr, uint8_t * addr) Review Comment: ```suggestion static inline void __clear_bit(int nr, FAR uint8_t *addr) ``` ########## drivers/lcd/max7219.c: ########## @@ -290,14 +290,14 @@ static struct max7219_dev_s g_max7219dev = static inline void __set_bit(int nr, uint8_t * addr) { uint8_t mask = BIT_MASK(nr); - uint8_t *p = ((uint8_t *) addr) + BIT_BYTE(nr); + uint8_t *p = ((uint8_t *)addr) + BIT_BYTE(nr); Review Comment: ```suggestion FAR uint8_t *p = ((FAR uint8_t *)addr) + BIT_BYTE(nr); ``` ########## drivers/lcd/memlcd.c: ########## @@ -233,14 +233,14 @@ static struct memlcd_dev_s g_memlcddev = static inline void __set_bit(int nr, uint8_t * addr) { uint8_t mask = BIT_MASK(nr); - uint8_t *p = ((uint8_t *) addr) + BIT_BYTE(nr); + uint8_t *p = ((uint8_t *)addr) + BIT_BYTE(nr); *p |= mask; } static inline void __clear_bit(int nr, uint8_t * addr) Review Comment: ditto ########## drivers/lcd/ssd1680.c: ########## @@ -438,7 +438,7 @@ static int ssd1680_getplaneinfo(FAR struct lcd_dev_s *dev, static int ssd1680_getpower(FAR struct lcd_dev_s *dev) { - struct ssd1680_dev_s *priv = (struct ssd1680_dev_s *) dev; + struct ssd1680_dev_s *priv = (struct ssd1680_dev_s *)dev; Review Comment: ```suggestion FAR struct ssd1680_dev_s *priv = (FAR struct ssd1680_dev_s *)dev; ``` ########## drivers/lcd/st7565.c: ########## @@ -264,7 +264,7 @@ 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 */ + .buffer = (uint8_t *)g_runbuffer, /* Run scratch buffer */ Review Comment: ```suggestion .buffer = (FAR uint8_t *)g_runbuffer, /* Run scratch buffer */ ``` ########## drivers/lcd/memlcd.c: ########## @@ -233,14 +233,14 @@ static struct memlcd_dev_s g_memlcddev = static inline void __set_bit(int nr, uint8_t * addr) { uint8_t mask = BIT_MASK(nr); - uint8_t *p = ((uint8_t *) addr) + BIT_BYTE(nr); + uint8_t *p = ((uint8_t *)addr) + BIT_BYTE(nr); *p |= mask; } static inline void __clear_bit(int nr, uint8_t * addr) { uint8_t mask = BIT_MASK(nr); - uint8_t *p = ((uint8_t *) addr) + BIT_BYTE(nr); + uint8_t *p = ((uint8_t *)addr) + BIT_BYTE(nr); Review Comment: ditto ########## drivers/modem/u-blox.c: ########## @@ -270,8 +270,8 @@ static int ubxmdm_poll(FAR struct file * filep, * Public Functions ****************************************************************************/ -FAR void * ubxmdm_register(FAR const char * path, - FAR struct ubxmdm_lower * lower) +FAR void * ubxmdm_register(FAR const char *path, Review Comment: ```suggestion FAR void *ubxmdm_register(FAR const char *path, ``` ########## drivers/lcd/ssd1680.c: ########## @@ -474,7 +474,7 @@ static void ssd1680_reset(struct ssd1680_dev_s *priv) static int ssd1680_setpower(FAR struct lcd_dev_s *dev, int power) { int ret = OK; - struct ssd1680_dev_s *priv = (struct ssd1680_dev_s *) dev; + struct ssd1680_dev_s *priv = (struct ssd1680_dev_s *)dev; Review Comment: ```suggestion FAR struct ssd1680_dev_s *priv = (FAR struct ssd1680_dev_s *)dev; ``` ########## drivers/mtd/smart.c: ########## @@ -3368,9 +3368,9 @@ 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); Review Comment: ```suggestion *((FAR uint16_t *)header->crc16) = smart_calc_sector_crc(dev); ``` ########## drivers/mtd/smart.c: ########## @@ -3207,9 +3207,9 @@ static inline int smart_llformat(FAR struct smart_struct_s *dev, #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); Review Comment: ```suggestion *((FAR uint16_t *)sectorheader->crc16) = smart_calc_sector_crc(dev); ``` ########## drivers/mtd/smart.c: ########## @@ -3207,9 +3207,9 @@ static inline int smart_llformat(FAR struct smart_struct_s *dev, #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); + *((uint32_t *)sectorheader->crc32) = smart_calc_sector_crc(dev); Review Comment: ```suggestion *((FAR uint32_t *)sectorheader->crc32) = smart_calc_sector_crc(dev); ``` ########## drivers/mtd/smart.c: ########## @@ -4141,7 +4141,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; + *((uint32_t *)buffer) = dev->blockerases; Review Comment: ```suggestion *((FAR uint32_t *)buffer) = dev->blockerases; ``` ########## drivers/mtd/smart.c: ########## @@ -4786,9 +4786,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); + *((uint32_t *)header->crc32) = smart_calc_sector_crc(dev); Review Comment: ```suggestion *((FAR uint32_t *)header->crc32) = smart_calc_sector_crc(dev); ``` ########## drivers/lcd/memlcd.c: ########## @@ -233,14 +233,14 @@ static struct memlcd_dev_s g_memlcddev = static inline void __set_bit(int nr, uint8_t * addr) { uint8_t mask = BIT_MASK(nr); - uint8_t *p = ((uint8_t *) addr) + BIT_BYTE(nr); + uint8_t *p = ((uint8_t *)addr) + BIT_BYTE(nr); Review Comment: ditto ########## drivers/pipes/pipe.c: ########## @@ -64,7 +64,7 @@ static const struct file_operations g_pipe_fops = pipecommon_poll /* poll */ }; -static sem_t g_pipesem = SEM_INITIALIZER(1); +static mutex_t g_pipelock = NXMUTEX_INITIALIZER; static int g_pipeno; Review Comment: ```suggestion static mutex_t g_pipelock = NXMUTEX_INITIALIZER; static int g_pipeno; ``` ########## drivers/lcd/max7219.c: ########## @@ -290,14 +290,14 @@ static struct max7219_dev_s g_max7219dev = static inline void __set_bit(int nr, uint8_t * addr) Review Comment: ```suggestion static inline void __set_bit(int nr, FAR uint8_t *addr) ``` ########## drivers/lcd/apa102.c: ########## @@ -571,7 +571,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; + uint16_t *ptr = (uint16_t *)buffer; Review Comment: ```suggestion FAR uint16_t *ptr = (FAR uint16_t *)buffer; ``` ########## drivers/lcd/memlcd.c: ########## @@ -233,14 +233,14 @@ static struct memlcd_dev_s g_memlcddev = static inline void __set_bit(int nr, uint8_t * addr) Review Comment: ditto ########## drivers/misc/rwbuffer.c: ########## @@ -68,58 +68,26 @@ static ssize_t rwb_read_(FAR struct rwbuffer_s *rwb, off_t startblock, ****************************************************************************/ /**************************************************************************** - * Name: rwb_semtake + * Name: rwb_lock ****************************************************************************/ #if defined(CONFIG_DRVR_WRITEBUFFER) -static int rwb_semtake(FAR sem_t *sem) +static int rwb_lock(FAR mutex_t *lock) { - return nxsem_wait_uninterruptible(sem); + return nxmutex_lock(lock); Review Comment: Why not just `# define rwb_lock(l) nxmutex_lock(l)`? the same as for `rwb_unlock` ########## drivers/leds/ws2812.c: ########## @@ -123,7 +124,7 @@ struct ws2812_dev_s FAR struct spi_dev_s *spi; /* SPI interface */ uint16_t nleds; /* Number of addressable LEDs */ uint8_t *tx_buf; /* Buffer for write transaction and state */ Review Comment: ```suggestion FAR uint8_t *tx_buf; /* Buffer for write transaction and state */ ``` ########## drivers/lcd/max7219.c: ########## @@ -290,14 +290,14 @@ static struct max7219_dev_s g_max7219dev = static inline void __set_bit(int nr, uint8_t * addr) { uint8_t mask = BIT_MASK(nr); - uint8_t *p = ((uint8_t *) addr) + BIT_BYTE(nr); + uint8_t *p = ((uint8_t *)addr) + BIT_BYTE(nr); *p |= mask; } static inline void __clear_bit(int nr, uint8_t * addr) { uint8_t mask = BIT_MASK(nr); - uint8_t *p = ((uint8_t *) addr) + BIT_BYTE(nr); + uint8_t *p = ((uint8_t *)addr) + BIT_BYTE(nr); Review Comment: ```suggestion FAR uint8_t *p = ((FAR uint8_t *)addr) + BIT_BYTE(nr); ``` ########## drivers/modem/u-blox.c: ########## @@ -77,29 +77,29 @@ struct ubxmdm_upper { - FAR char * path; /* Registration path */ + FAR char *path; /* Registration path */ /* The contained lower-half driver. */ - FAR struct ubxmdm_lower * lower; + FAR struct ubxmdm_lower *lower; }; /**************************************************************************** * Private Function Prototypes ****************************************************************************/ -static ssize_t ubxmdm_read (FAR struct file * filep, +static ssize_t ubxmdm_read (FAR struct file *filep, FAR char * buffer, size_t buflen); -static ssize_t ubxmdm_write(FAR struct file * filep, - FAR const char * buffer, +static ssize_t ubxmdm_write(FAR struct file *filep, + FAR const char *buffer, size_t buflen); -static int ubxmdm_ioctl(FAR struct file * filep, +static int ubxmdm_ioctl(FAR struct file *filep, int cmd, unsigned long arg); -static int ubxmdm_poll (FAR struct file * filep, - FAR struct pollfd * fds, +static int ubxmdm_poll (FAR struct file *filep, Review Comment: ```suggestion static int ubxmdm_poll(FAR struct file *filep, ``` ########## drivers/misc/rwbuffer.c: ########## @@ -68,58 +68,26 @@ static ssize_t rwb_read_(FAR struct rwbuffer_s *rwb, off_t startblock, ****************************************************************************/ /**************************************************************************** - * Name: rwb_semtake + * Name: rwb_lock ****************************************************************************/ #if defined(CONFIG_DRVR_WRITEBUFFER) -static int rwb_semtake(FAR sem_t *sem) +static int rwb_lock(FAR mutex_t *lock) { - return nxsem_wait_uninterruptible(sem); + return nxmutex_lock(lock); } #else -# define rwb_semtake(s) OK +# define rwb_lock(s) OK Review Comment: ```suggestion # define rwb_lock(l) OK ``` ########## drivers/lcd/memlcd.c: ########## @@ -183,7 +183,7 @@ 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 */ + .buffer = (uint8_t *)g_runbuffer, /* Run scratch buffer */ Review Comment: ```suggestion .buffer = (FAR uint8_t *)g_runbuffer, /* Run scratch buffer */ ``` ########## drivers/modem/u-blox.c: ########## @@ -77,29 +77,29 @@ struct ubxmdm_upper { - FAR char * path; /* Registration path */ + FAR char *path; /* Registration path */ /* The contained lower-half driver. */ - FAR struct ubxmdm_lower * lower; + FAR struct ubxmdm_lower *lower; }; /**************************************************************************** * Private Function Prototypes ****************************************************************************/ -static ssize_t ubxmdm_read (FAR struct file * filep, +static ssize_t ubxmdm_read (FAR struct file *filep, Review Comment: ```suggestion static ssize_t ubxmdm_read(FAR struct file *filep, ``` ########## drivers/modem/altair/altmdm.c: ########## @@ -292,7 +292,7 @@ static int altmdm_ioctl(FAR struct file *filep, int cmd, unsigned long arg) case MODEM_IOC_PM_GETSTATE: /* Get ALTMDM power management state. */ { - *(uint32_t *) arg = altmdm_pm_getstate(); + *(uint32_t *)arg = altmdm_pm_getstate(); Review Comment: ```suggestion *(FAR uint32_t *)arg = altmdm_pm_getstate(); ``` ########## drivers/mtd/smart.c: ########## @@ -4285,7 +4285,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 = *((uint32_t *)buffer); Review Comment: ```suggestion dev->blockerases = *((FAR uint32_t *)buffer); ``` ########## drivers/mtd/mtd_nandscheme.c: ########## @@ -271,7 +271,7 @@ void nandscheme_writeextra(FAR const struct nand_scheme_s *scheme, uint32_t i; for (i = 0; i < size; i++) { - spare[scheme->xbytepos[i + offset]] = ((uint8_t *) extra)[i]; + spare[scheme->xbytepos[i + offset]] = ((uint8_t *)extra)[i]; Review Comment: ```suggestion spare[scheme->xbytepos[i + offset]] = ((FAR uint8_t *)extra)[i]; ``` ########## drivers/mtd/smart.c: ########## @@ -3368,9 +3368,9 @@ 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); + *((uint32_t *)header->crc32) = smart_calc_sector_crc(dev); Review Comment: ```suggestion *((FAR uint32_t *)header->crc32) = smart_calc_sector_crc(dev); ``` ########## drivers/mtd/smart.c: ########## @@ -2490,7 +2490,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, (uint8_t *)dev->rwbuffer); Review Comment: ```suggestion dev->mtdblkspersector, (FAR uint8_t *)dev->rwbuffer); ``` ########## drivers/mtd/smart.c: ########## @@ -4500,14 +4500,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 != *((uint32_t *)header->crc32)) Review Comment: ```suggestion if (crc != *((FAR uint32_t *)header->crc32)) ``` ########## drivers/mtd/smart.c: ########## @@ -4500,14 +4500,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)) Review Comment: ```suggestion if (crc != *((FAR uint16_t *)header->crc16)) ``` ########## drivers/mtd/smart.c: ########## @@ -4786,9 +4786,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); Review Comment: ```suggestion *((FAR uint16_t *)header->crc16) = smart_calc_sector_crc(dev); ``` ########## drivers/net/slip.c: ########## @@ -185,45 +182,6 @@ static int slip_rmmac(FAR struct net_driver_s *dev, FAR const uint8_t *mac); * Private Functions ****************************************************************************/ -/**************************************************************************** - * Name: slip_semtake - ****************************************************************************/ - -static int slip_semtake(FAR struct slip_driver_s *priv) -{ - return nxsem_wait_uninterruptible(&priv->waitsem); -} - -#define slip_semgive(p) nxsem_post(&(p)->waitsem); - -/**************************************************************************** - * Name: slip_forcetake - * - * Description: - * This is just another wrapper but this one continues even if the thread - * is canceled. This must be done in certain conditions where were must - * continue in order to clean-up resources. - * - ****************************************************************************/ - -static void slip_forcetake(FAR struct slip_driver_s *priv) Review Comment: Removing this seems to change the logic -- 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