You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/11/03 21:37:41 UTC
[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #7472: Initialize global mutext/sem by NXMUTEX_INITIALIZER and SEM_INITIALIZER
pkarashchenko commented on code in PR #7472:
URL: https://github.com/apache/incubator-nuttx/pull/7472#discussion_r1009731942
##########
arch/arm/src/sam34/sam_spi.c:
##########
@@ -1857,12 +1859,7 @@ struct spi_dev_s *sam_spibus_initialize(int port)
spi_getreg(spi, SAM_SPI_SR_OFFSET);
spi_getreg(spi, SAM_SPI_RDR_OFFSET);
- /* Initialize the SPI mutex that enforces mutually exclusive
- * access to the SPI registers.
- */
-
- nxmutex_init(&spi->spilock);
- spi->initialized = true;
+ spi->initialized = true;
Review Comment:
```suggestion
spi->initialized = true;
```
##########
drivers/usbhost/usbhost_xboxcontroller.c:
##########
@@ -1901,10 +1901,10 @@ static int usbhost_close(FAR struct file *filep)
static ssize_t usbhost_read(FAR struct file *filep, FAR char *buffer,
size_t len)
{
- FAR struct inode *inode;
- FAR struct usbhost_state_s *priv;
- FAR struct xbox_controller_buttonstate_s sample;
- int ret;
+ FAR struct inode *inode;
+ FAR struct usbhost_state_s *priv;
+ FAR struct xbox_controller_buttonstate_s sample;
Review Comment:
```suggestion
struct xbox_controller_buttonstate_s sample;
```
##########
crypto/random_pool.c:
##########
@@ -45,8 +45,8 @@
# define MIN(a,b) ((a) < (b) ? (a) : (b))
#endif
-#define ROTL_32(x,n) ( ((x) << (n)) | ((x) >> (32-(n))) )
-#define ROTR_32(x,n) ( ((x) >> (n)) | ((x) << (32-(n))) )
+#define ROTL_32(x,n) (((x) << (n)) | ((x) >> (32-(n))))
+#define ROTR_32(x,n) (((x) >> (n)) | ((x) << (32-(n))))
Review Comment:
```suggestion
#define ROTL_32(x,n) (((x) << (n)) | ((x) >> (32 - (n))))
#define ROTR_32(x,n) (((x) >> (n)) | ((x) << (32 - (n))))
```
##########
boards/arm/stm32/mikroe-stm32f4/src/stm32_touchscreen.c:
##########
@@ -1350,10 +1350,10 @@ static int tc_ioctl(struct file *filep, int cmd, unsigned long arg)
static int tc_poll(struct file *filep, struct pollfd *fds,
bool setup)
Review Comment:
```suggestion
static int tc_poll(struct file *filep, struct pollfd *fds,
bool setup)
```
##########
arch/arm/src/sam34/sam_twi.c:
##########
@@ -174,7 +174,7 @@ static void twi_startmessage(struct twi_dev_s *priv, struct i2c_msg_s *msg);
static int twi_transfer(struct i2c_master_s *dev,
struct i2c_msg_s *msgs, int count);
Review Comment:
```suggestion
static int twi_transfer(struct i2c_master_s *dev,
struct i2c_msg_s *msgs, int count);
```
##########
crypto/random_pool.c:
##########
@@ -89,7 +89,10 @@ enum
* Private Data
****************************************************************************/
-static struct rng_s g_rng;
+static struct rng_s g_rng =
+{
+ .rd_lock = NXMUTEX_INITIALIZER,
Review Comment:
C89
##########
boards/mips/pic32mx/pic32mx7mmb/src/pic32_touchscreen.c:
##########
@@ -1227,10 +1227,10 @@ static int tc_ioctl(struct file *filep, int cmd, unsigned long arg)
static int tc_poll(struct file *filep, struct pollfd *fds,
bool setup)
Review Comment:
```suggestion
static int tc_poll(struct file *filep, struct pollfd *fds,
bool setup)
```
--
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-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org