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/08/31 03:32:25 UTC
[GitHub] [incubator-nuttx] anjiahao1 opened a new pull request, #6965: nxmutex replace nxsem when used as a lock
anjiahao1 opened a new pull request, #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965
Signed-off-by: anjiahao <an...@xiaomi.com>
## Summary
[pull5070](https://github.com/apache/incubator-nuttx/pull/5070)
this is step 2,then change sem defult behavior
## Impact
schedule
## Testing
CI
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r959695234
##########
include/nuttx/semaphore.h:
##########
@@ -74,6 +74,7 @@
# define _SEM_WAIT(s) nxsem_wait(s)
# define _SEM_TRYWAIT(s) nxsem_trywait(s)
# define _SEM_TIMEDWAIT(s,t) nxsem_timedwait(s,t)
+# define _SEM_TICKWAIT(s,t) nxsem_timedwait(s,t)
Review Comment:
why add
##########
fs/hostfs/hostfs.c:
##########
@@ -122,8 +123,7 @@ static int hostfs_chstat(FAR struct inode *mountpt,
* Private Data
****************************************************************************/
-static uint8_t g_seminitialized = FALSE;
-static sem_t g_sem;
+static mutex_t g_lock;
Review Comment:
need add NXMUTEX_INITxxxx
##########
drivers/wireless/ieee80211/bcm43xxx/bcmf_driver.c:
##########
@@ -173,6 +173,59 @@ static int bcmf_wl_channel_to_frequency(int chan)
return 0; /* not supported */
}
+FAR struct bcmf_dev_s *bcmf_allocate_device(void)
Review Comment:
why add
##########
drivers/input/button_upper.c:
##########
@@ -40,6 +40,7 @@
#include <debug.h>
#include <nuttx/kmalloc.h>
+#include <nuttx/mutex.h>
Review Comment:
why add
##########
drivers/input/button_upper.c:
##########
@@ -460,7 +461,6 @@ static ssize_t btn_read(FAR struct file *filep, FAR char *buffer,
opriv->bo_pending = false;
leave_critical_section(flags);
- return (ssize_t)sizeof(btn_buttonset_t);
Review Comment:
why remove
##########
net/local/local_connect.c:
##########
@@ -31,6 +31,7 @@
#include <queue.h>
#include <debug.h>
+#include <nuttx/mutex.h>
Review Comment:
revert
##########
wireless/bluetooth/bt_netdev.c:
##########
@@ -103,7 +104,7 @@ struct btnet_driver_s
/* For internal use by this driver */
- sem_t bd_exclsem; /* Exclusive access to struct */
+ mutex_t bd_excllock; /* Exclusive access to struct */
Review Comment:
fix the comment alignment
##########
arch/arm/src/lpc17xx_40xx/lpc17_40_gpdma.c:
##########
@@ -613,7 +613,7 @@ void lpc17_40_dmastop(DMA_HANDLE handle)
/* Disable this channel and mask any further interrupts from the channel.
* this channel. The channel is disabled by clearning the channel
- * enable bit. Any outstanding data in the FIFO�s is lost.
+ * enable bit. Any outstanding data in the FIFO�s is lost.
Review Comment:
revert this change
##########
net/local/local_connect.c:
##########
@@ -152,7 +138,7 @@ static int inline local_stream_connect(FAR struct local_conn_s *client,
{
do
{
- _local_semtake(&client->lc_waitsem);
Review Comment:
why change
##########
include/nuttx/semaphore.h:
##########
@@ -87,6 +88,7 @@
# define _SEM_WAIT(s) sem_wait(s)
# define _SEM_TRYWAIT(s) sem_trywait(s)
# define _SEM_TIMEDWAIT(s,t) sem_timedwait(s,t)
+# define _SEM_TICKWAIT(s,t) sem_timedwait(s,t)
Review Comment:
ditto
##########
fs/vfs/fs_eventfd.c:
##########
@@ -254,7 +255,7 @@ static int eventfd_do_close(FAR struct file *filep)
unregister_driver(devpath);
- DEBUGASSERT(priv->exclsem.semcount == 0);
+ DEBUGASSERT(nxmutex_is_locked(priv->excllock) > 0);
Review Comment:
remove `> 0`
##########
libs/libc/libc.h:
##########
@@ -74,13 +74,6 @@ extern "C"
* Public Function Prototypes
****************************************************************************/
-/* Defined in lib_streamsem.c */
-
-#ifdef CONFIG_FILE_STREAM
-void lib_stream_semtake(FAR struct streamlist *list);
Review Comment:
we need keep libc as before since mutex api is for kernel only
##########
net/local/local_connect.c:
##########
@@ -143,7 +129,7 @@ static int inline local_stream_connect(FAR struct local_conn_s *client,
if (nxsem_get_value(&server->lc_waitsem, &sval) >= 0 && sval < 1)
{
- _local_semgive(&server->lc_waitsem);
+ nxsem_post(&server->lc_waitsem);
Review Comment:
why change
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#issuecomment-1236124580
@anjiahao1 please fix the warning:
https://github.com/apache/incubator-nuttx/runs/8127486548?check_suite_focus=true
and fix the conflict.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r988581630
##########
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:
I think -ECANCEL should wait too.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989788855
##########
fs/nfs/nfs_mount.h:
##########
@@ -68,7 +68,7 @@
struct nfsmount
{
FAR struct nfsnode *nm_head; /* A list of all files opened on this mountpoint */
- sem_t nm_sem; /* Used to assure thread-safe access */
+ mutex_t nm_lock; /* Used to assure thread-safe access */
nfsfh_t *nm_fh; /* File handle of root dir */
Review Comment:
Done
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r985413403
##########
arch/arm/src/cxd56xx/cxd56_udmac.c:
##########
@@ -238,7 +239,7 @@ void cxd56_udmainitialize(void)
/* Initialize the channel list */
- nxsem_init(&g_dmac.exclsem, 0, 1);
+ nxmutex_init(&g_dmac.lock);
nxsem_init(&g_dmac.chansem, 0, CXD56_DMA_NCHANNELS);
Review Comment:
> Let's add `nxsem_set_protocol(&g_dmac.chansem, SEM_PRIO_NONE);`?
@anjiahao1 will create a new patch which disable priority inheritance by default, so we can ignore the problem temporarily.
> Or waiting on DMA channel should rise priority as well?
No, the priority inheritance require sem_wait/sem_post come from the same thread, otherwise the system will panic.
##########
arch/arm/src/efm32/efm32_dma.c:
##########
@@ -265,7 +266,7 @@ void weak_function arm_dma_initialize(void)
/* Initialize the channel list */
- nxsem_init(&g_dmac.exclsem, 0, 1);
+ nxmutex_init(&g_dmac.lock);
nxsem_init(&g_dmac.chansem, 0, EFM32_DMA_NCHANNELS);
Review Comment:
ditto
##########
arch/arm/src/cxd56xx/cxd56_udmac.c:
##########
@@ -238,7 +239,7 @@ void cxd56_udmainitialize(void)
/* Initialize the channel list */
- nxsem_init(&g_dmac.exclsem, 0, 1);
+ nxmutex_init(&g_dmac.lock);
nxsem_init(&g_dmac.chansem, 0, CXD56_DMA_NCHANNELS);
Review Comment:
> Let's add `nxsem_set_protocol(&g_dmac.chansem, SEM_PRIO_NONE);`?
@anjiahao1 will create a new patch which disable priority inheritance by default and remove all `nxsem_set_protocol(&g_dmac.chansem, SEM_PRIO_NONE);` after this patch get merged, so we can ignore the problem temporarily.
> Or waiting on DMA channel should rise priority as well?
No, the priority inheritance require sem_wait/sem_post come from the same thread, otherwise the system will panic.
##########
arch/arm/src/cxd56xx/cxd56_udmac.c:
##########
@@ -238,7 +239,7 @@ void cxd56_udmainitialize(void)
/* Initialize the channel list */
- nxsem_init(&g_dmac.exclsem, 0, 1);
+ nxmutex_init(&g_dmac.lock);
nxsem_init(&g_dmac.chansem, 0, CXD56_DMA_NCHANNELS);
Review Comment:
> Let's add `nxsem_set_protocol(&g_dmac.chansem, SEM_PRIO_NONE);`?
@anjiahao1 will create a new patch which disable priority inheritance by default and remove all `nxsem_set_protocol(&g_dmac.chansem, SEM_PRIO_NONE);` after this patch get merged, so we can ignore the problem temporarily.
> Or waiting on DMA channel should rise priority as well?
No, the priority inheritance require sem_wait/sem_post come from the same thread, otherwise the system will panic. This is also the key reason why is a bad idea to enable priority inheritance by default.
##########
arch/arm/src/sama5/sam_ssc.c:
##########
@@ -931,7 +884,7 @@ static struct sam_buffer_s *ssc_buf_allocate(struct sam_ssc_s *priv)
* have at least one free buffer container.
*/
- ret = ssc_bufsem_take(priv);
+ ret = nxsem_wait_uninterruptible(&priv->bufsem);
Review Comment:
Let's do in the next patch
##########
arch/arm/src/sama5/sam_ohci.c:
##########
@@ -4016,7 +3963,7 @@ struct usbhost_connection_s *sam_ohci_initialize(int controller)
/* Initialize the state data structure */
nxsem_init(&g_ohci.pscsem, 0, 0);
Review Comment:
Done.
##########
arch/arm/src/sama5/sam_ehci.c:
##########
@@ -4881,7 +4828,7 @@ struct usbhost_connection_s *sam_ehci_initialize(int controller)
/* Initialize the EHCI state data structure */
- nxsem_init(&g_ehci.exclsem, 0, 1);
+ nxmutex_init(&g_ehci.lock);
nxsem_init(&g_ehci.pscsem, 0, 0);
Review Comment:
Done.
##########
arch/arm/src/sama5/sam_dmac.c:
##########
@@ -1873,9 +1855,9 @@ void sam_dmainitialize(struct sam_dmac_s *dmac)
sam_putdmac(dmac, DMAC_EN_ENABLE, SAM_DMAC_EN_OFFSET);
- /* Initialize semaphores */
+ /* Initialize muttex & semaphores */
- nxsem_init(&dmac->chsem, 0, 1);
+ nxmutex_init(&dmac->chlock);
nxsem_init(&dmac->dsem, 0, SAM_NDMACHAN);
Review Comment:
In the next patch
##########
arch/arm/src/sam34/sam_dmac.c:
##########
@@ -1380,9 +1341,9 @@ void weak_function arm_dma_initialize(void)
putreg32(DMAC_EN_ENABLE, SAM_DMAC_EN);
- /* Initialize semaphores */
+ /* Initialize mutex & semaphores */
- nxsem_init(&g_chsem, 0, 1);
+ nxmutex_init(&g_chlock);
nxsem_init(&g_dsem, 0, CONFIG_SAM34_NLLDESC);
Review Comment:
Done.
##########
arch/arm/src/lpc54xx/lpc54_usb0_ohci.c:
##########
@@ -3884,10 +3829,10 @@ struct usbhost_connection_s *lpc54_usbhost_initialize(int controller)
usbhost_devaddr_initialize(&priv->rhport);
- /* Initialize semaphores */
+ /* Initialize semaphores & mutex */
nxsem_init(&priv->pscsem, 0, 0);
Review Comment:
Done.
##########
arch/arm/src/sam34/sam_aes.c:
##########
@@ -169,7 +159,7 @@ static int samaes_setup_mr(uint32_t keysize, int mode, int encrypt)
static int samaes_initialize(void)
{
- nxsem_init(&g_samaes_lock, 0, 1);
+ nxmutex_init(&g_samaes_lock);
Review Comment:
Done.
##########
arch/arm/src/sam34/sam_aes.c:
##########
@@ -59,8 +59,8 @@
* Private Data
****************************************************************************/
-static sem_t g_samaes_lock;
-static bool g_samaes_initdone = false;
+static mutex_t g_samaes_lock;
+static bool g_samaes_initdone = false;
Review Comment:
Done.
##########
arch/arm/src/rp2040/rp2040_dmac.c:
##########
@@ -160,7 +161,7 @@ void weak_function arm_dma_initialize(void)
/* Initialize the channel list */
- nxsem_init(&g_dmac.exclsem, 0, 1);
+ nxmutex_init(&g_dmac.lock);
nxsem_init(&g_dmac.chansem, 0, RP2040_DMA_NCHANNELS);
Review Comment:
Next patch
##########
arch/arm/src/lc823450/lc823450_sddrv_dep.c:
##########
@@ -427,7 +418,7 @@ SINT_T sddep_read(void *src, void *dst, UI_32 size, SINT_T type,
}
lc823450_dmastart(_hrdma[ch], dma_callback, &_sem_rwait[ch]);
- return _sddep_semtake(&_sem_rwait[ch]);
+ return nxsem_wait_uninterruptible(&_sem_rwait[ch]);
Review Comment:
next patch
##########
arch/arm/src/lc823450/lc823450_i2s.c:
##########
@@ -686,7 +677,7 @@ static int lc823450_i2s_send(struct i2s_dev_s *dev, struct ap_buffer_s *apb,
/* Wait for Audio Buffer */
- ret = _i2s_semtake(&_sem_buf_under);
+ ret = nxsem_wait_uninterruptible(&_sem_buf_under);
Review Comment:
next patch
##########
arch/arm/src/lc823450/lc823450_adc.c:
##########
@@ -538,12 +507,12 @@ struct adc_dev_s *lc823450_adcinitialize(void)
inst->nchannels = CONFIG_LC823450_ADC_NCHANNELS;
inst->chanlist = lc823450_chanlist;
- nxsem_init(&inst->sem_excl, 0, 1);
+ nxmutex_init(&inst->lock);
#ifndef CONFIG_ADC_POLLED
nxsem_init(&inst->sem_isr, 0, 0);
Review Comment:
next patch
##########
arch/arm/src/efm32/efm32_usbhost.c:
##########
@@ -5277,10 +5259,10 @@ static inline void efm32_sw_initialize(struct efm32_usbhost_s *priv)
usbhost_devaddr_initialize(&priv->rhport);
- /* Initialize semaphores */
+ /* Initialize semaphores & mutex */
nxsem_init(&priv->pscsem, 0, 0);
Review Comment:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989721075
##########
drivers/audio/vs1053.c:
##########
@@ -1797,8 +1796,8 @@ static int vs1053_release(FAR struct audio_lowerhalf_s *lower,
static int vs1053_release(FAR struct audio_lowerhalf_s *lower)
#endif
{
- FAR struct vs1053_struct_s *dev = (struct vs1053_struct_s *) lower;
- void *value;
+ FAR struct vs1053_struct_s *dev = (struct vs1053_struct_s *)lower;
+ void *value;
Review Comment:
Done
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989755733
##########
drivers/usbhost/usbhost_max3421e.c:
##########
@@ -419,13 +414,6 @@ static void max3421e_sndblock(FAR struct max3421e_usbhost_s *priv,
# define max3421e_pktdump(m,b,n)
#endif
-/* Semaphores ***************************************************************/
-
-static int max3421e_takesem(FAR sem_t *sem);
-#define max3421e_givesem(s) nxsem_post(s);
-static int max3421e_take_exclsem(FAR struct max3421e_usbhost_s *priv);
-static void max3421e_give_exclsem(FAR struct max3421e_usbhost_s *priv);
-
/* Byte stream access helper functions **************************************/
static inline uint16_t max3421e_getle16(const uint8_t *val);
Review Comment:
Done.
##########
drivers/usbhost/usbhost_xboxcontroller.c:
##########
@@ -318,56 +312,14 @@ static uint32_t g_devinuse;
/* The following are used to managed the class creation operation */
-static sem_t g_exclsem; /* For mutually exclusive thread creation */
-static sem_t g_syncsem; /* Thread data passing interlock */
-static struct usbhost_state_s *g_priv; /* Data passed to thread */
+static mutex_t g_lock = NXMUTEX_INITIALIZER;
+static sem_t g_syncsem = NXSEM_INITIALIZER(0, PRIOINHERIT_FLAGS_DISABLE);
+static struct usbhost_state_s *g_priv;
Review Comment:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989809866
##########
fs/vfs/fs_timerfd.c:
##########
@@ -282,10 +284,10 @@ static int timerfd_blocking_io(FAR struct timerfd_priv_s *dev,
if (ret < 0)
{
/* Interrupted wait, unregister semaphore
- * TODO ensure that exclsem wait does not fail (ECANCELED)
+ * TODO ensure that lock wait does not fail (ECANCELED)
*/
- nxsem_wait_uninterruptible(&dev->exclsem);
+ nxmutex_lock(&dev->lock);
timerfd_waiter_sem_t *cur_sem = *slist;
Review Comment:
Done
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989816966
##########
fs/vfs/fs_eventfd.c:
##########
@@ -50,7 +50,7 @@ typedef struct eventfd_waiter_sem_s
struct eventfd_priv_s
{
- sem_t exclsem; /* Enforces device exclusive access */
+ mutex_t lock; /* Enforces device exclusive access */
eventfd_waiter_sem_t *rdsems; /* List of blocking readers */
eventfd_waiter_sem_t *wrsems; /* List of blocking writers */
Review Comment:
Done
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r988542938
##########
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:
Done.
--
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
[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989354340
##########
arch/arm/src/stm32l4/hardware/stm32l4_spi.h:
##########
@@ -119,7 +119,7 @@
#define SPI_CR2_TXEIE (1 << 7) /* Bit 7: Tx buffer empty interrupt enable */
#define SPI_CR2_DS_SHIFT (8) /* Bits 8-11: Data size */
#define SPI_CR2_DS_MASK (15 << SPI_CR2_DS_SHIFT)
-# define SPI_CR2_DS_VAL(bits) ( ((bits)-1) << SPI_CR2_DS_SHIFT)
+# define SPI_CR2_DS_VAL(bits) (((bits)-1) << SPI_CR2_DS_SHIFT)
Review Comment:
```suggestion
# define SPI_CR2_DS_VAL(bits) (((bits) - 1) << SPI_CR2_DS_SHIFT)
```
##########
arch/arm/src/stm32/stm32_hrtim.h:
##########
@@ -1020,9 +1020,9 @@ struct stm32_hrtim_ops_s
uint64_t (*fclk_get)(struct hrtim_dev_s *dev, uint8_t timer);
int (*soft_update)(struct hrtim_dev_s *dev, uint8_t timer);
int (*soft_reset)(struct hrtim_dev_s *dev, uint8_t timer);
- int (*freq_set)(struct hrtim_dev_s *dev, uint8_t timer,
+ int (*freq_set)(struct hrtim_dev_s *dev, uint8_t timer,
uint64_t freq);
Review Comment:
```suggestion
int (*freq_set)(struct hrtim_dev_s *dev, uint8_t timer,
uint64_t freq);
```
##########
arch/arm/src/stm32l5/hardware/stm32l5_spi.h:
##########
@@ -122,7 +122,7 @@
#define SPI_CR2_TXEIE (1 << 7) /* Bit 7: Tx buffer empty interrupt enable */
#define SPI_CR2_DS_SHIFT (8) /* Bits 8-11: Data size */
#define SPI_CR2_DS_MASK (15 << SPI_CR2_DS_SHIFT)
-# define SPI_CR2_DS_VAL(bits) ( ((bits)-1) << SPI_CR2_DS_SHIFT)
+# define SPI_CR2_DS_VAL(bits) (((bits)-1) << SPI_CR2_DS_SHIFT)
Review Comment:
```suggestion
# define SPI_CR2_DS_VAL(bits) (((bits) - 1) << SPI_CR2_DS_SHIFT)
```
##########
arch/arm/src/phy62xx/mcu.h:
##########
@@ -82,7 +82,7 @@
#define subWriteReg(addr,high,low,value) write_reg(addr, ((read_reg(addr)) & (~((((unsigned int)1<<((high)-(low)+1))-1)<<(low)))) | ((unsigned int)(value)<<(low)))
#define TIME_BASE (0x003fffff) /* 24bit count shift 2 bit as 1us/bit */
-#define TIME_DELTA(x,y) ( (x>=y) ? x-y : TIME_BASE-y+x )
+#define TIME_DELTA(x,y) ((x>=y) ? x-y : TIME_BASE-y+x)
Review Comment:
```suggestion
#define TIME_DELTA(x,y) (((x) >= (y)) ? (x) - (y) : TIME_BASE - (y) + (x))
```
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r991409168
##########
drivers/lcd/st7032.c:
##########
@@ -146,11 +147,11 @@ static inline void st7032_write_inst(FAR struct st7032_dev_s *priv,
/* Setup the ST7032 Co command */
- msg.frequency = CONFIG_ST7032_I2C_FREQ; /* I2C frequency */
- msg.addr = ST7032_I2C_ADDR; /* 7-bit address */
- msg.flags = 0; /* Write transaction, beginning with START */
- msg.buffer = (FAR uint8_t *) data; /* Transfer from this address */
- msg.length = 2; /* Send two bytes */
+ msg.frequency = CONFIG_ST7032_I2C_FREQ; /* I2C frequency */
+ msg.addr = ST7032_I2C_ADDR; /* 7-bit address */
+ msg.flags = 0; /* Write transaction, beginning with START */
+ msg.buffer =data; /* Transfer from this address */
Review Comment:
Done
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r991409864
##########
drivers/lcd/st7032.c:
##########
@@ -67,7 +68,7 @@ struct st7032_dev_s
uint8_t col; /* Current col position to write on display */
uint8_t buffer[ST7032_MAX_ROW * ST7032_MAX_COL];
bool pendscroll;
- sem_t sem_excl;
+ mutex_t lock;
Review Comment:
Done
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#issuecomment-1274841464
> > @masayuki2009 it's hard to split the style change from the patch now. could you have method to retrieve the old revision from github?
>
> I think you can always retrieve the old revision from the latest master.
>
I mean the intermediate change in this PR, not the latest master. This patch contain 20000~ change, 10000~ change is about sem_t/mutex_t. It's very hard(or impossible) to separate sem_t/mutext_t change from the style one.
> Actually, there are many changes that do not relate to 'nxmutex replace nexsem' For example, besides the style changes, I can also see the changes such as (`kmm_malloc` to `kmm_zalloc`,
This is part of nxmutex_t change since @pkarashchenko suggest we initialize all global mutex_t field through NXMUTEX_INITIALIZER, which mean we need ensure no place zero out the global variables again, otherwise the static initialization will be lost. How to ensure this doesn't happen? The safest approach I can come up is to reduce memset as much as possible, so I can check the rest memset more quickly and less error. That's why I change kmm_malloc+memset to kmm_zalloc.
> `i2c_givesem` to `nxsem_post`, etc).
It's also part of sem_t and nxmutex_t replacement to avoid people consider the code use sem_t as lock(i2c_givesem/i2c_takesem) and remove the unneeded/simple one line wrapper. After the change, the rule is simple:
1. sem_t is always used as signal or resource couting(call nxsem_wait/nxsem_post, never takesem/givesem)
2. mutex_t is always used as lock(call nxmutex_lock/nxmutex_unlock)
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r988537115
##########
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:
Done.
##########
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:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r988537392
##########
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:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989703849
##########
libs/libc/audio/lib_buffer.c:
##########
@@ -85,9 +55,9 @@ static void apb_semtake(FAR struct ap_buffer_s *apb)
int apb_alloc(FAR struct audio_buf_desc_s *bufdesc)
{
- uint32_t bufsize;
- int ret;
- struct ap_buffer_s *apb;
+ uint32_t bufsize;
+ int ret;
+ struct ap_buffer_s *apb;
Review Comment:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989798391
##########
fs/smartfs/smartfs_procfs.c:
##########
@@ -90,7 +90,7 @@ struct smartfs_file_s
struct smartfs_procfs_entry_s
{
- const char *name; /* Name of the directory entry */
+ const char *name; /* Name of the directory entry */
Review Comment:
Done
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989876206
##########
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 = (int16_t *)fs->lu_work;
Review Comment:
Done
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#issuecomment-1274753705
@masayuki2009 it's hard to split the style change from the patch now. could you method to retrieve the old patch from github?
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r990810046
##########
drivers/audio/vs1053.c:
##########
@@ -1439,12 +1439,12 @@ static int vs1053_start(FAR struct audio_lowerhalf_s *lower,
static int vs1053_start(FAR struct audio_lowerhalf_s *lower)
#endif
{
- FAR struct vs1053_struct_s *dev = (struct vs1053_struct_s *) lower;
- struct mq_attr attr;
- struct sched_param sparam;
- pthread_attr_t tattr;
- int ret;
- void *value;
+ FAR struct vs1053_struct_s *dev = (FAR struct vs1053_struct_s *)lower;
+ struct mq_attr attr;
+ struct sched_param sparam;
+ pthread_attr_t tattr;
+ int ret;
+ void *value;
Review Comment:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r990809678
##########
drivers/mtd/smart.c:
##########
@@ -4406,12 +4406,12 @@ static int smart_write_alloc_sector(FAR struct smart_struct_s *dev,
memset(dev->rwbuffer, CONFIG_SMARTFS_ERASEDSTATE, dev->sectorsize);
header = (FAR struct smart_sect_header_s *) dev->rwbuffer;
Review Comment:
Done.
--
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
[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r996410754
##########
drivers/sensors/qencoder.c:
##########
@@ -409,7 +409,7 @@ int qe_register(FAR const char *devpath, FAR struct qe_lowerhalf_s *lower)
* (it was already zeroed by kmm_zalloc())
*/
- nxsem_init(&upper->exclsem, 0, 1);
+ nxmutex_init(&upper->lock);
Review Comment:
ditto. additionally need to add `kmm_free` if `register_driver` fails
##########
drivers/sensors/mlx90393.c:
##########
@@ -587,7 +586,7 @@ int mlx90393_register(FAR const char *devpath, FAR struct spi_dev_s *spi,
{
snerr("ERROR: Failed to register driver: %d\n", ret);
kmm_free(priv);
- nxsem_destroy(&priv->datasem);
+ nxmutex_destroy(&priv->datalock);
Review Comment:
```suggestion
```
##########
drivers/sensors/bmg160.c:
##########
@@ -552,7 +552,7 @@ int bmg160_register(FAR const char *devpath, FAR struct spi_dev_s *spi,
{
snerr("ERROR: Failed to register driver: %d\n", ret);
kmm_free(priv);
- nxsem_destroy(&priv->datasem);
+ nxmutex_destroy(&priv->datalock);
Review Comment:
ditto. either move before `kmm_free(priv);` or remove
##########
drivers/sensors/aht10.c:
##########
@@ -651,7 +600,7 @@ int aht10_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
priv->i2c = i2c;
priv->addr = addr;
- nxsem_init(&priv->devsem, 0, 1);
+ nxmutex_init(&priv->devlock);
Review Comment:
ditto
##########
drivers/sensors/bmg160.c:
##########
@@ -527,9 +527,9 @@ int bmg160_register(FAR const char *devpath, FAR struct spi_dev_s *spi,
priv->config = config;
priv->work.worker = NULL;
- /* Initialize sensor data access semaphore */
+ /* Initialize sensor data access mutex */
- nxsem_init(&priv->datasem, 0, 1);
+ nxmutex_init(&priv->datalock);
Review Comment:
ditto. after `priv->config->attach`
##########
drivers/sensors/lis3dsh.c:
##########
@@ -555,7 +553,7 @@ int lis3dsh_register(FAR const char *devpath, FAR struct spi_dev_s *spi,
{
snerr("ERROR: Failed to register driver: %d\n", ret);
kmm_free(priv);
- nxsem_destroy(&priv->datasem);
+ nxmutex_destroy(&priv->datalock);
Review Comment:
ditto. either move this call before `kmm_free` or remove.
Additionally add same code in case if `priv->config->attach` fails and unregister driver
##########
drivers/sensors/lis3dh.c:
##########
@@ -1024,7 +985,7 @@ int lis3dh_register(FAR const char *devpath, FAR struct spi_dev_s *spi,
{
snerr("ERROR: Failed to register driver: %d\n", ret);
kmm_free(priv);
- nxsem_destroy(&priv->queuesem);
+ nxmutex_destroy(&priv->queuelock);
nxsem_destroy(&priv->readsem);
Review Comment:
ditto. either move two calls before `kmm_free` or remove
##########
drivers/sensors/lsm330_spi.c:
##########
@@ -1409,7 +1405,7 @@ int lsm330_register(FAR const char *devpath_acl,
priv->flink = g_lsm330g_list;
g_lsm330g_list = priv;
- config_gyro->leaf_handle = (void *) priv;
+ config_gyro->leaf_handle = (void *)priv;
Review Comment:
style change. seems that should be removed from this PR
##########
drivers/sensors/lsm330_spi.c:
##########
@@ -1397,7 +1393,7 @@ int lsm330_register(FAR const char *devpath_acl,
{
snerr("ERROR: Failed to register gyroscope driver: %d\n", ret);
- nxsem_destroy(&priv->datasem);
+ nxmutex_destroy(&priv->devicelock);
kmm_free(priv);
Review Comment:
```suggestion
```
fix double free
##########
drivers/sensors/adxl345_base.c:
##########
@@ -373,7 +373,7 @@ ADXL345_HANDLE adxl345_instantiate(FAR struct i2c_master_s *dev,
/* Initialize the device state structure */
- nxsem_init(&priv->exclsem, 0, 1);
+ nxmutex_init(&priv->lock);
Review Comment:
We need to refine all cases in `drivers/sensors/xxx.c` and either to call `nxmutex_destroy` before `kmm_free` or remove call of `nxmutex_destroy` and call `kmm_free` only. Calling of `nxmutex_destroy` seems to be correct from logical perspective, but do not bring any value from functional perspective
##########
drivers/sensors/hall3ph.c:
##########
@@ -349,7 +349,7 @@ int hall3_register(FAR const char *devpath,
* (it was already zeroed by kmm_zalloc())
*/
- nxsem_init(&upper->exclsem, 0, 1);
+ nxmutex_init(&upper->lock);
Review Comment:
ditto.
need to free memory if `register_driver` fails additionally
##########
drivers/sensors/scd41.c:
##########
@@ -1012,7 +1013,7 @@ int scd41_register_i2c(FAR const char *devpath, FAR struct i2c_master_s *i2c)
priv->altitude_comp = SCD41_DEFAULT_ALTITUDE_COMPENSATION;
priv->temperature_offset = SCD41_DEFAULT_TEMPERATURE_OFFSET;
- nxsem_init(&priv->devsem, 0, 1);
+ nxmutex_init(&priv->devlock);
Review Comment:
ditto
##########
drivers/sensors/hdc1008.c:
##########
@@ -961,15 +959,15 @@ int hdc1008_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
priv->i2c = i2c;
priv->addr = addr;
- nxsem_init(&priv->devsem, 0, 1);
+ nxmutex_init(&priv->devlock);
/* Register the driver */
ret = register_driver(devpath, &g_hdc1008fops, 0666, priv);
if (ret < 0)
{
snerr("ERROR: Failed to register driver: %d\n", ret);
- nxsem_destroy(&priv->devsem);
+ nxmutex_destroy(&priv->devlock);
Review Comment:
ditto
##########
drivers/sensors/t67xx.c:
##########
@@ -721,7 +721,7 @@ int t67xx_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
priv->i2c = i2c;
priv->addr = addr;
- nxsem_init(&priv->devsem, 0, 1);
+ nxmutex_init(&priv->devlock);
Review Comment:
ditto
##########
drivers/sensors/dhtxx.c:
##########
@@ -561,6 +561,8 @@ int dhtxx_register(FAR const char *devpath,
priv->config = config;
+ nxmutex_init(&priv->devlock);
Review Comment:
ditto
##########
drivers/sensors/adxl372.c:
##########
@@ -872,7 +869,7 @@ int adxl372_register(FAR const char *devpath,
{
snerr("ERROR: Failed to register accelerometer driver: %d\n", ret);
- nxsem_destroy(&priv->datasem);
+ nxmutex_destroy(&priv->devicelock);
Review Comment:
ditto
##########
drivers/sensors/hdc1008.c:
##########
@@ -999,7 +997,7 @@ int hdc1008_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
if (ret < 0)
{
snerr("ERROR: failed to set default configuration: %d\n", ret);
- nxsem_destroy(&priv->devsem);
+ nxmutex_destroy(&priv->devlock);
Review Comment:
ditto
##########
drivers/sensors/hc_sr04.c:
##########
@@ -415,7 +416,7 @@ int hcsr04_register(FAR const char *devpath,
}
priv->config = config;
- nxsem_init(&priv->devsem, 0, 1);
+ nxmutex_init(&priv->devlock);
Review Comment:
ditto
##########
drivers/spi/spi_driver.c:
##########
@@ -366,7 +366,7 @@ int spi_register(FAR struct spi_dev_s *spi, int bus)
priv->spi = spi;
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
- nxsem_init(&priv->exclsem, 0, 1);
+ nxmutex_init(&priv->lock);
Review Comment:
ditto
##########
drivers/sensors/zerocross.c:
##########
@@ -501,15 +501,15 @@ int zc_register(FAR const char *devname, FAR struct zc_lowerhalf_s *lower)
/* Initialize the new zero cross driver instance */
priv->lower = lower;
- nxsem_init(&priv->exclsem, 0, 1);
+ nxmutex_init(&priv->lock);
/* And register the zero cross driver */
ret = register_driver(devname, &g_zcops, 0666, priv);
if (ret < 0)
{
snerr("ERROR: register_driver failed: %d\n", ret);
- nxsem_destroy(&priv->exclsem);
+ nxmutex_destroy(&priv->lock);
Review Comment:
ditto
##########
drivers/serial/ptmx.c:
##########
@@ -276,7 +277,7 @@ int ptmx_register(void)
{
/* Initialize driver state */
- nxsem_init(&g_ptmx.px_exclsem, 0, 1);
+ nxmutex_init(&g_ptmx.px_lock);
Review Comment:
ditto. either keep like it is or add `nxmutex_destroy` if `register_driver` fails
##########
drivers/sensors/hdc1008.c:
##########
@@ -987,7 +985,7 @@ int hdc1008_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
if (ret < 0)
{
snerr("ERROR: failed to read default configuration\n");
- nxsem_destroy(&priv->devsem);
+ nxmutex_destroy(&priv->devlock);
Review Comment:
ditto
##########
drivers/timers/oneshot.c:
##########
@@ -316,15 +316,15 @@ int oneshot_register(FAR const char *devname,
/* Initialize the new oneshot timer driver instance */
priv->od_lower = lower;
- nxsem_init(&priv->od_exclsem, 0, 1);
+ nxmutex_init(&priv->od_lock);
/* And register the oneshot timer driver */
ret = register_driver(devname, &g_oneshot_ops, 0666, priv);
if (ret < 0)
{
tmrerr("ERROR: register_driver failed: %d\n", ret);
- nxsem_destroy(&priv->od_exclsem);
+ nxmutex_destroy(&priv->od_lock);
Review Comment:
ditto
##########
drivers/sensors/hyt271.c:
##########
@@ -973,7 +973,7 @@ int hyt271_register(int devno, FAR struct i2c_master_s *i2c, uint8_t addr,
temp_err:
sensor_unregister(&priv->sensor[HYT271_SENSOR_TEMP].lower, devno);
- nxsem_destroy(&priv->lock_measure_cycle);
+ nxmutex_destroy(&priv->lock_measure_cycle);
Review Comment:
ditto
##########
drivers/timers/pwm.c:
##########
@@ -602,7 +603,7 @@ int pwm_register(FAR const char *path, FAR struct pwm_lowerhalf_s *dev)
* kmm_zalloc()).
*/
- nxsem_init(&upper->exclsem, 0, 1);
+ nxmutex_init(&upper->lock);
Review Comment:
ditto. either keep like it is or add error handling if `register_driver` fails
##########
drivers/timers/rpmsg_rtc.c:
##########
@@ -802,12 +802,12 @@ FAR struct rtc_lowerhalf_s *rpmsg_rtc_server_initialize(
server->ops = &g_rpmsg_rtc_server_ops;
server->lower = lower;
list_initialize(&server->list);
- nxsem_init(&server->exclsem, 0, 1);
+ nxmutex_init(&server->lock);
if (rpmsg_register_callback(server, NULL, NULL,
rpmsg_rtc_server_ns_match,
rpmsg_rtc_server_ns_bind) < 0)
{
- nxsem_destroy(&server->exclsem);
+ nxmutex_destroy(&server->lock);
Review Comment:
ditto
##########
drivers/usbdev/adb.c:
##########
@@ -1462,7 +1463,7 @@ static int usbclass_classobject(int minor,
/* Initialize the char device structure */
- nxsem_init(&alloc->dev.exclsem, 0, 1);
+ nxmutex_init(&alloc->dev.lock);
Review Comment:
ditto
##########
drivers/sensors/hts221.c:
##########
@@ -1168,7 +1169,7 @@ int hts221_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
priv->addr = addr;
priv->i2c = i2c;
priv->config = config;
- nxsem_init(&priv->devsem, 0, 1);
+ nxmutex_init(&priv->devlock);
Review Comment:
ditto
##########
drivers/timers/capture.c:
##########
@@ -365,7 +365,7 @@ int cap_register(FAR const char *devpath, FAR struct cap_lowerhalf_s *lower)
* (it was already zeroed by kmm_zalloc())
*/
- nxsem_init(&upper->exclsem, 0, 1);
+ nxmutex_init(&upper->lock);
Review Comment:
ditto
##########
drivers/sensors/lis2dh.c:
##########
@@ -2046,7 +2047,7 @@ int lis2dh_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
return OK;
errout_with_priv:
- nxsem_destroy(&priv->devsem);
+ nxmutex_destroy(&priv->devlock);
Review Comment:
ditto
##########
drivers/sensors/lis3mdl.c:
##########
@@ -610,7 +608,7 @@ int lis3mdl_register(FAR const char *devpath, FAR struct spi_dev_s *spi,
{
snerr("ERROR: Failed to register driver: %d\n", ret);
kmm_free(priv);
- nxsem_destroy(&priv->datasem);
+ nxmutex_destroy(&priv->datalock);
Review Comment:
ditto. either move this call before `kmm_free` or remove.
additionally add error handling in case if `priv->config->attach` fails
##########
drivers/sensors/kxtj9.c:
##########
@@ -628,7 +628,7 @@ int kxtj9_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
priv->i2c = i2c;
priv->address = address;
- nxsem_init(&priv->exclsem, 0, 1);
+ nxmutex_init(&priv->lock);
Review Comment:
ditto
##########
drivers/syslog/ramlog.c:
##########
@@ -786,7 +787,7 @@ int ramlog_register(FAR const char *devpath, FAR char *buffer, size_t buflen)
{
/* Initialize the non-zero values in the RAM logging device structure */
- nxsem_init(&priv->rl_exclsem, 0, 1);
+ nxmutex_init(&priv->rl_lock);
Review Comment:
ditto
##########
drivers/usbhost/usbhost_hidkbd.c:
##########
@@ -2551,7 +2504,7 @@ int usbhost_kbdinit(void)
{
/* Perform any one-time initialization of the class implementation */
- nxsem_init(&g_exclsem, 0, 1);
+ nxmutex_init(&g_lock);
Review Comment:
ditto. error handling if `usbhost_registerclass` fails
##########
drivers/sensors/lps25h.c:
##########
@@ -749,7 +750,7 @@ int lps25h_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
return -ENOMEM;
}
- nxsem_init(&dev->devsem, 0, 1);
+ nxmutex_init(&dev->devlock);
Review Comment:
ditto
##########
drivers/sensors/lsm330_spi.c:
##########
@@ -1425,7 +1421,7 @@ int lsm330_register(FAR const char *devpath_acl,
* accelerometer instance.
*/
- nxsem_destroy(&priva->datasem);
+ nxmutex_destroy(&priva->devicelock);
Review Comment:
ditto
##########
drivers/sensors/lsm330_spi.c:
##########
@@ -1370,7 +1367,7 @@ int lsm330_register(FAR const char *devpath_acl,
priv->flink = g_lsm330a_list;
g_lsm330a_list = priv;
priva = priv;
- config_acl->leaf_handle = (void *) priv;
+ config_acl->leaf_handle = (void *)priv;
Review Comment:
style change. seems that should be removed from this PR
##########
drivers/usbmisc/fusb301.c:
##########
@@ -805,7 +806,7 @@ int fusb301_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
return OK;
errout_with_priv:
- nxsem_destroy(&priv->devsem);
+ nxmutex_destroy(&priv->devlock);
Review Comment:
ditto
##########
drivers/sensors/scd30.c:
##########
@@ -1059,7 +1060,7 @@ int scd30_register_i2c(FAR const char *devpath, FAR struct i2c_master_s *i2c,
priv->altitude_comp = SCD30_DEFAULT_ALTITUDE_COMPENSATION;
priv->temperature_offset = SCD30_DEFAULT_TEMPERATURE_OFFSET;
- nxsem_init(&priv->devsem, 0, 1);
+ nxmutex_init(&priv->devlock);
Review Comment:
ditto
##########
drivers/sensors/max44009.c:
##########
@@ -889,7 +890,7 @@ int max44009_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
priv->addr = addr;
priv->i2c = i2c;
priv->config = config;
- nxsem_init(&priv->dev_sem, 0, 1);
+ nxmutex_init(&priv->dev_lock);
Review Comment:
ditto
##########
drivers/sensors/sgp30.c:
##########
@@ -1060,7 +1061,7 @@ int sgp30_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
priv->i2c = i2c;
priv->addr = addr;
- nxsem_init(&priv->devsem, 0, 1);
+ nxmutex_init(&priv->devlock);
Review Comment:
ditto
##########
drivers/sensors/sht3x.c:
##########
@@ -678,7 +679,7 @@ int sht3x_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
priv->i2c = i2c;
priv->addr = addr;
- nxsem_init(&priv->devsem, 0, 1);
+ nxmutex_init(&priv->devlock);
Review Comment:
ditto
##########
drivers/sensors/sht21.c:
##########
@@ -661,7 +662,7 @@ int sht21_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
priv->i2c = i2c;
priv->addr = addr;
- nxsem_init(&priv->devsem, 0, 1);
+ nxmutex_init(&priv->devlock);
Review Comment:
ditto
##########
drivers/video/video.c:
##########
@@ -3094,9 +3067,9 @@ static FAR void *video_register(FAR const char *devpath)
memcpy(priv->devpath, devpath, allocsize);
priv->devpath[allocsize] = '\0';
- /* Initialize semaphore */
+ /* Initialize mutex */
- nxsem_init(&priv->lock_open_num, 0, 1);
+ nxmutex_init(&priv->lock_open_num);
Review Comment:
ditto
##########
drivers/serial/serial.c:
##########
@@ -1683,14 +1659,14 @@ int uart_register(FAR const char *path, FAR uart_dev_t *dev)
}
#endif
- /* Initialize semaphores */
+ /* Initialize mutex & semaphores */
- nxsem_init(&dev->xmit.sem, 0, 1);
- nxsem_init(&dev->recv.sem, 0, 1);
- nxsem_init(&dev->closesem, 0, 1);
+ nxmutex_init(&dev->xmit.lock);
+ nxmutex_init(&dev->recv.lock);
+ nxmutex_init(&dev->closelock);
nxsem_init(&dev->xmitsem, 0, 0);
nxsem_init(&dev->recvsem, 0, 0);
- nxsem_init(&dev->pollsem, 0, 1);
+ nxmutex_init(&dev->polllock);
Review Comment:
ditto. either keep like it is or call `nxmutex_destroy` + `nxsem_destroy` if `register_driver` fails
##########
drivers/wireless/gs2200m.c:
##########
@@ -3522,7 +3504,7 @@ FAR void *gs2200m_register(FAR const char *devpath,
dev->path = strdup(devpath);
dev->lower = lower;
- nxsem_init(&dev->dev_sem, 0, 1);
+ nxmutex_init(&dev->dev_lock);
Review Comment:
ditto
##########
drivers/sensors/usensor.c:
##########
@@ -232,19 +232,19 @@ int usensor_initialize(void)
return -ENOMEM;
}
- nxsem_init(&usensor->exclsem, 0, 1);
+ nxmutex_init(&usensor->lock);
list_initialize(&usensor->list);
ret = register_driver(USENSOR_PATH, &g_usensor_fops, 0666, usensor);
if (ret < 0)
{
- goto errout_with_sem;
+ goto errout_with_lock;
}
return ret;
-errout_with_sem:
- nxsem_destroy(&usensor->exclsem);
+errout_with_lock:
+ nxmutex_destroy(&usensor->lock);
Review Comment:
ditto
##########
drivers/wireless/lpwan/sx127x/sx127x.c:
##########
@@ -4589,15 +4589,15 @@ int sx127x_register(FAR struct spi_dev_s *spi,
dev->pfd = NULL;
- /* Initialize sem */
+ /* Initialize mutex & sem */
- nxsem_init(&dev->dev_sem, 0, 1);
+ nxmutex_init(&dev->dev_lock);
Review Comment:
ditto. add vs not add `nxmutex_destroy` and `nxsem_destroy` if `register_driver` fails
##########
drivers/sensors/sps30.c:
##########
@@ -1073,7 +1074,7 @@ int sps30_register_i2c(FAR const char *devpath, FAR struct i2c_master_s *i2c,
priv->addr = addr;
priv->started = false;
- nxsem_init(&priv->devsem, 0, 1);
+ nxmutex_init(&priv->devlock);
Review Comment:
ditto
##########
drivers/spi/spi_slave_driver.c:
##########
@@ -604,7 +605,7 @@ int spi_slave_register(FAR struct spi_slave_ctrlr_s *ctrlr, int bus)
#endif
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
- nxsem_init(&priv->exclsem, 0, 1);
+ nxmutex_init(&priv->lock);
Review Comment:
ditto
##########
drivers/timers/rtc.c:
##########
@@ -853,7 +853,7 @@ int rtc_initialize(int minor, FAR struct rtc_lowerhalf_s *lower)
ret = register_driver(devpath, &rtc_fops, 0666, upper);
if (ret < 0)
{
- nxsem_destroy(&upper->exclsem);
+ nxmutex_destroy(&upper->lock);
Review Comment:
ditto
##########
drivers/wireless/ieee80211/bcm43xxx/bcmf_gspi.c:
##########
@@ -856,7 +856,7 @@ static int bcmf_bus_gspi_initialize(FAR struct bcmf_dev_s *priv,
/* Init transmit frames queue */
- if ((ret = nxsem_init(&gbus->queue_mutex, 0, 1)) != OK)
+ if ((ret = nxmutex_init(&gbus->queue_lock)) != OK)
Review Comment:
ditto
##########
drivers/wireless/ieee80211/bcm43xxx/bcmf_sdio.c:
##########
@@ -674,7 +674,7 @@ static int bcmf_bus_sdio_initialize(FAR struct bcmf_dev_s *priv,
/* Init transmit frames queue */
- if ((ret = nxsem_init(&sbus->queue_mutex, 0, 1)) != OK)
+ if ((ret = nxmutex_init(&sbus->queue_lock)) != OK)
Review Comment:
ditto
##########
drivers/video/vnc/vnc_updater.c:
##########
@@ -48,6 +48,9 @@
#include <debug.h>
#include <nuttx/queue.h>
+#ifdef VNCSERVER_SEM_DEBUG
+#include <nuttx/mutex.h>
Review Comment:
```suggestion
# include <nuttx/mutex.h>
```
##########
drivers/wireless/nrf24l01.c:
##########
@@ -1489,7 +1490,7 @@ int nrf24l01_register(FAR struct spi_dev_s *spi,
dev->rx_fifo = rx_fifo;
- nxsem_init(&(dev->sem_fifo), 0, 1);
+ nxmutex_init(&dev->lock_fifo);
Review Comment:
ditto
##########
fs/nfs/nfs_vfsops.c:
##########
@@ -2035,13 +2014,13 @@ static int nfs_bind(FAR struct inode *blkdriver, FAR const void *data,
/* Initialize the allocated mountpt state structure. */
- /* Initialize the semaphore that controls access. The initial count
- * is zero, but nfs_semgive() is called at the completion of
+ /* Initialize the mutex that controls access.
+ * nxmutex_lock() is called at the completion of
* initialization, incrementing the count to one.
*/
- nxsem_init(&nmp->nm_sem, 0, 0); /* Initialize the semaphore that
- * controls access */
+ nxmutex_init(&nmp->nm_lock); /* Initialize the mutex that
Review Comment:
ditto. do we need to `nxmutex_destroy(&nmp->nm_lock);` if `rpc = (FAR struct rpcclnt *)kmm_zalloc(sizeof(struct rpcclnt));` fails
##########
wireless/pktradio/pktradio_metadata.c:
##########
@@ -49,7 +49,7 @@ static FAR struct pktradio_metadata_s *g_free_metadata;
/* Supports mutually exclusive access to the free list */
-static sem_t g_metadata_sem;
+static mutex_t g_metadata_lock;
Review Comment:
```suggestion
static mutex_t g_metadata_lock = NXMUTEX_INITIALIZER;
```
##########
fs/rpmsgfs/rpmsgfs_server.c:
##########
@@ -849,14 +850,14 @@ static void rpmsgfs_ns_bind(FAR struct rpmsg_device *rdev,
}
priv->ept.priv = priv;
- nxsem_init(&priv->sem, 0, 1);
+ nxmutex_init(&priv->lock);
ret = rpmsg_create_ept(&priv->ept, rdev, name,
RPMSG_ADDR_ANY, dest,
rpmsgfs_ept_cb, rpmsgfs_ns_unbind);
if (ret)
{
- nxsem_destroy(&priv->sem);
+ nxmutex_destroy(&priv->lock);
Review Comment:
ditto
##########
drivers/wireless/spirit/drivers/spirit_netdev.c:
##########
@@ -2744,8 +2635,8 @@ int spirit_netdev_initialize(FAR struct spi_dev_s *spi,
/* Attach the interface, lower driver, and devops */
priv->lower = lower;
- nxsem_init(&priv->rxsem, 0, 1); /* Access to RX packet queue */
- nxsem_init(&priv->txsem, 0, 1); /* Access to TX packet queue */
+ nxmutex_init(&priv->rxlock); /* Access to RX packet queue */
+ nxmutex_init(&priv->txlock); /* Access to TX packet queue */
Review Comment:
ditto. add vs not add `nxmutex_destroy` at `errout_with_alloc`
##########
wireless/ieee802154/mac802154_netdev.c:
##########
@@ -1266,9 +1267,9 @@ int mac802154netdev_register(MACHANDLE mac)
dev->d_private = priv; /* Used to recover private state from dev */
priv->md_mac = mac; /* Save the MAC interface instance */
- /* Setup a locking semaphore for exclusive device driver access */
+ /* Setup a locking mutex for exclusive device driver access */
- nxsem_init(&priv->md_exclsem, 0, 1);
+ nxmutex_init(&priv->md_lock);
Review Comment:
ditto. `nxmutex_destroy` call at `errout`
##########
drivers/wireless/cc1101.c:
##########
@@ -1489,8 +1478,8 @@ int cc1101_register(FAR const char *path, FAR struct cc1101_dev_s *dev)
dev->nxt_read = 0;
dev->nxt_write = 0;
dev->fifo_len = 0;
- nxsem_init(&(dev->devsem), 0, 1);
- nxsem_init(&(dev->sem_rx_buffer), 0, 1);
+ nxmutex_init(&dev->devlock);
+ nxmutex_init(&dev->lock_rx_buffer);
nxsem_init(&(dev->sem_rx), 0, 0);
nxsem_init(&(dev->sem_tx), 0, 0);
Review Comment:
ditto. also probably need to add `kmm_free` if `register_driver` fails
##########
fs/nxffs/nxffs_initialize.c:
##########
@@ -171,7 +171,7 @@ int nxffs_initialize(FAR struct mtd_dev_s *mtd)
volume->mtd = mtd;
volume->cblock = (off_t)-1;
- nxsem_init(&volume->exclsem, 0, 1);
+ nxmutex_init(&volume->lock);
Review Comment:
ditto
##########
libs/libc/wqueue/work_usrthread.c:
##########
@@ -281,7 +280,7 @@ int work_usrstart(void)
/* Set up the work queue lock */
- _SEM_INIT(&g_usrwork.lock, 0, 1);
+ nxmutex_init(&g_usrwork.lock);
Review Comment:
ditto. do we need to call `nxmutex_destroy` + `_SEM_DESTROY` if `task_create` fails
##########
wireless/bluetooth/bt_ioctl.c:
##########
@@ -628,7 +629,7 @@ int btnet_ioctl(FAR struct net_driver_s *netdev, int cmd, unsigned long arg)
if (ret < 0)
{
- nxsem_destroy(&g_scanstate.bs_exclsem);
+ nxmutex_destroy(&g_scanstate.bs_lock);
Review Comment:
ditto
##########
wireless/ieee802154/mac802154_device.c:
##########
@@ -904,7 +886,7 @@ int mac802154dev_register(MACHANDLE mac, int minor)
return OK;
errout_with_priv:
- nxsem_destroy(&dev->md_exclsem);
+ nxmutex_destroy(&dev->md_lock);
Review Comment:
ditto
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r990783829
##########
drivers/wireless/ieee80211/bcm43xxx/bcmf_sdpcm.c:
##########
@@ -508,10 +508,10 @@ void bcmf_sdpcm_free_frame(FAR struct bcmf_dev_s *priv,
struct bcmf_frame_s *bcmf_sdpcm_get_rx_frame(FAR struct bcmf_dev_s *priv)
Review Comment:
Done
##########
drivers/wireless/ieee80211/bcm43xxx/bcmf_sdpcm.c:
##########
@@ -425,9 +425,9 @@ int bcmf_sdpcm_queue_frame(FAR struct bcmf_dev_s *priv,
struct bcmf_frame_s *frame, bool control)
Review Comment:
Done
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r990782521
##########
fs/fat/fs_fat32.h:
##########
@@ -864,7 +864,7 @@ struct fat_mountpt_s
struct inode *fs_blkdriver; /* The block driver inode that hosts the FAT32 fs */
struct fat_file_s *fs_head; /* A list to all files opened on this mountpoint */
Review Comment:
Done
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r990789112
##########
drivers/usbhost/usbhost_xboxcontroller.c:
##########
@@ -160,7 +160,7 @@ struct usbhost_state_s
uint8_t nwaiters; /* Number of threads waiting for controller data */
sem_t waitsem; /* Used to wait for controller data */
int16_t crefs; /* Reference count on the driver instance */
- sem_t exclsem; /* Used to maintain mutual exclusive access */
+ mutex_t lock; /* Used to maintain mutual exclusive access */
struct work_s work; /* For interacting with the worker thread */
FAR uint8_t *tbuffer; /* The allocated transfer buffer */
FAR uint8_t obuffer[20]; /* The fixed output transfer buffer */
Review Comment:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989341990
##########
drivers/mtd/smart.c:
##########
@@ -4150,7 +4150,7 @@ static int smart_write_wearstatus(struct smart_struct_s *dev)
if (dev->uneven_wearcount != 0)
{
- *((uint32_t *) &buffer[4]) = dev->uneven_wearcount;
+ *((uint32_t *)&buffer[4]) = dev->uneven_wearcount;
Review Comment:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r990788884
##########
drivers/video/video.c:
##########
@@ -3122,8 +3094,7 @@ static int video_unregister(FAR video_mng_t *v_mgr)
}
else
{
- nxsem_destroy(&v_mgr->lock_open_num);
-
+ nxmutex_destroy(&v_mgr->lock_open_num);
unregister_driver((const char *)v_mgr->devpath);
Review Comment:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r990809813
##########
drivers/audio/wm8776.c:
##########
@@ -1032,11 +976,11 @@ static int wm8776_reserve(FAR struct audio_lowerhalf_s *dev)
#endif
{
FAR struct wm8776_dev_s *priv = (FAR struct wm8776_dev_s *) dev;
Review Comment:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989704567
##########
include/nuttx/wireless/ieee80211/bcmf_gspi.h:
##########
@@ -60,32 +61,32 @@ typedef struct gspi_dev_s
* following fields before calling gspi_register.
*/
- FAR int (*init) (FAR struct gspi_dev_s *gspi);
+ FAR int (*init) (FAR struct gspi_dev_s *gspi);
Review Comment:
Done.
--
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
[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r988977542
##########
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;
+ volatile uint32_t *portsetreset = (uint32_t *)STM32_GPIOE_BSRR;
Review Comment:
good finding.
##########
arch/risc-v/src/esp32c3/esp32c3_tim.c:
##########
@@ -82,7 +82,7 @@ static void esp32c3_tim_setalarm(struct esp32c3_tim_dev_s *dev,
static void esp32c3_tim_setautoreload(struct esp32c3_tim_dev_s *dev,
bool enable);
static int esp32c3_tim_setisr(struct esp32c3_tim_dev_s *dev,
- xcpt_t handler, void * arg);
+ xcpt_t handler, void *arg);
Review Comment:
```suggestion
xcpt_t handler, void *arg);
```
##########
drivers/mtd/smart.c:
##########
@@ -120,7 +120,7 @@
#endif
#ifndef offsetof
-#define offsetof(type, member) ( (size_t) &( ( (type *) 0)->member))
+#define offsetof(type, member) ( (size_t) &( ( (type *)0)->member))
Review Comment:
```suggestion
# define offsetof(type, member) ((size_t)&(((type *)0)->member))
```
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989706793
##########
drivers/audio/vs1053.c:
##########
@@ -956,12 +956,12 @@ static int vs1053_shutdown(FAR struct audio_lowerhalf_s *lower)
static void vs1053_feeddata(FAR struct vs1053_struct_s *dev)
{
- int bytecount;
- int ret;
- uint8_t *samp = NULL;
- uint16_t reg;
- struct ap_buffer_s *apb;
- FAR struct spi_dev_s *spi = dev->spi;
+ int bytecount;
+ int ret;
+ uint8_t *samp = NULL;
+ uint16_t reg;
+ struct ap_buffer_s *apb;
Review Comment:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989720289
##########
drivers/audio/vs1053.c:
##########
@@ -1751,12 +1751,12 @@ static int vs1053_reserve(FAR struct audio_lowerhalf_s *lower,
static int vs1053_reserve(FAR struct audio_lowerhalf_s *lower)
#endif
{
- FAR struct vs1053_struct_s *dev = (struct vs1053_struct_s *) lower;
+ FAR struct vs1053_struct_s *dev = (struct vs1053_struct_s *)lower;
int ret;
Review Comment:
Done
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989883011
##########
fs/smartfs/smartfs_smart.c:
##########
@@ -1977,21 +1962,21 @@ int smartfs_rename(struct inode *mountpt, const char *oldrelpath,
NULL);
if (ret != OK)
{
- goto errout_with_semaphore;
+ goto errout_with_lock;
}
/* Now mark the old entry as inactive */
readwrite.logsector = oldentry.dsector;
readwrite.offset = 0;
readwrite.count = fs->fs_llformat.availbytes;
- readwrite.buffer = (uint8_t *) fs->fs_rwbuffer;
+ readwrite.buffer = (uint8_t *)fs->fs_rwbuffer;
Review Comment:
Done
##########
fs/smartfs/smartfs_smart.c:
##########
@@ -1406,22 +1406,22 @@ static int smartfs_readdir(FAR struct inode *mountpt,
sdir->fs_curroffset =
sizeof(struct smartfs_chain_header_s);
- header = (struct smartfs_chain_header_s *) fs->fs_rwbuffer;
+ header = (struct smartfs_chain_header_s *)fs->fs_rwbuffer;
sdir->fs_currsector = SMARTFS_NEXTSECTOR(header);
}
/* Now exit */
ret = OK;
- goto errout_with_semaphore;
+ goto errout_with_lock;
}
/* No more entries in this sector. Move on to next sector and
* continue the search. If no more sectors, then we are all
* done and will report ENOENT.
*/
- header = (struct smartfs_chain_header_s *) fs->fs_rwbuffer;
+ header = (struct smartfs_chain_header_s *)fs->fs_rwbuffer;
Review Comment:
Done
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r988535158
##########
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:
Done
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r988542031
##########
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:
Done.
##########
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:
Done
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r988543494
##########
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:
Done
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r988539375
##########
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:
Done.
--
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
[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r994989775
##########
arch/arm/src/lpc54xx/lpc54_dma.c:
##########
@@ -437,8 +438,8 @@ int lpc54_dma_setup(int ch, uint32_t cfg, uint32_t xfrcfg, uint8_t trigsrc,
putreg32(xfrcfg, base + LPC54_DMA_XFERCFG_OFFSET);
ret = OK;
-errout_with_exclsem:
- nxsem_post(&g_dma.exclsem);
+errout_with_excllock:
Review Comment:
```suggestion
errout_with_lock:
```
##########
arch/arm/src/cxd56xx/cxd56_udmac.c:
##########
@@ -67,8 +68,8 @@ struct dma_channel_s
struct dma_controller_s
{
- sem_t exclsem; /* Protects channel table */
- sem_t chansem; /* Count of free channels */
+ mutex_t lock; /* Protects channel table */
+ sem_t chansem; /* Count of free channels */
Review Comment:
```suggestion
mutex_t lock; /* Protects channel table */
sem_t chansem; /* Count of free channels */
```
just to align with `dma_channel_s` above
##########
arch/arm/src/sama5/sam_ssc.c:
##########
@@ -2434,7 +2387,7 @@ static int ssc_send(struct i2s_dev_s *dev, struct ap_buffer_s *apb,
{
i2serr("ERROR: SSC%d has no transmitter\n", priv->sscno);
ret = -EAGAIN;
- goto errout_with_exclsem;
+ goto errout_with_excllock;
Review Comment:
```suggestion
goto errout_with_lock;
```
##########
arch/arm/src/lpc54xx/lpc54_dma.c:
##########
@@ -307,7 +308,7 @@ int lpc54_dma_setup(int ch, uint32_t cfg, uint32_t xfrcfg, uint8_t trigsrc,
if (dmach->inuse)
{
ret = -EBUSY;
- goto errout_with_exclsem;
+ goto errout_with_excllock;
Review Comment:
```suggestion
goto errout_with_lock;
```
##########
arch/arm/src/stm32/stm32_dma2d.c:
##########
@@ -111,7 +111,7 @@ struct stm32_dma2d_s
uint32_t *clut; /* Color lookup table */
#endif
- sem_t *lock; /* Ensure mutually exclusive access */
+ mutex_t *lock; /* Ensure mutually exclusive access */
Review Comment:
```suggestion
mutex_t *lock; /* Ensure mutually exclusive access */
```
##########
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:
let's fix this again
##########
arch/arm/src/sama5/sam_ssc.c:
##########
@@ -2462,11 +2415,11 @@ static int ssc_send(struct i2s_dev_s *dev, struct ap_buffer_s *apb,
ret = ssc_txdma_setup(priv);
DEBUGASSERT(ret == OK);
leave_critical_section(flags);
- ssc_exclsem_give(priv);
+ nxmutex_unlock(&priv->lock);
return OK;
-errout_with_exclsem:
- ssc_exclsem_give(priv);
+errout_with_excllock:
Review Comment:
```suggestion
errout_with_lock:
```
##########
arch/arm/src/sama5/sam_ssc.c:
##########
@@ -2239,11 +2192,11 @@ static int ssc_receive(struct i2s_dev_s *dev, struct ap_buffer_s *apb,
ret = ssc_rxdma_setup(priv);
DEBUGASSERT(ret == OK);
leave_critical_section(flags);
- ssc_exclsem_give(priv);
+ nxmutex_unlock(&priv->lock);
return OK;
-errout_with_exclsem:
- ssc_exclsem_give(priv);
+errout_with_excllock:
Review Comment:
```suggestion
errout_with_lock:
```
##########
arch/arm/src/sama5/sam_ssc.c:
##########
@@ -2211,7 +2164,7 @@ static int ssc_receive(struct i2s_dev_s *dev, struct ap_buffer_s *apb,
{
i2serr("ERROR: SSC%d has no receiver\n", priv->sscno);
ret = -EAGAIN;
- goto errout_with_exclsem;
+ goto errout_with_excllock;
Review Comment:
```suggestion
goto errout_with_lock;
```
##########
arch/arm/src/rp2040/rp2040_dmac.c:
##########
@@ -61,8 +62,8 @@ struct dma_channel_s
struct dma_controller_s
{
- sem_t exclsem; /* Protects channel table */
- sem_t chansem; /* Count of free channels */
+ mutex_t lock; /* Protects channel table */
+ sem_t chansem; /* Count of free channels */
Review Comment:
let's align with comments in `struct dma_channel_s` above
##########
arch/arm/src/samv7/sam_ssc.c:
##########
@@ -2222,11 +2175,11 @@ static int ssc_receive(struct i2s_dev_s *dev, struct ap_buffer_s *apb,
ret = ssc_rxdma_setup(priv);
DEBUGASSERT(ret == OK);
leave_critical_section(flags);
- ssc_exclsem_give(priv);
+ nxmutex_unlock(&priv->lock);
return OK;
-errout_with_exclsem:
- ssc_exclsem_give(priv);
+errout_with_excllock:
Review Comment:
```suggestion
errout_with_lock:
```
##########
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 fix this again
##########
arch/arm/src/samd5e5/sam_usb.c:
##########
@@ -8566,10 +8531,10 @@ static inline void sam_sw_initialize(struct sam_usbhost_s *priv)
sam_reset_pipes(priv, false);
- /* Initialize semaphores */
+ /* Initialize semaphore & mutex */
Review Comment:
In some places `&` is used and in other `and`. So maybe we can use similar style in all the places?
--
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
[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r995863519
##########
drivers/mtd/mtd_config.c:
##########
@@ -1807,7 +1807,7 @@ int mtdconfig_unregister(void)
inode = file.f_inode;
dev = (FAR struct mtdconfig_struct_s *)inode->i_private;
- nxmutex_destroy(&dev->exclsem);
+ nxsem_destroy(&dev->exclsem);
Review Comment:
why here `exclsem` is not replaces with mutex?
##########
arch/arm/src/stm32h7/stm32_flash.c:
##########
@@ -817,19 +790,19 @@ ssize_t up_progmem_eraseblock(size_t block)
if (stm32h7_wait_for_last_operation(priv))
{
ret = -EIO;
- goto exit_with_lock_sem;
+ goto exit_with_unlok;
}
stm32h7_flash_modifyreg32(priv, STM32_FLASH_CR1_OFFSET, FLASH_CR_SER, 0);
stm32h7_flash_modifyreg32(priv, STM32_FLASH_CR1_OFFSET, FLASH_CR_SNB_MASK,
0);
ret = 0;
-exit_with_lock_sem:
+exit_with_unlok:
Review Comment:
```suggestion
exit_with_unlock:
```
##########
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 int g_pipeno;
```
##########
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:
Please fix again. Here and all similar places. Move after `DEBUGASSERT(dev);`
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r995870773
##########
drivers/mtd/mtd_config.c:
##########
@@ -1807,7 +1807,7 @@ int mtdconfig_unregister(void)
inode = file.f_inode;
dev = (FAR struct mtdconfig_struct_s *)inode->i_private;
- nxmutex_destroy(&dev->exclsem);
+ nxsem_destroy(&dev->exclsem);
Review Comment:
Since exclsem is used as resource count(ensure only one caller can open it at the same time):
1. Call nxsem_wait in mtdconfig_open
2. Call nxsem_post in mtdconfig_close
Only nxsem_wait/nxsem_post is called in pair can be replaced by mutex_lock/mutex_unlock.
--
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
[GitHub] [incubator-nuttx] masayuki2009 commented on pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#issuecomment-1277628210
@xiaoxiang781216
>As I said before, this patch want to distinguish sem_t usage which contain two part:
I think the two parts are independent and if the commit is split into two commits, it would be easier to read.
--
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
[GitHub] [incubator-nuttx] masayuki2009 commented on pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#issuecomment-1276097887
@xiaoxiang781216
>But, the initial version doesn't exist in my local git anymore. If I can't retrieve the initial/early version of this patch from github, it's very hard and error prone to split the stye change from this current patch. That's why I ask the question how to retrieve the old revision from github.
I think you don't have to use the initial commit to this PR.
You can check the current differences in this PR, then create a new PR based on the differences manually.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r996471511
##########
drivers/serial/serial.c:
##########
@@ -1683,14 +1659,14 @@ int uart_register(FAR const char *path, FAR uart_dev_t *dev)
}
#endif
- /* Initialize semaphores */
+ /* Initialize mutex & semaphores */
- nxsem_init(&dev->xmit.sem, 0, 1);
- nxsem_init(&dev->recv.sem, 0, 1);
- nxsem_init(&dev->closesem, 0, 1);
+ nxmutex_init(&dev->xmit.lock);
+ nxmutex_init(&dev->recv.lock);
+ nxmutex_init(&dev->closelock);
nxsem_init(&dev->xmitsem, 0, 0);
nxsem_init(&dev->recvsem, 0, 0);
- nxsem_init(&dev->pollsem, 0, 1);
+ nxmutex_init(&dev->polllock);
Review Comment:
keep
--
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
[GitHub] [incubator-nuttx] anjiahao1 commented on pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
anjiahao1 commented on PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#issuecomment-1232431554

this error can't fix
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r996470868
##########
drivers/wireless/ieee80211/bcm43xxx/bcmf_sdio.c:
##########
@@ -674,7 +674,7 @@ static int bcmf_bus_sdio_initialize(FAR struct bcmf_dev_s *priv,
/* Init transmit frames queue */
- if ((ret = nxsem_init(&sbus->queue_mutex, 0, 1)) != OK)
+ if ((ret = nxmutex_init(&sbus->queue_lock)) != OK)
Review Comment:
next patch
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r996469335
##########
wireless/pktradio/pktradio_metadata.c:
##########
@@ -49,7 +49,7 @@ static FAR struct pktradio_metadata_s *g_free_metadata;
/* Supports mutually exclusive access to the free list */
-static sem_t g_metadata_sem;
+static mutex_t g_metadata_lock;
Review Comment:
next patch
--
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
[GitHub] [incubator-nuttx] masayuki2009 merged pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
masayuki2009 merged PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#issuecomment-1277528793
> > @masayuki2009 ok, the change split into two patch, please review again.
>
> @xiaoxiang781216 Thanks for the changes. As far as I can see, the first commit still contains several intentions.
>
> For example, in `cxd56_emmc.c` you did the following changes which just replace `emmc_takesem` with `nxsem_wait_uninterruptible` and `emmc_givesem` with `nxsem_post`. However, these changes do NOT replace the nxsem with the nxmutex. Actually, I can see similar changes in cxd56_farapi.c and other files. So, these changes should be separated into another commit too.
As I said before, this patch want to distinguish sem_t usage which contain two part:
1. If sem is used as lock, change the variable name to lock and call nxmutex_lock/nxmutex_unlock
2. If sem is used as event/count, keep the variable name and call nxsem_wait_uninterruptible/nxsem_post instead _takesem/_givesem
If without the second part, takesem/givesem give reader expression that sem is still used as lock.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#issuecomment-1280361897
@pkarashchenko @masayuki2009 could we merge this patch now?
--
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
[GitHub] [incubator-nuttx] masayuki2009 commented on pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#issuecomment-1276961009
>nxmutex_t is initialized directly at the variables(g_i2cxdev) definition, not in cxd56_i2cbus_initialize, and then the code can be protected by mutex_t self, so it's redundancy to use the critical section here. That's why this patch remove the critical section too.
@xiaoxiang781216
My point is that such optimization is nothing to do with the original intention. (again, the original intention is just to replace nxsem with nxmutex) and should be in another commit. Otherwise, we confuse the commit.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#issuecomment-1278669279
@pkarashchenko @masayuki2009 @jerpelea all comment get addressed, please review again.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r988542745
##########
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:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r988527116
##########
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:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r988576186
##########
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:
Done.
##########
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:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989383161
##########
wireless/ieee802154/mac802154_internal.h:
##########
@@ -510,62 +511,12 @@ void mac802154_notify(FAR struct ieee802154_privmac_s *priv,
/* General helpers **********************************************************/
-#define mac802154_givesem(s) nxsem_post(s)
-
-static inline int mac802154_takesem(sem_t *sem, bool allowinterrupt)
-{
- if (allowinterrupt)
- {
- return nxsem_wait(sem);
- }
- else
- {
- return nxsem_wait_uninterruptible(sem);
- }
-}
-
-#ifdef CONFIG_MAC802154_LOCK_VERBOSE
-#define mac802154_unlock(dev) \
- mac802154_givesem(&dev->exclsem); \
- wlinfo("MAC unlocked\n");
-#else
-#define mac802154_unlock(dev) \
- mac802154_givesem(&dev->exclsem);
-#endif
-
-#define mac802154_lock(dev, allowinterrupt) \
- mac802154_lockpriv(dev, allowinterrupt, __FUNCTION__)
-
-static inline int
-mac802154_lockpriv(FAR struct ieee802154_privmac_s *dev,
- bool allowinterrupt, FAR const char *funcname)
-{
Review Comment:
Yes, I think it's very dangerous to allow user cancel the kernel work and then remove the possibility to simplify the code 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-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989413849
##########
drivers/audio/audio_null.c:
##########
@@ -825,7 +825,7 @@ static int null_release(FAR struct audio_lowerhalf_s *dev)
#endif
{
FAR struct null_dev_s *priv = (FAR struct null_dev_s *)dev;
- void *value;
+ void *value;
Review Comment:
```suggestion
FAR void *value;
```
##########
drivers/audio/vs1053.c:
##########
@@ -1797,8 +1796,8 @@ static int vs1053_release(FAR struct audio_lowerhalf_s *lower,
static int vs1053_release(FAR struct audio_lowerhalf_s *lower)
#endif
{
- FAR struct vs1053_struct_s *dev = (struct vs1053_struct_s *) lower;
- void *value;
+ FAR struct vs1053_struct_s *dev = (struct vs1053_struct_s *)lower;
Review Comment:
```suggestion
FAR struct vs1053_struct_s *dev = (FAR struct vs1053_struct_s *)lower;
```
##########
drivers/audio/vs1053.c:
##########
@@ -1591,7 +1591,7 @@ static int vs1053_pause(FAR struct audio_lowerhalf_s *lower,
static int vs1053_pause(FAR struct audio_lowerhalf_s *lower)
#endif
{
- FAR struct vs1053_struct_s *dev = (struct vs1053_struct_s *) lower;
+ FAR struct vs1053_struct_s *dev = (struct vs1053_struct_s *)lower;
Review Comment:
```suggestion
FAR struct vs1053_struct_s *dev = (FAR struct vs1053_struct_s *)lower;
```
##########
drivers/audio/vs1053.c:
##########
@@ -1546,7 +1546,7 @@ static int vs1053_stop(FAR struct audio_lowerhalf_s *lower,
static int vs1053_stop(FAR struct audio_lowerhalf_s *lower)
#endif
{
- FAR struct vs1053_struct_s *dev = (struct vs1053_struct_s *) lower;
+ FAR struct vs1053_struct_s *dev = (struct vs1053_struct_s *)lower;
Review Comment:
```suggestion
FAR struct vs1053_struct_s *dev = (FAR struct vs1053_struct_s *)lower;
```
##########
drivers/audio/vs1053.c:
##########
@@ -1280,7 +1280,7 @@ static int vs1053_dreq_isr(int irq, FAR void *context, FAR void *arg)
static void *vs1053_workerthread(pthread_addr_t pvarg)
{
- FAR struct vs1053_struct_s *dev = (struct vs1053_struct_s *) pvarg;
+ FAR struct vs1053_struct_s *dev = (struct vs1053_struct_s *)pvarg;
Review Comment:
```suggestion
FAR struct vs1053_struct_s *dev = (FAR struct vs1053_struct_s *)pvarg;
```
##########
drivers/audio/vs1053.c:
##########
@@ -1751,12 +1751,12 @@ static int vs1053_reserve(FAR struct audio_lowerhalf_s *lower,
static int vs1053_reserve(FAR struct audio_lowerhalf_s *lower)
#endif
{
- FAR struct vs1053_struct_s *dev = (struct vs1053_struct_s *) lower;
+ FAR struct vs1053_struct_s *dev = (struct vs1053_struct_s *)lower;
Review Comment:
```suggestion
FAR struct vs1053_struct_s *dev = (FAR struct vs1053_struct_s *)lower;
```
##########
drivers/leds/ws2812.c:
##########
@@ -143,9 +144,9 @@ static void ws2812_pack(FAR uint8_t *buf, uint32_t rgb);
#ifdef CONFIG_WS2812_NON_SPI_DRIVER
-static ssize_t ws2812_open(FAR struct file *filep);
+static ssize_t ws2812_open(FAR struct file *filep);
Review Comment:
```suggestion
static ssize_t ws2812_open(FAR struct file *filep);
```
##########
drivers/leds/ws2812.c:
##########
@@ -143,9 +144,9 @@ static void ws2812_pack(FAR uint8_t *buf, uint32_t rgb);
#ifdef CONFIG_WS2812_NON_SPI_DRIVER
-static ssize_t ws2812_open(FAR struct file *filep);
+static ssize_t ws2812_open(FAR struct file *filep);
-static ssize_t ws2812_close(FAR struct file *filep);
+static ssize_t ws2812_close(FAR struct file *filep);
Review Comment:
```suggestion
static ssize_t ws2812_close(FAR struct file *filep);
```
##########
drivers/video/video_framebuff.c:
##########
@@ -154,26 +154,25 @@ vbuf_container_t *video_framebuff_get_container(video_framebuff_t *fbuf)
{
vbuf_container_t *ret;
- nxsem_wait_uninterruptible(&fbuf->lock_empty);
+ nxmutex_lock(&fbuf->lock_empty);
ret = fbuf->vbuf_empty;
if (ret)
{
fbuf->vbuf_empty = ret->next;
ret->next = NULL;
}
- nxsem_post(&fbuf->lock_empty);
-
+ nxmutex_unlock(&fbuf->lock_empty);
return ret;
}
void video_framebuff_free_container(video_framebuff_t *fbuf,
vbuf_container_t *cnt)
{
- nxsem_wait_uninterruptible(&fbuf->lock_empty);
+ nxmutex_lock(&fbuf->lock_empty);
cnt->next = fbuf->vbuf_empty;
fbuf->vbuf_empty = cnt;
- nxsem_post(&fbuf->lock_empty);
+ nxmutex_unlock(&fbuf->lock_empty);
}
void video_framebuff_queue_container(video_framebuff_t *fbuf,
Review Comment:
```suggestion
void video_framebuff_queue_container(FAR video_framebuff_t *fbuf,
```
##########
drivers/video/vnc/vnc_updater.c:
##########
@@ -48,6 +48,9 @@
#include <debug.h>
#include <nuttx/queue.h>
+#ifdef VNCSERVER_SEM_DEBUG
+#include <nuttx/mutex.h>
Review Comment:
```suggestion
# include <nuttx/mutex.h>
```
##########
drivers/audio/vs1053.c:
##########
@@ -956,12 +956,12 @@ static int vs1053_shutdown(FAR struct audio_lowerhalf_s *lower)
static void vs1053_feeddata(FAR struct vs1053_struct_s *dev)
{
- int bytecount;
- int ret;
- uint8_t *samp = NULL;
- uint16_t reg;
- struct ap_buffer_s *apb;
- FAR struct spi_dev_s *spi = dev->spi;
+ int bytecount;
+ int ret;
+ uint8_t *samp = NULL;
+ uint16_t reg;
+ struct ap_buffer_s *apb;
Review Comment:
```suggestion
FAR struct ap_buffer_s *apb;
```
##########
drivers/audio/vs1053.c:
##########
@@ -1621,7 +1621,7 @@ static int vs1053_resume(FAR struct audio_lowerhalf_s *lower,
static int vs1053_resume(FAR struct audio_lowerhalf_s *lower)
#endif
{
- FAR struct vs1053_struct_s *dev = (struct vs1053_struct_s *) lower;
+ FAR struct vs1053_struct_s *dev = (struct vs1053_struct_s *)lower;
Review Comment:
```suggestion
FAR struct vs1053_struct_s *dev = (FAR struct vs1053_struct_s *)lower;
```
##########
drivers/audio/vs1053.c:
##########
@@ -1751,12 +1751,12 @@ static int vs1053_reserve(FAR struct audio_lowerhalf_s *lower,
static int vs1053_reserve(FAR struct audio_lowerhalf_s *lower)
#endif
{
- FAR struct vs1053_struct_s *dev = (struct vs1053_struct_s *) lower;
+ FAR struct vs1053_struct_s *dev = (struct vs1053_struct_s *)lower;
int ret;
Review Comment:
```suggestion
int ret;
```
##########
drivers/video/video_framebuff.c:
##########
@@ -103,13 +103,13 @@ void video_framebuff_init(video_framebuff_t *fbuf)
fbuf->vbuf_tail = NULL;
fbuf->vbuf_next = NULL;
- nxsem_init(&fbuf->lock_empty, 0, 1);
+ nxmutex_init(&fbuf->lock_empty);
}
void video_framebuff_uninit(video_framebuff_t *fbuf)
Review Comment:
```suggestion
void video_framebuff_uninit(FAR video_framebuff_t *fbuf)
```
##########
drivers/audio/vs1053.c:
##########
@@ -1439,7 +1439,7 @@ static int vs1053_start(FAR struct audio_lowerhalf_s *lower,
static int vs1053_start(FAR struct audio_lowerhalf_s *lower)
#endif
{
- FAR struct vs1053_struct_s *dev = (struct vs1053_struct_s *) lower;
+ FAR struct vs1053_struct_s *dev = (struct vs1053_struct_s *)lower;
Review Comment:
```suggestion
FAR struct vs1053_struct_s *dev = (FAR struct vs1053_struct_s *)lower;
```
##########
drivers/wireless/ieee80211/bcm43xxx/bcmf_gspi_f2_frame.c:
##########
@@ -185,7 +185,7 @@ int bcmf_gspi_read_f2_frame(FAR struct bcmf_dev_s *priv,
gspi_f2_dma,
0,
frame_length,
- (uint32_t *) iframe->data);
+ (uint32_t *)iframe->data);
Review Comment:
```suggestion
(FAR uint32_t *)iframe->data);
```
##########
drivers/audio/vs1053.c:
##########
@@ -775,7 +775,7 @@ static int vs1053_configure(FAR struct audio_lowerhalf_s *lower,
{
int ret = OK;
Review Comment:
```suggestion
int ret = OK;
```
##########
drivers/audio/wm8994.c:
##########
@@ -1727,7 +1711,7 @@ static int wm8994_interrupt(FAR const struct wm8994_lower_s *lower,
static void *wm8994_workerthread(pthread_addr_t pvarg)
{
- FAR struct wm8994_dev_s *priv = (struct wm8994_dev_s *) pvarg;
+ FAR struct wm8994_dev_s *priv = (struct wm8994_dev_s *)pvarg;
Review Comment:
```suggestion
FAR struct wm8994_dev_s *priv = (FAR struct wm8994_dev_s *)pvarg;
```
##########
drivers/audio/vs1053.c:
##########
@@ -956,12 +956,12 @@ static int vs1053_shutdown(FAR struct audio_lowerhalf_s *lower)
static void vs1053_feeddata(FAR struct vs1053_struct_s *dev)
{
- int bytecount;
- int ret;
- uint8_t *samp = NULL;
- uint16_t reg;
- struct ap_buffer_s *apb;
- FAR struct spi_dev_s *spi = dev->spi;
+ int bytecount;
+ int ret;
+ uint8_t *samp = NULL;
Review Comment:
```suggestion
FAR uint8_t *samp = NULL;
```
##########
drivers/audio/vs1053.c:
##########
@@ -934,8 +934,8 @@ static int vs1053_hardreset(FAR struct vs1053_struct_s *dev)
static int vs1053_shutdown(FAR struct audio_lowerhalf_s *lower)
{
- FAR struct vs1053_struct_s *dev = (struct vs1053_struct_s *) lower;
- FAR struct spi_dev_s *spi = dev->spi;
+ FAR struct vs1053_struct_s *dev = (struct vs1053_struct_s *)lower;
Review Comment:
```suggestion
FAR struct vs1053_struct_s *dev = (FAR struct vs1053_struct_s *)lower;
```
##########
drivers/audio/wm8994.c:
##########
@@ -1603,7 +1587,7 @@ static int wm8994_release(FAR struct audio_lowerhalf_s *dev)
#endif
{
FAR struct wm8994_dev_s *priv = (FAR struct wm8994_dev_s *)dev;
- void *value;
+ void *value;
Review Comment:
```suggestion
FAR void *value;
```
##########
drivers/wireless/ieee80211/bcm43xxx/bcmf_sdpcm.c:
##########
@@ -511,7 +511,7 @@ struct bcmf_frame_s *bcmf_sdpcm_get_rx_frame(FAR struct bcmf_dev_s *priv)
bcmf_interface_frame_t *iframe;
Review Comment:
```suggestion
FAR bcmf_interface_frame_t *iframe;
```
##########
drivers/lcd/apa102.c:
##########
@@ -375,7 +375,7 @@ 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 = (uint32_t *)&priv->fb[i];
Review Comment:
```suggestion
FAR uint32_t *led = (FAR uint32_t *)&priv->fb[i];
```
##########
drivers/sensors/bmp180.c:
##########
@@ -276,7 +276,7 @@ static 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, (uint8_t *)&data, 2);
Review Comment:
```suggestion
ret = i2c_write(priv->i2c, &config, (FAR uint8_t *)&data, 2);
```
##########
drivers/audio/vs1053.c:
##########
@@ -1797,8 +1796,8 @@ static int vs1053_release(FAR struct audio_lowerhalf_s *lower,
static int vs1053_release(FAR struct audio_lowerhalf_s *lower)
#endif
{
- FAR struct vs1053_struct_s *dev = (struct vs1053_struct_s *) lower;
- void *value;
+ FAR struct vs1053_struct_s *dev = (struct vs1053_struct_s *)lower;
+ void *value;
Review Comment:
```suggestion
FAR void *value;
```
##########
drivers/wireless/ieee80211/bcm43xxx/bcmf_sdpcm.c:
##########
@@ -376,14 +376,14 @@ int bcmf_sdpcm_sendframe(FAR struct bcmf_dev_s *priv)
return -EAGAIN;
}
- if (nxsem_wait_uninterruptible(&ibus->queue_mutex) < 0)
+ if (nxmutex_lock(&ibus->queue_lock) < 0)
{
DEBUGPANIC();
}
iframe = list_remove_head_type(&ibus->tx_queue, bcmf_interface_frame_t,
list_entry);
- nxsem_post(&ibus->queue_mutex);
+ nxmutex_unlock(&ibus->queue_lock);
header = (struct bcmf_sdpcm_header *)iframe->header.base;
Review Comment:
```suggestion
header = (FAR struct bcmf_sdpcm_header *)iframe->header.base;
```
##########
drivers/sensors/mlx90614.c:
##########
@@ -131,7 +131,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 = (uint8_t *)&checkcrc[3];
Review Comment:
```suggestion
buffer = (FAR uint8_t *)&checkcrc[3];
```
##########
drivers/audio/vs1053.c:
##########
@@ -775,7 +775,7 @@ static int vs1053_configure(FAR struct audio_lowerhalf_s *lower,
{
int ret = OK;
#if !defined(CONFIG_AUDIO_EXCLUDE_VOLUME) || !defined(CONFIG_AUDIO_EXCLUDE_TONE)
- FAR struct vs1053_struct_s *dev = (struct vs1053_struct_s *) lower;
+ FAR struct vs1053_struct_s *dev = (struct vs1053_struct_s *)lower;
Review Comment:
```suggestion
FAR struct vs1053_struct_s *dev = (FAR struct vs1053_struct_s *)lower;
```
##########
drivers/video/video.c:
##########
@@ -113,7 +114,7 @@ typedef struct video_format_s video_format_t;
struct video_type_inf_s
{
- sem_t lock_state;
+ mutex_t lock_state;
Review Comment:
```suggestion
mutex_t lock_state;
```
##########
drivers/usbhost/usbhost_xboxcontroller.c:
##########
@@ -318,56 +312,14 @@ static uint32_t g_devinuse;
/* The following are used to managed the class creation operation */
-static sem_t g_exclsem; /* For mutually exclusive thread creation */
-static sem_t g_syncsem; /* Thread data passing interlock */
-static struct usbhost_state_s *g_priv; /* Data passed to thread */
+static mutex_t g_lock = NXMUTEX_INITIALIZER;
+static sem_t g_syncsem = NXSEM_INITIALIZER(0, PRIOINHERIT_FLAGS_DISABLE);
+static struct usbhost_state_s *g_priv;
Review Comment:
```suggestion
static FAR struct usbhost_state_s *g_priv;
```
##########
drivers/usbdev/usbmsc_desc.c:
##########
@@ -369,7 +369,7 @@ int16_t usbmsc_mkcfgdesc(uint8_t *buf,
{
/* Single interface descriptor */
- FAR struct usb_ifdesc_s * dest = (struct usb_ifdesc_s *)buf;
+ FAR struct usb_ifdesc_s *dest = (struct usb_ifdesc_s *)buf;
Review Comment:
```suggestion
FAR struct usb_ifdesc_s *dest = (FAR struct usb_ifdesc_s *)buf;
```
##########
drivers/syslog/syslog_device.c:
##########
@@ -144,15 +144,6 @@ static inline int syslog_dev_takesem(FAR struct syslog_dev_s *syslog_dev)
return nxrmutex_lock(&syslog_dev->sl_lock);
}
-/****************************************************************************
- * Name: syslog_dev_givesem
- ****************************************************************************/
-
-static inline void syslog_dev_givesem(FAR struct syslog_dev_s *syslog_dev)
Review Comment:
Let's keep naming and add `#define syslog_dev_givesem nxrmutex_unlock`
##########
drivers/usbhost/usbhost_hidmouse.c:
##########
@@ -409,60 +404,18 @@ static const struct file_operations g_hidmouse_fops =
/* This is a bitmap that is used to allocate device names /dev/mouse0-31. */
-static uint32_t g_devinuse;
+static uint32_t g_devinuse;
/* The following are used to managed the class creation operation */
-static sem_t g_exclsem; /* For mutually exclusive thread creation */
-static sem_t g_syncsem; /* Thread data passing interlock */
-static struct usbhost_state_s *g_priv; /* Data passed to thread */
+static mutex_t g_lock = NXMUTEX_INITIALIZER;
+static sem_t g_syncsem = NXSEM_INITIALIZER(0, PRIOINHERIT_FLAGS_DISABLE);
+static struct usbhost_state_s *g_priv;
Review Comment:
```suggestion
static FAR struct usbhost_state_s *g_priv;
```
##########
drivers/video/video_framebuff.c:
##########
@@ -103,13 +103,13 @@ void video_framebuff_init(video_framebuff_t *fbuf)
fbuf->vbuf_tail = NULL;
fbuf->vbuf_next = NULL;
- nxsem_init(&fbuf->lock_empty, 0, 1);
+ nxmutex_init(&fbuf->lock_empty);
}
void video_framebuff_uninit(video_framebuff_t *fbuf)
{
video_framebuff_realloc_container(fbuf, 0);
- nxsem_destroy(&fbuf->lock_empty);
+ nxmutex_destroy(&fbuf->lock_empty);
}
int video_framebuff_realloc_container(video_framebuff_t *fbuf, int sz)
Review Comment:
```suggestion
int video_framebuff_realloc_container(FAR video_framebuff_t *fbuf, int sz)
```
##########
drivers/usbmisc/fusb301.c:
##########
@@ -529,7 +530,7 @@ static ssize_t fusb301_read(FAR struct file *filep,
ptr = (struct fusb301_result_s *)buffer;
Review Comment:
```suggestion
ptr = (FAR struct fusb301_result_s *)buffer;
```
##########
drivers/usbhost/usbhost_max3421e.c:
##########
@@ -419,13 +414,6 @@ static void max3421e_sndblock(FAR struct max3421e_usbhost_s *priv,
# define max3421e_pktdump(m,b,n)
#endif
-/* Semaphores ***************************************************************/
-
-static int max3421e_takesem(FAR sem_t *sem);
-#define max3421e_givesem(s) nxsem_post(s);
-static int max3421e_take_exclsem(FAR struct max3421e_usbhost_s *priv);
-static void max3421e_give_exclsem(FAR struct max3421e_usbhost_s *priv);
-
/* Byte stream access helper functions **************************************/
static inline uint16_t max3421e_getle16(const uint8_t *val);
Review Comment:
```suggestion
static inline uint16_t max3421e_getle16(FAR const uint8_t *val);
```
##########
drivers/usbhost/usbhost_hidkbd.c:
##########
@@ -362,9 +357,9 @@ static uint32_t g_devinuse;
/* The following are used to managed the class creation operation */
-static sem_t g_exclsem; /* For mutually exclusive thread creation */
-static sem_t g_syncsem; /* Thread data passing interlock */
-static struct usbhost_state_s *g_priv; /* Data passed to thread */
+static mutex_t g_lock = NXMUTEX_INITIALIZER;
+static sem_t g_syncsem = NXSEM_INITIALIZER(0, PRIOINHERIT_FLAGS_DISABLE);
+static struct usbhost_state_s *g_priv;
Review Comment:
```suggestion
static FAR struct usbhost_state_s *g_priv;
```
##########
drivers/wireless/ieee80211/bcm43xxx/bcmf_utils.h:
##########
@@ -43,8 +41,6 @@
void bcmf_hexdump(uint8_t *data, unsigned int len, unsigned long offset);
-int bcmf_sem_wait(sem_t *sem, unsigned int timeout_ms);
-
static inline uint16_t bcmf_getle16(void *val)
{
uint8_t *valb = (uint8_t *)val;
Review Comment:
```suggestion
FAR uint8_t *valb = (FAR uint8_t *)val;
```
##########
drivers/wireless/ieee80211/bcm43xxx/bcmf_utils.h:
##########
@@ -43,8 +41,6 @@
void bcmf_hexdump(uint8_t *data, unsigned int len, unsigned long offset);
-int bcmf_sem_wait(sem_t *sem, unsigned int timeout_ms);
-
static inline uint16_t bcmf_getle16(void *val)
Review Comment:
```suggestion
static inline uint16_t bcmf_getle16(FAR void *val)
```
##########
drivers/video/video_framebuff.c:
##########
@@ -252,7 +251,7 @@ void video_framebuff_capture_done(video_framebuff_t *fbuf)
}
}
-void video_framebuff_change_mode(video_framebuff_t *fbuf,
+void video_framebuff_change_mode(video_framebuff_t *fbuf,
Review Comment:
```suggestion
void video_framebuff_change_mode(FAR video_framebuff_t *fbuf,
```
##########
drivers/wireless/ieee80211/bcm43xxx/bcmf_utils.h:
##########
@@ -43,8 +41,6 @@
void bcmf_hexdump(uint8_t *data, unsigned int len, unsigned long offset);
Review Comment:
```suggestion
void bcmf_hexdump(FAR uint8_t *data, unsigned int len, unsigned long offset);
```
##########
drivers/wireless/lpwan/sx127x/sx127x.c:
##########
@@ -867,8 +868,7 @@ static ssize_t sx127x_read(FAR struct file *filep, FAR char *buffer,
ret = sx127x_rxfifo_get(dev, (uint8_t *)buffer, buflen);
Review Comment:
```suggestion
ret = sx127x_rxfifo_get(dev, (FAR uint8_t *)buffer, buflen);
```
##########
drivers/video/video_framebuff.c:
##########
@@ -154,26 +154,25 @@ vbuf_container_t *video_framebuff_get_container(video_framebuff_t *fbuf)
{
vbuf_container_t *ret;
- nxsem_wait_uninterruptible(&fbuf->lock_empty);
+ nxmutex_lock(&fbuf->lock_empty);
ret = fbuf->vbuf_empty;
if (ret)
{
fbuf->vbuf_empty = ret->next;
ret->next = NULL;
}
- nxsem_post(&fbuf->lock_empty);
-
+ nxmutex_unlock(&fbuf->lock_empty);
return ret;
}
void video_framebuff_free_container(video_framebuff_t *fbuf,
vbuf_container_t *cnt)
Review Comment:
```suggestion
void video_framebuff_free_container(FAR video_framebuff_t *fbuf,
FAR vbuf_container_t *cnt)
```
##########
drivers/wireless/lpwan/sx127x/sx127x.c:
##########
@@ -493,7 +494,7 @@ static void sx127x_unlock(FAR struct spi_dev_s *spi)
* Name: sx127x_select
****************************************************************************/
-static inline void sx127x_select(struct sx127x_dev_s * dev)
+static inline void sx127x_select(struct sx127x_dev_s *dev)
Review Comment:
```suggestion
static inline void sx127x_select(FAR struct sx127x_dev_s *dev)
```
##########
drivers/wireless/ieee80211/bcm43xxx/bcmf_driver.c:
##########
@@ -1804,8 +1781,8 @@ int bcmf_wl_set_ssid(FAR struct bcmf_dev_s *priv, struct iwreq *iwr)
WLC_DISASSOC, (uint8_t *)&scbval, &out_len);
Review Comment:
```suggestion
WLC_DISASSOC, (FAR uint8_t *)&scbval, &out_len);
```
##########
drivers/wireless/nrf24l01.c:
##########
@@ -1055,7 +1056,7 @@ static ssize_t nrf24l01_read(FAR struct file *filep, FAR char *buffer,
ret = nrf24l01_recv(dev, (uint8_t *)buffer, buflen, &dev->last_recvpipeno);
Review Comment:
```suggestion
ret = nrf24l01_recv(dev, (FAR uint8_t *)buffer, buflen, &dev->last_recvpipeno);
```
##########
drivers/wireless/nrf24l01.c:
##########
@@ -1077,15 +1078,15 @@ static ssize_t nrf24l01_write(FAR struct file *filep, FAR const char *buffer,
DEBUGASSERT(inode && inode->i_private);
dev = (FAR struct nrf24l01_dev_s *)inode->i_private;
- ret = nxsem_wait(&dev->devsem);
+ ret = nxmutex_lock(&dev->devlock);
if (ret < 0)
{
return ret;
}
ret = nrf24l01_send(dev, (const uint8_t *)buffer, buflen);
Review Comment:
```suggestion
ret = nrf24l01_send(dev, (FAR const uint8_t *)buffer, buflen);
```
##########
fs/nfs/nfs_mount.h:
##########
@@ -68,7 +68,7 @@
struct nfsmount
{
FAR struct nfsnode *nm_head; /* A list of all files opened on this mountpoint */
- sem_t nm_sem; /* Used to assure thread-safe access */
+ mutex_t nm_lock; /* Used to assure thread-safe access */
nfsfh_t *nm_fh; /* File handle of root dir */
Review Comment:
```suggestion
FAR nfsfh_t *nm_fh; /* File handle of root dir */
```
##########
drivers/wireless/nrf24l01.c:
##########
@@ -338,7 +339,7 @@ static inline void nrf24l01_select(struct nrf24l01_dev_s * dev)
* Name: nrf24l01_deselect
****************************************************************************/
-static inline void nrf24l01_deselect(struct nrf24l01_dev_s * dev)
+static inline void nrf24l01_deselect(struct nrf24l01_dev_s *dev)
Review Comment:
```suggestion
static inline void nrf24l01_deselect(FAR struct nrf24l01_dev_s *dev)
```
##########
fs/fat/fs_fat32.h:
##########
@@ -1018,11 +1018,6 @@ EXTERN uint32_t fat_getuint32(uint8_t *ptr);
EXTERN void fat_putuint16(uint8_t *ptr, uint16_t value16);
EXTERN void fat_putuint32(uint8_t *ptr, uint32_t value32);
Review Comment:
```suggestion
EXTERN void fat_putuint16(FAR uint8_t *ptr, uint16_t value16);
EXTERN void fat_putuint32(FAR uint8_t *ptr, uint32_t value32);
```
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989754949
##########
drivers/audio/vs1053.c:
##########
@@ -1751,12 +1751,12 @@ static int vs1053_reserve(FAR struct audio_lowerhalf_s *lower,
static int vs1053_reserve(FAR struct audio_lowerhalf_s *lower)
#endif
{
- FAR struct vs1053_struct_s *dev = (struct vs1053_struct_s *) lower;
+ FAR struct vs1053_struct_s *dev = (struct vs1053_struct_s *)lower;
Review Comment:
Done
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989796044
##########
fs/rpmsgfs/rpmsgfs.c:
##########
@@ -308,21 +291,21 @@ static int rpmsgfs_open(FAR struct file *filep, FAR const char *relpath,
DEBUGASSERT(fs != NULL);
- /* Take the semaphore */
+ /* Take the lock */
- ret = rpmsgfs_semtake(fs);
+ ret = nxmutex_lock(&fs->fs_lock);
if (ret < 0)
{
return ret;
}
/* Allocate memory for the open file */
- hf = (struct rpmsgfs_ofile_s *) kmm_malloc(sizeof *hf);
+ hf = (struct rpmsgfs_ofile_s *)kmm_malloc(sizeof *hf);
Review Comment:
Done
--
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
[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r985285801
##########
arch/arm/src/cxd56xx/cxd56_udmac.c:
##########
@@ -238,7 +239,7 @@ void cxd56_udmainitialize(void)
/* Initialize the channel list */
- nxsem_init(&g_dmac.exclsem, 0, 1);
+ nxmutex_init(&g_dmac.lock);
nxsem_init(&g_dmac.chansem, 0, CXD56_DMA_NCHANNELS);
Review Comment:
Let's add `nxsem_set_protocol(&g_dmac.chansem, SEM_PRIO_NONE);`? Or waiting on DMA channel should rise priority as well?
##########
arch/arm/src/lc823450/lc823450_adc.c:
##########
@@ -538,12 +507,12 @@ struct adc_dev_s *lc823450_adcinitialize(void)
inst->nchannels = CONFIG_LC823450_ADC_NCHANNELS;
inst->chanlist = lc823450_chanlist;
- nxsem_init(&inst->sem_excl, 0, 1);
+ nxmutex_init(&inst->lock);
#ifndef CONFIG_ADC_POLLED
nxsem_init(&inst->sem_isr, 0, 0);
Review Comment:
```suggestion
nxsem_init(&inst->sem_isr, 0, 0);
nxsem_set_protocol(&inst->sem_isr, SEM_PRIO_NONE);
```
##########
arch/arm/src/efm32/efm32_usbhost.c:
##########
@@ -5277,10 +5259,10 @@ static inline void efm32_sw_initialize(struct efm32_usbhost_s *priv)
usbhost_devaddr_initialize(&priv->rhport);
- /* Initialize semaphores */
+ /* Initialize semaphores & mutex */
nxsem_init(&priv->pscsem, 0, 0);
Review Comment:
```suggestion
nxsem_init(&priv->pscsem, 0, 0);
nxsem_set_protocol(&priv->pscsem, SEM_PRIO_NONE);
```
##########
arch/arm/src/rp2040/rp2040_dmac.c:
##########
@@ -160,7 +161,7 @@ void weak_function arm_dma_initialize(void)
/* Initialize the channel list */
- nxsem_init(&g_dmac.exclsem, 0, 1);
+ nxmutex_init(&g_dmac.lock);
nxsem_init(&g_dmac.chansem, 0, RP2040_DMA_NCHANNELS);
Review Comment:
```suggestion
nxsem_init(&g_dmac.chansem, 0, RP2040_DMA_NCHANNELS);
nxsem_set_protocol(&g_dmac.chansem, SEM_PRIO_NONE);
```
##########
arch/arm/src/sam34/sam_dmac.c:
##########
@@ -1380,9 +1341,9 @@ void weak_function arm_dma_initialize(void)
putreg32(DMAC_EN_ENABLE, SAM_DMAC_EN);
- /* Initialize semaphores */
+ /* Initialize mutex & semaphores */
- nxsem_init(&g_chsem, 0, 1);
+ nxmutex_init(&g_chlock);
nxsem_init(&g_dsem, 0, CONFIG_SAM34_NLLDESC);
Review Comment:
```suggestion
nxsem_init(&g_dsem, 0, CONFIG_SAM34_NLLDESC);
nxsem_set_protocol(&g_dsem, SEM_PRIO_NONE);
```
Optionally: we can do static init for both `g_dsem` and `g_chlock`
##########
arch/arm/src/lc823450/lc823450_i2s.c:
##########
@@ -686,7 +677,7 @@ static int lc823450_i2s_send(struct i2s_dev_s *dev, struct ap_buffer_s *apb,
/* Wait for Audio Buffer */
- ret = _i2s_semtake(&_sem_buf_under);
+ ret = nxsem_wait_uninterruptible(&_sem_buf_under);
Review Comment:
Lets add `nxsem_set_protocol(&XXX, SEM_PRIO_NONE);` for `_sem_rxdma`, `_sem_buf_over`, `_sem_txdma` and `_sem_buf_under`
##########
arch/arm/src/lc823450/lc823450_sddrv_dep.c:
##########
@@ -427,7 +418,7 @@ SINT_T sddep_read(void *src, void *dst, UI_32 size, SINT_T type,
}
lc823450_dmastart(_hrdma[ch], dma_callback, &_sem_rwait[ch]);
- return _sddep_semtake(&_sem_rwait[ch]);
+ return nxsem_wait_uninterruptible(&_sem_rwait[ch]);
Review Comment:
Lets add `nxsem_set_protocol(&XXX, SEM_PRIO_NONE);` for `_sem_rwait` and `_sem_wwait`
##########
arch/arm/src/efm32/efm32_dma.c:
##########
@@ -265,7 +266,7 @@ void weak_function arm_dma_initialize(void)
/* Initialize the channel list */
- nxsem_init(&g_dmac.exclsem, 0, 1);
+ nxmutex_init(&g_dmac.lock);
nxsem_init(&g_dmac.chansem, 0, EFM32_DMA_NCHANNELS);
Review Comment:
Let's add `nxsem_set_protocol(&g_dmac.chansem, SEM_PRIO_NONE);`? Or waiting on DMA channel should rise priority as well?
##########
arch/arm/src/sama5/sam_ssc.c:
##########
@@ -931,7 +884,7 @@ static struct sam_buffer_s *ssc_buf_allocate(struct sam_ssc_s *priv)
* have at least one free buffer container.
*/
- ret = ssc_bufsem_take(priv);
+ ret = nxsem_wait_uninterruptible(&priv->bufsem);
Review Comment:
Lets add `nxsem_set_protocol(&priv->bufsem, SEM_PRIO_NONE);`
##########
arch/arm/src/lpc54xx/lpc54_usb0_ohci.c:
##########
@@ -3884,10 +3829,10 @@ struct usbhost_connection_s *lpc54_usbhost_initialize(int controller)
usbhost_devaddr_initialize(&priv->rhport);
- /* Initialize semaphores */
+ /* Initialize semaphores & mutex */
nxsem_init(&priv->pscsem, 0, 0);
Review Comment:
```suggestion
nxsem_init(&priv->pscsem, 0, 0);
```
##########
arch/arm/src/sama5/sam_dmac.c:
##########
@@ -1873,9 +1855,9 @@ void sam_dmainitialize(struct sam_dmac_s *dmac)
sam_putdmac(dmac, DMAC_EN_ENABLE, SAM_DMAC_EN_OFFSET);
- /* Initialize semaphores */
+ /* Initialize muttex & semaphores */
- nxsem_init(&dmac->chsem, 0, 1);
+ nxmutex_init(&dmac->chlock);
nxsem_init(&dmac->dsem, 0, SAM_NDMACHAN);
Review Comment:
```suggestion
nxsem_init(&dmac->dsem, 0, SAM_NDMACHAN);
nxsem_set_protocol(&dmac->dsem, SEM_PRIO_NONE);
```
##########
arch/arm/src/rtl8720c/amebaz_driver.c:
##########
@@ -112,7 +112,7 @@ static void amebaz_state_deinit(struct amebaz_state_s *state)
static int amebaz_state_init(struct amebaz_state_s *state)
{
- if (nxsem_init(&state->mutex, 0, 0) != OK)
+ if (nxsem_init(&state->sem, 0, 0) != OK)
{
return -ENOMEM;
}
Review Comment:
```suggestion
if (nxsem_init(&state->sem, 0, 0) != OK)
{
return -ENOMEM;
}
nxsem_set_protocol(&state->sem, SEM_PRIO_NONE);
```
Also I do not think that `nxsem_init` can ever fail here. The error check can be removed
##########
arch/arm/src/sam34/sam_aes.c:
##########
@@ -59,8 +59,8 @@
* Private Data
****************************************************************************/
-static sem_t g_samaes_lock;
-static bool g_samaes_initdone = false;
+static mutex_t g_samaes_lock;
+static bool g_samaes_initdone = false;
Review Comment:
```suggestion
static bool g_samaes_initdone;
```
##########
arch/arm/src/sam34/sam_aes.c:
##########
@@ -169,7 +159,7 @@ static int samaes_setup_mr(uint32_t keysize, int mode, int encrypt)
static int samaes_initialize(void)
{
- nxsem_init(&g_samaes_lock, 0, 1);
+ nxmutex_init(&g_samaes_lock);
Review Comment:
We can do a static init instead
##########
arch/arm/src/sama5/sam_ehci.c:
##########
@@ -4881,7 +4828,7 @@ struct usbhost_connection_s *sam_ehci_initialize(int controller)
/* Initialize the EHCI state data structure */
- nxsem_init(&g_ehci.exclsem, 0, 1);
+ nxmutex_init(&g_ehci.lock);
nxsem_init(&g_ehci.pscsem, 0, 0);
Review Comment:
```suggestion
nxsem_init(&g_ehci.pscsem, 0, 0);
```
##########
arch/arm/src/sama5/sam_ohci.c:
##########
@@ -4016,7 +3963,7 @@ struct usbhost_connection_s *sam_ohci_initialize(int controller)
/* Initialize the state data structure */
nxsem_init(&g_ohci.pscsem, 0, 0);
Review Comment:
```suggestion
nxsem_init(&g_ohci.pscsem, 0, 0);
```
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989722671
##########
drivers/audio/vs1053.c:
##########
@@ -1797,8 +1796,8 @@ static int vs1053_release(FAR struct audio_lowerhalf_s *lower,
static int vs1053_release(FAR struct audio_lowerhalf_s *lower)
#endif
{
- FAR struct vs1053_struct_s *dev = (struct vs1053_struct_s *) lower;
- void *value;
+ FAR struct vs1053_struct_s *dev = (struct vs1053_struct_s *)lower;
Review Comment:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989741900
##########
drivers/sensors/bmp180.c:
##########
@@ -276,7 +276,7 @@ static 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, (uint8_t *)&data, 2);
Review Comment:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r988555328
##########
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:
Done.
##########
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:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r990783902
##########
drivers/wireless/ieee80211/bcm43xxx/bcmf_interface.h:
##########
@@ -140,15 +117,15 @@ void bcmf_initialize_interface_frames(void);
****************************************************************************/
void bcmf_interface_free_frame(FAR struct bcmf_dev_s *priv,
- bcmf_interface_frame_t *iframe);
+ FAR bcmf_interface_frame_t *iframe);
/****************************************************************************
* Name: bcmf_interface_allocate_frame
****************************************************************************/
-bcmf_interface_frame_t
+FAR bcmf_interface_frame_t
*bcmf_interface_allocate_frame(FAR struct bcmf_dev_s *priv,
Review Comment:
Done
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r990784313
##########
drivers/wireless/ieee80211/bcm43xxx/bcmf_interface.h:
##########
@@ -140,15 +117,15 @@ void bcmf_initialize_interface_frames(void);
****************************************************************************/
void bcmf_interface_free_frame(FAR struct bcmf_dev_s *priv,
Review Comment:
Done
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r990789153
##########
drivers/usbhost/usbhost_cdcmbim.c:
##########
@@ -855,7 +823,7 @@ static void usbhost_bulkin_work(FAR void *arg)
DRVR_ASYNCH(hport->drvr, priv->bulkin,
(uint8_t *)priv->rxnetbuf, CDCMBIM_NETBUF_SIZE,
Review Comment:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r990809997
##########
drivers/audio/vs1053.c:
##########
@@ -1647,22 +1647,22 @@ static int vs1053_resume(FAR struct audio_lowerhalf_s *lower)
static int vs1053_enqueuebuffer(FAR struct audio_lowerhalf_s *lower,
FAR struct ap_buffer_s *apb)
{
- FAR struct vs1053_struct_s *dev = (struct vs1053_struct_s *)lower;
+ FAR struct vs1053_struct_s *dev = (FAR struct vs1053_struct_s *)lower;
struct audio_msg_s term_msg;
Review Comment:
Done.
--
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
[GitHub] [incubator-nuttx] masayuki2009 commented on pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#issuecomment-1276107696
>sim:usrsocktest with CONFIG_DEBUG_ASSERTIONS=y failed.
Same as `spresense:wifi_smp` with `CONFIG_DEBUG_ASSERTIONS=y`
```
AEG
[ 0.440000] [CPU1] up_assert: Assertion failed CPU1 at file:/mnt/m2ssd/opensource/github_anjiahao1/nuttx/include/nuttx/mutex.h line: 489 task: spresense_main
[ 0.450000] [CPU1] arm_registerdump: R0: 00000000 R1: 2d05ef80 R2: 041ac000 R3: 00000000
[ 0.460000] [CPU1] arm_registerdump: R4: 2d05ef80 R5: 2d06b710 R6: 2d05e3a4 FP: 2d06c5c8
[ 0.470000] [CPU1] arm_registerdump: R8: 2d06c5c8 SB: 00000002 SL: 00000000 R11: 00000000
[ 0.470000] [CPU1] arm_registerdump: IP: 00000004 SP: 2d06c5b0 LR: 0d00f7e1 PC: 0d00fa44
[ 0.480000] [CPU1] arm_registerdump: xPSR: 61000200 BASEPRI: 000000e0 CONTROL: 00000004
[ 0.490000] [CPU1] arm_registerdump: EXC_RETURN: ffffffe9
[ 0.500000] [CPU1] arm_dump_stack: IRQ Stack:
[ 0.500000] [CPU1] arm_dump_stack: sp: 2d06c5c8
[ 0.500000] [CPU1] arm_dump_stack: base: 2d05db00
[ 0.510000] [CPU1] arm_dump_stack: size: 00000800
[ 0.510000] [CPU1] arm_dump_stack: ERROR: IRQ Stack pointer is not within the stack
[ 0.520000] [CPU1] arm_dump_stack: User Stack:
[ 0.530000] [CPU1] arm_dump_stack: sp: 2d06c5c8
[ 0.530000] [CPU1] arm_dump_stack: base: 2d06bb50
[ 0.540000] [CPU1] arm_dump_stack: size: 00000bd0
```
--
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
[GitHub] [incubator-nuttx] lupyuen commented on pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
lupyuen commented on PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#issuecomment-1291856755
Hi @anjiahao1 BL602 I2C Read seems to hang after this commit, I think it might be caused by the Semaphore Init Value.
Refer to the changes for `arch/risc-v/src/bl602/bl602_i2c.c`:
https://github.com/apache/incubator-nuttx/commit/d1d46335df6cc1bc63f1cd7e7bffe3735b8c275d#diff-b9e7242d24fc5f206885bdcd9fa90409e9c8356d041a968e786cfb8c8db32aeb
Previously the Semaphore `sem_isr` was set to Init Value 1:
```c
static void bl602_i2c_sem_init(struct bl602_i2c_priv_s *priv)
{
...
nxsem_init(&priv->sem_isr, 0, 1);
```
Now `sem_isr` is set to Init Value 0:
```c
static struct bl602_i2c_priv_s bl602_i2c0_priv =
{
...
.sem_isr = SEM_INITIALIZER(0),
```
This causes [`nxsem_wait_uninterruptible`](https://github.com/apache/incubator-nuttx/blob/master/arch/risc-v/src/bl602/bl602_i2c.c#L682) to hang during I2C Transfer:
```c
static int bl602_i2c_transfer(struct i2c_master_s *dev,
struct i2c_msg_s * msgs,
int count)
{
...
// Hangs here
ret = nxsem_wait_uninterruptible(&priv->sem_isr);
```
When I changed `sem_isr` to Init Value 1:
```c
.sem_isr = SEM_INITIALIZER(1),
```
The I2C Transfer now works OK. [(Here's the log)](https://github.com/lupyuen/incubator-nuttx/pull/148#issue-1421797837)
Can you verify if this fix `SEM_INITIALIZER(1)` is correct? Thanks :-)
--
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
[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
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-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r988568171
##########
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:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989343041
##########
drivers/mtd/smart.c:
##########
@@ -211,7 +211,7 @@ struct smart_cache_s
#ifdef CONFIG_MTD_SMART_ENABLE_CRC
struct smart_allocsector_s
{
- struct smart_allocsector_s *next; /* Pointer to next alloc sector */
+ struct smart_allocsector_s *next; /* Pointer to next alloc sector */
Review Comment:
Done
--
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
[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
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-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989230028
##########
drivers/sensors/mlx90393.c:
##########
@@ -499,9 +499,9 @@ static ssize_t mlx90393_read(FAR struct file *filep, FAR char *buffer,
data->z_mag = priv->data.z_mag;
data->temperature = priv->data.temperature;
- /* Give back the semaphore */
+ /* Give back the mutex */
- nxsem_post(&priv->datasem);
+ nxmutex_unlock(&priv->datalock);
return sizeof(FAR struct mlx90393_sensor_data_s);
Review Comment:
Done
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989231291
##########
drivers/sensors/lsm330_spi.c:
##########
@@ -1409,7 +1405,7 @@ int lsm330_register(FAR const char *devpath_acl,
priv->flink = g_lsm330g_list;
g_lsm330g_list = priv;
- config_gyro->leaf_handle = (void *) priv;
+ config_gyro->leaf_handle = (void *)priv;
Review Comment:
Done
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989756616
##########
drivers/video/video.c:
##########
@@ -113,7 +114,7 @@ typedef struct video_format_s video_format_t;
struct video_type_inf_s
{
- sem_t lock_state;
+ mutex_t lock_state;
Review Comment:
Done
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r988530538
##########
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:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989768847
##########
drivers/wireless/ieee80211/bcm43xxx/bcmf_sdpcm.c:
##########
@@ -376,14 +376,14 @@ int bcmf_sdpcm_sendframe(FAR struct bcmf_dev_s *priv)
return -EAGAIN;
}
- if (nxsem_wait_uninterruptible(&ibus->queue_mutex) < 0)
+ if (nxmutex_lock(&ibus->queue_lock) < 0)
{
DEBUGPANIC();
}
iframe = list_remove_head_type(&ibus->tx_queue, bcmf_interface_frame_t,
list_entry);
- nxsem_post(&ibus->queue_mutex);
+ nxmutex_unlock(&ibus->queue_lock);
header = (struct bcmf_sdpcm_header *)iframe->header.base;
Review Comment:
Done
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r988996002
##########
arch/risc-v/src/esp32c3/esp32c3_tim.c:
##########
@@ -82,7 +82,7 @@ static void esp32c3_tim_setalarm(struct esp32c3_tim_dev_s *dev,
static void esp32c3_tim_setautoreload(struct esp32c3_tim_dev_s *dev,
bool enable);
static int esp32c3_tim_setisr(struct esp32c3_tim_dev_s *dev,
- xcpt_t handler, void * arg);
+ xcpt_t handler, void *arg);
Review Comment:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989795480
##########
fs/procfs/fs_procfs.c:
##########
@@ -947,7 +947,7 @@ static int procfs_rewinddir(struct inode *mountpt, struct fs_dirent_s *dir)
if (priv->level > 0 && priv->procfsentry == NULL)
{
- priv->index = ((struct procfs_level1_s *) priv)->firstindex;
+ priv->index = ((struct procfs_level1_s *)priv)->firstindex;
Review Comment:
Done
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r988540711
##########
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:
Since many places have the similar issue, let's do in the next patch: all nxsem_set_protocol will be removed, the default setting is good in all case.
##########
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:
Since many places have the similar issue, let's do in the next patch: all nxsem_set_protocol will be removed, the default setting is good in all cases.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r988537259
##########
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:
Done.
##########
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:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r988539943
##########
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:
Done.
##########
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:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989739590
##########
drivers/audio/wm8994.c:
##########
@@ -1727,7 +1711,7 @@ static int wm8994_interrupt(FAR const struct wm8994_lower_s *lower,
static void *wm8994_workerthread(pthread_addr_t pvarg)
{
- FAR struct wm8994_dev_s *priv = (struct wm8994_dev_s *) pvarg;
+ FAR struct wm8994_dev_s *priv = (struct wm8994_dev_s *)pvarg;
Review Comment:
Done
##########
drivers/audio/wm8994.c:
##########
@@ -1603,7 +1587,7 @@ static int wm8994_release(FAR struct audio_lowerhalf_s *dev)
#endif
{
FAR struct wm8994_dev_s *priv = (FAR struct wm8994_dev_s *)dev;
- void *value;
+ void *value;
Review Comment:
Done.
--
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
[GitHub] [incubator-nuttx] masayuki2009 commented on pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#issuecomment-1276920822
>@masayuki2009 @pkarashchenko the style change is revert, please review again.
@xiaoxiang781216
Thanks for your efforts and updates.
It seems much easier to check the differences but I still have some comments.
In my understanding, this PR is intended to replace binary semaphore usage with nxmutex.
However, I can see some other changes like critical section with nxsem (e.g. cxd56_i2c.c) and nxsem to nxsem (i.e. cxd56_icc.c). I think that kind of changes should not be mixed in this PR.
--
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
[GitHub] [incubator-nuttx] masayuki2009 commented on pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#issuecomment-1277481868
>@masayuki2009 ok, the change split into two patch, please review again.
@xiaoxiang781216
Thanks for the changes.
As far as I can see, the first commit still contains several intentions.
For example, in `cxd56_emmc.c` you did the following changes which just replace `emmc_takesem` with `nxsem_wait_uninterruptible` and `emmc_givesem` with `nxsem_post`. However, these changes do NOT replace the nxsem with the nxmutex. Actually, I can see similar changes in cxd56_farapi.c and other files. So, these changes should be separated into another commit too.
```
static void emmc_cmdstarted(void)
{
uint32_t val;
@@ -429,7 +420,7 @@ static void emmc_send(int datatype, uint32_t opcode, uint32_t arg,
/* Wait for command or data transfer done */
- ret = emmc_takesem(&g_waitsem);
+ ret = nxsem_wait_uninterruptible(&g_waitsem);
if (ret < 0)
{
return;
@@ -592,8 +583,7 @@ static int emmc_interrupt(int irq, void *context, void *arg)
ferr("End-bit error/write no CRC.\n");
}
- emmc_givesem(&g_waitsem);
-
+ nxsem_post(&g_waitsem);
return OK;
}
```
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r990721119
##########
drivers/input/ft5x06.c:
##########
@@ -986,10 +977,10 @@ static int ft5x06_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
static int ft5x06_poll(FAR struct file *filep, FAR struct pollfd *fds,
bool setup)
Review Comment:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r996460570
##########
drivers/sensors/adxl345_base.c:
##########
@@ -373,7 +373,7 @@ ADXL345_HANDLE adxl345_instantiate(FAR struct i2c_master_s *dev,
/* Initialize the device state structure */
- nxsem_init(&priv->exclsem, 0, 1);
+ nxmutex_init(&priv->lock);
Review Comment:
Let's move nxmutex_destroy before kmm_free
--
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
[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r996470424
##########
drivers/lcd/ht16k33_14seg.c:
##########
@@ -107,7 +108,7 @@ struct ht16k33_dev_s
uint8_t col; /* Current col position to write on display */
uint8_t buffer[HT16K33_MAX_COL];
bool pendscroll;
- sem_t sem_excl;
+ mutex_t lock;
Review Comment:
optional
```suggestion
mutex_t lock;
```
##########
drivers/lcd/st7032.c:
##########
@@ -67,7 +68,7 @@ struct st7032_dev_s
uint8_t col; /* Current col position to write on display */
uint8_t buffer[ST7032_MAX_ROW * ST7032_MAX_COL];
bool pendscroll;
- sem_t sem_excl;
+ mutex_t lock;
Review Comment:
Optional
##########
drivers/input/stmpe811_base.c:
##########
@@ -302,6 +302,7 @@ STMPE811_HANDLE stmpe811_instantiate(FAR struct i2c_master_s *dev,
ret = stmpe811_checkid(priv);
if (ret < 0)
{
+ nxmutex_destroy(&priv->lock);
Review Comment:
should be
```
#ifdef CONFIG_STMPE811_MULTIPLE
g_stmpe811list = priv->flink;
#endif
nxmutex_destroy(&priv->lock);
kmm_free(priv);
```
##########
drivers/sensors/lsm330_spi.c:
##########
@@ -1397,7 +1393,7 @@ int lsm330_register(FAR const char *devpath_acl,
{
snerr("ERROR: Failed to register gyroscope driver: %d\n", ret);
- nxsem_destroy(&priv->datasem);
+ nxmutex_destroy(&priv->devicelock);
kmm_free(priv);
Review Comment:
yeah. missed `priv` vs `priva` :)
##########
drivers/syslog/ramlog.c:
##########
@@ -805,6 +806,10 @@ int ramlog_register(FAR const char *devpath, FAR char *buffer, size_t buflen)
ret = register_driver(devpath, &g_ramlogfops, 0666, priv);
if (ret < 0)
{
+ nxmutex_destroy(&priv->rl_lock);
+#ifndef CONFIG_RAMLOG_NONBLOCKING
+ nxsem_destroy(&priv->rl_waitsem, 0, 0);
Review Comment:
```suggestion
nxsem_destroy(&priv->rl_waitsem);
```
##########
wireless/pktradio/pktradio_metadata.c:
##########
@@ -49,7 +49,7 @@ static FAR struct pktradio_metadata_s *g_free_metadata;
/* Supports mutually exclusive access to the free list */
-static sem_t g_metadata_sem;
+static mutex_t g_metadata_lock;
Review Comment:
Sorry. I missed the call of `nxmutex_init(&g_metadata_lock);` and posted this comment. Now reviewed again and all is in place
--
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
[GitHub] [incubator-nuttx] pkarashchenko commented on pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#issuecomment-1279804156
> @pkarashchenko do you have more comment for this patch?
Please give me 1 more day to take a final look. Then we can move forward
--
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
[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r996485176
##########
drivers/input/stmpe811_base.c:
##########
@@ -302,6 +302,7 @@ STMPE811_HANDLE stmpe811_instantiate(FAR struct i2c_master_s *dev,
ret = stmpe811_checkid(priv);
if (ret < 0)
{
+ nxmutex_destroy(&priv->lock);
Review Comment:
Yes. Thank you
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#issuecomment-1276328045
@masayuki2009 @pkarashchenko the style change is revert, please review again.
--
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
[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r991890244
##########
arch/arm/src/stm32h7/stm32_serial.c:
##########
@@ -3347,7 +3352,7 @@ static void up_dma_txcallback(DMA_HANDLE handle, uint8_t status, void *arg)
/* Start transmission with the callback on DMA completion */
stm32_dmastart(priv->txdma, up_dma_txcallback,
- (void *)priv, false);
+ priv, false);
Review Comment:
```suggestion
priv, false);
```
##########
arch/arm/src/stm32f0l0g0/stm32_serial_v1.c:
##########
@@ -1272,7 +1272,7 @@ static int stm32serial_dmasetup(struct uart_dev_s *dev)
*/
stm32_dmastart(priv->rxdma, stm32serial_dmarxcallback,
- (void *)priv, false);
+ priv, false);
Review Comment:
```suggestion
priv, false);
```
##########
arch/arm/src/imxrt/imxrt_lpi2c.c:
##########
@@ -1145,7 +1070,7 @@ static void imxrt_lpi2c_setclock(struct imxrt_lpi2c_priv_s *priv,
CCM_CSCDR2_LPI2C_CLK_PODF_SHIFT;
lpi2c_clk_div = lpi2c_clk_div + 1;
src_freq = (BOARD_XTAL_FREQUENCY * pll3_div) /
- (8 * lpi2c_clk_div) ;
+ (8 * lpi2c_clk_div) ;
Review Comment:
```suggestion
(8 * lpi2c_clk_div);
```
##########
drivers/audio/wm8994.c:
##########
@@ -1727,7 +1711,7 @@ static int wm8994_interrupt(FAR const struct wm8994_lower_s *lower,
static void *wm8994_workerthread(pthread_addr_t pvarg)
Review Comment:
```suggestion
static FAR void *wm8994_workerthread(pthread_addr_t pvarg)
```
##########
drivers/mtd/w25qxxxjv.c:
##########
@@ -566,7 +566,7 @@ static void w25qxxxjv_write_status(FAR struct w25qxxxjv_dev_s *priv)
priv->cmdbuf[0] &= ~STATUS_SRP_MASK;
w25qxxxjv_command_write(priv->qspi, W25QXXXJV_WRITE_STATUS_1,
- (FAR const void *)priv->cmdbuf, 1);
+ priv->cmdbuf, 1);
Review Comment:
```suggestion
priv->cmdbuf, 1);
```
##########
drivers/wireless/ieee802154/at86rf23x/at86rf23x.c:
##########
@@ -725,7 +725,7 @@ static int at86rf23x_setpanid(FAR struct ieee802154_radio_s *ieee,
uint16_t panid)
{
FAR struct at86rf23x_dev_s *dev = (struct at86rf23x_dev_s *)ieee;
Review Comment:
```suggestion
FAR struct at86rf23x_dev_s *dev = (FAR struct at86rf23x_dev_s *)ieee;
```
##########
drivers/mtd/n25qxxx.c:
##########
@@ -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);
+ priv->cmdbuf, 1);
Review Comment:
```suggestion
priv->cmdbuf, 1);
```
##########
drivers/wireless/ieee802154/at86rf23x/at86rf23x.c:
##########
@@ -745,7 +745,7 @@ 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;
Review Comment:
```suggestion
FAR struct at86rf23x_dev_s *dev = (FAR struct at86rf23x_dev_s *)ieee;
```
##########
drivers/wireless/gs2200m.c:
##########
@@ -910,7 +892,7 @@ enum spi_status_e gs2200m_hal_write(FAR struct gs2200m_dev_s *dev,
const void *data,
uint16_t txlen)
{
- uint8_t *tx = (uint8_t *)data;
+ uint8_t *tx = (FAR uint8_t *)data;
Review Comment:
```suggestion
FAR uint8_t *tx = (FAR uint8_t *)data;
```
##########
net/sixlowpan/sixlowpan_input.c:
##########
@@ -724,7 +724,7 @@ static int sixlowpan_dispatch(FAR struct radio_driver_s *radio)
****************************************************************************/
int sixlowpan_input(FAR struct radio_driver_s *radio,
- FAR struct iob_s *framelist, FAR const void *metadata)
+ FAR struct iob_s *framelist, FAR const void *metadata)
{
int ret = -EINVAL;
uint8_t *d_buf_backup;
Review Comment:
```suggestion
FAR uint8_t *d_buf_backup;
```
##########
wireless/bluetooth/bt_smp.c:
##########
@@ -1035,7 +1035,7 @@ static uint8_t smp_ident_addr_info(FAR struct bt_conn_s *conn,
if (bt_addr_le_is_rpa(&conn->dst))
{
- bt_addr_copy(&keys->irk.rpa, (bt_addr_t *) & conn->dst.val);
+ bt_addr_copy(&keys->irk.rpa, (bt_addr_t *)&conn->dst.val);
Review Comment:
```suggestion
bt_addr_copy(&keys->irk.rpa, (FAR bt_addr_t *)&conn->dst.val);
```
##########
drivers/audio/wm8776.c:
##########
@@ -1179,7 +1122,7 @@ static void wm8776_hw_reset(FAR struct wm8776_dev_s *priv)
static void *wm8776_workerthread(pthread_addr_t pvarg)
Review Comment:
```suggestion
static FAR void *wm8776_workerthread(pthread_addr_t pvarg)
```
##########
drivers/video/video.c:
##########
@@ -3209,7 +3180,7 @@ static int video_complete_capture(uint8_t err_code, uint32_t datasize)
}
else
{
- g_video_data_ops->set_buf((uint8_t *)container->buf.m.userptr,
+ g_video_data_ops->set_buf((FAR uint8_t *)container->buf.m.userptr,
container->buf.length);
Review Comment:
```suggestion
container->buf.length);
```
##########
drivers/audio/wm8904.c:
##########
@@ -2090,7 +2035,7 @@ static int wm8904_interrupt(FAR const struct wm8904_lower_s *lower,
static void *wm8904_workerthread(pthread_addr_t pvarg)
Review Comment:
```suggestion
static FAR void *wm8904_workerthread(pthread_addr_t pvarg)
```
##########
arch/arm/src/stm32wl5/stm32wl5_serial.c:
##########
@@ -1327,7 +1327,7 @@ static int stm32wl5serial_dmasetup(struct uart_dev_s *dev)
*/
stm32wl5_dmastart(priv->rxdma, stm32wl5serial_dmarxcallback,
- (void *)priv, true);
+ priv, true);
Review Comment:
```suggestion
priv, true);
```
##########
drivers/wireless/ieee80211/bcm43xxx/bcmf_gspi.c:
##########
@@ -339,7 +339,7 @@ static int bcmf_gspi_bus_lowpower(FAR bcmf_gspi_dev_t *gbus, bool enable)
static int bcmf_gspi_thread_isr(int isr, void *context, void *arg)
Review Comment:
```suggestion
static int bcmf_gspi_thread_isr(int isr, FAR void *context, FAR void *arg)
```
##########
fs/rpmsgfs/rpmsgfs.c:
##########
@@ -77,7 +78,7 @@ struct rpmsgfs_ofile_s
struct rpmsgfs_mountpt_s
{
- sem_t fs_sem; /* Assure thread-safe access */
+ mutex_t fs_lock; /* Assure thread-safe access */
FAR struct rpmsgfs_ofile_s *fs_head; /* Singly-linked list of open files */
char fs_root[PATH_MAX];
void *handle;
Review Comment:
```suggestion
FAR void *handle;
```
##########
drivers/wireless/gs2200m.c:
##########
@@ -910,7 +892,7 @@ enum spi_status_e gs2200m_hal_write(FAR struct gs2200m_dev_s *dev,
const void *data,
Review Comment:
```suggestion
FAR const void *data,
```
##########
net/can/can_recvmsg.c:
##########
@@ -231,7 +231,7 @@ static inline void can_newdata(FAR struct net_driver_s *dev,
static inline int can_readahead(struct can_recvfrom_s *pstate)
Review Comment:
```suggestion
static inline int can_readahead(FAR struct can_recvfrom_s *pstate)
```
##########
drivers/wireless/ieee802154/at86rf23x/at86rf23x.c:
##########
@@ -766,7 +766,7 @@ static int at86rf23x_setsaddr(FAR struct ieee802154_radio_s *ieee,
uint16_t saddr)
{
FAR struct at86rf23x_dev_s *dev = (struct at86rf23x_dev_s *)ieee;
Review Comment:
```suggestion
FAR struct at86rf23x_dev_s *dev = (FAR struct at86rf23x_dev_s *)ieee;
```
##########
drivers/wireless/ieee80211/bcm43xxx/bcmf_gspi_f2_frame.c:
##########
@@ -145,13 +145,12 @@ int process_f2_frame_header(FAR bcmf_interface_dev_t *gbus,
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;
+ f2_frame_header_t *header;
Review Comment:
```suggestion
FAR f2_frame_header_t *header;
```
##########
drivers/wireless/ieee802154/at86rf23x/at86rf23x.c:
##########
@@ -786,7 +786,7 @@ 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;
Review Comment:
```suggestion
FAR struct at86rf23x_dev_s *dev = (FAR struct at86rf23x_dev_s *)ieee;
```
--
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
[GitHub] [incubator-nuttx] pkarashchenko commented on pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#issuecomment-1276121674
Let me take an effort and separate FAR and some style changes and submit as a separate PR. I will need a couple of days based on my current work load
--
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
[GitHub] [incubator-nuttx] anjiahao1 commented on pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
anjiahao1 commented on PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#issuecomment-1263356792
@xiaoxiang781216 i check it all agin,is look good
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989883167
##########
fs/smartfs/smartfs_smart.c:
##########
@@ -1406,22 +1406,22 @@ static int smartfs_readdir(FAR struct inode *mountpt,
sdir->fs_curroffset =
sizeof(struct smartfs_chain_header_s);
- header = (struct smartfs_chain_header_s *) fs->fs_rwbuffer;
+ header = (struct smartfs_chain_header_s *)fs->fs_rwbuffer;
Review Comment:
Done
##########
fs/smartfs/smartfs_smart.c:
##########
@@ -1337,7 +1337,7 @@ static int smartfs_readdir(FAR struct inode *mountpt,
ret = FS_IOCTL(fs, BIOC_READSECT, (unsigned long) &readwrite);
Review Comment:
Done
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989882085
##########
fs/smartfs/smartfs_utils.c:
##########
@@ -405,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 = (char *)0xdeadbeef;
+ fs->fs_workbuffer = (char *)0xdeadbeef;
Review Comment:
Done
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r988537836
##########
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:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r988531898
##########
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:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989341770
##########
drivers/mtd/smart.c:
##########
@@ -4271,11 +4271,11 @@ 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 = *((uint32_t *)&buffer[4]);
Review Comment:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989340759
##########
libs/libc/stdio/lib_rewind.c:
##########
@@ -46,8 +46,8 @@ void rewind(FAR FILE *stream)
return;
}
- lib_take_semaphore(stream);
+ lib_take_lock(stream);
(void) fseek(stream, 0L, SEEK_SET);
Review Comment:
Done
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r988572065
##########
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:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989880759
##########
fs/smartfs/smartfs_utils.c:
##########
@@ -1121,15 +1103,15 @@ int smartfs_createentry(FAR struct smartfs_mountpt_s *fs,
int smartfs_deleteentry(struct smartfs_mountpt_s *fs,
struct smartfs_entry_s *entry)
Review Comment:
Done
##########
fs/smartfs/smartfs_utils.c:
##########
@@ -889,7 +871,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 = (struct smartfs_chain_header_s *)fs->fs_rwbuffer;
Review Comment:
Done
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r985881307
##########
arch/arm/src/cxd56xx/cxd56_udmac.c:
##########
@@ -238,7 +239,7 @@ void cxd56_udmainitialize(void)
/* Initialize the channel list */
- nxsem_init(&g_dmac.exclsem, 0, 1);
+ nxmutex_init(&g_dmac.lock);
nxsem_init(&g_dmac.chansem, 0, CXD56_DMA_NCHANNELS);
Review Comment:
> I think that is not a good way. If I understand correctly we will have a Kconfig option so users can select either enable or disable by default.
If we enable priority inheritance by default, this simple POSIX compliant code will panic:
```
#include <pthread.h>
#include <semaphore.h>
#include <unistd.h>
static sem_t g_sem;
static void *thread1_cb(void *arg)
{
sem_wait(&g_sem);
return NULL;
}
static void *thread2_cb(void *arg)
{
sleep(2);
sem_wait(&g_sem);
return NULL;
}
static void *thread3_cb(void *arg)
{
sleep(1);
sem_post(&g_sem);
sleep(2);
sem_post(&g_sem);
return NULL;
}
int main(int argc, char *argv[])
{
sem_init(&g_sem);
thread1 = pthread_create(thread1_cb...);
thread2 = pthread_create(thread2_cb...);
thread3 = pthread_create(thread3_cb...);
pthread_join(&thread1);
pthread_join(&thread2);
pthread_join(&thread3);
sem_destroy(&g_sem);
return 0;
}
```
semaphore can be used either as lock or as signal. Priority inheritance can only work well when semaphore is used as lock. So it's wrong to enable it by default and even worse that the default behavior is controlled by an Kconfig.
> Having explicit calls will break this dependency. Unless we will have Kconfig applied only for nxmutex. In such a way I agree.
The current behavior break all programs if they don't call NuttX specific nxsem_set_protocol, when they use semaphore as an event notification or resource counting.
So, the default behavior must be changed to compliant POSIX standard:
1. Semaphore disable priority inheritance after initialization
2. Caller has to call nxsem_set_protocol(SEM_PRIO_INHERIT) if the semaphore is used as lock
Of course, the caller is better to use:
1. nxmutex_t or nxrmutex_t as lock for kernel code
2. or pthread_mutex_t as lock for userspace code
All these type will call nxsem_set_protocol(SEM_PRIO_INHERIT) automatically for caller.
##########
arch/arm/src/cxd56xx/cxd56_udmac.c:
##########
@@ -238,7 +239,7 @@ void cxd56_udmainitialize(void)
/* Initialize the channel list */
- nxsem_init(&g_dmac.exclsem, 0, 1);
+ nxmutex_init(&g_dmac.lock);
nxsem_init(&g_dmac.chansem, 0, CXD56_DMA_NCHANNELS);
Review Comment:
> I think that is not a good way. If I understand correctly we will have a Kconfig option so users can select either enable or disable by default.
If we enable priority inheritance by default, this simple POSIX compliant code will panic:
```
#include <pthread.h>
#include <semaphore.h>
#include <unistd.h>
static sem_t g_sem;
static void *thread1_cb(void *arg)
{
sem_wait(&g_sem);
return NULL;
}
static void *thread2_cb(void *arg)
{
sleep(2);
sem_wait(&g_sem);
return NULL;
}
static void *thread3_cb(void *arg)
{
sleep(1);
sem_post(&g_sem);
sleep(2);
sem_post(&g_sem);
return NULL;
}
int main(int argc, char *argv[])
{
sem_init(&g_sem);
thread1 = pthread_create(thread1_cb...);
thread2 = pthread_create(thread2_cb...);
thread3 = pthread_create(thread3_cb...);
pthread_join(&thread1);
pthread_join(&thread2);
pthread_join(&thread3);
sem_destroy(&g_sem);
return 0;
}
```
Semaphore can be used either as lock or as signal. Priority inheritance can only work well when semaphore is used as lock. So it's wrong to enable it by default and even worse that the default behavior is controlled by an Kconfig.
> Having explicit calls will break this dependency. Unless we will have Kconfig applied only for nxmutex. In such a way I agree.
The current behavior break all programs if they don't call NuttX specific nxsem_set_protocol, when they use semaphore as an event notification or resource counting.
So, the default behavior must be changed to compliant POSIX standard:
1. Semaphore disable priority inheritance after initialization
2. Caller has to call nxsem_set_protocol(SEM_PRIO_INHERIT) if the semaphore is used as lock
Of course, the caller is better to use:
1. nxmutex_t or nxrmutex_t as lock for kernel code
2. or pthread_mutex_t as lock for userspace code
All these type will call nxsem_set_protocol(SEM_PRIO_INHERIT) automatically for caller.
##########
arch/arm/src/cxd56xx/cxd56_udmac.c:
##########
@@ -238,7 +239,7 @@ void cxd56_udmainitialize(void)
/* Initialize the channel list */
- nxsem_init(&g_dmac.exclsem, 0, 1);
+ nxmutex_init(&g_dmac.lock);
nxsem_init(&g_dmac.chansem, 0, CXD56_DMA_NCHANNELS);
Review Comment:
> I think that is not a good way. If I understand correctly we will have a Kconfig option so users can select either enable or disable by default.
If we enable priority inheritance by default, this simple POSIX compliant code will panic:
```
#include <pthread.h>
#include <semaphore.h>
#include <unistd.h>
static sem_t g_sem;
static void *thread1_cb(void *arg)
{
sem_wait(&g_sem);
return NULL;
}
static void *thread2_cb(void *arg)
{
sleep(2);
sem_wait(&g_sem);
return NULL;
}
static void *thread3_cb(void *arg)
{
sleep(1);
sem_post(&g_sem);
sleep(2);
sem_post(&g_sem);
return NULL;
}
int main(int argc, char *argv[])
{
sem_init(&g_sem);
thread1 = pthread_create(thread1_cb...);
thread2 = pthread_create(thread2_cb...);
thread3 = pthread_create(thread3_cb...);
pthread_join(&thread1);
pthread_join(&thread2);
pthread_join(&thread3);
sem_destroy(&g_sem);
return 0;
}
```
Semaphore can be used either as lock or as signal. Priority inheritance can only work well when semaphore is used as lock. So it's wrong to enable it by default and even worse that the default behavior is controlled by an Kconfig.
> Having explicit calls will break this dependency. Unless we will have Kconfig applied only for nxmutex. In such a way I agree.
The current behavior break all programs if they don't call NuttX specific nxsem_set_protocol(SEM_PRIO_NONE), when they use semaphore as an event notification or resource counting.
So, the default behavior must be changed to compliant POSIX standard:
1. Semaphore disable priority inheritance after initialization
2. Caller has to call nxsem_set_protocol(SEM_PRIO_INHERIT) if the semaphore is used as lock
Of course, the caller is better to use:
1. nxmutex_t or nxrmutex_t as lock for kernel code
2. or pthread_mutex_t as lock for userspace code
All these type will call nxsem_set_protocol(SEM_PRIO_INHERIT) automatically for caller.
##########
arch/arm/src/cxd56xx/cxd56_udmac.c:
##########
@@ -238,7 +239,7 @@ void cxd56_udmainitialize(void)
/* Initialize the channel list */
- nxsem_init(&g_dmac.exclsem, 0, 1);
+ nxmutex_init(&g_dmac.lock);
nxsem_init(&g_dmac.chansem, 0, CXD56_DMA_NCHANNELS);
Review Comment:
> I think that is not a good way. If I understand correctly we will have a Kconfig option so users can select either enable or disable by default.
If we enable priority inheritance by default, this simple POSIX compliant code will panic:
```
#include <pthread.h>
#include <semaphore.h>
#include <unistd.h>
static sem_t g_sem;
static void *thread1_cb(void *arg)
{
sem_wait(&g_sem);
return NULL;
}
static void *thread2_cb(void *arg)
{
sleep(2);
sem_wait(&g_sem);
return NULL;
}
static void *thread3_cb(void *arg)
{
sleep(1);
sem_post(&g_sem);
sleep(2);
sem_post(&g_sem);
return NULL;
}
int main(int argc, char *argv[])
{
sem_init(&g_sem);
thread1 = pthread_create(thread1_cb...);
thread2 = pthread_create(thread2_cb...);
thread3 = pthread_create(thread3_cb...);
pthread_join(&thread1);
pthread_join(&thread2);
pthread_join(&thread3);
sem_destroy(&g_sem);
return 0;
}
```
Semaphore can be used either as lock or as signal. Priority inheritance can only work well when semaphore is used as lock. So it's wrong to enable it by default and even worse that the default behavior is controlled by an Kconfig.
> Having explicit calls will break this dependency. Unless we will have Kconfig applied only for nxmutex. In such a way I agree.
The current behavior break all programs if they don't call NuttX specific nxsem_set_protocol(SEM_PRIO_NONE), when they use semaphore as an event notification or resource counting.
So, the default behavior must be changed to compliant POSIX standard:
1. Semaphore disable priority inheritance after initialization
2. Caller has to call nxsem_set_protocol(SEM_PRIO_INHERIT) if the semaphore is used as lock
Of course, the caller is better to use:
1. nxmutex_t or nxrmutex_t as lock for kernel code
2. pthread_mutex_t as lock for userspace code
All these type will call nxsem_set_protocol(SEM_PRIO_INHERIT) automatically for caller.
##########
arch/arm/src/cxd56xx/cxd56_udmac.c:
##########
@@ -238,7 +239,7 @@ void cxd56_udmainitialize(void)
/* Initialize the channel list */
- nxsem_init(&g_dmac.exclsem, 0, 1);
+ nxmutex_init(&g_dmac.lock);
nxsem_init(&g_dmac.chansem, 0, CXD56_DMA_NCHANNELS);
Review Comment:
> I think that is not a good way. If I understand correctly we will have a Kconfig option so users can select either enable or disable by default.
If we enable priority inheritance by default, this simple POSIX compliant code will panic:
```
#include <pthread.h>
#include <semaphore.h>
#include <unistd.h>
static sem_t g_sem;
static void *thread1_cb(void *arg)
{
sem_wait(&g_sem);
return NULL;
}
static void *thread2_cb(void *arg)
{
sleep(2);
sem_wait(&g_sem);
return NULL;
}
static void *thread3_cb(void *arg)
{
sleep(1);
sem_post(&g_sem);
sleep(2);
sem_post(&g_sem);
return NULL;
}
int main(int argc, char *argv[])
{
sem_init(&g_sem);
thread1 = pthread_create(thread1_cb...);
thread2 = pthread_create(thread2_cb...);
thread3 = pthread_create(thread3_cb...);
pthread_join(&thread1);
pthread_join(&thread2);
pthread_join(&thread3);
sem_destroy(&g_sem);
return 0;
}
```
Semaphore can be used either as lock or as signal. Priority inheritance can only work well when semaphore is used as lock. So it's wrong to enable it by default and even worse that the default behavior is controlled by an Kconfig.
> Having explicit calls will break this dependency. Unless we will have Kconfig applied only for nxmutex. In such a way I agree.
The current behavior break all programs if they don't call NuttX specific nxsem_set_protocol(SEM_PRIO_NONE), when they use semaphore as an event notification or resource counting.
So, the default behavior must be changed to compliant POSIX standard:
1. Semaphore disable priority inheritance after initialization
2. Caller has to call nxsem_set_protocol(SEM_PRIO_INHERIT) if the semaphore is used as lock
Of course, the caller is better to use:
1. nxmutex_t or nxrmutex_t as lock for kernel code
2. pthread_mutex_t as lock for userspace code
All these types will call nxsem_set_protocol(SEM_PRIO_INHERIT) automatically for caller.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r988575795
##########
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:
Done.
##########
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:
Done
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r988540081
##########
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:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r988542486
##########
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:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989706127
##########
drivers/audio/audio_null.c:
##########
@@ -825,7 +825,7 @@ static int null_release(FAR struct audio_lowerhalf_s *dev)
#endif
{
FAR struct null_dev_s *priv = (FAR struct null_dev_s *)dev;
- void *value;
+ void *value;
Review Comment:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989740973
##########
drivers/leds/ws2812.c:
##########
@@ -143,9 +144,9 @@ static void ws2812_pack(FAR uint8_t *buf, uint32_t rgb);
#ifdef CONFIG_WS2812_NON_SPI_DRIVER
-static ssize_t ws2812_open(FAR struct file *filep);
+static ssize_t ws2812_open(FAR struct file *filep);
Review Comment:
Done.
##########
drivers/leds/ws2812.c:
##########
@@ -143,9 +144,9 @@ static void ws2812_pack(FAR uint8_t *buf, uint32_t rgb);
#ifdef CONFIG_WS2812_NON_SPI_DRIVER
-static ssize_t ws2812_open(FAR struct file *filep);
+static ssize_t ws2812_open(FAR struct file *filep);
-static ssize_t ws2812_close(FAR struct file *filep);
+static ssize_t ws2812_close(FAR struct file *filep);
Review Comment:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989740669
##########
drivers/lcd/apa102.c:
##########
@@ -375,7 +375,7 @@ 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 = (uint32_t *)&priv->fb[i];
Review Comment:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989760753
##########
drivers/wireless/ieee80211/bcm43xxx/bcmf_driver.c:
##########
@@ -1804,8 +1781,8 @@ int bcmf_wl_set_ssid(FAR struct bcmf_dev_s *priv, struct iwreq *iwr)
WLC_DISASSOC, (uint8_t *)&scbval, &out_len);
Review Comment:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989810227
##########
include/nuttx/contactless/pn532.h:
##########
@@ -57,8 +57,8 @@ struct pn532_config_s
/* External CS, if NULL then SPIDEV_WIRELESS(n) CS is used */
- int (*select)(struct pn532_dev_s *dev, bool sel);
- int (*irqattach)(void *dev, xcpt_t isr);
+ int (*select)(FAR truct pn532_dev_s *dev, bool sel);
+ int (*irqattach)(FAR void *dev, xcpt_t isr);
Review Comment:
Done
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r991247297
##########
drivers/mtd/smart.c:
##########
@@ -4709,9 +4709,9 @@ 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;
Review Comment:
Done
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r991414096
##########
drivers/can/mcp2515.c:
##########
@@ -198,7 +199,7 @@ struct mcp2515_can_s
struct mcp2515_config_s *config; /* The constant configuration */
Review Comment:
Done
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r991412000
##########
drivers/clk/clk.h:
##########
@@ -50,12 +50,12 @@
static inline void clk_write(uint32_t reg, uint32_t value)
{
- *((volatile uint32_t *) (reg)) = value;
+ *((volatile uint32_t *)(reg)) = value;
}
static inline uint32_t clk_read(uint32_t reg)
{
- return *((volatile uint32_t *) (reg));
+ return *((volatile uint32_t *)(reg));
Review Comment:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r990809749
##########
drivers/mtd/mtd_config.c:
##########
@@ -559,8 +559,8 @@ static int mtdconfig_findnextentry(FAR struct mtdconfig_struct_s *dev,
static off_t mtdconfig_ramconsolidate(FAR struct mtdconfig_struct_s *dev)
{
FAR uint8_t *pbuf;
- FAR struct mtdconfig_header_s *phdr;
- struct mtdconfig_header_s hdr;
+ FAR struct mtdconfig_header_s *phdr;
+ struct mtdconfig_header_s hdr;
Review Comment:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r990810100
##########
boards/arm/stm32/omnibusf4/src/stm32_romfs_initialize.c:
##########
@@ -119,7 +119,7 @@ extern const uint8_t romfs_data_end[];
int stm32_romfs_initialize(void)
{
size_t romfs_data_len
Review Comment:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r996471651
##########
drivers/serial/ptmx.c:
##########
@@ -276,7 +277,7 @@ int ptmx_register(void)
{
/* Initialize driver state */
- nxsem_init(&g_ptmx.px_exclsem, 0, 1);
+ nxmutex_init(&g_ptmx.px_lock);
Review Comment:
next patch
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#issuecomment-1279803220
@pkarashchenko do you have more comment for this patch?
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#issuecomment-1278384108
> > The change is already simple and consistent now, it's very error prone and time consuming to split the change into two commit again. @pkarashchenko and I already spend a lot of time to review and refine the change. Please respect our work, especially many code is vendor specific. I already spend many time to improve the code that I don't really use. If you insist I have to drop all code that I don't care about from this patch.
>
> @xiaoxiang781216 @pkarashchenko Thank you for your comments and efforts so far. OK, I understand the current situation. However, when you create a new PR next time, please consider dividing a commit into smaller ones that are independent. Reviewing each commit file will be much easier to find any simple mistake.
Sure, thanks for suggestion.
--
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
[GitHub] [incubator-nuttx] pkarashchenko commented on pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#issuecomment-1259463410
I will review code soon
--
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
[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r983741815
##########
arch/arm/src/cxd56xx/cxd56_adc.c:
##########
@@ -174,7 +174,7 @@ struct cxd56adc_dev_s
struct scufifo_wm_s *wm; /* water mark */
struct math_filter_s *filter; /* math filter */
struct scuev_notify_s * notify; /* notify */
- sem_t exclsem; /* exclusive semaphore */
+ mutex_t excllock; /* exclusive mutex */
Review Comment:
anyway we are changing those names. I do not insist, but that seems to be natural. In `exclsem` it is "exclusive semaphore", but when we move from semaphore to mutex than it is natural to remove `excl` as well
--
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
[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r983741815
##########
arch/arm/src/cxd56xx/cxd56_adc.c:
##########
@@ -174,7 +174,7 @@ struct cxd56adc_dev_s
struct scufifo_wm_s *wm; /* water mark */
struct math_filter_s *filter; /* math filter */
struct scuev_notify_s * notify; /* notify */
- sem_t exclsem; /* exclusive semaphore */
+ mutex_t excllock; /* exclusive mutex */
Review Comment:
anyway we are changing those names
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r983804354
##########
arch/arm/src/cxd56xx/cxd56_adc.c:
##########
@@ -174,7 +174,7 @@ struct cxd56adc_dev_s
struct scufifo_wm_s *wm; /* water mark */
struct math_filter_s *filter; /* math filter */
struct scuev_notify_s * notify; /* notify */
- sem_t exclsem; /* exclusive semaphore */
+ mutex_t excllock; /* exclusive mutex */
Review Comment:
Ok, done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989757760
##########
drivers/video/video_framebuff.c:
##########
@@ -252,7 +251,7 @@ void video_framebuff_capture_done(video_framebuff_t *fbuf)
}
}
-void video_framebuff_change_mode(video_framebuff_t *fbuf,
+void video_framebuff_change_mode(video_framebuff_t *fbuf,
Review Comment:
The whole code bsdrivers/video/video_framebuff.c doesn't add FAR pointer, let's keep as it, or fix it in a new patch.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989773763
##########
drivers/wireless/ieee80211/bcm43xxx/bcmf_utils.h:
##########
@@ -43,8 +41,6 @@
void bcmf_hexdump(uint8_t *data, unsigned int len, unsigned long offset);
Review Comment:
Done
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989756253
##########
drivers/usbmisc/fusb301.c:
##########
@@ -529,7 +530,7 @@ static ssize_t fusb301_read(FAR struct file *filep,
ptr = (struct fusb301_result_s *)buffer;
Review Comment:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989758390
##########
drivers/video/vnc/vnc_updater.c:
##########
@@ -48,6 +48,9 @@
#include <debug.h>
#include <nuttx/queue.h>
+#ifdef VNCSERVER_SEM_DEBUG
+#include <nuttx/mutex.h>
Review Comment:
Done
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989704966
##########
include/nuttx/drivers/rwbuffer.h:
##########
@@ -137,7 +137,7 @@ struct rwbuffer_s
/* This is the state of the read-ahead buffering */
#ifdef CONFIG_DRVR_READAHEAD
- sem_t rhsem; /* Enforces exclusive access to the write buffer */
+ mutex_t rhlock; /* Enforces exclusive access to the write buffer */
uint8_t *rhbuffer; /* Allocated read-ahead buffer */
Review Comment:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989875753
##########
fs/smartfs/smartfs_utils.c:
##########
@@ -1639,7 +1621,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 = (struct smartfs_chain_header_s *)fs->fs_rwbuffer;
Review Comment:
Done
##########
fs/spiffs/src/spiffs_gc.c:
##########
@@ -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 = (int16_t *)fs->lu_work;
Review Comment:
Done
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r990789076
##########
drivers/usbhost/usbhost_xboxcontroller.c:
##########
@@ -234,8 +228,8 @@ static inline int usbhost_tfree(FAR struct usbhost_state_s *priv);
/* struct usbhost_registry_s methods */
static struct usbhost_class_s *
Review Comment:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989792272
##########
fs/procfs/fs_procfs.c:
##########
@@ -383,7 +383,7 @@ static int procfs_open(FAR struct file *filep, FAR const char *relpath,
{
DEBUGASSERT(filep->f_priv);
- ((struct procfs_file_s *) filep->f_priv)->procfsentry =
+ ((struct procfs_file_s *)filep->f_priv)->procfsentry =
Review Comment:
Done
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989882687
##########
fs/smartfs/smartfs_utils.c:
##########
@@ -284,8 +266,8 @@ int smartfs_mount(struct smartfs_mountpt_s *fs, bool writeable)
g_mounthead = fs;
#endif
- fs->fs_rwbuffer = (char *) kmm_malloc(fs->fs_llformat.availbytes);
- fs->fs_workbuffer = (char *) kmm_malloc(WORKBUFFER_SIZE);
+ fs->fs_rwbuffer = (char *)kmm_malloc(fs->fs_llformat.availbytes);
+ fs->fs_workbuffer = (char *)kmm_malloc(WORKBUFFER_SIZE);
Review Comment:
Done
##########
fs/smartfs/smartfs_utils.c:
##########
@@ -260,8 +242,8 @@ int smartfs_mount(struct smartfs_mountpt_s *fs, bool writeable)
if (nextfs == NULL)
{
- fs->fs_rwbuffer = (char *) kmm_malloc(fs->fs_llformat.availbytes);
- fs->fs_workbuffer = (char *) kmm_malloc(WORKBUFFER_SIZE);
+ fs->fs_rwbuffer = (char *)kmm_malloc(fs->fs_llformat.availbytes);
+ fs->fs_workbuffer = (char *)kmm_malloc(WORKBUFFER_SIZE);
Review Comment:
Done
##########
fs/smartfs/smartfs_smart.c:
##########
@@ -2006,26 +1991,26 @@ int smartfs_rename(struct inode *mountpt, const char *oldrelpath,
readwrite.offset = oldentry.doffset;
readwrite.count = sizeof(direntry->flags);
- readwrite.buffer = (uint8_t *) &direntry->flags;
+ readwrite.buffer = (uint8_t *)&direntry->flags;
Review Comment:
Done
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r990720854
##########
fs/rpmsgfs/rpmsgfs.c:
##########
@@ -1059,7 +1042,7 @@ static int rpmsgfs_rewinddir(FAR struct inode *mountpt,
static int rpmsgfs_bind(FAR struct inode *blkdriver, FAR const void *data,
FAR void **handle)
{
- FAR struct rpmsgfs_mountpt_s *fs;
+ FAR struct rpmsgfs_mountpt_s *fs;
FAR const char *cpuname = NULL;
FAR char *options;
char *saveptr;
Review Comment:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r988541776
##########
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:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r988542142
##########
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:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989232712
##########
drivers/sensors/apds9960.c:
##########
@@ -1029,7 +1029,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);
+ (uint8_t *)fifo_data, bytes_read);
Review Comment:
Done
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r988572319
##########
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:
Done.
##########
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:
Done.
--
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
[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989462472
##########
fs/procfs/fs_procfs.c:
##########
@@ -947,7 +947,7 @@ static int procfs_rewinddir(struct inode *mountpt, struct fs_dirent_s *dir)
if (priv->level > 0 && priv->procfsentry == NULL)
{
- priv->index = ((struct procfs_level1_s *) priv)->firstindex;
+ priv->index = ((struct procfs_level1_s *)priv)->firstindex;
Review Comment:
```suggestion
priv->index = ((FAR struct procfs_level1_s *)priv)->firstindex;
```
##########
fs/smartfs/smartfs_procfs.c:
##########
@@ -90,7 +90,7 @@ struct smartfs_file_s
struct smartfs_procfs_entry_s
{
- const char *name; /* Name of the directory entry */
+ const char *name; /* Name of the directory entry */
Review Comment:
```suggestion
FAR const char *name; /* Name of the directory entry */
```
##########
fs/smartfs/smartfs_smart.c:
##########
@@ -763,14 +763,14 @@ static ssize_t smartfs_write(FAR struct file *filep, const char *buffer,
*/
readwrite.offset = 0;
- readwrite.buffer = (uint8_t *) fs->fs_rwbuffer;
+ readwrite.buffer = (uint8_t *)fs->fs_rwbuffer;
Review Comment:
```suggestion
readwrite.buffer = (FAR uint8_t *)fs->fs_rwbuffer;
```
##########
fs/smartfs/smartfs_smart.c:
##########
@@ -802,7 +802,7 @@ static ssize_t smartfs_write(FAR struct file *filep, const char *buffer,
#else /* CONFIG_SMARTFS_USE_SECTOR_BUFFER */
readwrite.offset = sf->curroffset;
readwrite.logsector = sf->currsector;
- readwrite.buffer = (uint8_t *) &buffer[byteswritten];
+ readwrite.buffer = (uint8_t *)&buffer[byteswritten];
Review Comment:
```suggestion
readwrite.buffer = (FAR uint8_t *)&buffer[byteswritten];
```
##########
fs/smartfs/smartfs_utils.c:
##########
@@ -260,8 +242,8 @@ int smartfs_mount(struct smartfs_mountpt_s *fs, bool writeable)
if (nextfs == NULL)
{
- fs->fs_rwbuffer = (char *) kmm_malloc(fs->fs_llformat.availbytes);
- fs->fs_workbuffer = (char *) kmm_malloc(WORKBUFFER_SIZE);
+ fs->fs_rwbuffer = (char *)kmm_malloc(fs->fs_llformat.availbytes);
+ fs->fs_workbuffer = (char *)kmm_malloc(WORKBUFFER_SIZE);
Review Comment:
```suggestion
fs->fs_rwbuffer = (FAR char *)kmm_malloc(fs->fs_llformat.availbytes);
fs->fs_workbuffer = (FAR char *)kmm_malloc(WORKBUFFER_SIZE);
```
##########
fs/smartfs/smartfs_smart.c:
##########
@@ -562,19 +562,19 @@ static ssize_t smartfs_read(FAR struct file *filep, char *buffer,
readwrite.logsector = sf->currsector;
readwrite.offset = 0;
- readwrite.buffer = (uint8_t *) fs->fs_rwbuffer;
+ readwrite.buffer = (uint8_t *)fs->fs_rwbuffer;
readwrite.count = fs->fs_llformat.availbytes;
ret = FS_IOCTL(fs, BIOC_READSECT, (unsigned long) &readwrite);
Review Comment:
```suggestion
ret = FS_IOCTL(fs, BIOC_READSECT, (unsigned long)&readwrite);
```
##########
fs/smartfs/smartfs_utils.c:
##########
@@ -1649,7 +1631,7 @@ off_t smartfs_seek_internal(FAR struct smartfs_mountpt_s *fs,
readwrite.logsector = sf->currsector;
readwrite.offset = 0;
readwrite.count = sizeof(struct smartfs_chain_header_s);
- readwrite.buffer = (uint8_t *) fs->fs_rwbuffer;
+ readwrite.buffer = (uint8_t *)fs->fs_rwbuffer;
Review Comment:
```suggestion
readwrite.buffer = (FAR uint8_t *)fs->fs_rwbuffer;
```
##########
fs/smartfs/smartfs.h:
##########
@@ -33,7 +33,7 @@
#include <nuttx/mtd/mtd.h>
#include <nuttx/fs/smart.h>
-#include <nuttx/semaphore.h>
+#include <nuttx/mutex.h>
Review Comment:
Why do we need this include here?
##########
fs/rpmsgfs/rpmsgfs.c:
##########
@@ -308,21 +291,21 @@ static int rpmsgfs_open(FAR struct file *filep, FAR const char *relpath,
DEBUGASSERT(fs != NULL);
- /* Take the semaphore */
+ /* Take the lock */
- ret = rpmsgfs_semtake(fs);
+ ret = nxmutex_lock(&fs->fs_lock);
if (ret < 0)
{
return ret;
}
/* Allocate memory for the open file */
- hf = (struct rpmsgfs_ofile_s *) kmm_malloc(sizeof *hf);
+ hf = (struct rpmsgfs_ofile_s *)kmm_malloc(sizeof *hf);
Review Comment:
```suggestion
hf = (FAR struct rpmsgfs_ofile_s *)kmm_malloc(sizeof *hf);
```
##########
fs/procfs/fs_procfs.c:
##########
@@ -383,7 +383,7 @@ static int procfs_open(FAR struct file *filep, FAR const char *relpath,
{
DEBUGASSERT(filep->f_priv);
- ((struct procfs_file_s *) filep->f_priv)->procfsentry =
+ ((struct procfs_file_s *)filep->f_priv)->procfsentry =
Review Comment:
```suggestion
((FAR struct procfs_file_s *)filep->f_priv)->procfsentry =
```
##########
fs/smartfs/smartfs_smart.c:
##########
@@ -340,7 +340,7 @@ static int smartfs_open(FAR struct file *filep, const char *relpath,
readwrite.logsector = sf->currsector;
readwrite.offset = 0;
readwrite.count = fs->fs_llformat.availbytes;
- readwrite.buffer = (uint8_t *) sf->buffer;
+ readwrite.buffer = (uint8_t *)sf->buffer;
Review Comment:
```suggestion
readwrite.buffer = (FAR uint8_t *)sf->buffer;
```
##########
fs/smartfs/smartfs_smart.c:
##########
@@ -562,19 +562,19 @@ static ssize_t smartfs_read(FAR struct file *filep, char *buffer,
readwrite.logsector = sf->currsector;
readwrite.offset = 0;
- readwrite.buffer = (uint8_t *) fs->fs_rwbuffer;
+ readwrite.buffer = (uint8_t *)fs->fs_rwbuffer;
Review Comment:
```suggestion
readwrite.buffer = (FAR uint8_t *)fs->fs_rwbuffer;
```
##########
fs/smartfs/smartfs_smart.c:
##########
@@ -693,15 +693,15 @@ static ssize_t smartfs_write(FAR struct file *filep, const char *buffer,
if (ret < 0)
{
ret = -EIO;
- goto errout_with_semaphore;
+ goto errout_with_lock;
}
}
/* First test if we are overwriting an existing location or writing to
* a new one.
*/
- header = (struct smartfs_chain_header_s *) fs->fs_rwbuffer;
+ header = (struct smartfs_chain_header_s *)fs->fs_rwbuffer;
Review Comment:
```suggestion
header = (FAR struct smartfs_chain_header_s *)fs->fs_rwbuffer;
```
##########
fs/smartfs/smartfs_smart.c:
##########
@@ -714,7 +714,7 @@ static ssize_t smartfs_write(FAR struct file *filep, const char *buffer,
readwrite.offset = sf->curroffset;
readwrite.logsector = sf->currsector;
- readwrite.buffer = (uint8_t *) &buffer[byteswritten];
+ readwrite.buffer = (uint8_t *)&buffer[byteswritten];
Review Comment:
```suggestion
readwrite.buffer = (FAR uint8_t *)&buffer[byteswritten];
```
##########
fs/vfs/fs_timerfd.c:
##########
@@ -282,10 +284,10 @@ static int timerfd_blocking_io(FAR struct timerfd_priv_s *dev,
if (ret < 0)
{
/* Interrupted wait, unregister semaphore
- * TODO ensure that exclsem wait does not fail (ECANCELED)
+ * TODO ensure that lock wait does not fail (ECANCELED)
*/
- nxsem_wait_uninterruptible(&dev->exclsem);
+ nxmutex_lock(&dev->lock);
timerfd_waiter_sem_t *cur_sem = *slist;
Review Comment:
```suggestion
FAR timerfd_waiter_sem_t *cur_sem = *slist;
```
##########
fs/smartfs/smartfs_smart.c:
##########
@@ -902,22 +902,22 @@ static ssize_t smartfs_write(FAR struct file *filep, const char *buffer,
if (ret < 0)
{
ferr("ERROR: Error %d allocating new sector\n", ret);
- goto errout_with_semaphore;
+ goto errout_with_lock;
}
/* Copy the new sector to the old one and chain it */
- header = (struct smartfs_chain_header_s *) fs->fs_rwbuffer;
+ header = (struct smartfs_chain_header_s *)fs->fs_rwbuffer;
Review Comment:
```suggestion
header = (FAR struct smartfs_chain_header_s *)fs->fs_rwbuffer;
```
##########
include/nuttx/drivers/rwbuffer.h:
##########
@@ -127,7 +127,7 @@ struct rwbuffer_s
/* This is the state of the write buffering */
#ifdef CONFIG_DRVR_WRITEBUFFER
- sem_t wrsem; /* Enforces exclusive access to the write buffer */
+ mutex_t wrlock; /* Enforces exclusive access to the write buffer */
struct work_s work; /* Delayed work to flush buffer after a delay with no activity */
uint8_t *wrbuffer; /* Allocated write buffer */
Review Comment:
```suggestion
FAR uint8_t *wrbuffer; /* Allocated write buffer */
```
##########
fs/smartfs/smartfs_smart.c:
##########
@@ -1337,7 +1337,7 @@ static int smartfs_readdir(FAR struct inode *mountpt,
ret = FS_IOCTL(fs, BIOC_READSECT, (unsigned long) &readwrite);
Review Comment:
```suggestion
ret = FS_IOCTL(fs, BIOC_READSECT, (unsigned long)&readwrite);
```
##########
include/nuttx/wireless/ieee80211/bcmf_gspi.h:
##########
@@ -60,32 +61,32 @@ typedef struct gspi_dev_s
* following fields before calling gspi_register.
*/
- FAR int (*init) (FAR struct gspi_dev_s *gspi);
+ FAR int (*init) (FAR struct gspi_dev_s *gspi);
Review Comment:
```suggestion
CODE int (*init) (FAR struct gspi_dev_s *gspi);
```
##########
include/nuttx/analog/dac.h:
##########
@@ -127,14 +128,14 @@ struct dac_ops_s
struct dac_dev_s
{
- const struct dac_ops_s *ad_ops; /* Arch-specific operations */
- void *ad_priv; /* Used by the arch-specific logic */
- uint8_t ad_ocount; /* The number of times the device has
- * been opened */
- uint8_t ad_nchannel; /* Number of dac channel */
- sem_t ad_closesem; /* Locks out new opens while close is
- * in progress */
- struct dac_fifo_s ad_xmit; /* Describes receive FIFO */
+ const struct dac_ops_s *ad_ops; /* Arch-specific operations */
+ void *ad_priv; /* Used by the arch-specific logic */
Review Comment:
```suggestion
FAR const struct dac_ops_s *ad_ops; /* Arch-specific operations */
FAR void *ad_priv; /* Used by the arch-specific logic */
```
##########
fs/smartfs/smartfs_smart.c:
##########
@@ -763,14 +763,14 @@ static ssize_t smartfs_write(FAR struct file *filep, const char *buffer,
*/
readwrite.offset = 0;
- readwrite.buffer = (uint8_t *) fs->fs_rwbuffer;
+ readwrite.buffer = (uint8_t *)fs->fs_rwbuffer;
readwrite.count = sizeof(struct smartfs_chain_header_s);
ret = FS_IOCTL(fs, BIOC_READSECT, (unsigned long) &readwrite);
Review Comment:
```suggestion
ret = FS_IOCTL(fs, BIOC_READSECT, (unsigned long)&readwrite);
```
##########
libs/libc/audio/lib_buffer.c:
##########
@@ -85,9 +55,9 @@ static void apb_semtake(FAR struct ap_buffer_s *apb)
int apb_alloc(FAR struct audio_buf_desc_s *bufdesc)
{
- uint32_t bufsize;
- int ret;
- struct ap_buffer_s *apb;
+ uint32_t bufsize;
+ int ret;
+ struct ap_buffer_s *apb;
Review Comment:
```suggestion
FAR struct ap_buffer_s *apb;
```
##########
fs/smartfs/smartfs_smart.c:
##########
@@ -902,22 +902,22 @@ static ssize_t smartfs_write(FAR struct file *filep, const char *buffer,
if (ret < 0)
{
ferr("ERROR: Error %d allocating new sector\n", ret);
- goto errout_with_semaphore;
+ goto errout_with_lock;
}
/* Copy the new sector to the old one and chain it */
- header = (struct smartfs_chain_header_s *) fs->fs_rwbuffer;
+ header = (struct smartfs_chain_header_s *)fs->fs_rwbuffer;
SMARTFS_SET_NEXTSECTOR(header, ret);
readwrite.offset = offsetof(struct smartfs_chain_header_s,
nextsector);
- readwrite.buffer = (uint8_t *) header->nextsector;
+ readwrite.buffer = (uint8_t *)header->nextsector;
Review Comment:
```suggestion
readwrite.buffer = (FAR uint8_t *)header->nextsector;
```
##########
include/nuttx/contactless/pn532.h:
##########
@@ -57,8 +57,8 @@ struct pn532_config_s
/* External CS, if NULL then SPIDEV_WIRELESS(n) CS is used */
- int (*select)(struct pn532_dev_s *dev, bool sel);
- int (*irqattach)(void *dev, xcpt_t isr);
+ int (*select)(FAR truct pn532_dev_s *dev, bool sel);
+ int (*irqattach)(FAR void *dev, xcpt_t isr);
Review Comment:
```suggestion
CODE int (*select)(FAR truct pn532_dev_s *dev, bool sel);
CODE int (*irqattach)(FAR void *dev, xcpt_t isr);
```
##########
fs/smartfs/smartfs_smart.c:
##########
@@ -562,19 +562,19 @@ static ssize_t smartfs_read(FAR struct file *filep, char *buffer,
readwrite.logsector = sf->currsector;
readwrite.offset = 0;
- readwrite.buffer = (uint8_t *) fs->fs_rwbuffer;
+ readwrite.buffer = (uint8_t *)fs->fs_rwbuffer;
readwrite.count = fs->fs_llformat.availbytes;
ret = FS_IOCTL(fs, BIOC_READSECT, (unsigned long) &readwrite);
if (ret < 0)
{
ferr("ERROR: Error %d reading sector %d data\n",
ret, sf->currsector);
- goto errout_with_semaphore;
+ goto errout_with_lock;
}
/* Point header to the read data to get used byte count */
- header = (struct smartfs_chain_header_s *) fs->fs_rwbuffer;
+ header = (struct smartfs_chain_header_s *)fs->fs_rwbuffer;
Review Comment:
```suggestion
header = (FAR struct smartfs_chain_header_s *)fs->fs_rwbuffer;
```
##########
fs/smartfs/smartfs_smart.c:
##########
@@ -1406,22 +1406,22 @@ static int smartfs_readdir(FAR struct inode *mountpt,
sdir->fs_curroffset =
sizeof(struct smartfs_chain_header_s);
- header = (struct smartfs_chain_header_s *) fs->fs_rwbuffer;
+ header = (struct smartfs_chain_header_s *)fs->fs_rwbuffer;
Review Comment:
```suggestion
header = (FAR struct smartfs_chain_header_s *)fs->fs_rwbuffer;
```
##########
include/nuttx/drivers/rwbuffer.h:
##########
@@ -137,7 +137,7 @@ struct rwbuffer_s
/* This is the state of the read-ahead buffering */
#ifdef CONFIG_DRVR_READAHEAD
- sem_t rhsem; /* Enforces exclusive access to the write buffer */
+ mutex_t rhlock; /* Enforces exclusive access to the write buffer */
uint8_t *rhbuffer; /* Allocated read-ahead buffer */
Review Comment:
```suggestion
FAR uint8_t *rhbuffer; /* Allocated read-ahead buffer */
```
##########
fs/smartfs/smartfs_smart.c:
##########
@@ -1977,21 +1962,21 @@ int smartfs_rename(struct inode *mountpt, const char *oldrelpath,
NULL);
if (ret != OK)
{
- goto errout_with_semaphore;
+ goto errout_with_lock;
}
/* Now mark the old entry as inactive */
readwrite.logsector = oldentry.dsector;
readwrite.offset = 0;
readwrite.count = fs->fs_llformat.availbytes;
- readwrite.buffer = (uint8_t *) fs->fs_rwbuffer;
+ readwrite.buffer = (uint8_t *)fs->fs_rwbuffer;
Review Comment:
```suggestion
readwrite.buffer = (FAR uint8_t *)fs->fs_rwbuffer;
```
##########
fs/smartfs/smartfs_smart.c:
##########
@@ -902,22 +902,22 @@ static ssize_t smartfs_write(FAR struct file *filep, const char *buffer,
if (ret < 0)
{
ferr("ERROR: Error %d allocating new sector\n", ret);
- goto errout_with_semaphore;
+ goto errout_with_lock;
}
/* Copy the new sector to the old one and chain it */
- header = (struct smartfs_chain_header_s *) fs->fs_rwbuffer;
+ header = (struct smartfs_chain_header_s *)fs->fs_rwbuffer;
SMARTFS_SET_NEXTSECTOR(header, ret);
readwrite.offset = offsetof(struct smartfs_chain_header_s,
nextsector);
- readwrite.buffer = (uint8_t *) header->nextsector;
+ readwrite.buffer = (uint8_t *)header->nextsector;
readwrite.count = sizeof(uint16_t);
ret = FS_IOCTL(fs, BIOC_WRITESECT, (unsigned long) &readwrite);
Review Comment:
```suggestion
ret = FS_IOCTL(fs, BIOC_WRITESECT, (unsigned long)&readwrite);
```
##########
fs/smartfs/smartfs_utils.c:
##########
@@ -405,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 = (char *)0xdeadbeef;
+ fs->fs_workbuffer = (char *)0xdeadbeef;
Review Comment:
```suggestion
fs->fs_rwbuffer = (FAR char *)0xdeadbeef;
fs->fs_workbuffer = (FAR char *)0xdeadbeef;
```
##########
fs/smartfs/smartfs_utils.c:
##########
@@ -284,8 +266,8 @@ int smartfs_mount(struct smartfs_mountpt_s *fs, bool writeable)
g_mounthead = fs;
#endif
- fs->fs_rwbuffer = (char *) kmm_malloc(fs->fs_llformat.availbytes);
- fs->fs_workbuffer = (char *) kmm_malloc(WORKBUFFER_SIZE);
+ fs->fs_rwbuffer = (char *)kmm_malloc(fs->fs_llformat.availbytes);
+ fs->fs_workbuffer = (char *)kmm_malloc(WORKBUFFER_SIZE);
Review Comment:
```suggestion
fs->fs_rwbuffer = (FAR char *)kmm_malloc(fs->fs_llformat.availbytes);
fs->fs_workbuffer = (FAR char *)kmm_malloc(WORKBUFFER_SIZE);
```
##########
fs/smartfs/smartfs_smart.c:
##########
@@ -2006,26 +1991,26 @@ int smartfs_rename(struct inode *mountpt, const char *oldrelpath,
readwrite.offset = oldentry.doffset;
readwrite.count = sizeof(direntry->flags);
- readwrite.buffer = (uint8_t *) &direntry->flags;
+ readwrite.buffer = (uint8_t *)&direntry->flags;
Review Comment:
```suggestion
readwrite.buffer = (FAR uint8_t *)&direntry->flags;
```
##########
fs/smartfs/smartfs_utils.c:
##########
@@ -597,7 +579,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 = (struct smartfs_chain_header_s *)fs->fs_rwbuffer;
Review Comment:
```suggestion
header = (FAR struct smartfs_chain_header_s *)fs->fs_rwbuffer;
```
##########
fs/smartfs/smartfs_utils.c:
##########
@@ -1121,15 +1103,15 @@ int smartfs_createentry(FAR struct smartfs_mountpt_s *fs,
int smartfs_deleteentry(struct smartfs_mountpt_s *fs,
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;
+ struct smartfs_entry_header_s *direntry;
+ struct smartfs_chain_header_s *header;
Review Comment:
```suggestion
FAR struct smartfs_entry_header_s *direntry;
FAR struct smartfs_chain_header_s *header;
```
##########
fs/smartfs/smartfs_utils.c:
##########
@@ -880,7 +862,7 @@ 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;
+ readwrite.buffer = (uint8_t *)fs->fs_rwbuffer;
Review Comment:
```suggestion
readwrite.buffer = (FAR uint8_t *)fs->fs_rwbuffer;
```
##########
fs/smartfs/smartfs_smart.c:
##########
@@ -1406,22 +1406,22 @@ static int smartfs_readdir(FAR struct inode *mountpt,
sdir->fs_curroffset =
sizeof(struct smartfs_chain_header_s);
- header = (struct smartfs_chain_header_s *) fs->fs_rwbuffer;
+ header = (struct smartfs_chain_header_s *)fs->fs_rwbuffer;
sdir->fs_currsector = SMARTFS_NEXTSECTOR(header);
}
/* Now exit */
ret = OK;
- goto errout_with_semaphore;
+ goto errout_with_lock;
}
/* No more entries in this sector. Move on to next sector and
* continue the search. If no more sectors, then we are all
* done and will report ENOENT.
*/
- header = (struct smartfs_chain_header_s *) fs->fs_rwbuffer;
+ header = (struct smartfs_chain_header_s *)fs->fs_rwbuffer;
Review Comment:
```suggestion
header = (FAR struct smartfs_chain_header_s *)fs->fs_rwbuffer;
```
##########
fs/smartfs/smartfs_utils.c:
##########
@@ -1121,15 +1103,15 @@ int smartfs_createentry(FAR struct smartfs_mountpt_s *fs,
int smartfs_deleteentry(struct smartfs_mountpt_s *fs,
struct smartfs_entry_s *entry)
Review Comment:
```suggestion
int smartfs_deleteentry(FAR struct smartfs_mountpt_s *fs,
FAR struct smartfs_entry_s *entry)
```
##########
fs/smartfs/smartfs_smart.c:
##########
@@ -846,20 +846,20 @@ static ssize_t smartfs_write(FAR struct file *filep, const char *buffer,
if (ret < 0)
{
ferr("ERROR: Error %d allocating new sector\n", ret);
- goto errout_with_semaphore;
+ goto errout_with_lock;
}
/* Copy the new sector to the old one and chain it */
- header = (struct smartfs_chain_header_s *) sf->buffer;
+ header = (struct smartfs_chain_header_s *)sf->buffer;
Review Comment:
```suggestion
header = (FAR struct smartfs_chain_header_s *)sf->buffer;
```
##########
fs/spiffs/src/spiffs_core.c:
##########
@@ -1191,7 +1191,7 @@ int spiffs_page_move(FAR struct spiffs_s *fs,
*dst_pgndx = free_pgndx;
}
- phdr = page_data ? (struct spiffs_page_header_s *) page_data : page_hdr;
+ phdr = page_data ? (struct spiffs_page_header_s *)page_data : page_hdr;
Review Comment:
```suggestion
phdr = page_data ? (FAR struct spiffs_page_header_s *)page_data : page_hdr;
```
##########
fs/smartfs/smartfs_utils.c:
##########
@@ -889,7 +871,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 = (struct smartfs_chain_header_s *)fs->fs_rwbuffer;
Review Comment:
```suggestion
chainheader = (FAR struct smartfs_chain_header_s *)fs->fs_rwbuffer;
```
##########
fs/spiffs/src/spiffs_core.c:
##########
@@ -183,7 +183,7 @@ static int spiffs_page_index_check(FAR struct spiffs_s *fs,
#ifdef CONFIG_SPIFFS_PAGE_CHECK
ret = spiffs_cache_read(fs, SPIFFS_OP_T_OBJNDX | SPIFFS_OP_C_READ,
fobj->objid, SPIFFS_PAGE_TO_PADDR(fs, pgndx),
- sizeof(struct spiffs_page_header_s), (uint8_t *) & ph);
+ sizeof(struct spiffs_page_header_s), (uint8_t *)&ph);
Review Comment:
```suggestion
sizeof(struct spiffs_page_header_s), (FAR uint8_t *)&ph);
```
##########
fs/smartfs/smartfs_utils.c:
##########
@@ -2030,7 +2012,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 = (struct smartfs_chain_header_s *)sf->buffer;
Review Comment:
```suggestion
header = (FAR struct smartfs_chain_header_s *)sf->buffer;
```
##########
fs/smartfs/smartfs_utils.c:
##########
@@ -1639,7 +1621,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 = (struct smartfs_chain_header_s *)fs->fs_rwbuffer;
Review Comment:
```suggestion
header = (FAR struct smartfs_chain_header_s *)fs->fs_rwbuffer;
```
##########
fs/vfs/fs_timerfd.c:
##########
@@ -61,7 +62,7 @@ typedef struct timerfd_waiter_sem_s
struct timerfd_priv_s
{
- sem_t exclsem; /* Enforces device exclusive access */
+ mutex_t lock; /* Enforces device exclusive access */
timerfd_waiter_sem_t *rdsems; /* List of blocking readers */
Review Comment:
```suggestion
FAR timerfd_waiter_sem_t *rdsems; /* List of blocking readers */
```
##########
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 = (int16_t *)fs->lu_work;
Review Comment:
```suggestion
FAR int16_t *objlu_buf = (FAR int16_t *)fs->lu_work;
```
##########
fs/vfs/fs_eventfd.c:
##########
@@ -50,7 +50,7 @@ typedef struct eventfd_waiter_sem_s
struct eventfd_priv_s
{
- sem_t exclsem; /* Enforces device exclusive access */
+ mutex_t lock; /* Enforces device exclusive access */
eventfd_waiter_sem_t *rdsems; /* List of blocking readers */
eventfd_waiter_sem_t *wrsems; /* List of blocking writers */
Review Comment:
```suggestion
FAR eventfd_waiter_sem_t *rdsems; /* List of blocking readers */
FAR eventfd_waiter_sem_t *wrsems; /* List of blocking writers */
```
##########
fs/spiffs/src/spiffs_gc.c:
##########
@@ -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 = (int16_t *)fs->lu_work;
Review Comment:
```suggestion
FAR int16_t *objlu_buf = (FAR int16_t *)fs->lu_work;
```
##########
graphics/nxterm/nxterm.h:
##########
@@ -110,7 +110,7 @@ struct nxterm_state_s
FAR const struct nxterm_operations_s *ops; /* Window operations */
FAR void *handle; /* The window handle */
FAR struct nxterm_window_s wndo; /* Describes the window and font */
Review Comment:
```suggestion
struct nxterm_window_s wndo; /* Describes the window and font */
```
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#issuecomment-1276274881
> Let me take an effort and separate FAR and some style changes and submit as a separate PR. I will need a couple of days based on my current work load
I find a method to retrieve the previous revision:
```
git reflog anjiahao/nxmutex
84f46b474a (anjiahao/nxmutex, nxmutex) refs/remotes/anjiahao/nxmutex@{0}: update by push
36c31b0de3 refs/remotes/anjiahao/nxmutex@{1}: update by push
6e1eacf541 refs/remotes/anjiahao/nxmutex@{2}: update by push
0e6fe2b14b refs/remotes/anjiahao/nxmutex@{3}: update by push
1d74f75b5b refs/remotes/anjiahao/nxmutex@{4}: update by push
a3b457edb2 refs/remotes/anjiahao/nxmutex@{5}: update by push
cbfdf155ab refs/remotes/anjiahao/nxmutex@{6}: update by push
```
let me try to separate.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#issuecomment-1275621697
> @xiaoxiang781216 As for style changes, I think you can create another PR, and after the PR is merged then rebase this PR. The result would be much simpler to review.
But, the initial version doesn't exist in my local git anymore. If I can't retrieve the initial/early version of this patch from github, it's very hard and error prone to split the stye change from this current patch. That's why I ask the question how to retrieve the old revision from github.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r988527901
##########
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:
Done.
--
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
[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989315174
##########
drivers/mtd/smart.c:
##########
@@ -736,8 +736,8 @@ int smart_checkfree(FAR struct smart_struct_s *dev, int lineno)
uint16_t blockrelease;
static uint16_t prev_freesectors = 0;
static uint16_t prev_releasesectors = 0;
- static uint8_t *prev_freecount = NULL;
- static uint8_t *prev_releasecount = NULL;
+ static uint8_t *prev_freecount = NULL;
+ static uint8_t *prev_releasecount = NULL;
Review Comment:
```suggestion
static FAR uint8_t *prev_freecount = NULL;
static FAR uint8_t *prev_releasecount = NULL;
```
##########
drivers/mtd/smart.c:
##########
@@ -4150,7 +4150,7 @@ static int smart_write_wearstatus(struct smart_struct_s *dev)
if (dev->uneven_wearcount != 0)
{
- *((uint32_t *) &buffer[4]) = dev->uneven_wearcount;
+ *((uint32_t *)&buffer[4]) = dev->uneven_wearcount;
Review Comment:
```suggestion
*((FAR uint32_t *)&buffer[4]) = dev->uneven_wearcount;
```
##########
wireless/ieee802154/mac802154_internal.h:
##########
@@ -510,62 +511,12 @@ void mac802154_notify(FAR struct ieee802154_privmac_s *priv,
/* General helpers **********************************************************/
-#define mac802154_givesem(s) nxsem_post(s)
-
-static inline int mac802154_takesem(sem_t *sem, bool allowinterrupt)
-{
- if (allowinterrupt)
- {
- return nxsem_wait(sem);
- }
- else
- {
- return nxsem_wait_uninterruptible(sem);
- }
-}
-
-#ifdef CONFIG_MAC802154_LOCK_VERBOSE
-#define mac802154_unlock(dev) \
- mac802154_givesem(&dev->exclsem); \
- wlinfo("MAC unlocked\n");
-#else
-#define mac802154_unlock(dev) \
- mac802154_givesem(&dev->exclsem);
-#endif
-
-#define mac802154_lock(dev, allowinterrupt) \
- mac802154_lockpriv(dev, allowinterrupt, __FUNCTION__)
-
-static inline int
-mac802154_lockpriv(FAR struct ieee802154_privmac_s *dev,
- bool allowinterrupt, FAR const char *funcname)
-{
Review Comment:
I think this changes the logic significantly since driver was allowing to handle signal interrupt. I'm not sure if such situation is relevant for kernel at all and this driver does not seems to run as a user space application. So anyway seems to be fine to use nxmutex instead
##########
wireless/ieee802154/mac802154_netdev.c:
##########
@@ -362,7 +363,7 @@ static int macnet_notify(FAR struct mac802154_maccb_s *maccb,
* back to trying to get access again
*/
- while (nxsem_wait(&priv->md_exclsem) < 0);
+ while (nxmutex_lock(&priv->md_lock) < 0);
Review Comment:
is while really needed here? is it intended to handle ECANCEL?
##########
arch/arm/src/a1x/hardware/a10_memorymap.h:
##########
@@ -502,7 +502,7 @@
* LI PAGE TABLE
* ADDRESS RANGE SIZE ENTRIES SECTIONS
* ----------------------- ------- -------------- ---------
- * 0xc000:0000-0xffef:ffff 1022MB *0x3000-0x3ff8 1022
+ * 0xc000:0000-0xffef:ffff 1022MB 0x3000-0x3ff8 1022
Review Comment:
Please fix inclusion of board_memorymap.h
##########
drivers/mtd/smart.c:
##########
@@ -211,7 +211,7 @@ struct smart_cache_s
#ifdef CONFIG_MTD_SMART_ENABLE_CRC
struct smart_allocsector_s
{
- struct smart_allocsector_s *next; /* Pointer to next alloc sector */
+ struct smart_allocsector_s *next; /* Pointer to next alloc sector */
Review Comment:
```suggestion
FAR struct smart_allocsector_s *next; /* Pointer to next alloc sector */
```
##########
drivers/mtd/smart.c:
##########
@@ -1375,9 +1375,9 @@ static int smart_setsectorsize(FAR struct smart_struct_s *dev, uint16_t size)
****************************************************************************/
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)
Review Comment:
```suggestion
int nbytes, FAR const uint8_t *buffer)
```
##########
libs/libc/stdio/lib_rewind.c:
##########
@@ -46,8 +46,8 @@ void rewind(FAR FILE *stream)
return;
}
- lib_take_semaphore(stream);
+ lib_take_lock(stream);
(void) fseek(stream, 0L, SEEK_SET);
Review Comment:
```suggestion
(void)fseek(stream, 0L, SEEK_SET);
```
##########
drivers/mtd/smart.c:
##########
@@ -4271,11 +4271,11 @@ 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 = *((uint32_t *)&buffer[4]);
Review Comment:
```suggestion
dev->uneven_wearcount = *((FAR uint32_t *)&buffer[4]);
```
##########
mm/mm_heap/mm_free.c:
##########
@@ -84,10 +84,10 @@ void mm_free(FAR struct mm_heap_s *heap, FAR void *mem)
return;
}
- if (mm_takesemaphore(heap) == false)
+ if (mm_lock(heap) == false)
Review Comment:
```suggestion
if (!mm_lock(heap))
```
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r991414701
##########
drivers/audio/vs1053.c:
##########
@@ -1280,7 +1280,7 @@ static int vs1053_dreq_isr(int irq, FAR void *context, FAR void *arg)
static void *vs1053_workerthread(pthread_addr_t pvarg)
Review Comment:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r996470518
##########
wireless/bluetooth/bt_ioctl.c:
##########
@@ -628,7 +629,7 @@ int btnet_ioctl(FAR struct net_driver_s *netdev, int cmd, unsigned long arg)
if (ret < 0)
{
- nxsem_destroy(&g_scanstate.bs_exclsem);
+ nxmutex_destroy(&g_scanstate.bs_lock);
Review Comment:
next patch
--
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
[GitHub] [incubator-nuttx] masayuki2009 commented on pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#issuecomment-1279032868
>@pkarashchenko @masayuki2009 @jerpelea all comment get addressed, please review again.
@xiaoxiang781216
I think it would be better to merge the following style change in the second commit into the first commit because the first commit also changes the lines.
```
diff --git a/arch/arm/src/cxd56xx/cxd56_udmac.c b/arch/arm/src/cxd56xx/cxd56_udmac.c
index 69d2c87aa0..6a490e9cd0 100644
--- a/arch/arm/src/cxd56xx/cxd56_udmac.c
+++ b/arch/arm/src/cxd56xx/cxd56_udmac.c
@@ -68,8 +68,8 @@ struct dma_channel_s
struct dma_controller_s
{
- mutex_t lock; /* Protects channel table */
- sem_t chansem; /* Count of free channels */
+ mutex_t lock; /* Protects channel table */
+ sem_t chansem; /* Count of free channels */
};
```
Also, I can see similar changes in the second commit.
```
diff --git a/arch/arm/src/rp2040/rp2040_dmac.c b/arch/arm/src/rp2040/rp2040_dmac.c
index 1604c9d829..7d54c70124 100644
--- a/arch/arm/src/rp2040/rp2040_dmac.c
+++ b/arch/arm/src/rp2040/rp2040_dmac.c
@@ -62,8 +62,8 @@ struct dma_channel_s
struct dma_controller_s
{
- mutex_t lock; /* Protects channel table */
- sem_t chansem; /* Count of free channels */
+ mutex_t lock; /* Protects channel table */
+ sem_t chansem; /* Count of free channels */
};
```
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#issuecomment-1274675439
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#issuecomment-1277670039
> @xiaoxiang781216
>
> > As I said before, this patch want to distinguish sem_t usage which contain two part:
>
> I think the two parts are independent and if the commit is split into two commits, it would be easier to read.
The change is already simple and consistent now, it's very error prone and time consuming to split the change into two commit again. @pkarashchenko and I already spend a lot of time to review and refine the change. Please respect our work.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#issuecomment-1276265560
> At least, you need to test with `CONFIG_DEBUG_ASSERTIONS=y`
Ok, the problem is nxrmutex_breaklock forget to clear ret value:
https://github.com/apache/incubator-nuttx/pull/6965/files#diff-8f94a783bf92ca637d929226ed048a878be0030b9f88720844f9b1e63e3f594bR529
--
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
[GitHub] [incubator-nuttx] masayuki2009 commented on pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#issuecomment-1274750655
@anjiahao1
This PR contains only one big commit.
Please divide the commit into smaller ones (e.g. style changes, etc)
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r996460258
##########
drivers/sensors/qencoder.c:
##########
@@ -409,7 +409,7 @@ int qe_register(FAR const char *devpath, FAR struct qe_lowerhalf_s *lower)
* (it was already zeroed by kmm_zalloc())
*/
- nxsem_init(&upper->exclsem, 0, 1);
+ nxmutex_init(&upper->lock);
Review Comment:
I prefer that:
1. Keep ignore the error may be returned by register_driver if the origin code doesn't check it
2. Call nxmutex_destroy if the origin code free memory in case register_driver return fail
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r996469192
##########
libs/libc/wqueue/work_usrthread.c:
##########
@@ -281,7 +280,7 @@ int work_usrstart(void)
/* Set up the work queue lock */
- _SEM_INIT(&g_usrwork.lock, 0, 1);
+ nxmutex_init(&g_usrwork.lock);
Review Comment:
next patch
--
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
[GitHub] [incubator-nuttx] masayuki2009 commented on pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#issuecomment-1276084714
`sim:usrsocktest` with `CONFIG_DEBUG_ASSERTIONS=y` failed.
```
up_assert: Assertion failed at file:/mnt/m2ssd/opensource/github_anjiahao1/nuttx/include/nuttx/mutex.h line: 489 task: nsh_main
```
--
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
[GitHub] [incubator-nuttx] masayuki2009 commented on pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#issuecomment-1278259748
>The change is already simple and consistent now, it's very error prone and time consuming to split the change into two commit again. @pkarashchenko and I already spend a lot of time to review and refine the change. Please respect our work, especially many code is vendor specific. I already spend many time to improve the code that I don't really use. If you insist I have to drop all code that I don't care about from this patch.
@xiaoxiang781216 @pkarashchenko
Thank you for your comments and efforts so far. OK, I understand the current situation.
However, when you create a new PR next time, please consider dividing a commit into smaller ones that are independent.
Reviewing each commit file will be much easier to find any simple mistake.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r991417742
##########
drivers/audio/vs1053.c:
##########
@@ -1210,7 +1210,7 @@ static void vs1053_feeddata(FAR struct vs1053_struct_s *dev)
/* Pop the next entry */
- apb = (struct ap_buffer_s *) dq_remfirst(&dev->apbq);
+ apb = (struct ap_buffer_s *)dq_remfirst(&dev->apbq);
Review Comment:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r990721134
##########
drivers/input/mxt.c:
##########
@@ -1532,10 +1523,10 @@ 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)
Review Comment:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#issuecomment-1270540561
> With each new push 100-200 new files are modified. I'm feeling that I can't pursuit that and getting far and far away from completing this review
Since your suggestion may suitable for other source files, I grep the whole code base and apply the suggestion to all possible place. That's why the touch file become larger in each iteration. The good news is that all common issue is fixed, the list shouldn't increase anymore:).
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989384076
##########
arch/arm/src/phy62xx/mcu.h:
##########
@@ -82,7 +82,7 @@
#define subWriteReg(addr,high,low,value) write_reg(addr, ((read_reg(addr)) & (~((((unsigned int)1<<((high)-(low)+1))-1)<<(low)))) | ((unsigned int)(value)<<(low)))
#define TIME_BASE (0x003fffff) /* 24bit count shift 2 bit as 1us/bit */
-#define TIME_DELTA(x,y) ( (x>=y) ? x-y : TIME_BASE-y+x )
+#define TIME_DELTA(x,y) ((x>=y) ? x-y : TIME_BASE-y+x)
Review Comment:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989384576
##########
arch/arm/src/stm32/stm32_hrtim.h:
##########
@@ -1020,9 +1020,9 @@ struct stm32_hrtim_ops_s
uint64_t (*fclk_get)(struct hrtim_dev_s *dev, uint8_t timer);
int (*soft_update)(struct hrtim_dev_s *dev, uint8_t timer);
int (*soft_reset)(struct hrtim_dev_s *dev, uint8_t timer);
- int (*freq_set)(struct hrtim_dev_s *dev, uint8_t timer,
+ int (*freq_set)(struct hrtim_dev_s *dev, uint8_t timer,
uint64_t freq);
Review Comment:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989705162
##########
include/nuttx/drivers/rwbuffer.h:
##########
@@ -127,7 +127,7 @@ struct rwbuffer_s
/* This is the state of the write buffering */
#ifdef CONFIG_DRVR_WRITEBUFFER
- sem_t wrsem; /* Enforces exclusive access to the write buffer */
+ mutex_t wrlock; /* Enforces exclusive access to the write buffer */
struct work_s work; /* Delayed work to flush buffer after a delay with no activity */
uint8_t *wrbuffer; /* Allocated write buffer */
Review Comment:
Done
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989722998
##########
drivers/audio/vs1053.c:
##########
@@ -1439,7 +1439,7 @@ static int vs1053_start(FAR struct audio_lowerhalf_s *lower,
static int vs1053_start(FAR struct audio_lowerhalf_s *lower)
#endif
{
- FAR struct vs1053_struct_s *dev = (struct vs1053_struct_s *) lower;
+ FAR struct vs1053_struct_s *dev = (struct vs1053_struct_s *)lower;
Review Comment:
Done.
##########
drivers/audio/vs1053.c:
##########
@@ -1280,7 +1280,7 @@ static int vs1053_dreq_isr(int irq, FAR void *context, FAR void *arg)
static void *vs1053_workerthread(pthread_addr_t pvarg)
{
- FAR struct vs1053_struct_s *dev = (struct vs1053_struct_s *) pvarg;
+ FAR struct vs1053_struct_s *dev = (struct vs1053_struct_s *)pvarg;
Review Comment:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989811164
##########
fs/vfs/fs_timerfd.c:
##########
@@ -61,7 +62,7 @@ typedef struct timerfd_waiter_sem_s
struct timerfd_priv_s
{
- sem_t exclsem; /* Enforces device exclusive access */
+ mutex_t lock; /* Enforces device exclusive access */
timerfd_waiter_sem_t *rdsems; /* List of blocking readers */
Review Comment:
Done
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989881832
##########
fs/smartfs/smartfs_utils.c:
##########
@@ -880,7 +862,7 @@ 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;
+ readwrite.buffer = (uint8_t *)fs->fs_rwbuffer;
Review Comment:
Done
##########
fs/smartfs/smartfs_utils.c:
##########
@@ -597,7 +579,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 = (struct smartfs_chain_header_s *)fs->fs_rwbuffer;
Review Comment:
Done
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r988534543
##########
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:
Let's keep as before since:
1. All pointer doesn't add FAR
2. It's specific to Spresense(arm core)
##########
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:
ditto
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r988540711
##########
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:
Since many place has the similar issue, let's do in the next patch: all nxsem_set_protocol will be removed, the default setting is good in all case.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r986038510
##########
arch/arm/src/cxd56xx/cxd56_udmac.c:
##########
@@ -238,7 +239,7 @@ void cxd56_udmainitialize(void)
/* Initialize the channel list */
- nxsem_init(&g_dmac.exclsem, 0, 1);
+ nxmutex_init(&g_dmac.lock);
nxsem_init(&g_dmac.chansem, 0, CXD56_DMA_NCHANNELS);
Review Comment:
The missing call isn't introduced by this PR, but it's the bug already exist in the origin code base. But, anyway I will change the runtime initialization to the static initializer as much as possible. So, the place which forget to call nxsem_set_protocol should be rare.
The final goal(last patch) is that the whole code base doesn't call nxsem_set_protocol(all nxsem_set_protocol(SEM_PRIO_NONE) are removed too) anymore except nxmutex_t/nxrmutex_t/pthread_mutex_t.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r988533284
##########
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:
Done.
##########
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:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r988529067
##########
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:
Done.
##########
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:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r988527449
##########
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:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r988528504
##########
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:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r988568549
##########
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:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989232269
##########
drivers/sensors/lps25h.c:
##########
@@ -708,31 +709,31 @@ static int lps25h_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
break;
case SNIOC_PRESSURE_OUT:
- ret = lps25h_read_pressure(dev, (lps25h_pressure_data_t *) arg);
+ ret = lps25h_read_pressure(dev, (lps25h_pressure_data_t *)arg);
break;
case SNIOC_TEMPERATURE_OUT:
/* NOTE: call SNIOC_PRESSURE_OUT before this one,
* or results are bogus.
*/
- ret = lps25h_read_temper(dev, (lps25h_temper_data_t *) arg);
+ ret = lps25h_read_temper(dev, (lps25h_temper_data_t *)arg);
Review Comment:
Done.
##########
drivers/sensors/lps25h.c:
##########
@@ -708,31 +709,31 @@ static int lps25h_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
break;
case SNIOC_PRESSURE_OUT:
- ret = lps25h_read_pressure(dev, (lps25h_pressure_data_t *) arg);
+ ret = lps25h_read_pressure(dev, (lps25h_pressure_data_t *)arg);
Review Comment:
Done
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989231009
##########
drivers/sensors/lsm330_spi.c:
##########
@@ -1370,7 +1367,7 @@ int lsm330_register(FAR const char *devpath_acl,
priv->flink = g_lsm330a_list;
g_lsm330a_list = priv;
priva = priv;
- config_acl->leaf_handle = (void *) priv;
+ config_acl->leaf_handle = (void *)priv;
Review Comment:
Done
--
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
[GitHub] [incubator-nuttx] masayuki2009 commented on pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#issuecomment-1275596146
@xiaoxiang781216
As for style changes, I think you can create another PR, and after the PR is merged then rebase this PR.
The result would be much simpler to review.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r996469452
##########
drivers/sensors/lsm330_spi.c:
##########
@@ -1370,7 +1367,7 @@ int lsm330_register(FAR const char *devpath_acl,
priv->flink = g_lsm330a_list;
g_lsm330a_list = priv;
priva = priv;
- config_acl->leaf_handle = (void *) priv;
+ config_acl->leaf_handle = (void *)priv;
Review Comment:
Next patch
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r996471606
##########
drivers/timers/pwm.c:
##########
@@ -602,7 +603,7 @@ int pwm_register(FAR const char *path, FAR struct pwm_lowerhalf_s *dev)
* kmm_zalloc()).
*/
- nxsem_init(&upper->exclsem, 0, 1);
+ nxmutex_init(&upper->lock);
Review Comment:
keep
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r990809770
##########
drivers/audio/wm8994.c:
##########
@@ -1559,11 +1544,11 @@ static int wm8994_reserve(FAR struct audio_lowerhalf_s *dev)
#endif
{
FAR struct wm8994_dev_s *priv = (FAR struct wm8994_dev_s *) dev;
Review Comment:
Done
--
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
[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r992124847
##########
drivers/rptun/rptun.c:
##########
@@ -462,7 +462,7 @@ static int rptun_notify_wait(FAR struct remoteproc *rproc, uint32_t id)
return 0;
}
-static void *rptun_get_priv_by_rdev(FAR struct rpmsg_device *rdev)
+static FAR void *rptun_get_priv_by_rdev(FAR struct rpmsg_device *rdev)
{
struct rpmsg_virtio_device *rvdev;
struct virtio_device *vdev;
Review Comment:
```suggestion
FAR struct rpmsg_virtio_device *rvdev;
FAR struct virtio_device *vdev;
```
##########
drivers/wireless/ieee80211/bcm43xxx/bcmf_gspi.c:
##########
@@ -337,9 +337,9 @@ static int bcmf_gspi_bus_lowpower(FAR bcmf_gspi_dev_t *gbus, bool enable)
* Name: bcmf_gspi_thread_isr
****************************************************************************/
-static int bcmf_gspi_thread_isr(int isr, void *context, void *arg)
+static int bcmf_gspi_thread_isr(int isr, FAR void *context, FAR void *arg)
{
- FAR bcmf_gspi_dev_t *gbus = (FAR bcmf_gspi_dev_t *) arg;
+ FAR bcmf_gspi_dev_t *gbus = (FAR bcmf_gspi_dev_t *)arg;
Review Comment:
```suggestion
FAR bcmf_gspi_dev_t *gbus = (FAR bcmf_gspi_dev_t *)arg;
```
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989742158
##########
drivers/sensors/mlx90614.c:
##########
@@ -131,7 +131,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 = (uint8_t *)&checkcrc[3];
Review Comment:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r988534737
##########
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:
ditto
##########
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:
ditto
##########
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:
ditto
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r988528974
##########
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:
Done.
##########
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:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r988531467
##########
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:
Done.
--
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
[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989432412
##########
drivers/wireless/ieee80211/bcm43xxx/bcmf_gspi_f2_frame.c:
##########
@@ -309,12 +309,12 @@ int bcmf_gspi_read_f2_frame(FAR struct bcmf_dev_s *priv,
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;
+ f2_frame_header_t *header;
+ bcmf_interface_frame_t *iframe;
Review Comment:
```suggestion
FAR bcmf_interface_frame_t *iframe;
```
##########
drivers/wireless/lpwan/sx127x/sx127x.c:
##########
@@ -502,7 +503,7 @@ static inline void sx127x_select(struct sx127x_dev_s * dev)
* Name: sx127x_deselect
****************************************************************************/
-static inline void sx127x_deselect(struct sx127x_dev_s * dev)
+static inline void sx127x_deselect(struct sx127x_dev_s *dev)
Review Comment:
```suggestion
static inline void sx127x_deselect(FAR struct sx127x_dev_s *dev)
```
##########
drivers/wireless/nrf24l01.c:
##########
@@ -329,7 +330,7 @@ static inline void nrf24l01_configspi(FAR struct spi_dev_s *spi)
* Name: nrf24l01_select
****************************************************************************/
-static inline void nrf24l01_select(struct nrf24l01_dev_s * dev)
+static inline void nrf24l01_select(struct nrf24l01_dev_s *dev)
Review Comment:
```suggestion
static inline void nrf24l01_select(FAR struct nrf24l01_dev_s *dev)
```
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989875284
##########
fs/smartfs/smartfs_utils.c:
##########
@@ -2030,7 +2012,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 = (struct smartfs_chain_header_s *)sf->buffer;
Review Comment:
Done
##########
fs/smartfs/smartfs_utils.c:
##########
@@ -1649,7 +1631,7 @@ off_t smartfs_seek_internal(FAR struct smartfs_mountpt_s *fs,
readwrite.logsector = sf->currsector;
readwrite.offset = 0;
readwrite.count = sizeof(struct smartfs_chain_header_s);
- readwrite.buffer = (uint8_t *) fs->fs_rwbuffer;
+ readwrite.buffer = (uint8_t *)fs->fs_rwbuffer;
Review Comment:
Done
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989879522
##########
fs/smartfs/smartfs_utils.c:
##########
@@ -1121,15 +1103,15 @@ int smartfs_createentry(FAR struct smartfs_mountpt_s *fs,
int smartfs_deleteentry(struct smartfs_mountpt_s *fs,
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;
+ struct smartfs_entry_header_s *direntry;
+ struct smartfs_chain_header_s *header;
Review Comment:
Done
--
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
[GitHub] [incubator-nuttx] anjiahao1 commented on pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
anjiahao1 commented on PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#issuecomment-1292927563
Sorry, I'll check all the SEM modifications later.
> Hi @anjiahao1 BL602 I2C Read seems to hang after this commit, I think it might be caused by the Semaphore Init Value.
>
> Refer to the changes for `arch/risc-v/src/bl602/bl602_i2c.c`:
>
> [d1d4633#diff-b9e7242d24fc5f206885bdcd9fa90409e9c8356d041a968e786cfb8c8db32aeb](https://github.com/apache/incubator-nuttx/commit/d1d46335df6cc1bc63f1cd7e7bffe3735b8c275d#diff-b9e7242d24fc5f206885bdcd9fa90409e9c8356d041a968e786cfb8c8db32aeb)
>
> Previously the Semaphore `sem_isr` was set to Init Value 1:
>
> ```c
> static void bl602_i2c_sem_init(struct bl602_i2c_priv_s *priv)
> {
> ...
> nxsem_init(&priv->sem_isr, 0, 1);
> ```
>
> Now `sem_isr` is set to Init Value 0:
>
> ```c
> static struct bl602_i2c_priv_s bl602_i2c0_priv =
> {
> ...
> .sem_isr = SEM_INITIALIZER(0),
> ```
>
> This causes [`nxsem_wait_uninterruptible`](https://github.com/apache/incubator-nuttx/blob/master/arch/risc-v/src/bl602/bl602_i2c.c#L682) to hang during I2C Transfer:
>
> ```c
> static int bl602_i2c_transfer(struct i2c_master_s *dev,
> struct i2c_msg_s * msgs,
> int count)
> {
> ...
> // Hangs here
> ret = nxsem_wait_uninterruptible(&priv->sem_isr);
> ```
>
> When I changed `sem_isr` to Init Value 1:
>
> ```c
> .sem_isr = SEM_INITIALIZER(1),
> ```
>
> The I2C Transfer now works OK. [(Here's the log)](https://github.com/lupyuen/incubator-nuttx/pull/148#issue-1421797837)
>
> Can you verify if this fix `SEM_INITIALIZER(1)` is correct? Thanks :-)
Sorry, I'll check all the SEM modifications later.
--
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
[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r985474716
##########
arch/arm/src/cxd56xx/cxd56_udmac.c:
##########
@@ -238,7 +239,7 @@ void cxd56_udmainitialize(void)
/* Initialize the channel list */
- nxsem_init(&g_dmac.exclsem, 0, 1);
+ nxmutex_init(&g_dmac.lock);
nxsem_init(&g_dmac.chansem, 0, CXD56_DMA_NCHANNELS);
Review Comment:
I think that is not a good way. If I understand correctly we will have a Kconfig option so users can select either enable or disable by default. Having explicit calls will break this dependency. Unless we will have Kconfig applied only for nxmutex. In such a way I agree.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989744195
##########
drivers/syslog/syslog_device.c:
##########
@@ -144,15 +144,6 @@ static inline int syslog_dev_takesem(FAR struct syslog_dev_s *syslog_dev)
return nxrmutex_lock(&syslog_dev->sl_lock);
}
-/****************************************************************************
- * Name: syslog_dev_givesem
- ****************************************************************************/
-
-static inline void syslog_dev_givesem(FAR struct syslog_dev_s *syslog_dev)
Review Comment:
Ok, restore but rename to syslog_dev_unlock
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989768167
##########
drivers/wireless/ieee80211/bcm43xxx/bcmf_gspi_f2_frame.c:
##########
@@ -309,12 +309,12 @@ int bcmf_gspi_read_f2_frame(FAR struct bcmf_dev_s *priv,
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;
+ f2_frame_header_t *header;
+ bcmf_interface_frame_t *iframe;
Review Comment:
Done
##########
drivers/wireless/ieee80211/bcm43xxx/bcmf_sdpcm.c:
##########
@@ -511,7 +511,7 @@ struct bcmf_frame_s *bcmf_sdpcm_get_rx_frame(FAR struct bcmf_dev_s *priv)
bcmf_interface_frame_t *iframe;
Review Comment:
Done
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989776485
##########
drivers/wireless/ieee80211/bcm43xxx/bcmf_utils.h:
##########
@@ -43,8 +41,6 @@
void bcmf_hexdump(uint8_t *data, unsigned int len, unsigned long offset);
-int bcmf_sem_wait(sem_t *sem, unsigned int timeout_ms);
-
static inline uint16_t bcmf_getle16(void *val)
{
uint8_t *valb = (uint8_t *)val;
Review Comment:
Done
##########
drivers/wireless/ieee80211/bcm43xxx/bcmf_utils.h:
##########
@@ -43,8 +41,6 @@
void bcmf_hexdump(uint8_t *data, unsigned int len, unsigned long offset);
-int bcmf_sem_wait(sem_t *sem, unsigned int timeout_ms);
-
static inline uint16_t bcmf_getle16(void *val)
Review Comment:
Done
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989759045
##########
drivers/wireless/ieee80211/bcm43xxx/bcmf_gspi_f2_frame.c:
##########
@@ -185,7 +185,7 @@ int bcmf_gspi_read_f2_frame(FAR struct bcmf_dev_s *priv,
gspi_f2_dma,
0,
frame_length,
- (uint32_t *) iframe->data);
+ (uint32_t *)iframe->data);
Review Comment:
Done
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989787681
##########
drivers/wireless/nrf24l01.c:
##########
@@ -1077,15 +1078,15 @@ static ssize_t nrf24l01_write(FAR struct file *filep, FAR const char *buffer,
DEBUGASSERT(inode && inode->i_private);
dev = (FAR struct nrf24l01_dev_s *)inode->i_private;
- ret = nxsem_wait(&dev->devsem);
+ ret = nxmutex_lock(&dev->devlock);
if (ret < 0)
{
return ret;
}
ret = nrf24l01_send(dev, (const uint8_t *)buffer, buflen);
Review Comment:
Done
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989791707
##########
fs/fat/fs_fat32.h:
##########
@@ -1018,11 +1018,6 @@ EXTERN uint32_t fat_getuint32(uint8_t *ptr);
EXTERN void fat_putuint16(uint8_t *ptr, uint16_t value16);
EXTERN void fat_putuint32(uint8_t *ptr, uint32_t value32);
Review Comment:
Done
--
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
[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r986057479
##########
arch/arm/src/cxd56xx/cxd56_udmac.c:
##########
@@ -238,7 +239,7 @@ void cxd56_udmainitialize(void)
/* Initialize the channel list */
- nxsem_init(&g_dmac.exclsem, 0, 1);
+ nxmutex_init(&g_dmac.lock);
nxsem_init(&g_dmac.chansem, 0, CXD56_DMA_NCHANNELS);
Review Comment:
Ok. Let's proceed step by step. pthread does not have an issue since I changed to init with priority inheritance disabled by default.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r988542354
##########
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:
Done.
##########
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:
Done
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r988555031
##########
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:
Keep since it align with other line
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r988568923
##########
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:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989801921
##########
fs/smartfs/smartfs_smart.c:
##########
@@ -340,7 +340,7 @@ static int smartfs_open(FAR struct file *filep, const char *relpath,
readwrite.logsector = sf->currsector;
readwrite.offset = 0;
readwrite.count = fs->fs_llformat.availbytes;
- readwrite.buffer = (uint8_t *) sf->buffer;
+ readwrite.buffer = (uint8_t *)sf->buffer;
Review Comment:
Done
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989798995
##########
fs/smartfs/smartfs.h:
##########
@@ -33,7 +33,7 @@
#include <nuttx/mtd/mtd.h>
#include <nuttx/fs/smart.h>
-#include <nuttx/semaphore.h>
+#include <nuttx/mutex.h>
Review Comment:
since it doesn't contain sem_t anymore
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r996482144
##########
drivers/input/stmpe811_base.c:
##########
@@ -302,6 +302,7 @@ STMPE811_HANDLE stmpe811_instantiate(FAR struct i2c_master_s *dev,
ret = stmpe811_checkid(priv);
if (ret < 0)
{
+ nxmutex_destroy(&priv->lock);
Review Comment:
No, priv come from g_stmpe811 if CONFIG_STMPE811_MULTIPLE isn't defined.
--
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
[GitHub] [incubator-nuttx] anjiahao1 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
anjiahao1 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r960173866
##########
net/local/local_connect.c:
##########
@@ -143,7 +129,7 @@ static int inline local_stream_connect(FAR struct local_conn_s *client,
if (nxsem_get_value(&server->lc_waitsem, &sval) >= 0 && sval < 1)
{
- _local_semgive(&server->lc_waitsem);
+ nxsem_post(&server->lc_waitsem);
Review Comment:
use nxsem_post & nxmutex_unlock inside
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r960182148
##########
net/local/local_connect.c:
##########
@@ -143,7 +129,7 @@ static int inline local_stream_connect(FAR struct local_conn_s *client,
if (nxsem_get_value(&server->lc_waitsem, &sval) >= 0 && sval < 1)
{
- _local_semgive(&server->lc_waitsem);
+ nxsem_post(&server->lc_waitsem);
Review Comment:
but net_lockedwait_uninterruptible doesn't equals to nxsem_post.
--
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
[GitHub] [incubator-nuttx] masayuki2009 commented on pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#issuecomment-1274779803
>@masayuki2009 it's hard to split the style change from the patch now. could you have method to retrieve the old revision from github?
I think you can always retrieve the old revision from the latest master.
Actually, there are many changes that do not relate to 'nxmutex replace nexsem'
For example, besides the style changes, I can also see the changes such as (`kmm_malloc` to `kmm_zalloc`, `i2c_givesem` to `nxsem_post`, etc).
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989213575
##########
drivers/sensors/mpu60x0.c:
##########
@@ -537,7 +537,7 @@ static inline int __mpu_write_reg(FAR struct mpu_dev_s *dev,
static inline int __mpu_read_imu(FAR struct mpu_dev_s *dev,
FAR struct sensor_data_s *buf)
{
- return __mpu_read_reg(dev, ACCEL_XOUT_H, (uint8_t *) buf, sizeof(*buf));
+ return __mpu_read_reg(dev, ACCEL_XOUT_H, (uint8_t *)buf, sizeof(*buf));
Review Comment:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989233092
##########
drivers/mtd/smart.c:
##########
@@ -120,7 +120,7 @@
#endif
#ifndef offsetof
-#define offsetof(type, member) ( (size_t) &( ( (type *) 0)->member))
+#define offsetof(type, member) ( (size_t) &( ( (type *)0)->member))
Review Comment:
Done.
--
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
[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r986009588
##########
arch/arm/src/cxd56xx/cxd56_udmac.c:
##########
@@ -238,7 +239,7 @@ void cxd56_udmainitialize(void)
/* Initialize the channel list */
- nxsem_init(&g_dmac.exclsem, 0, 1);
+ nxmutex_init(&g_dmac.lock);
nxsem_init(&g_dmac.chansem, 0, CXD56_DMA_NCHANNELS);
Review Comment:
I agree, but this PR seems to be inconsistent. We add static initializers with priority disable flag in some places, but ignore other places that are missing API calls.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r988540940
##########
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:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r988539057
##########
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:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r988541917
##########
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:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989383161
##########
wireless/ieee802154/mac802154_internal.h:
##########
@@ -510,62 +511,12 @@ void mac802154_notify(FAR struct ieee802154_privmac_s *priv,
/* General helpers **********************************************************/
-#define mac802154_givesem(s) nxsem_post(s)
-
-static inline int mac802154_takesem(sem_t *sem, bool allowinterrupt)
-{
- if (allowinterrupt)
- {
- return nxsem_wait(sem);
- }
- else
- {
- return nxsem_wait_uninterruptible(sem);
- }
-}
-
-#ifdef CONFIG_MAC802154_LOCK_VERBOSE
-#define mac802154_unlock(dev) \
- mac802154_givesem(&dev->exclsem); \
- wlinfo("MAC unlocked\n");
-#else
-#define mac802154_unlock(dev) \
- mac802154_givesem(&dev->exclsem);
-#endif
-
-#define mac802154_lock(dev, allowinterrupt) \
- mac802154_lockpriv(dev, allowinterrupt, __FUNCTION__)
-
-static inline int
-mac802154_lockpriv(FAR struct ieee802154_privmac_s *dev,
- bool allowinterrupt, FAR const char *funcname)
-{
Review Comment:
Yes, I think it's very dangerous to allow user cancel the kernel work and then remove the possibility.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989385216
##########
arch/arm/src/stm32l4/hardware/stm32l4_spi.h:
##########
@@ -119,7 +119,7 @@
#define SPI_CR2_TXEIE (1 << 7) /* Bit 7: Tx buffer empty interrupt enable */
#define SPI_CR2_DS_SHIFT (8) /* Bits 8-11: Data size */
#define SPI_CR2_DS_MASK (15 << SPI_CR2_DS_SHIFT)
-# define SPI_CR2_DS_VAL(bits) ( ((bits)-1) << SPI_CR2_DS_SHIFT)
+# define SPI_CR2_DS_VAL(bits) (((bits)-1) << SPI_CR2_DS_SHIFT)
Review Comment:
Done.
##########
arch/arm/src/stm32l5/hardware/stm32l5_spi.h:
##########
@@ -122,7 +122,7 @@
#define SPI_CR2_TXEIE (1 << 7) /* Bit 7: Tx buffer empty interrupt enable */
#define SPI_CR2_DS_SHIFT (8) /* Bits 8-11: Data size */
#define SPI_CR2_DS_MASK (15 << SPI_CR2_DS_SHIFT)
-# define SPI_CR2_DS_VAL(bits) ( ((bits)-1) << SPI_CR2_DS_SHIFT)
+# define SPI_CR2_DS_VAL(bits) (((bits)-1) << SPI_CR2_DS_SHIFT)
Review Comment:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989381930
##########
wireless/ieee802154/mac802154_netdev.c:
##########
@@ -362,7 +363,7 @@ static int macnet_notify(FAR struct mac802154_maccb_s *maccb,
* back to trying to get access again
*/
- while (nxsem_wait(&priv->md_exclsem) < 0);
+ while (nxmutex_lock(&priv->md_lock) < 0);
Review Comment:
I think so:)
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989343395
##########
drivers/mtd/smart.c:
##########
@@ -736,8 +736,8 @@ int smart_checkfree(FAR struct smart_struct_s *dev, int lineno)
uint16_t blockrelease;
static uint16_t prev_freesectors = 0;
static uint16_t prev_releasesectors = 0;
- static uint8_t *prev_freecount = NULL;
- static uint8_t *prev_releasecount = NULL;
+ static uint8_t *prev_freecount = NULL;
+ static uint8_t *prev_releasecount = NULL;
Review Comment:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989342394
##########
drivers/mtd/smart.c:
##########
@@ -1375,9 +1375,9 @@ static int smart_setsectorsize(FAR struct smart_struct_s *dev, uint16_t size)
****************************************************************************/
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)
Review Comment:
Done
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989341158
##########
mm/mm_heap/mm_free.c:
##########
@@ -84,10 +84,10 @@ void mm_free(FAR struct mm_heap_s *heap, FAR void *mem)
return;
}
- if (mm_takesemaphore(heap) == false)
+ if (mm_lock(heap) == false)
Review Comment:
Done
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r990809617
##########
drivers/sensors/adxl372.c:
##########
@@ -884,7 +881,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 = (void *)priv;
Review Comment:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r988533158
##########
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:
Done.
##########
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:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r988576068
##########
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:
Done.
##########
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:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989744471
##########
drivers/usbdev/usbmsc_desc.c:
##########
@@ -369,7 +369,7 @@ int16_t usbmsc_mkcfgdesc(uint8_t *buf,
{
/* Single interface descriptor */
- FAR struct usb_ifdesc_s * dest = (struct usb_ifdesc_s *)buf;
+ FAR struct usb_ifdesc_s *dest = (struct usb_ifdesc_s *)buf;
Review Comment:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989749850
##########
drivers/usbhost/usbhost_hidkbd.c:
##########
@@ -362,9 +357,9 @@ static uint32_t g_devinuse;
/* The following are used to managed the class creation operation */
-static sem_t g_exclsem; /* For mutually exclusive thread creation */
-static sem_t g_syncsem; /* Thread data passing interlock */
-static struct usbhost_state_s *g_priv; /* Data passed to thread */
+static mutex_t g_lock = NXMUTEX_INITIALIZER;
+static sem_t g_syncsem = NXSEM_INITIALIZER(0, PRIOINHERIT_FLAGS_DISABLE);
+static struct usbhost_state_s *g_priv;
Review Comment:
Done
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989876748
##########
fs/spiffs/src/spiffs_core.c:
##########
@@ -1191,7 +1191,7 @@ int spiffs_page_move(FAR struct spiffs_s *fs,
*dst_pgndx = free_pgndx;
}
- phdr = page_data ? (struct spiffs_page_header_s *) page_data : page_hdr;
+ phdr = page_data ? (struct spiffs_page_header_s *)page_data : page_hdr;
Review Comment:
Done
--
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
[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r990691527
##########
drivers/audio/vs1053.c:
##########
@@ -1647,22 +1647,22 @@ static int vs1053_resume(FAR struct audio_lowerhalf_s *lower)
static int vs1053_enqueuebuffer(FAR struct audio_lowerhalf_s *lower,
FAR struct ap_buffer_s *apb)
{
- FAR struct vs1053_struct_s *dev = (struct vs1053_struct_s *)lower;
+ FAR struct vs1053_struct_s *dev = (FAR struct vs1053_struct_s *)lower;
struct audio_msg_s term_msg;
Review Comment:
```suggestion
struct audio_msg_s term_msg;
```
##########
drivers/audio/wm8776.c:
##########
@@ -1032,11 +976,11 @@ static int wm8776_reserve(FAR struct audio_lowerhalf_s *dev)
#endif
{
FAR struct wm8776_dev_s *priv = (FAR struct wm8776_dev_s *) dev;
Review Comment:
```suggestion
FAR struct wm8776_dev_s *priv = (FAR struct wm8776_dev_s *)dev;
```
##########
drivers/mtd/smart.c:
##########
@@ -4406,12 +4406,12 @@ static int smart_write_alloc_sector(FAR struct smart_struct_s *dev,
memset(dev->rwbuffer, CONFIG_SMARTFS_ERASEDSTATE, dev->sectorsize);
header = (FAR struct smart_sect_header_s *) dev->rwbuffer;
Review Comment:
```suggestion
header = (FAR struct smart_sect_header_s *)dev->rwbuffer;
```
##########
drivers/input/ft5x06.c:
##########
@@ -986,10 +977,10 @@ static int ft5x06_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
static int ft5x06_poll(FAR struct file *filep, FAR struct pollfd *fds,
bool setup)
Review Comment:
```suggestion
static int ft5x06_poll(FAR struct file *filep, FAR struct pollfd *fds,
bool setup)
```
##########
fs/rpmsgfs/rpmsgfs.c:
##########
@@ -1059,7 +1042,7 @@ static int rpmsgfs_rewinddir(FAR struct inode *mountpt,
static int rpmsgfs_bind(FAR struct inode *blkdriver, FAR const void *data,
FAR void **handle)
{
- FAR struct rpmsgfs_mountpt_s *fs;
+ FAR struct rpmsgfs_mountpt_s *fs;
FAR const char *cpuname = NULL;
FAR char *options;
char *saveptr;
Review Comment:
```suggestion
FAR char *saveptr;
```
##########
sched/clock/clock_getres.c:
##########
@@ -45,7 +45,7 @@
int clock_getres(clockid_t clock_id, struct timespec *res)
Review Comment:
```suggestion
int clock_getres(clockid_t clock_id, FAR struct timespec *res)
```
##########
drivers/audio/vs1053.c:
##########
@@ -1439,12 +1439,12 @@ static int vs1053_start(FAR struct audio_lowerhalf_s *lower,
static int vs1053_start(FAR struct audio_lowerhalf_s *lower)
#endif
{
- FAR struct vs1053_struct_s *dev = (struct vs1053_struct_s *) lower;
- struct mq_attr attr;
- struct sched_param sparam;
- pthread_attr_t tattr;
- int ret;
- void *value;
+ FAR struct vs1053_struct_s *dev = (FAR struct vs1053_struct_s *)lower;
+ struct mq_attr attr;
+ struct sched_param sparam;
+ pthread_attr_t tattr;
+ int ret;
+ void *value;
Review Comment:
```suggestion
FAR void *value;
```
##########
drivers/audio/wm8994.c:
##########
@@ -1559,11 +1544,11 @@ static int wm8994_reserve(FAR struct audio_lowerhalf_s *dev)
#endif
{
FAR struct wm8994_dev_s *priv = (FAR struct wm8994_dev_s *) dev;
Review Comment:
```suggestion
FAR struct wm8994_dev_s *priv = (FAR struct wm8994_dev_s *)dev;
```
##########
boards/arm/stm32/omnibusf4/src/stm32_romfs_initialize.c:
##########
@@ -119,7 +119,7 @@ extern const uint8_t romfs_data_end[];
int stm32_romfs_initialize(void)
{
size_t romfs_data_len
Review Comment:
```suggestion
size_t romfs_data_len;
```
##########
drivers/mtd/mtd_config.c:
##########
@@ -559,8 +559,8 @@ static int mtdconfig_findnextentry(FAR struct mtdconfig_struct_s *dev,
static off_t mtdconfig_ramconsolidate(FAR struct mtdconfig_struct_s *dev)
{
FAR uint8_t *pbuf;
- FAR struct mtdconfig_header_s *phdr;
- struct mtdconfig_header_s hdr;
+ FAR struct mtdconfig_header_s *phdr;
+ struct mtdconfig_header_s hdr;
Review Comment:
```suggestion
struct mtdconfig_header_s hdr;
```
##########
drivers/usbhost/usbhost_cdcmbim.c:
##########
@@ -855,7 +823,7 @@ static void usbhost_bulkin_work(FAR void *arg)
DRVR_ASYNCH(hport->drvr, priv->bulkin,
(uint8_t *)priv->rxnetbuf, CDCMBIM_NETBUF_SIZE,
Review Comment:
```suggestion
(FAR uint8_t *)priv->rxnetbuf, CDCMBIM_NETBUF_SIZE,
```
##########
drivers/sensors/adxl372.c:
##########
@@ -884,7 +881,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 = (void *)priv;
Review Comment:
```suggestion
config->leaf_handle = (FAR void *)priv;
```
##########
drivers/input/mxt.c:
##########
@@ -1532,10 +1523,10 @@ 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)
Review Comment:
```suggestion
static int mxt_poll(FAR struct file *filep, FAR struct pollfd *fds,
bool setup)
```
##########
drivers/usbhost/usbhost_xboxcontroller.c:
##########
@@ -234,8 +228,8 @@ static inline int usbhost_tfree(FAR struct usbhost_state_s *priv);
/* struct usbhost_registry_s methods */
static struct usbhost_class_s *
Review Comment:
```suggestion
static FAR struct usbhost_class_s *
```
##########
drivers/wireless/ieee80211/bcm43xxx/bcmf_interface.c:
##########
@@ -64,11 +64,11 @@ void bcmf_initialize_interface_frames(void)
****************************************************************************/
void bcmf_interface_free_frame(FAR struct bcmf_dev_s *priv,
Review Comment:
```suggestion
void bcmf_interface_free_frame(FAR struct bcmf_dev_s *priv,
```
##########
drivers/mtd/smart.c:
##########
@@ -4709,9 +4709,9 @@ 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;
Review Comment:
```suggestion
if (*((FAR uint16_t *)&header->seq) == 0xffff)
{
*((FAR uint16_t *)&header->seq) = 1;
}
```
##########
drivers/usbhost/usbhost_xboxcontroller.c:
##########
@@ -160,7 +160,7 @@ struct usbhost_state_s
uint8_t nwaiters; /* Number of threads waiting for controller data */
sem_t waitsem; /* Used to wait for controller data */
int16_t crefs; /* Reference count on the driver instance */
- sem_t exclsem; /* Used to maintain mutual exclusive access */
+ mutex_t lock; /* Used to maintain mutual exclusive access */
struct work_s work; /* For interacting with the worker thread */
FAR uint8_t *tbuffer; /* The allocated transfer buffer */
FAR uint8_t obuffer[20]; /* The fixed output transfer buffer */
Review Comment:
```suggestion
uint8_t obuffer[20]; /* The fixed output transfer buffer */
```
##########
drivers/video/video.c:
##########
@@ -3122,8 +3094,7 @@ static int video_unregister(FAR video_mng_t *v_mgr)
}
else
{
- nxsem_destroy(&v_mgr->lock_open_num);
-
+ nxmutex_destroy(&v_mgr->lock_open_num);
unregister_driver((const char *)v_mgr->devpath);
Review Comment:
```suggestion
unregister_driver((FAR const char *)v_mgr->devpath);
```
##########
fs/fat/fs_fat32util.c:
##########
@@ -1127,7 +1109,7 @@ int fat_putcluster(struct fat_mountpt_s *fs, uint32_t clusterno,
int fat_removechain(struct fat_mountpt_s *fs, uint32_t cluster)
Review Comment:
```suggestion
int fat_removechain(FAR struct fat_mountpt_s *fs, uint32_t cluster)
```
##########
drivers/wireless/ieee80211/bcm43xxx/bcmf_interface.h:
##########
@@ -140,15 +117,15 @@ void bcmf_initialize_interface_frames(void);
****************************************************************************/
void bcmf_interface_free_frame(FAR struct bcmf_dev_s *priv,
Review Comment:
```suggestion
void bcmf_interface_free_frame(FAR struct bcmf_dev_s *priv,
```
##########
drivers/wireless/ieee80211/bcm43xxx/bcmf_interface.c:
##########
@@ -64,11 +64,11 @@ void bcmf_initialize_interface_frames(void)
****************************************************************************/
void bcmf_interface_free_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;
Review Comment:
```suggestion
FAR bcmf_interface_dev_t *ibus = (FAR bcmf_interface_dev_t *)priv->bus;
```
##########
fs/fat/fs_fat32.h:
##########
@@ -864,7 +864,7 @@ struct fat_mountpt_s
struct inode *fs_blkdriver; /* The block driver inode that hosts the FAT32 fs */
struct fat_file_s *fs_head; /* A list to all files opened on this mountpoint */
Review Comment:
```suggestion
FAR struct inode *fs_blkdriver; /* The block driver inode that hosts the FAT32 fs */
FAR struct fat_file_s *fs_head; /* A list to all files opened on this mountpoint */
```
##########
drivers/wireless/ieee80211/bcm43xxx/bcmf_sdpcm.c:
##########
@@ -425,9 +425,9 @@ int bcmf_sdpcm_queue_frame(FAR struct bcmf_dev_s *priv,
struct bcmf_frame_s *frame, bool control)
Review Comment:
```suggestion
FAR struct bcmf_frame_s *frame, bool control)
```
##########
drivers/wireless/ieee80211/bcm43xxx/bcmf_interface.h:
##########
@@ -140,15 +117,15 @@ void bcmf_initialize_interface_frames(void);
****************************************************************************/
void bcmf_interface_free_frame(FAR struct bcmf_dev_s *priv,
- bcmf_interface_frame_t *iframe);
+ FAR bcmf_interface_frame_t *iframe);
/****************************************************************************
* Name: bcmf_interface_allocate_frame
****************************************************************************/
-bcmf_interface_frame_t
+FAR bcmf_interface_frame_t
*bcmf_interface_allocate_frame(FAR struct bcmf_dev_s *priv,
Review Comment:
I think it is better to move `*` to row above
##########
fs/smartfs/smartfs.h:
##########
@@ -33,7 +33,7 @@
#include <nuttx/mtd/mtd.h>
#include <nuttx/fs/smart.h>
-#include <nuttx/semaphore.h>
+#include <nuttx/mutex.h>
Review Comment:
But I do not see any structures of functions here referring nxmutex.
##########
drivers/wireless/ieee80211/bcm43xxx/bcmf_sdpcm.c:
##########
@@ -508,10 +508,10 @@ void bcmf_sdpcm_free_frame(FAR struct bcmf_dev_s *priv,
struct bcmf_frame_s *bcmf_sdpcm_get_rx_frame(FAR struct bcmf_dev_s *priv)
Review Comment:
```suggestion
FAR struct bcmf_frame_s *bcmf_sdpcm_get_rx_frame(FAR struct bcmf_dev_s *priv)
```
##########
include/nuttx/wireless/ieee80211/bcmf_gspi.h:
##########
@@ -60,32 +61,32 @@ 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,
- xcpt_t thread_isr,
- FAR void *thread_isr_arg);
+ 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,
- bool increment,
- enum gspi_cmd_func_e function,
- uint32_t address,
- uint16_t length,
- FAR const uint32_t *data);
+ 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,
- bool increment,
- enum gspi_cmd_func_e function,
- uint32_t address,
- uint16_t length,
- FAR uint32_t *buffer);
+ CODE int (*read) (FAR struct gspi_dev_s *gspi,
+ bool increment,
+ enum gspi_cmd_func_e function,
+ uint32_t address,
+ uint16_t length,
+ FAR uint32_t *buffer);
- sem_t exclsem;
+ mutex_t lock;
Review Comment:
Please add `FAR` to `io_dev` as well
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r990721068
##########
fs/fat/fs_fat32util.c:
##########
@@ -1127,7 +1109,7 @@ int fat_putcluster(struct fat_mountpt_s *fs, uint32_t clusterno,
int fat_removechain(struct fat_mountpt_s *fs, uint32_t cluster)
Review Comment:
Done
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r995297542
##########
arch/arm/src/samd5e5/sam_usb.c:
##########
@@ -8566,10 +8531,10 @@ static inline void sam_sw_initialize(struct sam_usbhost_s *priv)
sam_reset_pipes(priv, false);
- /* Initialize semaphores */
+ /* Initialize semaphore & mutex */
Review Comment:
after search, all place use &.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r991415654
##########
drivers/audio/vs1053.c:
##########
@@ -1249,7 +1249,7 @@ static void vs1053_feeddata(FAR struct vs1053_struct_s *dev)
static int vs1053_dreq_isr(int irq, FAR void *context, FAR void *arg)
{
- struct vs1053_struct_s *dev = (struct vs1053_struct_s *)arg;
+ struct vs1053_struct_s *dev = (FAR struct vs1053_struct_s *)arg;
Review Comment:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r991408698
##########
drivers/modem/altair/altmdm_pm.c:
##########
@@ -54,7 +54,7 @@
****************************************************************************/
static struct altmdm_dev_s *g_privdata = NULL;
Review Comment:
Done
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#issuecomment-1276949593
> > @masayuki2009 @pkarashchenko the style change is revert, please review again.
>
> @xiaoxiang781216 Thanks for your efforts and updates.
>
> It seems much easier to check the differences but I still have some comments. In my understanding, this PR is intended to replace binary semaphore usage with nxmutex. However, I can see some other changes like critical section with nxsem (e.g. cxd56_i2c.c) and nxsem to nxsem (i.e. cxd56_icc.c). I think that kind of changes should not be mixed in this PR.
nxmutex_t is initialized directly at the variables(g_i2cxdev) definition, not in cxd56_i2cbus_initialize, and then the code can be protected by mutex_t self, so it's redundancy to use the critical section here. That's why the patch remove the critical section too.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#issuecomment-1277368760
@masayuki2009 ok, the change split into two patch, please review again.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#issuecomment-1279049612
> > @pkarashchenko @masayuki2009 @jerpelea all comment get addressed, please review again.
>
> @xiaoxiang781216
>
> I think it would be better to merge the following style change in the second commit into the first commit because the first commit also changes the lines.
>
> ```
> diff --git a/arch/arm/src/cxd56xx/cxd56_udmac.c b/arch/arm/src/cxd56xx/cxd56_udmac.c
> index 69d2c87aa0..6a490e9cd0 100644
> --- a/arch/arm/src/cxd56xx/cxd56_udmac.c
> +++ b/arch/arm/src/cxd56xx/cxd56_udmac.c
> @@ -68,8 +68,8 @@ struct dma_channel_s
>
> struct dma_controller_s
> {
> - mutex_t lock; /* Protects channel table */
> - sem_t chansem; /* Count of free channels */
> + mutex_t lock; /* Protects channel table */
> + sem_t chansem; /* Count of free channels */
> };
> ```
>
> Also, I can see similar changes in the second commit.
>
> ```
> diff --git a/arch/arm/src/rp2040/rp2040_dmac.c b/arch/arm/src/rp2040/rp2040_dmac.c
> index 1604c9d829..7d54c70124 100644
> --- a/arch/arm/src/rp2040/rp2040_dmac.c
> +++ b/arch/arm/src/rp2040/rp2040_dmac.c
> @@ -62,8 +62,8 @@ struct dma_channel_s
>
> struct dma_controller_s
> {
> - mutex_t lock; /* Protects channel table */
> - sem_t chansem; /* Count of free channels */
> + mutex_t lock; /* Protects channel table */
> + sem_t chansem; /* Count of free channels */
> };
> ```
Done, move to the first patch.
--
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
[GitHub] [incubator-nuttx] jerpelea commented on pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
jerpelea commented on PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#issuecomment-1278453035
> > > The change is already simple and consistent now, it's very error prone and time consuming to split the change into two commit again. @pkarashchenko and I already spend a lot of time to review and refine the change. Please respect our work, especially many code is vendor specific. I already spend many time to improve the code that I don't really use. If you insist I have to drop all code that I don't care about from this patch.
> >
> >
> > @xiaoxiang781216 @pkarashchenko Thank you for your comments and efforts so far. OK, I understand the current situation. However, when you create a new PR next time, please consider dividing a commit into smaller ones that are independent. Reviewing each commit file will be much easier to find any simple mistake.
>
> Sure, thanks for suggestion.
considering the current PR and the work spent on it I think that we should do our best to merge it then we should think how we can avoid this situation by working with smaller PR.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#issuecomment-1273513069
> just few last changes
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#issuecomment-1275535337
@masayuki2009 what do you think?
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r991408047
##########
drivers/modem/altair/altmdm_spi.c:
##########
@@ -382,7 +382,7 @@ static void init_rxbuffer(FAR struct altmdm_dev_s *priv,
{
memset(l_buff, 0x00, sizeof(struct altmdm_spi_rxbuff_s));
- l_buff->buff_addr = (char *)kmm_malloc(unit_size);
+ l_buff->buff_addr = (FAr char *)kmm_malloc(unit_size);
Review Comment:
Done
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#issuecomment-1258925929
@pkarashchenko could you review this patch which is part of effort to fix the potential issue when we enable priority inheritance.
--
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
[GitHub] [incubator-nuttx] masayuki2009 commented on pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#issuecomment-1279035871
@xiaoxiang781216
The latest code passed my automatic tests.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#issuecomment-1280034074
@pkarashchenko done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r996468049
##########
drivers/wireless/ieee80211/bcm43xxx/bcmf_gspi.c:
##########
@@ -856,7 +856,7 @@ static int bcmf_bus_gspi_initialize(FAR struct bcmf_dev_s *priv,
/* Init transmit frames queue */
- if ((ret = nxsem_init(&gbus->queue_mutex, 0, 1)) != OK)
+ if ((ret = nxmutex_init(&gbus->queue_lock)) != OK)
Review Comment:
next patch
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r996466761
##########
drivers/usbhost/usbhost_hidkbd.c:
##########
@@ -2551,7 +2504,7 @@ int usbhost_kbdinit(void)
{
/* Perform any one-time initialization of the class implementation */
- nxsem_init(&g_exclsem, 0, 1);
+ nxmutex_init(&g_lock);
Review Comment:
next path
--
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
[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r983578005
##########
arch/arm/src/cxd56xx/cxd56_adc.c:
##########
@@ -174,7 +174,7 @@ struct cxd56adc_dev_s
struct scufifo_wm_s *wm; /* water mark */
struct math_filter_s *filter; /* math filter */
struct scuev_notify_s * notify; /* notify */
- sem_t exclsem; /* exclusive semaphore */
+ mutex_t excllock; /* exclusive mutex */
Review Comment:
I think all similar can be replaced to `lock` or `mutex` as mutex itself is used for "exclusive access"
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r983692931
##########
arch/arm/src/cxd56xx/cxd56_adc.c:
##########
@@ -174,7 +174,7 @@ struct cxd56adc_dev_s
struct scufifo_wm_s *wm; /* water mark */
struct math_filter_s *filter; /* math filter */
struct scuev_notify_s * notify; /* notify */
- sem_t exclsem; /* exclusive semaphore */
+ mutex_t excllock; /* exclusive mutex */
Review Comment:
so you want all lock/devlock/excllock change to mutex?
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#issuecomment-1264354902
@pkarashchenko the patch is ready for review again.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r988554491
##########
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:
Done.
--
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
[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989138805
##########
drivers/sensors/lps25h.c:
##########
@@ -708,31 +709,31 @@ static int lps25h_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
break;
case SNIOC_PRESSURE_OUT:
- ret = lps25h_read_pressure(dev, (lps25h_pressure_data_t *) arg);
+ ret = lps25h_read_pressure(dev, (lps25h_pressure_data_t *)arg);
break;
case SNIOC_TEMPERATURE_OUT:
/* NOTE: call SNIOC_PRESSURE_OUT before this one,
* or results are bogus.
*/
- ret = lps25h_read_temper(dev, (lps25h_temper_data_t *) arg);
+ ret = lps25h_read_temper(dev, (lps25h_temper_data_t *)arg);
Review Comment:
```suggestion
ret = lps25h_read_temper(dev, (FAR lps25h_temper_data_t *)arg);
```
##########
drivers/sensors/lps25h.c:
##########
@@ -708,31 +709,31 @@ static int lps25h_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
break;
case SNIOC_PRESSURE_OUT:
- ret = lps25h_read_pressure(dev, (lps25h_pressure_data_t *) arg);
+ ret = lps25h_read_pressure(dev, (lps25h_pressure_data_t *)arg);
break;
case SNIOC_TEMPERATURE_OUT:
/* NOTE: call SNIOC_PRESSURE_OUT before this one,
* or results are bogus.
*/
- ret = lps25h_read_temper(dev, (lps25h_temper_data_t *) arg);
+ ret = lps25h_read_temper(dev, (lps25h_temper_data_t *)arg);
break;
case SNIOC_SENSOR_OFF:
ret = lps25h_power_on_off(dev, false);
break;
case SNIOC_GET_DEV_ID:
- ret = lps25h_who_am_i(dev, (lps25h_who_am_i_data *) arg);
+ ret = lps25h_who_am_i(dev, (lps25h_who_am_i_data *)arg);
Review Comment:
```suggestion
ret = lps25h_who_am_i(dev, (FAR lps25h_who_am_i_data *)arg);
```
##########
drivers/sensors/lps25h.c:
##########
@@ -708,31 +709,31 @@ static int lps25h_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
break;
case SNIOC_PRESSURE_OUT:
- ret = lps25h_read_pressure(dev, (lps25h_pressure_data_t *) arg);
+ ret = lps25h_read_pressure(dev, (lps25h_pressure_data_t *)arg);
Review Comment:
```suggestion
ret = lps25h_read_pressure(dev, (FAR lps25h_pressure_data_t *)arg);
```
##########
drivers/sensors/apds9960.c:
##########
@@ -1029,7 +1029,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);
+ (uint8_t *)fifo_data, bytes_read);
Review Comment:
```suggestion
(FAR uint8_t *)fifo_data, bytes_read);
```
##########
drivers/sensors/mlx90393.c:
##########
@@ -499,9 +499,9 @@ static ssize_t mlx90393_read(FAR struct file *filep, FAR char *buffer,
data->z_mag = priv->data.z_mag;
data->temperature = priv->data.temperature;
- /* Give back the semaphore */
+ /* Give back the mutex */
- nxsem_post(&priv->datasem);
+ nxmutex_unlock(&priv->datalock);
return sizeof(FAR struct mlx90393_sensor_data_s);
Review Comment:
```suggestion
return sizeof(struct mlx90393_sensor_data_s);
```
##########
drivers/sensors/lsm330_spi.c:
##########
@@ -1409,7 +1405,7 @@ int lsm330_register(FAR const char *devpath_acl,
priv->flink = g_lsm330g_list;
g_lsm330g_list = priv;
- config_gyro->leaf_handle = (void *) priv;
+ config_gyro->leaf_handle = (void *)priv;
Review Comment:
```suggestion
config_gyro->leaf_handle = (FAR void *)priv;
```
##########
drivers/sensors/lsm330_spi.c:
##########
@@ -1370,7 +1367,7 @@ int lsm330_register(FAR const char *devpath_acl,
priv->flink = g_lsm330a_list;
g_lsm330a_list = priv;
priva = priv;
- config_acl->leaf_handle = (void *) priv;
+ config_acl->leaf_handle = (void *)priv;
Review Comment:
```suggestion
config_acl->leaf_handle = (FAR void *)priv;
```
##########
drivers/sensors/mpu60x0.c:
##########
@@ -537,7 +537,7 @@ static inline int __mpu_write_reg(FAR struct mpu_dev_s *dev,
static inline int __mpu_read_imu(FAR struct mpu_dev_s *dev,
FAR struct sensor_data_s *buf)
{
- return __mpu_read_reg(dev, ACCEL_XOUT_H, (uint8_t *) buf, sizeof(*buf));
+ return __mpu_read_reg(dev, ACCEL_XOUT_H, (uint8_t *)buf, sizeof(*buf));
Review Comment:
```suggestion
return __mpu_read_reg(dev, ACCEL_XOUT_H, (FAR uint8_t *)buf, sizeof(*buf));
```
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989231703
##########
drivers/sensors/lps25h.c:
##########
@@ -708,31 +709,31 @@ static int lps25h_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
break;
case SNIOC_PRESSURE_OUT:
- ret = lps25h_read_pressure(dev, (lps25h_pressure_data_t *) arg);
+ ret = lps25h_read_pressure(dev, (lps25h_pressure_data_t *)arg);
break;
case SNIOC_TEMPERATURE_OUT:
/* NOTE: call SNIOC_PRESSURE_OUT before this one,
* or results are bogus.
*/
- ret = lps25h_read_temper(dev, (lps25h_temper_data_t *) arg);
+ ret = lps25h_read_temper(dev, (lps25h_temper_data_t *)arg);
break;
case SNIOC_SENSOR_OFF:
ret = lps25h_power_on_off(dev, false);
break;
case SNIOC_GET_DEV_ID:
- ret = lps25h_who_am_i(dev, (lps25h_who_am_i_data *) arg);
+ ret = lps25h_who_am_i(dev, (lps25h_who_am_i_data *)arg);
Review Comment:
Done
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989344282
##########
arch/arm/src/a1x/hardware/a10_memorymap.h:
##########
@@ -502,7 +502,7 @@
* LI PAGE TABLE
* ADDRESS RANGE SIZE ENTRIES SECTIONS
* ----------------------- ------- -------------- ---------
- * 0xc000:0000-0xffef:ffff 1022MB *0x3000-0x3ff8 1022
+ * 0xc000:0000-0xffef:ffff 1022MB 0x3000-0x3ff8 1022
Review Comment:
Can't from the comment:
```
/* A1X Virtual (mapped) Memory Map
*
* board_memorymap.h contains special mappings that are needed when a ROM
* memory map is used. It is included in this odd location because it
* depends on some the virtual address definitions provided above.
*/
#include <arch/board/board_memorymap.h>
```
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989787921
##########
drivers/wireless/nrf24l01.c:
##########
@@ -329,7 +330,7 @@ static inline void nrf24l01_configspi(FAR struct spi_dev_s *spi)
* Name: nrf24l01_select
****************************************************************************/
-static inline void nrf24l01_select(struct nrf24l01_dev_s * dev)
+static inline void nrf24l01_select(struct nrf24l01_dev_s *dev)
Review Comment:
Done
##########
drivers/wireless/lpwan/sx127x/sx127x.c:
##########
@@ -502,7 +503,7 @@ static inline void sx127x_select(struct sx127x_dev_s * dev)
* Name: sx127x_deselect
****************************************************************************/
-static inline void sx127x_deselect(struct sx127x_dev_s * dev)
+static inline void sx127x_deselect(struct sx127x_dev_s *dev)
Review Comment:
Done
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989804469
##########
fs/smartfs/smartfs_smart.c:
##########
@@ -763,14 +763,14 @@ static ssize_t smartfs_write(FAR struct file *filep, const char *buffer,
*/
readwrite.offset = 0;
- readwrite.buffer = (uint8_t *) fs->fs_rwbuffer;
+ readwrite.buffer = (uint8_t *)fs->fs_rwbuffer;
readwrite.count = sizeof(struct smartfs_chain_header_s);
ret = FS_IOCTL(fs, BIOC_READSECT, (unsigned long) &readwrite);
Review Comment:
Done
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r989878847
##########
fs/spiffs/src/spiffs_core.c:
##########
@@ -183,7 +183,7 @@ static int spiffs_page_index_check(FAR struct spiffs_s *fs,
#ifdef CONFIG_SPIFFS_PAGE_CHECK
ret = spiffs_cache_read(fs, SPIFFS_OP_T_OBJNDX | SPIFFS_OP_C_READ,
fobj->objid, SPIFFS_PAGE_TO_PADDR(fs, pgndx),
- sizeof(struct spiffs_page_header_s), (uint8_t *) & ph);
+ sizeof(struct spiffs_page_header_s), (uint8_t *)&ph);
Review Comment:
Done
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r988527816
##########
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:
Done.
--
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
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6965: nxmutex replace nxsem when used as a lock
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6965:
URL: https://github.com/apache/incubator-nuttx/pull/6965#discussion_r988575943
##########
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:
Done.
##########
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:
Done.
--
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